Brekeke Forum Index » Brekeke SIP Server Forum

Post new topic   Reply to topic
Catching All Outbound Calls
Author Message
JRayfield
Brekeke Guru


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

PostPosted: Tue Mar 12, 2024 4:58 pm    Post subject: Catching All Outbound Calls Reply with quote

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 Patterns
$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 Patterns
$rtp = false
$continue = true

Suggestions?

John

_________________
John Rayfield, Jr. CETma
Rayfield Communications
Springfield, MO
www.rayfield.net
Back to top
View user's profile
Ericcc
Brekeke Member


Joined: 21 Apr 2014
Posts: 23
Location: NY, USA

PostPosted: Fri Mar 15, 2024 11:58 am    Post subject: Reply with quote

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


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

PostPosted: Tue Mar 19, 2024 2:15 pm    Post subject: Reply with quote

That works nice. Thanks.

John

_________________
John Rayfield, Jr. CETma
Rayfield Communications
Springfield, MO
www.rayfield.net
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