Variable execute on media

From FreeSWITCH Wiki
Jump to: navigation, search


Execute an application when the far end sends media, i.e. ringing or 183/SDP.

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'.


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

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

originate sofia/gateway/my_gateway/5551212 885551212
<extension name="exe_on_ans">
  <condition field="destination_number" expression="^88(\d+)$">
    <action application="set" data="execute_on_media=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"/>

See also:

Implemented By:

Module Name Source FileLast Revised