Author |
Message |
PiotrOS Brekeke Junior Member
Joined: 09 Apr 2015 Posts: 8
|
Posted: Mon Jul 11, 2016 3:04 am Post subject: Dial Plan Preliminary $addr modify |
|
|
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:
Quote: |
Matching Patterns:
$request=^INVITE
$addr=10.10.10.1[0-2]
From=<sip:(.+)@(.+)>(.+)
$addr=(.+) |
Quote: |
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. |
|
Back to top |
|
snuyzm Brekeke Talented
Joined: 11 Feb 2015 Posts: 97
|
Posted: Mon Jul 11, 2016 5:57 pm Post subject: |
|
|
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. |
|
Back to top |
|
PiotrOS Brekeke Junior Member
Joined: 09 Apr 2015 Posts: 8
|
Posted: Wed Jul 13, 2016 6:38 am Post subject: |
|
|
Hello
It works as below.
Quote: |
Matching Patterns
$request = ^INVITE
$addr = 10.10.10.1[0-2]
From = <sip:(.+)@(.+)>(.+) |
Quote: |
Deploy Patterns
From = <sip:%1@%{$addr}>%3
$replaceuri = true |
Thank you for help!
BR |
|
Back to top |
|
snuyzm Brekeke Talented
Joined: 11 Feb 2015 Posts: 97
|
Posted: Wed Jul 13, 2016 11:12 am Post subject: |
|
|
> $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-Matching-addrRange
Matching Patterns will be
Matching Patterns | $request = ^INVITE $addrRange("10.10.10.10","10.10.10.12") = true From = <sip:(.+)@(.+)>(.+)
|
|
|
Back to top |
|
PiotrOS Brekeke Junior Member
Joined: 09 Apr 2015 Posts: 8
|
Posted: Thu Jul 14, 2016 2:17 am Post subject: |
|
|
Thank you snuyzm, I forgot about ^ and $
Thanks!
BR |
|
Back to top |
|
|