Multiple IP addresses in $addr Line

Discuss any topic about Brekeke SIP Server.

Moderator: Brekeke Support Team

Post Reply
JRayfield
Posts: 147
Joined: Mon Dec 03, 2012 5:50 pm
Location: Springfield, MO

Multiple IP addresses in $addr Line

Post by JRayfield »

1. Brekeke Product Name and Version:
3.13.0.0/552
2. Java version:
11.0.15
3. OS type and the version:
Windows Server 2016
4. UA (phone), gateway or other hardware/software involved:
3CX
5. Your problem:

In the Matching Rules of Dial Plans, I'm using $addr to verify that a user who's attempting to make an outbound calls is the correct user (calling from the correct public IP address).

Now I need to set up a Matching Rule that will allow for calls coming from 2 different IP addresses for one user.

For example, this particular user may be making calls from xxx.xxx.101.xxx or may be making calls from xxx.xxx.102.xxx.

I could use two dial plan entries, but doing it in one seems to make more sense.

I tried this: ^xxx.xxx.[101-102].xxx$, but through up a syntax error.
I tried this: ^xxx\.xxx\.[101-102\.xxx$, but this also through up a syntax error. This second line is very close to how the Brekeke SIP Server documentation shows doing something like this, but it must not be correct.

Can someone help me?

John Rayfield, Jr.
John Rayfield, Jr. CETma
Rayfield Communications
Springfield, MO
www.rayfield.net
JRayfield
Posts: 147
Joined: Mon Dec 03, 2012 5:50 pm
Location: Springfield, MO

Post by JRayfield »

I think I found what I needed.

It looks like this will work:

$addr = ^xxx.xxx.101.xxx$|^xxx.xxx.102.xxx$

Is this correct?

John
John Rayfield, Jr. CETma
Rayfield Communications
Springfield, MO
www.rayfield.net
Niloc
Posts: 70
Joined: Tue Sep 19, 2017 9:49 pm
Location: NL

Post by Niloc »

> $addr = ^xxx.xxx.101.xxx$|^xxx.xxx.102.xxx$

It works.

Also it might be written as
$addr = ^xxx.xxx.10[12].xxx$

If you allow the range between xxx.xxx.101.xxx and xxx.xxx.102.xxx, you can write
$addrRange( "xxx.xxx.101.xxx", "xxx.xxx.102.xxx" ) = ^true

FYI:
https://docs.brekeke.com/sip/addr
https://docs.brekeke.com/sip/addrrange
https://docs.brekeke.com/sip/addrprefix
JRayfield
Posts: 147
Joined: Mon Dec 03, 2012 5:50 pm
Location: Springfield, MO

Post by JRayfield »

I also see this shown in the documentation:

$addr = ^xxx\.xxx\.101\.xxx$|^xxx\.xxx\.102\.xxx$

In this case, is it necessary to use the "\"? I've tried both with and without and it seems to work either way.

John
John Rayfield, Jr. CETma
Rayfield Communications
Springfield, MO
www.rayfield.net
Laurie
Posts: 245
Joined: Mon Jan 07, 2008 12:25 pm

Post by Laurie »

> $addr = ^xxx\.xxx\.101\.xxx$|^xxx\.xxx\.102\.xxx$
>
> In this case, is it necessary to use the "\"? I've tried both with and without and it seems to work either way.


\ is an Escape character in Regular expression.
In your case, you don't have to use the "\" .

Refer to the Regular expression reference for more details.
https://en.wikipedia.org/wiki/Regular_expression
Post Reply