Using a Single Rule to pattern match on multiple Caller IDs?

Discuss any topic about Brekeke SIP Server.

Moderator: Brekeke Support Team

Post Reply
ajlindy
Posts: 53
Joined: Tue Sep 12, 2017 1:47 pm

Using a Single Rule to pattern match on multiple Caller IDs?

Post by ajlindy »

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 Pattern

$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 Pattern

$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!
Laurie
Posts: 245
Joined: Mon Jan 07, 2008 12:25 pm

Post by Laurie »

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
ajlindy
Posts: 53
Joined: Tue Sep 12, 2017 1:47 pm

Post by ajlindy »

You are super awesome!

Thank you so much for this help and for the links. Got some reading to do!
Post Reply