Skip to main content

execute_on_media

Created by Ryan Harris, last modified on 2018.02.07

execute_on_media

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

Usage

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

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"/>
</condition>
</extension>