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

Discuss any topic about Brekeke SIP Server.

Moderator: Brekeke Support Team

Izzyg
Posts: 91
Joined: Tue Jun 25, 2013 1:14 pm
Location: Sip Land

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

Post by Izzyg »

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
Posts: 862
Joined: Tue Jan 15, 2008 4:08 pm

Post by hope »

Code: Select all

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
Posts: 91
Joined: Tue Jun 25, 2013 1:14 pm
Location: Sip Land

Post by 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
Posts: 862
Joined: Tue Jan 15, 2008 4:08 pm

Post by 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
Posts: 91
Joined: Tue Jun 25, 2013 1:14 pm
Location: Sip Land

Post by 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
Posts: 862
Joined: Tue Jan 15, 2008 4:08 pm

Post by 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
Posts: 91
Joined: Tue Jun 25, 2013 1:14 pm
Location: Sip Land

Post by 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
Posts: 215
Joined: Thu Mar 27, 2008 12:20 pm

Post by ambrosio »

Izzyg,

What does your "URI" mean??
Are you talking about URI in To header?
or are you talking about Request-URI?
ambrosio
Posts: 215
Joined: Thu Mar 27, 2008 12:20 pm

Post by 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
Posts: 91
Joined: Tue Jun 25, 2013 1:14 pm
Location: Sip Land

Post by Izzyg »

i am on Version 2.

should it work fine ?
Izzyg
Posts: 91
Joined: Tue Jun 25, 2013 1:14 pm
Location: Sip Land

Post by 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
Posts: 91
Joined: Tue Jun 25, 2013 1:14 pm
Location: Sip Land

Post by Izzyg »

whats an easy way to edit multiple dial plans (over 2000) and add the new lines to it ?
Izzyg
Posts: 91
Joined: Tue Jun 25, 2013 1:14 pm
Location: Sip Land

Post by 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
Posts: 215
Joined: Thu Mar 27, 2008 12:20 pm

Post by 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
Posts: 215
Joined: Thu Mar 27, 2008 12:20 pm

Post by 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
Posts: 215
Joined: Thu Mar 27, 2008 12:20 pm

Post by 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
Posts: 91
Joined: Tue Jun 25, 2013 1:14 pm
Location: Sip Land

Post by 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
Posts: 215
Joined: Thu Mar 27, 2008 12:20 pm

Post by 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
Posts: 91
Joined: Tue Jun 25, 2013 1:14 pm
Location: Sip Land

Post by Izzyg »

i tried it earlier and ti didnt work
ambrosio
Posts: 215
Joined: Thu Mar 27, 2008 12:20 pm

Post by ambrosio »

Use Brekeke SIP Server 3.1
Izzyg
Posts: 91
Joined: Tue Jun 25, 2013 1:14 pm
Location: Sip Land

Post by Izzyg »

is it possible to get it working in V2?
not sure if i want to buy a license just for this option ?
ambrosio
Posts: 215
Joined: Thu Mar 27, 2008 12:20 pm

Post by 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
Posts: 91
Joined: Tue Jun 25, 2013 1:14 pm
Location: Sip Land

Post by Izzyg »

can anyone advise how to do it in V2?
Tata
Posts: 223
Joined: Sun Jan 27, 2008 1:03 pm

Post by Tata »

Have you tested the above dialplan rule but didn't work?
Izzyg
Posts: 91
Joined: Tue Jun 25, 2013 1:14 pm
Location: Sip Land

Post by Izzyg »

thats correct
Post Reply