[Freeswitch-users] Routing calls based on 'Referred-By'

Matt Darnell mattdarnell at gmail.com
Thu Jul 17 02:08:31 PDT 2008


On Wed, Jul 16, 2008 at 10:59 PM, Matt Darnell <mattdarnell at gmail.com> wrote:
>> I would like the dial plan to route based on the number in the
>> Refered-By or Diversion field.
>
>    <extension name="Mailbox_4473451">
>      <condition "${sip_referred_by_user}" expression="4473451">
>        <action application="info"/>
>        <action application="export" data="sip_h_Diversion=3451"/>
>        <action application="bridge"
> data="{absolute_codec_string=PCMA}sofia/gateway/gw.akamaitel.com/3451"/>
>      </condition>
>    </extension>
>
>    <extension name="Mailbox_4473452">
>      <condition "${sip_referred_by_user}" expression="4473452">
>        <action application="info"/>
>        <action application="export" data="sip_h_Diversion=3452"/>
>        <action application="bridge"
> data="{absolute_codec_string=PCMA}sofia/gateway/gw.akamaitel.com/3452"/>
>      </condition>
>    </extension>
>
> For some reason, all calls go to the first extension.  When I look at
> the out put from info, the sip_referred_by_user is 4473452 but it
> still routes to the first extension.
> variable_sip_referred_by_user: [4473452]
>
> I have even changed the condition statement of the first extensin to :
> <condition "${sip_referred_BOGUS_by_user}" expression="4473451">
> and it still executes that extension.
>
> Please let me know if you can see the issue.
>
> -Matt
>

Another interesting thing is that if I have this:
    <extension name="Mailbox_4473451">
      <condition "${sip_referred_by_user}" expression="^\d{3}(\d{4})$">
        <action application="info"/>
        <action application="export" data="sip_h_Diversion=$1"/>
        <action application="bridge"
data="{absolute_codec_string=PCMA}sofia/gateway/gw.akamaitel.com/$1"/>
      </condition>
    </extension>

$1 does not get populated with \d{4}, the invite has $1 in the string.

This however works fine:
<condition field="destination_number" expression="^\d{3}(\d{4})$">

-Matt




More information about the FreeSWITCH-users mailing list