How exactly execute_extension work?
Hello! From one of my extension I call another extension in another context. I suppose that exactly this extension should be executed, but instead I get all previous extension executed to. So below is my configuration. We are calling start_hunting in context tagnet.ru. I suppose start_hunting extension should be executed but no, hunting begins from the start of context and all extensions before start_hunting are executed too. auto_hunt=true solves the problem. So the question is - is this normal behaviour of execute_extension or am I doing something wrong? <!-- We are hunting only for TAGNet numbering plan --> <extension name="ext_hunting"> <condition field="${v_tagnet_dst}" expression="^(73435230[0-9]{3}|73435494989|7343549499[0-1])$"> <action application="javascript" data="$${scripts_dir}/toll_check.js ${toll_allow} local"/> <action application="set" data="v_tagnet_hunting=true" inline="true"/> <action application="log" data="NOTICE [top.ctx] - hunting in tagnet.ru"/> <action application="log" data="NOTICE ${v_tagnet_dst} $1"/> <action application="execute_extension" data="start_hunting XML tagnet.ru"/> </condition> </extension> Context tagnet.ru: <!-- This context is for home networking soft phones and cheap telephony. --> <?xml version="1.0" encoding="utf-8"?> <include> <context name="tagnet.ru"> <extension name="unloop"> <condition field="${unroll_loops}" expression="^true$"/> <condition field="${sip_looped_call}" expression="^true$"> <action application="deflect" data="${destination_number}"/> </condition> </extension> <!-- Destination number normalization --> <extension name="ext_translate_dst" continue="true"> <!-- <condition field="${v_tagnet_hunting}" expression="^true$" break="on-true"/> --> <condition field="${destination_number}" expression="^(1[0-9]{3})$" break="on-true"> <action application="set" data="v_tagnet_dst=$1" inline="true"/> </condition> <condition field="${destination_number}" expression="^(\d+)$" break="on-true"> <action application="set" data="v_tagnet_dst=$1" inline="true"/> <action application="execute_extension" data="ext_translate_dst XML features"/> </condition> </extension> <!-- Source number normalization --> <extension name="ext_translate_src" continue="true"> <condition field="${caller_id_number}" expression="^2([0-9]{4})$" break="on-true"> <action application="set" data="caller_id_number=7343549$1" inline="true"/> <action application="set" data="ani=7343549$1" inline="true"/> </condition> </extension> <!-- Here we start hunting process --> <extension name="start_hunting" continue="true"> <condition field="destination_number" expression="^start_hunting$"/> </extension> <!-- You can place files in the default directory to get included. --> <X-PRE-PROCESS cmd="include" data="tagnet.ru/*.xml"/> <!-- Here we stop hunting process --> <extension name="stop_hunting"> <condition field="${v_tagnet_hunting}" expression="true"/> </extension> <!-- Transfer call to the TOP context --> <extension name="top.ctx"> <condition field="${v_tagnet_dst}" expression="^(\d+)$"> <action application="log" data="DEBUG [top.ctx] - transfer to top.ctx"/> <!-- Caller ID normalization --> <action application="execute_extension" data="ext_translate_src XML features"/> <action application="transfer" data="$1 XML top.ctx"/> </condition> </extension> </context> </include> -- С уважением, Борис Коваленко ЗАО "Тагнет" (3435) 494991
The execute_extension app is similar to a GOSUB command in BASIC: it goes out, executes some stuff, and then comes back. However, keep in mind that when you execute an extension it does loop through the dialplan looking for the destination_number that you specified. Depending on your needs you probably just need to create a distinct dialplan context for this special extension. Then you execute the extension in a separate context and only the extensions within that context will be checked against destination_number. -MC On Tue, Jan 25, 2011 at 6:42 AM, Boris Kovalenko <boris@tagnet.ru> wrote:
Hello!
From one of my extension I call another extension in another context. I suppose that exactly this extension should be executed, but instead I get all previous extension executed to. So below is my configuration. We are calling start_hunting in context tagnet.ru. I suppose start_hunting extension should be executed but no, hunting begins from the start of context and all extensions before start_hunting are executed too. auto_hunt=true solves the problem. So the question is - is this normal behaviour of execute_extension or am I doing something wrong?
<!-- We are hunting only for TAGNet numbering plan --> <extension name="ext_hunting"> <condition field="${v_tagnet_dst}" expression="^(73435230[0-9]{3}|73435494989|7343549499[0-1])$"> <action application="javascript" data="$${scripts_dir}/toll_check.js ${toll_allow} local"/> <action application="set" data="v_tagnet_hunting=true" inline="true"/> <action application="log" data="NOTICE [top.ctx] - hunting in tagnet.ru"/> <action application="log" data="NOTICE ${v_tagnet_dst} $1"/> <action application="execute_extension" data="start_hunting XML tagnet.ru "/> </condition> </extension>
Context tagnet.ru: <!-- This context is for home networking soft phones and cheap telephony. --> <?xml version="1.0" encoding="utf-8"?> <include> <context name="tagnet.ru"> <extension name="unloop"> <condition field="${unroll_loops}" expression="^true$"/> <condition field="${sip_looped_call}" expression="^true$"> <action application="deflect" data="${destination_number}"/> </condition> </extension>
<!-- Destination number normalization --> <extension name="ext_translate_dst" continue="true"> <!-- <condition field="${v_tagnet_hunting}" expression="^true$" break="on-true"/> --> <condition field="${destination_number}" expression="^(1[0-9]{3})$" break="on-true"> <action application="set" data="v_tagnet_dst=$1" inline="true"/> </condition> <condition field="${destination_number}" expression="^(\d+)$" break="on-true"> <action application="set" data="v_tagnet_dst=$1" inline="true"/> <action application="execute_extension" data="ext_translate_dst XML features"/> </condition> </extension>
<!-- Source number normalization --> <extension name="ext_translate_src" continue="true"> <condition field="${caller_id_number}" expression="^2([0-9]{4})$" break="on-true"> <action application="set" data="caller_id_number=7343549$1" inline="true"/> <action application="set" data="ani=7343549$1" inline="true"/> </condition> </extension>
<!-- Here we start hunting process --> <extension name="start_hunting" continue="true"> <condition field="destination_number" expression="^start_hunting$"/> </extension>
<!-- You can place files in the default directory to get included. --> <X-PRE-PROCESS cmd="include" data="tagnet.ru/*.xml"/>
<!-- Here we stop hunting process --> <extension name="stop_hunting"> <condition field="${v_tagnet_hunting}" expression="true"/> </extension>
<!-- Transfer call to the TOP context --> <extension name="top.ctx"> <condition field="${v_tagnet_dst}" expression="^(\d+)$"> <action application="log" data="DEBUG [top.ctx] - transfer to top.ctx"/>
<!-- Caller ID normalization --> <action application="execute_extension" data="ext_translate_src XML features"/>
<action application="transfer" data="$1 XML top.ctx"/> </condition> </extension> </context> </include>
-- С уважением, Борис Коваленко ЗАО "Тагнет" (3435) 494991
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
participants (2)
-
Boris Kovalenko
-
Michael Collins