[Freeswitch-users] call forward question

Tihomir Culjaga tculjaga at gmail.com
Mon Nov 15 07:35:08 PST 2010


On Mon, Nov 15, 2010 at 3:19 PM, Anthony Cosgrove <acosgrov at gmail.com>wrote:

> I would think in this situation you would need to either use a dynamic
> dialplan to return the 302 to whatever destination you wish (
> http://wiki.freeswitch.org/wiki/Mod_xml_curl), or if staying static a
> continue_on_fail branch along with lua to fetch your destination value.
>
> After a quick look at google looks like my line of thinking is somewhat on
> track...
>
> Old Nabble - <http://old.nabble.com/302-redirects-and-continue_on_fail%3Dtrue-td24544501.html>
> *Freeswitch<http://old.nabble.com/302-redirects-and-continue_on_fail%3Dtrue-td24544501.html>
> *-users - 302 redirects and <http://old.nabble.com/302-redirects-and-continue_on_fail%3Dtrue-td24544501.html>
> *continue_on_fail<http://old.nabble.com/302-redirects-and-continue_on_fail%3Dtrue-td24544501.html>
> * <http://old.nabble.com/302-redirects-and-continue_on_fail%3Dtrue-td24544501.html>
> *...<http://old.nabble.com/302-redirects-and-continue_on_fail%3Dtrue-td24544501.html>
> *
> 302 redirects and *continue_on_fail*=true<http://www.google.com/url?q=http://lists.freeswitch.org/pipermail/freeswitch-users/2009-July/016903.html&sa=X&ei=zD7hTMTkM4WglAe-5_TMAw&ved=0CDIQrAIoAzAD&usg=AFQjCNGc7F3s8UprN9V3M6iaV7L-NBsnog>‎
> - Jul 18, 2009
> [*Freeswitch*-users] "*continue on fail*" howto
>
>

thanks for your answer ....

actually im looking at something like this... still need to test it and see
what the scalability might be.




put this in context features:


  <extension name="A-CFU">
    <condition field="destination_number" expression="^\*21\*(\d.*)$">

      <action application="db" data="insert/FWD-${caller_id_number}/U/$1"/>

      <!-- play appropriate confirmation tone -->
      <action application="hangup"/>
    </condition>
  </extension>



  <extension name="D-CFU">
    <condition field="destination_number" expression="^\#21\#$">

      <action application="db" data="delete/FWD-${caller_id_number}/U"/>

      <!-- play appropriate confirmation tone -->
      <action application="hangup"/>
    </condition>
  </extension>


  <extension name="check_if_forwarded">

    <condition field="destination_number"
expression="^check_if_forwarded$"/>
    <condition field="${forwarded-to}" expression="^$"/>
        <action application="export"
data="to_dial=user/${dialed_extension}"/>
    </condition>

    <condition field="destination_number"
expression="^check_if_forwarded$"/>
    <condition field="${forwarded-to}" expression="^(10[01][0-9])$"/>
        <action application="set"
data="sip_h_Diversion=<sip:${dialed_extension}@${sip_from_host};user=phone>;reason=unconditional"/>

        <action application="export" data="to_dial=user/${forwarded-to}"/>
    </condition>

    <condition field="destination_number"
expression="^check_if_forwarded$"/>
    <condition field="${forwarded-to}" expression="^(0.*)$"/>
        <action application="set"
data="sip_h_Diversion=<sip:${dialed_extension}@
${sip_from_host};user=phone>;reason=unconditional"/>
        <action application="export"
data="to_dial=loopback/${forwarded-to}"/>
    </condition>
  </extension>



In context default just execute this to populate forwarded-to variable:

  <extension name="isForwarded">
    <condition>
      <action application="set"
data="forwarded-to=${db(select/FWD-${destination_number}/U)}"/>
    </condition>
  </extension>





modify just a bit the LocalExtension :)


    <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"/>
        <!-- bind_meta_app can have these args <key> [a|b|ab] [a|b|o|s]
<app> -->
        <action application="bind_meta_app" data="1 b s
execute_extension::dx XML features"/>
        <action application="bind_meta_app" data="2 b s
record_session::$${recordings_dir}/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
        <action application="bind_meta_app" data="3 b s
execute_extension::cf XML features"/>
        <action application="set" data="ringback=${us-ring}"/>
        <action application="set" data="transfer_ringback=$${hold_music}"/>
        <action application="set" data="call_timeout=30"/>
        <!-- <action application="set"
data="sip_exclude_contact=${network_addr}"/> -->
        <action application="set" data="hangup_after_bridge=true"/>
        <!--<action application="set"
data="continue_on_fail=NORMAL_TEMPORARY_FAILURE,USER_BUSY,NO_ANSWER,TIMEOUT,NO_ROUTE_DESTINATION"/>
-->
        <action application="set" data="continue_on_fail=true"/>
        <action application="hash"
data="insert/${domain_name}-call_return/${dialed_extension}/${caller_id_number}"/>
        <action application="hash"
data="insert/${domain_name}-last_dial_ext/${dialed_extension}/${uuid}"/>
        <action application="set"
data="called_party_callgroup=${user_data(${dialed_extension}@${domain_name}
var callgroup)}"/>
        <!--<action application="export"
data="nolocal:sip_secure_media=${user_data(${dialed_extension}@${domain_name}
var sip_secure_media)}"/>-->
        <action application="hash"
data="insert/${domain_name}-last_dial/${called_party_callgroup}/${uuid}"/>


        <!-- check if the destination is actually forwarded -->
        <action application="execute_extension" data="check_if_forwarded"
XML features/>


        <action application="bridge" data="${to_dial}@${domain_name}"/>


        <action application="answer"/>
        <action application="sleep" data="1000"/>
        <action application="bridge" data="loopback/app=voicemail:default
${domain_name} ${dialed_extension}"/>
      </condition>
    </extension>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20101115/6250e79a/attachment-0001.html 


More information about the FreeSWITCH-users mailing list