|
![Reply to topic](templates/iCGstation/images/lang_english/reply.gif) |
Author |
Message |
JRayfield Brekeke Guru
![](images/spacer.gif)
Joined: 03 Dec 2012 Posts: 147
Location: Springfield, MO
|
Posted: Wed Feb 28, 2024 8:26 am Post subject: Using $If in Dial Plan |
|
|
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:
I want to use $alias.lookup to determine if a number that has been dialed from a PBX connected to BSS, is in the Alias List or not. If it is, then I want to set $rtp = false and if it is not, I want to set $rtp = true, in the Deploy Patterns.
$request = ^INVITE
$registered("UserName") = true
$addr = ^PBX_IP-Address$
To = sip:(.+)@
$alias.lookup("%1") = (.+)
This part works to determine if the number dialed (the To number) is in the Alias List or not. In other programming languages, I would do something like:
IF $alias.lookup("%1") = TRUE THEN
$rtp = false
ELSE
$rtp = true
END IF
How can something like the above be set up in the Dial Plan for BSS?
John Rayfield, Jr. _________________ John Rayfield, Jr. CETma
Rayfield Communications
Springfield, MO
www.rayfield.net |
|
Back to top |
|
Laurie Brekeke Master Guru
![](images/spacer.gif)
Joined: 07 Jan 2008 Posts: 241
|
Posted: Thu Feb 29, 2024 5:42 pm Post subject: |
|
|
Use $not
https://docs.brekeke.com/sip/not
Matching Patterns | $request = ^INVITE $registered("UserName") = true $addr = ^PBX_IP-Address$ To = sip:(.+)@ $not($alias.lookup("%1")) = (.+)
| Deploy Patterns | $rtp = %2
|
You can also use $if
Matching Patterns | $request = ^INVITE $registered("UserName") = true $addr = ^PBX_IP-Address$ To = sip:(.+)@ $if($alias.lookup("%1"),"false","true") = (.+)
| Deploy Patterns | $rtp = %2
|
|
|
Back to top |
|
JRayfield Brekeke Guru
![](images/spacer.gif)
Joined: 03 Dec 2012 Posts: 147
Location: Springfield, MO
|
Posted: Sat Mar 02, 2024 10:56 am Post subject: |
|
|
Thanks for these suggestions.
This also helps me to better understand how the BSS programming works overall. In other language that I'm most familiar with, I tended to use Subprograms instead of Functions. I have to remember that with BSS, these are Functions, therefore are returning a result itself, instead of returning results in 'parameters' that are being passed through the Subprogram.
So, I see in the case of using $not, $alias.lookup is returning "true" (so in effect, the Function $alias.lookup = "true", and the $not changes that to $alias.lookup = "false". And since $alias.lookup is in (), it can be retrieved by using %2.
And in the case of using $if, since alias.lookup = "true" or "false", and alias.lookup is in (), then again, the 'value' ("true" or "false") can be retrieved by using %2.
Am I getting closer to understanding how the syntax of BSS dial plan programming works?
John _________________ John Rayfield, Jr. CETma
Rayfield Communications
Springfield, MO
www.rayfield.net |
|
Back to top |
|
Laurie Brekeke Master Guru
![](images/spacer.gif)
Joined: 07 Jan 2008 Posts: 241
|
|
Back to top |
|
JRayfield Brekeke Guru
![](images/spacer.gif)
Joined: 03 Dec 2012 Posts: 147
Location: Springfield, MO
|
Posted: Fri Mar 08, 2024 3:40 pm Post subject: |
|
|
Thank you very much for the help, Laurie.
John _________________ John Rayfield, Jr. CETma
Rayfield Communications
Springfield, MO
www.rayfield.net |
|
Back to top |
|
|
|
|
|