[Freeswitch-users] Time of day routing / too many stacked extensions

Steven Ayre steveayre at gmail.com
Thu Oct 16 15:58:39 MSD 2014


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 at 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_09:00-16:00
> :
>
> 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 at 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 at 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 at 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 at freeswitch.org
> http://www.freeswitchsolutions.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.freeswitch.org
> http://www.cluecon.com
>
> 
> 
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20141016/3525c994/attachment-0001.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list