trouble making conditions for OR
Hello everyone, The last few days I am beginning to explore freeswitch. I am having a bit of trouble. I am trying to user the examples near http://wiki.freeswitch.org/wiki/Dialplan_XML#Complex_Condition.2FAction_Rule... in the documentation. If I use '\' as it says, I get an error about </extension> being unexpected. If I use '/' it doesn't work. Below is my dialplan. It should trigger on empty number as well as the strings mentioned. I am pretty sure the regex is accurate. However, instead of running, I get: 2011-10-27 14:38:16.269266 [INFO] mod_dialplan_xml.c:336 Processing private <private>-> in context Incoming-FXO 2011-10-27 14:38:16.269266 [INFO] switch_core_state_machine.c:177 No Route, Aborting The dialplan: <include> <context name="Incoming-FXO"> <extension name="screen"> <condition field="caller_id_number" expression="^$" break="on-true"/> <condition field="caller_id_number" expression=".nonymous.*" break="on-true"/> <condition field="caller_id_number" expression=".nknown.*" break="on-true"/> <condition field="caller_id_number" expression=".*rivate.*" break="on-true"/> <condition field="caller_id_number" expression=".estricted.*" break="on-true"/> <condition field="caller_id_number" expression="PTSN.*" break="on-true"/> <condition field="caller_id_number" expression=".oll.*" break="on-true"/> <condition field="caller_id_name" expression=".nonymous.*" break="on-true"/> <condition field="caller_id_name" expression=".nknown.*" break="on-true"/> <condition field="caller_id_name" expression=".*rivate.*" break="on-true"/> <condition field="caller_id_name" expression=".estricted.*" break="on-true"/> <condition field="caller_id_name" expression="PTSN.*" break="on-true"/> <condition field="caller_id_name" expression=".oll.*" break="on-true"/> <condition field="caller_id_name" expression=".--.*" break="on-true"/> <condition field="caller_id_name" expression=",.*" break="on-true"/> <condition field="caller_id_name" expression="000.*"> <action application="set" data="call_screen_filename=/tmp/${caller_id_number}-name.wav"/> <action application="answer"/> <action application="sleep" data="1000"/> <action application="phrase" data="voicemail_record_name"/> <action application="playback" data="tone_stream://%(500, 0, 640)"/> <action application="set" data="playback_terminators=#*0123456789"/> <action application="record" data="${call_screen_filename} 7 200 2"/> <action application="set" data="group_confirm_key=1"/> <action application="set" data="fail_on_single_reject=true"/> <action application="set" data="group_confirm_file=phrase:screen_confirm:${call_screen_filename}"/> <action application="set" data="continue_on_fail=true"/> <!-- <action application="bridge" data="user/$1"/> --> <action application="voicemail" data="default $${domain} $1"/> <action application="hangup"/> </condition> </extension> </context> </include> Any help would be greatly appreciated. Thank you, Trever -- "I know who I am. No one else knows who I am. If I was a giraffe, and someone said I was a snake, I'd think, no, actually I'm a giraffe." -- Richard Gere
Trever, You're in one of those gray areas where xml_curl may actually be easier in the long run unless you have just this one single set of goofy conditions to handle. However, if I understand your question correctly you should be able to do this in the dialplan. I can't be exactly certain why your call is failing since the debug log snippet you gave was a bit small, however my guess is that you don't actually have any actions inside of a matching <condition> for the call that was made. It looks like it was a "private" caller so this line would no doubt match: <condition field="caller_id_name" expression=".*rivate.*" break="on-true"/> When that condition matches, the dialplan processing will stop checking for any more conditions inside of the extension named "screen" and simply move on in the dialplan. (That behavior is caused by the break="on-true" directive.) So, do you have any other extensions in this context? Whether you do or not, it seems like none of your conditions that actually have actions inside them is being matched, therefore you have no actions for this call and get the no route error. My recommendation is to pastebin the entire Incoming-FXO context as well as debug level output for the incoming call. Paste the call log from start to finish. That will help us see what's really going on. -MC On Thu, Oct 27, 2011 at 1:44 PM, Trever L. Adams <trever.adams@gmail.com>wrote:
Hello everyone,
The last few days I am beginning to explore freeswitch. I am having a bit of trouble. I am trying to user the examples near
http://wiki.freeswitch.org/wiki/Dialplan_XML#Complex_Condition.2FAction_Rule... in the documentation. If I use '\' as it says, I get an error about </extension> being unexpected. If I use '/' it doesn't work. Below is my dialplan. It should trigger on empty number as well as the strings mentioned. I am pretty sure the regex is accurate. However, instead of running, I get:
2011-10-27 14:38:16.269266 [INFO] mod_dialplan_xml.c:336 Processing private <private>-> in context Incoming-FXO 2011-10-27 14:38:16.269266 [INFO] switch_core_state_machine.c:177 No Route, Aborting
The dialplan:
<include> <context name="Incoming-FXO"> <extension name="screen"> <condition field="caller_id_number" expression="^$" break="on-true"/> <condition field="caller_id_number" expression=".nonymous.*" break="on-true"/> <condition field="caller_id_number" expression=".nknown.*" break="on-true"/> <condition field="caller_id_number" expression=".*rivate.*" break="on-true"/> <condition field="caller_id_number" expression=".estricted.*" break="on-true"/> <condition field="caller_id_number" expression="PTSN.*" break="on-true"/> <condition field="caller_id_number" expression=".oll.*" break="on-true"/> <condition field="caller_id_name" expression=".nonymous.*" break="on-true"/> <condition field="caller_id_name" expression=".nknown.*" break="on-true"/> <condition field="caller_id_name" expression=".*rivate.*" break="on-true"/> <condition field="caller_id_name" expression=".estricted.*" break="on-true"/> <condition field="caller_id_name" expression="PTSN.*" break="on-true"/> <condition field="caller_id_name" expression=".oll.*" break="on-true"/> <condition field="caller_id_name" expression=".--.*" break="on-true"/> <condition field="caller_id_name" expression=",.*" break="on-true"/> <condition field="caller_id_name" expression="000.*"> <action application="set" data="call_screen_filename=/tmp/${caller_id_number}-name.wav"/> <action application="answer"/> <action application="sleep" data="1000"/> <action application="phrase" data="voicemail_record_name"/> <action application="playback" data="tone_stream://%(500, 0, 640)"/> <action application="set" data="playback_terminators=#*0123456789"/> <action application="record" data="${call_screen_filename} 7 200 2"/> <action application="set" data="group_confirm_key=1"/> <action application="set" data="fail_on_single_reject=true"/> <action application="set" data="group_confirm_file=phrase:screen_confirm:${call_screen_filename}"/> <action application="set" data="continue_on_fail=true"/> <!-- <action application="bridge" data="user/$1"/> --> <action application="voicemail" data="default $${domain} $1"/> <action application="hangup"/> </condition> </extension> </context> </include>
Any help would be greatly appreciated.
Thank you, Trever -- "I know who I am. No one else knows who I am. If I was a giraffe, and someone said I was a snake, I'd think, no, actually I'm a giraffe." -- Richard Gere
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
On 10/27/2011 04:07 PM, Michael Collins wrote:
Trever,
You're in one of those gray areas where xml_curl may actually be easier in the long run unless you have just this one single set of goofy conditions to handle. However, if I understand your question correctly you should be able to do this in the dialplan.
I can't be exactly certain why your call is failing since the debug log snippet you gave was a bit small, however my guess is that you don't actually have any actions inside of a matching <condition> for the call that was made. It looks like it was a "private" caller so this line would no doubt match:
<condition field="caller_id_name" expression=".*rivate.*" break="on-true"/>
When that condition matches, the dialplan processing will stop checking for any more conditions inside of the extension named "screen" and simply move on in the dialplan. (That behavior is caused by the break="on-true" directive.) So, do you have any other extensions in this context? Whether you do or not, it seems like none of your conditions that actually have actions inside them is being matched, therefore you have no actions for this call and get the no route error.
My recommendation is to pastebin the entire Incoming-FXO context as well as debug level output for the incoming call. Paste the call log from start to finish. That will help us see what's really going on.
-MC
MC, Thank you, I will have to look into xml_curl. Apparently I misunderstood the documentation. If ANY of these things match, the actions to screen the call should be taken. Am I messing this up? At the moment I have no other processing of incoming calls. Still working on things.
On Thu, Oct 27, 2011 at 1:44 PM, Trever L. Adams <trever.adams@gmail.com <mailto:trever.adams@gmail.com>> wrote:
The dialplan:
<include> <context name="Incoming-FXO"> <extension name="screen"> <condition field="caller_id_number" expression="^$" break="on-true"/> <condition field="caller_id_number" expression=".nonymous.*" break="on-true"/> <condition field="caller_id_number" expression=".nknown.*" break="on-true"/> <condition field="caller_id_number" expression=".*rivate.*" break="on-true"/> <condition field="caller_id_number" expression=".estricted.*" break="on-true"/> <condition field="caller_id_number" expression="PTSN.*" break="on-true"/> <condition field="caller_id_number" expression=".oll.*" break="on-true"/> <condition field="caller_id_name" expression=".nonymous.*" break="on-true"/> <condition field="caller_id_name" expression=".nknown.*" break="on-true"/> <condition field="caller_id_name" expression=".*rivate.*" break="on-true"/> <condition field="caller_id_name" expression=".estricted.*" break="on-true"/> <condition field="caller_id_name" expression="PTSN.*" break="on-true"/> <condition field="caller_id_name" expression=".oll.*" break="on-true"/> <condition field="caller_id_name" expression=".--.*" break="on-true"/> <condition field="caller_id_name" expression=",.*" break="on-true"/> <condition field="caller_id_name" expression="000.*"> <action application="set" data="call_screen_filename=/tmp/${caller_id_number}-name.wav"/> <action application="answer"/> <action application="sleep" data="1000"/> <action application="phrase" data="voicemail_record_name"/> <action application="playback" data="tone_stream://%(500, 0, 640)"/> <action application="set" data="playback_terminators=#*0123456789"/> <action application="record" data="${call_screen_filename} 7 200 2"/> <action application="set" data="group_confirm_key=1"/> <action application="set" data="fail_on_single_reject=true"/> <action application="set" data="group_confirm_file=phrase:screen_confirm:${call_screen_filename}"/> <action application="set" data="continue_on_fail=true"/> <!-- <action application="bridge" data="user/$1"/> --> <action application="voicemail" data="default $${domain} $1"/> <action application="hangup"/> </condition> </extension> </context> </include>
On Thu, Oct 27, 2011 at 7:14 PM, Trever L. Adams <trever.adams@gmail.com>wrote:
On 10/27/2011 04:07 PM, Michael Collins wrote:
Trever,
You're in one of those gray areas where xml_curl may actually be easier in the long run unless you have just this one single set of goofy conditions to handle. However, if I understand your question correctly you should be able to do this in the dialplan.
I can't be exactly certain why your call is failing since the debug log snippet you gave was a bit small, however my guess is that you don't actually have any actions inside of a matching <condition> for the call that was made. It looks like it was a "private" caller so this line would no doubt match:
<condition field="caller_id_name" expression=".*rivate.*" break="on-true"/>
When that condition matches, the dialplan processing will stop checking for any more conditions inside of the extension named "screen" and simply move on in the dialplan. (That behavior is caused by the break="on-true" directive.) So, do you have any other extensions in this context? Whether you do or not, it seems like none of your conditions that actually have actions inside them is being matched, therefore you have no actions for this call and get the no route error.
My recommendation is to pastebin the entire Incoming-FXO context as well as debug level output for the incoming call. Paste the call log from start to finish. That will help us see what's really going on.
-MC
MC,
Thank you, I will have to look into xml_curl. Apparently I misunderstood the documentation. If ANY of these things match, the actions to screen the call should be taken. Am I messing this up?
To be frank, yes, you are messing it up. :) The "proper" way to do an OR is by using the | (pipe) char in the regex. However, you are checking two different fields and you want the same actions if either field matches the values you have supplied. In this case I'd do something like the following: <extension name="screen"> <condition field="caller_id_name" expression="^$| nonymous|nknown|rivate|PSTN|oll|restricted|.--.*|,.*|000.*"> <action application="set" data="private_caller=true" inline="true"/> </condition> <condition field="caller_id_number" expression="^$|nonymous|nknown|rivate|PSTN|oll"> <action application="set" data="private_caller=true" inline="true"/> </condition> <condition field="${private_caller}" expression="^true$"> <action application="set" data="call_screen_filename=/tmp/${caller_id_number}-name.wav"/> <action application="answer"/> <action application="sleep" data="1000"/> <action application="phrase" data="voicemail_record_name"/> <action application="playback" data="tone_stream://%(500, 0, 640)"/> <action application="set" data="playback_terminators=#*0123456789"/> <action application="record" data="${call_screen_filename} 7 200 2"/> <action application="set" data="group_confirm_key=1"/> <action application="set" data="fail_on_single_reject=true"/> <action application="set" data="group_confirm_file=phrase:screen_confirm:${call_screen_filename}"/> <action application="set" data="continue_on_fail=true"/> <action application="bridge" data="user/${dialed_number}"/> <action application="voicemail" data="default $${domain} ${dialed_number}"/> <action application="hangup"/> </condition> </extension> NOTE: I took some liberties with your regex patterns. You may need to tweak the expressions depending on exactly what comes down the pipe. Bonus question: why did I replace $1 with ${dialed_number}? :) Be sure that you route the call properly. I'm making an assumption about what the dialed number is, but you won't have that luxury - you will need to make sure that you have a user ID that is the same as the dialed number or you will need to parse the dialed number and relate it somehow to one of your users. -MC
At the moment I have no other processing of incoming calls. Still working on things.
On Thu, Oct 27, 2011 at 1:44 PM, Trever L. Adams <trever.adams@gmail.com>wrote:
The dialplan:
<include> <context name="Incoming-FXO"> <extension name="screen"> <condition field="caller_id_number" expression="^$" break="on-true"/> <condition field="caller_id_number" expression=".nonymous.*" break="on-true"/> <condition field="caller_id_number" expression=".nknown.*" break="on-true"/> <condition field="caller_id_number" expression=".*rivate.*" break="on-true"/> <condition field="caller_id_number" expression=".estricted.*" break="on-true"/> <condition field="caller_id_number" expression="PTSN.*" break="on-true"/> <condition field="caller_id_number" expression=".oll.*" break="on-true"/> <condition field="caller_id_name" expression=".nonymous.*" break="on-true"/> <condition field="caller_id_name" expression=".nknown.*" break="on-true"/> <condition field="caller_id_name" expression=".*rivate.*" break="on-true"/> <condition field="caller_id_name" expression=".estricted.*" break="on-true"/> <condition field="caller_id_name" expression="PTSN.*" break="on-true"/> <condition field="caller_id_name" expression=".oll.*" break="on-true"/> <condition field="caller_id_name" expression=".--.*" break="on-true"/> <condition field="caller_id_name" expression=",.*" break="on-true"/> <condition field="caller_id_name" expression="000.*"> <action application="set" data="call_screen_filename=/tmp/${caller_id_number}-name.wav"/> <action application="answer"/> <action application="sleep" data="1000"/> <action application="phrase" data="voicemail_record_name"/> <action application="playback" data="tone_stream://%(500, 0, 640)"/> <action application="set" data="playback_terminators=#*0123456789"/> <action application="record" data="${call_screen_filename} 7 200 2"/> <action application="set" data="group_confirm_key=1"/> <action application="set" data="fail_on_single_reject=true"/> <action application="set" data="group_confirm_file=phrase:screen_confirm:${call_screen_filename}"/> <action application="set" data="continue_on_fail=true"/> <!-- <action application="bridge" data="user/$1"/> --> <action application="voicemail" data="default $${domain} $1"/> <action application="hangup"/> </condition> </extension> </context> </include>
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
On 10/28/2011 12:16 AM, Michael Collins wrote:
To be frank, yes, you are messing it up. :)
Glad to be set straight. Thank you! The method you suggested worked perfectly. Unfortunately, the regex did need those prefix periods. Now it works. Thank you so very much! Trever -- "If there is righteousness in the heart, there will be beauty in the character. If there is beauty in the character, there will be harmony in the home. If there is harmony in the home, there will be order in the nation. If there is order in the nation, there will be peace in the world. So let it be." -- Scottish Blessing
participants (2)
-
Michael Collins
-
Trever L. Adams