Skip to main content
Inspiring
February 7, 2012
Answered

Routing calls based on a leading number

  • February 7, 2012
  • 1 reply
  • 1039 views

Is it possible to use different profile based on a padded phone number?  Reminiscent of the 'Dial 9 to get out'

i.e. 812345678901

8 = a routing number

12345678901 the phone to call.

I tried changing my workflow.xml without luck

<Context name="rtmp">

     <Condition variable="destNum" value="^8.*$">

          <AppNode sequence="1" app="bridge" args="sip|${destNum}@myContext8"/>

          <AppNode sequence="2" app="hangup" args="null"/>

     </Condition>

</Context>

<Context name="rtmp">

     <Condition variable="destNum" value="^9.*$">

          <AppNode sequence="1" app="bridge" args="sip|${destNum}@myContext9"/>

          <AppNode sequence="2" app="hangup" args="null"/>

     </Condition>

</Context>

This topic has been closed for replies.
Correct answer

   $1 variable in below example would contain the substring after removing prefix 8.

    <Condition variable="destNum" value="^8(.*)$">

          <AppNode sequence="1" app="bridge" args="sip|$1@myContext8"/>

          <AppNode sequence="2" app="hangup" args="null"/>

     </Condition>

1 reply

February 7, 2012

All conditions need to go into one context node (e.g. rtmp in your case). See changed node after strikethrough.

<Context name="rtmp">

     <Condition variable="destNum" value="^8(.*)$">

          <AppNode sequence="1" app="bridge" args="sip|$1@myContext8"/>

          <AppNode sequence="2" app="hangup" args="null"/>

     </Condition>

</Context>

<Context name="rtmp">

     <Condition variable="destNum" value="^9(.*)$">

          <AppNode sequence="1" app="bridge" args="sip|$1@myContext9"/>

          <AppNode sequence="2" app="hangup" args="null"/>

     </Condition>

</Context>

There must be a SIP profileID myContext8 & myContext9 in sip.xml to point to your sip gateway.

Inspiring
February 7, 2012

Thanks Pankaj, but I am sorry I typed my example wrong. My XML does look like your striked out example.

My main question is can I get a substring from destNum?  If I could send "812345678901" to my application and use "8" for routing and then send "12345678901" to my SIP provider, I could route calls based on location easier.

Correct answer
February 7, 2012

   $1 variable in below example would contain the substring after removing prefix 8.

    <Condition variable="destNum" value="^8(.*)$">

          <AppNode sequence="1" app="bridge" args="sip|$1@myContext8"/>

          <AppNode sequence="2" app="hangup" args="null"/>

     </Condition>