Catching All Outbound Calls

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

Catching All Outbound Calls

Post by JRayfield »

1. Brekeke Product Name and Version:
Brekeke SIP Server - 3.14.5.17/563.2

2. Java version:
11.0.15

3. OS type and the version:
Windows Server 2012

4. UA (phone), gateway or other hardware/software involved:
3CX

5. Your problem:

My idea is to catch all outbound calls from connected 3CX servers and depending upon whether or not the number called is in an alias list, enabled or disable $rtp. The default in the BSS configuration is $rtp=true, so I need to make it false IF the number dialed by a user, through BSS, is found in the alias list.

For example, if a 3CX user (that is connected to BSS) dials 12015551234 and that number is NOT in the alias list, then the deploy pattern won't be triggered.

But, if that number dialed IS in the alias list, then a deploy pattern will be triggered that includes $rtp=false.

So I start with this at the beginning of my dial plans, to catch all outbound calls from BSS to my upstream provider:

Matching Pattern:

$request = ^INVITE
To = sip:(.+)@

Now, I need an alias.lookup function to determine if %1 is in the alias list.

One problem that I'm running into is that sometimes, an outbound number will include a 'tech code', which is a 6 digit number that is prepended to the number dialed. So, using the example above, %1 will look like: 54872312015551234

But with other users there will not be a 'tech code', so the number dialed would look like 12015551234.

So, I need to use the right-most 11 digits, to search the alias list (the alias list will always just have the 11 digits in it). The number dialed will never be less than 11 digits long.

And this is where I'm having the problem. In other programming languages, this would be simple to use the right-most 11 digits of the %1 variable as the parameter to search for in the alias.lookup function. But, I can't figure out how to do this with the BSS programming.

My deploy pattern is simple:

Deploy Pattern:

$rtp = false
$continue = true

Suggestions?

John
John Rayfield, Jr. CETma
Rayfield Communications
Springfield, MO
www.rayfield.net
Ericcc
Posts: 24
Joined: Mon Apr 21, 2014 9:46 am
Location: NY, USA

Post by Ericcc »

> So, I need to use the right-most 11 digits,

[Matching Patterns]
$request = ^INVITE
To = sip:.*(\d{11})@

You can test it at https://regex101.com/
Type sip:.*(\d{11})@ in "REGULAR EXPRESSION" field.
and type sip:54872312015551234@xxx in "TEST STRING" field.
The Group 1 will be 12015551234
JRayfield
Posts: 147
Joined: Mon Dec 03, 2012 5:50 pm
Location: Springfield, MO

Post by JRayfield »

That works nice. Thanks.

John
John Rayfield, Jr. CETma
Rayfield Communications
Springfield, MO
www.rayfield.net
Post Reply