Less repetition: <extension name="DDI_9600"> <condition field="destination_number" expression="^441614249600$"> <action application="set" data="domain_name=$${domain}"/> <action application="set" data="effective_caller_id_name=${cidlookup(${caller_id_number})}"/> </condition> <condition field="${office_status}" expression="^open$"> <action application="ivr" data="bashton_9600_open"/> <anti-action application="ivr" data="bashton_9600_closed"/> </condition> </extension> In fact then you could even <action application="ivr" data="bashton_9600_${office_status}"/> and you don't need the 2nd condition at all then. On 16 October 2014 12:58, Steven Ayre <steveayre@gmail.com> wrote:
You have recursion.
expression is a regular expression. You need ^ and $ to match the start and end of the string, without them it'll match the expression appearing anywhere in the string. As a result...
<extension name="DDI_9600" continue="true"> <condition field="destination_number" expression="441614249600"> <action application="execute_extension" data="441614249600_${office_status}"/> </condition> </extension>
This executes itself again and again and again... it never reaches the next extension.
These conditions would avoid the issue: <condition field="destination_number" expression="^441614249600$"> <condition field="destination_number" expression="^441614249600_open$"> <condition field="destination_number" expression="^441614249600_closed$">
As an alternative implementation you could also do this in a single extension: <extension name="DDI_9600"> <condition field="destination_number" expression="^441614249600$"/> <condition field="${office_status}" expression="^open$"> <!-- open --> <action application="set" data="domain_name=$${domain}"/> <action application="set" data="effective_caller_id_name=${cidlookup(${caller_id_number})}"/> <action application="ivr" data="bashton_9600_open"/> <!-- closed --> <anti-action application="set" data="domain_name=$${domain}"/> <anti-action application="set" data="effective_caller_id_name=${cidlookup(${caller_id_number})}"/> <anti-action application="ivr" data="bashton_9600_closed"/> </condition> </extension>
Note this only works because you're setting inline="true" when setting ${office_status}.
On 16 October 2014 09:09, Gavin Hamill <gavin@bashton.com> wrote:
Hi all,
I'm using FS 1.4.12 on CentOS 6.5 and I think I'm running into an issue with 'dialplan parsed all at once' when trying to implement the example based on
https://wiki.freeswitch.org/wiki/Time_of_Day_Routing#Example_for_office_open... :
When I dial our main '9600' external DID, the call is answered and routed exactly as I want, however, there is a lot of ugly logging going on and I suspect that the desired behaviour is by chance rather than design. I'd love to hear some feedback on how to best implement the logic of 'Office open Mon-Fri 8am-6pm':
2014-10-16 08:49:48.515467 [NOTICE] switch_channel.c:1055 New Channel sofia/external/nobody@87.238.73.162 [ee5fb654-31c0-4c89-977e-b85ad4a0cb23] 2014-10-16 08:49:48.515467 [NOTICE] switch_core_session.c:2987 Execute execute_extension(441614249600_${office_status}) 2014-10-16 08:49:48.515467 [NOTICE] switch_core_session.c:2987 Execute execute_extension(441614249600_${office_status}) [.. 17 times in total...] 2014-10-16 08:49:48.515467 [NOTICE] switch_core_session.c:2987 Execute execute_extension(441614249600_${office_status}) 2014-10-16 08:49:48.515467 [ERR] switch_core_session.c:2918 Error sofia/external/nobody@87.238.73.162 too many stacked extensions 2014-10-16 08:49:48.515467 [NOTICE] switch_core_session.c:2987 Execute set(domain_name=freeswitch.bashton.eu) 2014-10-16 08:49:48.515467 [NOTICE] switch_core_session.c:2987 Execute set(effective_caller_id_name=${cidlookup(${caller_id_number})}) 2014-10-16 08:49:48.515467 [NOTICE] switch_core_session.c:2987 Execute ivr(bashton_9600_open) 2014-10-16 08:49:48.515467 [NOTICE] mod_sofia.c:2243 Pre-Answer sofia/external/nobody@87.238.73.162!
<extension name="are_we_open" continue="true"> <condition wday="2-6" hour="8-18" break="never"> <action application="set" data="office_status=open" inline="true"/> <anti-action application="set" data="office_status=closed" inline="true"/> </condition> </extension>
<extension name="DDI_9600" continue="true"> <condition field="destination_number" expression="441614249600"> <action application="execute_extension" data="441614249600_${office_status}"/> </condition> </extension>
<extension name="DDI_9600_open"> <condition field="destination_number" expression="441614249600_open"> <action application="set" data="domain_name=$${domain}"/> <action application="set" data="effective_caller_id_name=${cidlookup(${caller_id_number})}"/> <action application="ivr" data="bashton_9600_open"/> </condition> </extension>
<extension name="DDI_9600_closed"> <condition field="destination_number" expression="441614249600_closed"> <action application="set" data="domain_name=$${domain}"/> <action application="set" data="effective_caller_id_name=${cidlookup(${caller_id_number})}"/> <action application="ivr" data="bashton_9600_closed"/> </condition> </extension>
Suggestions would be most welcome! :)
Cheers, Gavin.
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.cluecon.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
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