Hello, I am getting a strange problem in my dialplan. After doing "SET", I want to use it in the next condition field. But then the value is not being set properly. Could someone please tell me what is wrong? Thanks, Woody Here is the dialplan: <context name="conf-execution"> <extension name="get-pin" continue="true" > <condition field="${destination_number}" expression="^(.*)$" break="never"> <action application="set" data="conference_id=111"/> <action application="set" data="is_moderator=true"/> <action application="info"/> </condition> </extension> <extension name="conf"> <condition field="${is_moderator}" expression="^true$" break="never"> <action application="conference" data="${conference_id}@default +flags{Moderator}+1234"/> </condition> <condition field="${is_moderator}" expression="^false$" break="never"> <action application="conference" data="${conference_id}@default"/> </condition> <condition field="${is_moderator}" expression="^$" break="always"> <action application="playback" data="/var/app/prompt/wav/bye.wav"/> <action application="hangup"/> </condition> </extension> </context> Here is the FS log. Dialplan: sofia/internal/1001@192.168.1.101 parsing [conf-execution->get-pin] continue=true Dialplan: sofia/internal/1001@192.168.1.101 Regex (PASS) [get-pin] ${destination_number}(117) =~ /^(.*)$/ break=never Dialplan: sofia/internal/1001@192.168.1.101 Action set(conference_id=111) Dialplan: sofia/internal/1001@192.168.1.101 Action set(is_moderator=true) Dialplan: sofia/internal/1001@192.168.1.101 Action info() Dialplan: sofia/internal/1001@192.168.1.101 parsing [conf-execution->conf] continue=false Dialplan: sofia/internal/1001@192.168.1.101 Regex (FAIL) [conf] ${is_moderator}() =~ /^true$/ break=never Dialplan: sofia/internal/1001@192.168.1.101 Regex (FAIL) [conf] ${is_moderator}() =~ /^false$/ break=never Dialplan: sofia/internal/1001@192.168.1.101 Regex (PASS) [conf] ${is_moderator}() =~ /^$/ break=always Dialplan: sofia/internal/1001@192.168.1.101 Action playback(/var/app/prompt/wav/bye.wav) Dialplan: sofia/internal/1001@192.168.1.101 Action hangup()
Hi, FreeSWITCH decides what to execute first, the set application runs later (look a few lines later, you'll see lines beginning with EXECUTE, this is when it runs). If you need to use variables you've set in the DP, you need to use the transfer application to make it go back into routing state. Math On 3-Jun-09, at 2:22 AM, Woody Dickson wrote:
Hello,
I am getting a strange problem in my dialplan.
After doing "SET", I want to use it in the next condition field. But then the value is not being set properly.
Could someone please tell me what is wrong?
Thanks, Woody
Here is the dialplan: <context name="conf-execution"> <extension name="get-pin" continue="true" > <condition field="${destination_number}" expression="^(.*)$" break="never">
<action application="set" data="conference_id=111"/> <action application="set" data="is_moderator=true"/> <action application="info"/>
</condition> </extension> <extension name="conf"> <condition field="${is_moderator}" expression="^true$" break="never"> <action application="conference" data="${conference_id}@default +flags{Moderator}+1234"/>
</condition> <condition field="${is_moderator}" expression="^false$" break="never"> <action application="conference" data="${conference_id}@default"/>
</condition> <condition field="${is_moderator}" expression="^$" break="always"> <action application="playback" data="/var/app/prompt/wav/bye.wav"/> <action application="hangup"/>
</condition> </extension>
</context>
Here is the FS log.
Dialplan: sofia/internal/1001@192.168.1.101 parsing [conf-execution-
get-pin] continue=true Dialplan: sofia/internal/1001@192.168.1.101 Regex (PASS) [get-pin] $ {destination_number}(117) =~ /^(.*)$/ break=never Dialplan: sofia/internal/1001@192.168.1.101 Action set(conference_id=111) Dialplan: sofia/internal/1001@192.168.1.101 Action set(is_moderator=true) Dialplan: sofia/internal/1001@192.168.1.101 Action info() Dialplan: sofia/internal/1001@192.168.1.101 parsing [conf-execution- conf] continue=false Dialplan: sofia/internal/1001@192.168.1.101 Regex (FAIL) [conf] $ {is_moderator}() =~ /^true$/ break=never Dialplan: sofia/internal/1001@192.168.1.101 Regex (FAIL) [conf] $ {is_moderator}() =~ /^false$/ break=never Dialplan: sofia/internal/1001@192.168.1.101 Regex (PASS) [conf] $ {is_moderator}() =~ /^$/ break=always Dialplan: sofia/internal/1001@192.168.1.101 Action playback(/var/app/ prompt/wav/bye.wav) Dialplan: sofia/internal/1001@192.168.1.101 Action hangup()
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
Woody Dickson <woodydickson@gmail.com> wrote:
I am getting a strange problem in my dialplan.
After doing "SET", I want to use it in the next condition field. But then the value is not being set properly.
When parsing the dial plan, FreeSWITCH tests all of the conditions, then builds a linked list of actions to execute. Once this is done, the actions are executed, in order. This is why you can't simply set a variable in one extension and test it in the condition of a later extension.
Hi Woody :) You cannot use the variable on another extension, however you could just merge both extensions' conditions. then your only problem would be that you're not exporting the value, after set, you gotta export, look at this example (a little extract from dialplan/default.xml): <extension name="Local_Extension"> <condition field="destination_number" expression="^(10[01][0-9])$"> <action application="set" data="dialed_extension=$1"/> <action application="export" data="dialed_extension=$1"/> </condition> <condition field="destination_number" expression="^${caller_id_number}$"> <action application="set" data="voicemail_authorized=${sip_authorized}"$ <action application="answer"/> <action application="sleep" data="1000"/> <action application="voicemail" data="check default ${domain_name} ${dialed_extension}"/> ... <anti-action application="bridge" data="user/${dialed_extension}@ ${domain_name}"/> </condition> </extension> 2009/6/3 Jason White <jason@jasonjgw.net>
Woody Dickson <woodydickson@gmail.com> wrote:
I am getting a strange problem in my dialplan.
After doing "SET", I want to use it in the next condition field. But then the value is not being set properly.
When parsing the dial plan, FreeSWITCH tests all of the conditions, then builds a linked list of actions to execute. Once this is done, the actions are executed, in order.
This is why you can't simply set a variable in one extension and test it in the condition of a later extension.
_______________________________________________ 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
Export transfers the variable to the B-leg whenever the channel is bridged, it doesnt affect how the dialplan work, conditions are still checked before executing anything. Math On 3-Jun-09, at 1:39 PM, Milena wrote:
Hi Woody :) You cannot use the variable on another extension, however you could just merge both extensions' conditions.
then your only problem would be that you're not exporting the value, after set, you gotta export, look at this example (a little extract from dialplan/default.xml):
<extension name="Local_Extension"> <condition field="destination_number" expression="^(10[01][0-9])$"> <action application="set" data="dialed_extension=$1"/> <action application="export" data="dialed_extension=$1"/> </condition>
<condition field="destination_number" expression="^$ {caller_id_number}$"> <action application="set" data="voicemail_authorized=$ {sip_authorized}"$ <action application="answer"/> <action application="sleep" data="1000"/> <action application="voicemail" data="check default $ {domain_name} ${dialed_extension}"/> ... <anti-action application="bridge" data="user/$ {dialed_extension}@${domain_name}"/> </condition> </extension>
2009/6/3 Jason White <jason@jasonjgw.net> Woody Dickson <woodydickson@gmail.com> wrote:
I am getting a strange problem in my dialplan.
After doing "SET", I want to use it in the next condition field. But then the value is not being set properly.
When parsing the dial plan, FreeSWITCH tests all of the conditions, then builds a linked list of actions to execute. Once this is done, the actions are executed, in order.
This is why you can't simply set a variable in one extension and test it in the condition of a later extension.
_______________________________________________ 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
_______________________________________________ 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 (4)
-
Jason White
-
Mathieu Rene
-
Milena
-
Woody Dickson