[Freeswitch-users] unable to get transfer_on_fail to work

Gabriel Kuri gkuri at ieee.org
Thu Nov 26 03:26:38 MSK 2015


I understand that I can have multiple bridge statements after my initial
bridge, however this is specifically for detecting when a device fell off
the network and the registration hasn't timed out. We want the behavior to
be different than if the device was still on the network and it just rang
for some time period and timed out and moved on to the next bridge
statement, which is why I need transfer_on_fail.

In regards to "hangup_on_bridge", I figured out later that it doesn't
exist. I pulled that straight out of the documentation for
transfer_on_fail, as with everything I was trying initially.

     https://wiki.freeswitch.org/wiki/Variable_transfer_on_fail


I think I figured out the problem, the condition for the transfer_on_fail
wasn't being met with ${originate_disposition}, which is also straight out
of the documentation for transfer_on_fail. It looks like the conditions get
evaluated only at the beginning when the dialplan is called, not when that
part of the dialplan gets hit? So at the time the dialplan is initially
called, ${originate_disposition} isn't set and didn't match the Regex for
it to pass the condition. I changed the condition to destination_number and
it works now.

The only part I couldn't get working is transferring to a different context
within transfer_on_fail, for example:

       <action application="set" data="transfer_on_fail=PROGRESS_TIMEOUT
auto_cause xml error"/>

If I put the PROGRESS_TIMEOUT extension within the "error" context, it
doesn't work. Not sure what's going on there, but it's not a big deal. It
works fine like this ...

<document type="freeswitch/xml">
  <section name="dialplan" description="Dial Plan for FreeSWITCH">
    <context name="default">
      <extension name="call to 12225551212">
        <condition field="destination_number" expression="12225551212">
          <action application="set" data="bypass_media=true"/>
          <action application="set" data="continue_on_fail=true"/>
          <action application="set" data="hangup_on_bridge=true"/>
      <action application="export" data="leg_progress_timeout=3"/>
          <action application="set" data="transfer_on_fail=PROGRESS_TIMEOUT
auto_cause xml"/>
          <action application="bridge"
data="${sofia_contact(12225551212 at switch.local)"/>
        </condition>
      </extension>
      <extension name="PROGRESS_TIMEOUT">
        <condition field="destination_number" expression="12225551212"
continue="false" break="on-true">
          <action application="bridge" data="sofia/external/12345551212
@switch2.local"/>
        </condition>
      </extension>
    </context>
  </section>
</document>




On Wed, Nov 25, 2015 at 3:07 PM, Brian West <brian at freeswitch.org> wrote:

> And for those wondering:
>
> <extension name="call to 1234">
>
>   <condition field="destination_number" expression="^(1234)$">
>
>     <action application="set" data="orig_dest=$1"/>
>
>     <action application="set" data="bypass_media=true"/>
>
>     <action application="set" data="hangup_afer_bridge=true"/>
>
>     <action application="set" data=
> "transfer_on_fail=PROGRESS_TIMEOUT,USER_BUSY,NORMAL_TEMPORARY_FAILURE"/>
>
>     <action application="bridge" data="{progress_timeout=2}sofia/external/
> sip:1234 at 192.168.1.123"/>
>
>   </condition>
>
> </extension>
>
>
> <*extension* name="call to 1234">
>
>   <condition field="destination_number" expression="^PROGRESS_TIMEOUT$">
>
>     <action application="log" data="CRIT We can have progress timeouts?"/>
>
>   </condition>
>
> </extension>
>
>
>
> See XML on https://freeswitch.org/jira/browse/FS-3193
>
>
> I fear this isn't documented correctly.
>
> On Wed, Nov 25, 2015 at 4:53 PM, Brian West <brian at freeswitch.org> wrote:
>
>> There is no such thing as hangup_on_bridge, and if you wish to try a
>> different gateway if the first one doesn't respond quick enough with
>> progress do this:
>>
>> <extension name="call to 1234">
>>
>>   <condition field="destination_number" expression="^1234$">
>>
>>     <action application="set" data="bypass_media=true"/>
>>
>>     <action application="set" data="hangup_after_bridge=true"/>
>>
>>     <action application="bridge" data=
>> "{progress_timeout=2}sofia/internal/sip:1234 at switch2-asdfa.com"/>
>>
>>     <action application="bridge" data=
>> "{progress_timeout=10}sofia/internal/sip:1234 at switch1-asdfa.com"/>
>>
>>   </condition>
>>
>> </extension>
>>
>>
>> There is no reason to do what you were doing in this case.
>>
>> On Wed, Nov 25, 2015 at 12:42 PM, Gabriel Kuri <gkuri at ieee.org> wrote:
>>
>>> I can't seem to get transfer_on_fail to work. I'm not sure what I'm
>>> doing wrong, it just doesn't transfer to the transfer_on_fail extension.
>>> The dialplan is below.
>>>
>>> The idea is to set leg_progress_timeout = 3, so that if the device isn't
>>> responding to INVITEs, we use transfer_on_fail with the cause
>>> PROGRESS_TIMEOUT to send the call somewhere else. But transfer_on_fail
>>> never seems to get executed when we test it out. The FS logs show that
>>> we're hitting PROGRESS_TIMEOUT when the device doesn't respond to INVITEs,
>>> so I'm pretty sure we have the right hangup cause, but it's just not
>>> catching transfer_on_fail ...
>>>
>>> <document type="freeswitch/xml">
>>>   <section name="dialplan" description="Dial Plan for FreeSWITCH">
>>>     <context name="default">
>>>       <extension name="call to 12225551212">
>>>         <condition field="destination_number" expression="12225551212">
>>>           <action application="set" data="bypass_media=true"/>
>>>           <action application="set" data="continue_on_fail=true"/>
>>>           <action application="set" data="hangup_on_bridge=true"/>
>>>       <action application="export" data="leg_progress_timeout=3"/>
>>>           <action application="set"
>>> data="transfer_on_fail=PROGRESS_TIMEOUT NETWORK_UNAVAIL xml error"/>
>>>           <action application="bridge"
>>> data="${sofia_contact(12225551212 at switch.local)"/>
>>>         </condition>
>>>       </extension>
>>>     </context>
>>>     <context name="error">
>>>       <extension name="NETWORK_UNAVAIL">
>>>         <condition field="${originate_disposition}"
>>> expression="PROGRESS_TIMEOUT" continue="false" break="on-true">
>>>           <action application="bridge" data="sofia/external/12345551212
>>> @switch2.local"/>
>>>         </condition>
>>>       </extension>
>>>     </context>
>>>   </section>
>>> </document>
>>>
>>> Here's a small snippet of the logs when leg_progress_timeout expires ...
>>>
>>> b54a79cd-85f1-4c15-929d-15b1654ff1de 2015-11-24 22:06:21.021538 [DEBUG]
>>> switch_ivr_originate.c:3727 Originate Resulted in Error Cause: 607
>>> [PROGRESS_TIMEOUT]
>>> b54a79cd-85f1-4c15-929d-15b1654ff1de 2015-11-24 22:06:21.021538 [INFO]
>>> mod_dptools.c:3333 Originate Failed.  Cause: PROGRESS_TIMEOUT
>>>
>>>
>>> Thanks ...
>>>
>>>
>>>
>>> _________________________________________________________________________
>>> 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
>>>
>>
>>
>>
>> --
>>
>> *Brian West*
>> brian at freeswitch.org
>>
>>
>> *Twitter: @FreeSWITCH , @briankwest*
>> http://www.freeswitchbook.com
>> http://www.freeswitchcookbook.com
>>
>> Got Bugs? Report them here <https://freeswitch.org/jira>! | Reddit:
>> /r/freeswitch <https://www.reddit.com/r/freeswitch>
>>
>> *T:*+19184209001 | *F:*+19184209002 | *M:*+1918424WEST (9378)
>> *iNUM:*+883 5100 1420 9001 | *ISN:*410*543 | *Skype:*briankwest
>>
>
>
>
> --
>
> *Brian West*
> brian at freeswitch.org
>
>
> *Twitter: @FreeSWITCH , @briankwest*
> http://www.freeswitchbook.com
> http://www.freeswitchcookbook.com
>
> Got Bugs? Report them here <https://freeswitch.org/jira>! | Reddit:
> /r/freeswitch <https://www.reddit.com/r/freeswitch>
>
> *T:*+19184209001 | *F:*+19184209002 | *M:*+1918424WEST (9378)
> *iNUM:*+883 5100 1420 9001 | *ISN:*410*543 | *Skype:*briankwest
>
> _________________________________________________________________________
> 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/20151125/6d784ffe/attachment-0001.html 


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