Dial Plan Preliminary $addr modify

Discuss any topic about Brekeke SIP Server.

Moderator: Brekeke Support Team

Post Reply
PiotrOS
Posts: 8
Joined: Thu Apr 09, 2015 2:02 am

Dial Plan Preliminary $addr modify

Post by PiotrOS »

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
Posts: 97
Joined: Wed Feb 11, 2015 10:12 pm

Post by 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
Posts: 8
Joined: Thu Apr 09, 2015 2:02 am

Post by 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
Posts: 97
Joined: Wed Feb 11, 2015 10:12 pm

Post by 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: Select all

$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
Posts: 8
Joined: Thu Apr 09, 2015 2:02 am

Post by PiotrOS »

Thank you snuyzm, I forgot about ^ and $

Thanks!

BR
Post Reply