Variable execute on pre answer

From FreeSWITCH Wiki
Jump to: navigation, search

execute_on_pre_answer

Execute an application (not an api) when the called party "preanswers" - that is, when some form of early media is coming or the far end sends a 180 Ringing.

The command is executed only on channels that are not already answered. Just use export or export with nolocal: prefix to make sure it is executed when b-leg answers.

In the second usage example below, we have originated an outbound call to a local extension, where we will wait 30 seconds without ignoring media. In this case we use 'set' and not 'export'.


Usage:

<action application="export" data="nolocal:execute_on_pre_answer=lua incrInUse.lua ${uuid}"/>

or, to wait 30 seconds for an answer without ignoring early media

originate sofia/gateway/my_gw/5551212 885551212
<extension name="exe_on_preans">
  <condition field="destination_number" expression="^88(\d+)$">
    <action application="set" data="execute_on_pre_answer=transfer ANSWEREDCALL XML default"/>
    <action application="log" data="INFO Waiting 30 seconds for $1 to answer..."/>
    <action application="sleep" data="30000"/>
    <action application="log" data="INFO Call to $1 was not answered, taking alternative action..."/>
    <action application="transfer" data="UNANSWEREDCALL XML default"/>
  </condition>
</extension>


See also:


Implemented By:

Module Name Source FileLast Revised
coreswitch_channel.c