Brekeke Forum Index » Brekeke SIP Server Forum

Post new topic   Reply to topic
Multiple IP addresses in $addr Line
Author Message
JRayfield
Brekeke Guru


Joined: 03 Dec 2012
Posts: 147
Location: Springfield, MO

PostPosted: Fri Jan 27, 2023 11:30 am    Post subject: Multiple IP addresses in $addr Line Reply with quote

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
Back to top
View user's profile
JRayfield
Brekeke Guru


Joined: 03 Dec 2012
Posts: 147
Location: Springfield, MO

PostPosted: Fri Jan 27, 2023 12:03 pm    Post subject: Reply with quote

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
Back to top
View user's profile
Niloc
Brekeke Talented


Joined: 19 Sep 2017
Posts: 70
Location: NL

PostPosted: Fri Jan 27, 2023 1:07 pm    Post subject: Reply with quote

> $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
Back to top
View user's profile
JRayfield
Brekeke Guru


Joined: 03 Dec 2012
Posts: 147
Location: Springfield, MO

PostPosted: Fri Jan 27, 2023 5:52 pm    Post subject: Reply with quote

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
Back to top
View user's profile
Laurie
Brekeke Master Guru


Joined: 07 Jan 2008
Posts: 241

PostPosted: Sat Jan 28, 2023 3:12 pm    Post subject: Reply with quote

> $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
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    Brekeke Forum Index » Brekeke SIP Server Forum All times are GMT - 7 Hours
Page 1 of 1