Forums Read-only archive

Dial Plan Preliminary $addr modify

5 posts · Brekeke SIP Server Forum

PiotrOS Original post
1. Brekeke Product Name and Version:
Brekeke SIP Server, Version 3.5.2.8
2. Java version:
1.6.0_45
3. OS type and the version:
Linux centos 6.6
4. UA (phone), gateway or other hardware/software involved:
doesn't matter
5. Your problem: How to reach

I need to modify FROM URI with IP address from which INVITE was send.
Right now We are receiving INVITEs from specific IP addresses ex. 10.10.10.10, 10.10.10.11, 10.10.10.12
But in FROM URI there is different ip address than from it was send.

For example:
We received INVITE from IP 10.10.10.10,
But From URI contains different IP than source:
From: <sip:555342639191@192.168.0.10:5062;user=phone>;tag=bbdb2b7c5s

And now we need to change From URI with source IP address:
From: <sip:555342639191@10.10.10.10:5062;user=phone>;tag=bbdb2b7c5s

It can be done with Dial Plan Preliminary, I've created rules as below:
Matching Patterns:
$request=^INVITE
$addr=10.10.10.1[0-2]
From=<sip:(.+)@(.+)>(.+)
$addr=(.+)
Deploy Patterns:
From=<sip:%1@%4>%3
$replaceuri=true
But as I assume this rule will match all IP addresses - and I need to do this only for specific IPs

Thanks in advance for any hint.
snuyzm
Try this. This syntax requires version 3.5 or later.
[Matching Patterns]
$request=^INVITE
$addr = ^10.10.10.1[0-2]$

[Deploy Patterns]
From/uri = sip:%{$getSIPuser(From)}@%{$addr}


> But as I assume this rule will match all IP addresses - and I need to do this only for specific IPs

It matches only 10.10.10.10, 10.10.10.11 and 10.10.10.12 because you have $addr condition in MatchingPatterns.
PiotrOS
Hello

It works as below.
Matching Patterns
$request = ^INVITE
$addr = 10.10.10.1[0-2]
From = <sip:(.+)@(.+)>(.+)
Deploy Patterns
From = <sip:%1@%{$addr}>%3
$replaceuri = true

Thank you for help!
BR
snuyzm
> $addr = 10.10.10.1[0-2]

You need ^ and $ to match the IP addresses 10.10.10.10-10.10.10.12 only.
Without ^, it matches others such as 110.10.10.10, 210.10.10.10...
Without $, it matches others such as 10.10.10.100, 10.10.10.111...

So you need to define $addr as the following.

Code:

$addr = ^10.10.10.1[0-2]$
Also you can define the range like this.
$addrRange("10.10.10.10", "10.10.10.12" ) = true
http://wiki.brekeke.com/wiki/DialPlan-M ... -addrRange

Matching Patterns will be
Matching Patterns
$request = ^INVITE
$addrRange("10.10.10.10","10.10.10.12") = true
From = <sip:(.+)@(.+)>(.+)
PiotrOS
Thank you snuyzm, I forgot about ^ and $

Thanks!

BR