Brekeke Forum Index » Brekeke SIP Server Forum

Post new topic   Reply to topic
Using a Single Rule to pattern match on multiple Caller IDs?
Author Message
ajlindy
Brekeke Talented


Joined: 12 Sep 2017
Posts: 53

PostPosted: Mon Feb 03, 2020 9:01 am    Post subject: Using a Single Rule to pattern match on multiple Caller IDs? Reply with quote

1. Brekeke Product Name and Version:

Brekeke SIP Server
3.9.4.3/517-1

2. Java version: 1.8.0_231 64-bit

3. OS type and the version: Windows 2008

4. UA (phone), gateway or other hardware/software involved: N/A

5. Your problem:

This works to allow calls from a single caller ID to route how I want it to:

Matching Patterns
$request = ^INVITE
To = sip:(.+)@
$getUri(From) = sip:(<insert 10 digit caller ID here))@(.+)
$addr = 192.168.blah.blah


My question is this -- Can I have a single SIP Dialing Plan rule that allows me to specify a list of Caller IDs so that if an outbound call from my contact platform has one of these Caller IDs, it will Match on this rule and go out a deploy pattern I specify?

Or, if I have ten caller IDs it could be, I need ten dial plan rules?

I know this won't work:

Matching Patterns
$request = ^INVITE
To = sip:(.+)@
$getUri(From) = sip:(<insert 10 digit caller ID here))@(.+)
$getUri(From) = sip:(<insert different 10 digit caller ID here))@(.+)
$addr = 192.168.blah.blah

It actually caused NO outbound call from either 10-digit number to match on this rule.

Thank you!
Back to top
View user's profile
Laurie
Brekeke Master Guru


Joined: 07 Jan 2008
Posts: 241

PostPosted: Mon Feb 03, 2020 9:48 pm    Post subject: Reply with quote

In a Regular Expression, OR-operation is |.
1111111111|2222222222 means 1111111111 or 2222222222

so your dialplan rule can be written like this.
Matching Patterns
$request = ^INVITE
$addr = 192.168.blah.blah
To = sip:(.+)@
$getSIPuser(From) = 1111111111|2222222222|3333333333
$getUri(From) = @(.+)


If there are many caller IDs, you can manage them at the Alias Database. If so, the dialplan rule will be like this.
Matching Patterns
$request = ^INVITE
$addr = 192.168.blah.blah
To = sip:(.+)@
$alias.lookup($getSIPuser(From)) = true
$getUri(From) = @(.+)

FYI:
https://docs.brekeke.com/sip/alias-lookup
https://docs.brekeke.com/sip/alias-function
Back to top
View user's profile
ajlindy
Brekeke Talented


Joined: 12 Sep 2017
Posts: 53

PostPosted: Tue Feb 04, 2020 6:16 am    Post subject: Reply with quote

You are super awesome!

Thank you so much for this help and for the links. Got some reading to do!
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