Forums Read-only archive

get the number from "TO" OR the "URI"

30 posts · Brekeke SIP Server Forum

Izzyg Original post
1. Brekeke Product Name and Version: 2.4.8.6/286.3

2. Java version: 1.6.0_31

3. OS type and the version: Windows Server 2008 R2

4. UA (phone), gateway or other hardware/software involved:

5. Your problem: i need to be able to get the phone number from the TO field as well as from the URI

sometimes carriers will send us the calls to the Brekeke using the number in the TO field and some times int he URI (when they send it in the URI the TO has a differen tnumber, the LRN)

this is my current dial plan examples

Matching Patterns:
$request=^INVITE
To=sip:(.+)@
To=sip:2124588888


Deploy Patterns:
$auth=false
To=sip:%1@192.168.1.15
$session=failover sip:%1@192.168.1.15 sip:%1@192.168.1.16
&failover.timer.inviting=5
&failover.timer.provisional=360
$continue=false

i want to see the 2124558888 if its int he TO field or int he URI field (doesnt have to be both)
hope

Code:

sometimes carriers will send us the calls to the Brekeke using the number in the TO field and some times int he URI (when they send it in the URI the TO has a differen tnumber, the LRN) 
Could you give an example?
and which number do you want to use for sending the call to?
Izzyg
i want to look in the TO or the URI for the number specified in the 3rd entry
"To = sip:2124588888"

if it exists in the TO or the URI then it should be considered legit, and i want to send (Deploy) the number i specified int he "To = sip:2124588888"
hope
do you want to use 2124588888 in deploy pattern no matter what number is used in the INVITE from caller?

or caller send INVITE request and the number in the INVITE request line is different from the number in the INVITE To header
if so, which number you want to use in deploy pattern?
the number shown in the INVITE request line or the number in the INVITE To header
Izzyg
i want to check the Number thats in this line "To=sip:2124588888 "


so if i have
"To=sip:2124447777" then the TO or the URI can have 2124447777

if i have
"To=sip:6178888888" then the TO or URI can have 6178888888

and when i Deploy the call, i want to show the 2124447777 or 6178888888 depends on the "To=sip:xxxxxxxxx"
hope
Matching Patterns:
$request=^INVITE
To=sip:(.+)@

Deploy Patterns:
$auth=false
To=sip:%1@192.168.1.15
$session=failover sip:%1@192.168.1.15 sip:%1@192.168.1.16
&failover.timer.inviting=5
&failover.timer.provisional=360
$continue=false

does above dial plan rule work as you need?
how many To headers in the caller INVITE?
Izzyg
No it wont work
i need to specify the exact number


the dial plan i am using works excellent, i just need to add to check for the information in the TO header like it is doing now,
but i need to add to check what it is checking now, OR if it is int he URI
ambrosio
Izzyg,

What does your "URI" mean??
Are you talking about URI in To header?
or are you talking about Request-URI?
ambrosio
I've tested it in BSS v3.1.7.8
The rule matches if 2124588888 is in To-URI or Request-URI.

[Matching Patterns]
$request = ^INVITE
"2124588888" = (.+)
$getUri($request) = sip:(\d*)
$getUri(To) = sip:(\d*)
$or($str.equals("%1","%2"),$str.equals("%1","%3")) = true

[Deploy Patterns]
$auth = false
To = sip:%1@192.168.1.15
$session = failover sip:%1@192.168.1.15 sip:%1@192.168.1.16
&failover.timer.inviting = 5
&failover.timer.provisional = 360
$continue = false
Izzyg
i am on Version 2.

should it work fine ?
Izzyg
just tested and it seems to work

so i understand and learn, can you explain to me what each line does?

thanks so much
Izzyg
whats an easy way to edit multiple dial plans (over 2000) and add the new lines to it ?
Izzyg
i just had a chance to reach out to the carrier that we had an issue with

they sent us the call, the phone number was only in the Request-Line: INVITE sip:phonenumber@ip:port SIP/2.0


in the To field it had a different number <sip:wrongnumber@ip>


and the brekeke rejected the call, i assume because it didnt find the phonenumber in the URI?

is that above rule you asked me to use looking for the phonenumber in the To OR in the Request-URI ?
ambrosio
Yes

---------------------------------------
$request = ^INVITE
"phonenumber" = (.+)
$getUri($request) = sip:(\d*)
$getUri(To) = sip:(\d*)
$or($str.equals("%1","%2"),$str.equals("%1","%3")) = true
---------------------------------------


The above definition will be fulfilled if phonenumber is shown in Request-Line or To header
ambrosio
> whats an easy way to edit multiple dial plans (over 2000) and add the new lines to it ?

If you use Alias, you don't have to create multiple rules if they look same.
ambrosio
> so i understand and learn, can you explain to me what each line does?

$request = ^INVITE
if Request-Line is INVITE

"2124588888" = (.+)
2124588888 --> %1

$getUri($request) = sip:(\d*)
Request-URI's digits --> %2

$getUri(To) = sip:(\d*)
To-URI's digits --> %3

$or($str.equals("%1","%2"),$str.equals("%1","%3")) = true
if %1 is same as %2 -or- %2 is same as %3
Izzyg
$request = ^INVITE
if Request-Line is INVITE

"2124588888" = (.+)
2124588888 --> %1

$getUri($request) = sip:(\d*)
Request-URI's digits --> %2

$getUri(To) = sip:(\d*)
To-URI's digits --> %3

$or($str.equals("%1","%2"),$str.equals("%1","%3")) = true
if %1 is same as %2 -or- %2 is same as %


what i want the rule to be, if %1 is same as %2 or %3
ambrosio
$or($str.equals("%1","%2"),$str.equals("%1","%3")) = true
correction: if %1 is same as %2 -or- %1 is same as %3

Let you test yourself.
Izzyg
i tried it earlier and ti didnt work
ambrosio
Use Brekeke SIP Server 3.1
Izzyg
is it possible to get it working in V2?
not sure if i want to buy a license just for this option ?
ambrosio
I tested the above dialplan definition in ver 3.1.7.8.
I don't have v2.

You can download an evaluation version from brekeke's web.
Izzyg
can anyone advise how to do it in V2?
Tata
Have you tested the above dialplan rule but didn't work?
Izzyg
thats correct
hope
does it work with v2 if remove lines in deploy patterns
$session = failover sip:%1@192.168.1.15 sip:%1@192.168.1.16
&failover.timer.inviting = 5
&failover.timer.provisional = 360

v3 failover plugin is different from that in v2

you may need to use v3
Izzyg
nope still cant get it working

anyone out there has a known working dial plan to get this working?

currently i am still on V2
Tata
The DialPlan you tried is for ver3 not for ver2.
Izzyg
is it possible to also do it in V2?

also does anyone recommend not upgrading to V3 from V2?
james
Use version 3.
Version 2 doesn't meet your requirements.