Skip to main content

mod_dptools: bind_meta_app

About

Execute a dialplan application on DTMF command on specified call legs during a bridge.

Description

bind_meta_app binds an application to the specified call leg(s). During a bridged call, the DTMF sequence on the bound call leg will trigger the execution of the application. The call leg that is '''not''' bound will '''not''' hear the DTMF sequence being dialed. Once bound to a call leg, the application binding will survive for the lifetime of the call leg.

Important: This feature will not work when bypass_media=true, because the endpoints will be communicating directly with each other, and the key presses will not be sent to FreeSWITCH.

For a more advanced digit binding, see the mod_dptools: bind_digit_action application.

Usage

<action application="bind_meta_app" data="KEY LISTEN_TO FLAGS APPLICATION[::PARAMETERS]"/>

Explanation of parameters

  • KEY is the button you want to respond to after the * button is pressed. If you wanted to respond to *1, you would put 1 in place of KEY. You are limited to a single digit in the range 0-9 while * or # will be translated to 0.
  • LISTEN_TO specifies which call leg(s) to listen for digits. Acceptable parameters are '''a''', '''b''' or '''ab'''.
  • FLAGS modifies the behavior. The following flags are available:
    • a - Respond on A leg
    • b - Respond on B leg
    • o - Respond on opposite leg
    • s - Respond on same leg
    • i - Execute inline (see below)
    • 1 - Unbind this meta_app after it is used one time
  • APPLICATION specifies the application to execute.
  • PARAMETERS specify the arguments to provide to the APPLICATION. You must put :: after the APPLICATION for these arguments to be parsed properly.

After the * button is pressed, the KEY event is expected within 5 seconds. In case of timeout, the KEY is passed further to the B leg.

Inline Execution

The '''i''' flag means to execute the application inline, that is, immediately. Normally the application is queued up to be executed in the session's thread synchronously, similar to how ESL queues up an application.

Examples

<action application="bind_meta_app" data="1 a s execute_extension::dx XML features"/>

When *1 is pressed on the A call leg, the execute_extension application is executed upon the A call leg. The extension that is executed is the dx extension in the XML dialplan under the context named "features".

<action application="bind_meta_app" data="2 a s record_session::$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>

When *2 is pressed on the A call leg, the session audio starts recording on the A call leg. It saves the audio to the $$(base_dir)/recordings/${caller_id_number}.$(strftime(%Y-%m-%d-%H-%M-%S)}.wav file. (i.e. /usr/local/freeswitch/recordings/1234.2008-04-09-10-11-12.wav).

In default dialplan example record_session is listening for DTMF on the B leg, so only the callee can activate the recording.

bind_meta_key variable

You may also customise the meta key. It will default to '*' but you can use the [[Variable_bind_meta_key|bind_meta_key]] channel variable to select a different meta key:

<!-- The following uses # as the meta key -->
<action application="set" data="bind_meta_key=#"/>
<action application="bind_meta_app" data="2 a s foo"/>

See Also

mod_dptools: bind_digit_action

mod_dptools: unbind_meta_app