1. Brekeke Product Name and Version: SIP Server
2. Java version: 11.0.15
3. OS type and the version: Windows Server 2019
4. UA (phone), gateway or other hardware/software involved: Responder/FreePBX
5. Your problem:
I am attempting to determine if a particular string exists in the caller ID - $getDisplayName(From) field - and take action if it does by modifying the SIP message and then $continue = true. I have a matching pattern that breaks up the From field into three pieces. I am attempting to determine if %3 contains that string with an $eval function. I have tried various versions of $eval(%3 = My String) = ^true with quotes around the various components, no quotes, etc. What is the proper way to use the eval function? Searching for "eval" on the forum is useless as it only brings up people talking about the evaluation edition. And the Wiki has only one example and it doesn't include variables.
Using $eval to determine if string exists
Moderator: Brekeke Support Team
You can write the matching pattern like this for example
[Matching Patterns]
$request = ^INVITE
$getDisplayName(From) = (\d+) (\d+) (.+)
"%3" = My String
With $eval, the above can be written as the following.
[Matching Patterns]
$request = ^INVITE
$getDisplayName(From) = (\d+) (\d+) (.+)
$eval("\"%3\"=My String") = ^true
If you want to use %3 in a later rule, store the %3 to a variable like &my.value3.
Rule-1: Parse Caller ID
[Matching Patterns]
$request = ^INVITE
$getDisplayName(From) = (\d+) (\d+) (.+)
[Deploy Patterns]
&my.value1 = %1
&my.value2 = %2
&my.value3 = %3
$continue = true
Rule-2: Find My String
[Matching Patterns]
$request = ^INVITE
&my.value3 = My String
[Matching Patterns]
$request = ^INVITE
$getDisplayName(From) = (\d+) (\d+) (.+)
"%3" = My String
With $eval, the above can be written as the following.
[Matching Patterns]
$request = ^INVITE
$getDisplayName(From) = (\d+) (\d+) (.+)
$eval("\"%3\"=My String") = ^true
If you want to use %3 in a later rule, store the %3 to a variable like &my.value3.
Rule-1: Parse Caller ID
[Matching Patterns]
$request = ^INVITE
$getDisplayName(From) = (\d+) (\d+) (.+)
[Deploy Patterns]
&my.value1 = %1
&my.value2 = %2
&my.value3 = %3
$continue = true
Rule-2: Find My String
[Matching Patterns]
$request = ^INVITE
&my.value3 = My String
That worked great, thank you! One last question you may be able to answer. I'd like to modify the SDP body. In particular, the c= line. Do you know if there is a deploy function specific to that? I see a long list of potential variables/functions, but no description of them. Is there a document that describes all of these in detail where I could determine that myself?
Why do you want to modify the c= line of SDP?
It should be a destination IP address for RTP packets.
Anyway does &net.rtp.ifdst or &net.rtp.ifsrc meet the requirement?
https://docs.brekeke.com/sip/net-rtp-ifdst
https://docs.brekeke.com/sip/net-rtp-ifsrc
> Is there a document that describes all of these in detail where I could determine that myself?
Have you looked at the link below?
https://docs.brekeke.com/sip/dial-plan-reference
It should be a destination IP address for RTP packets.
Anyway does &net.rtp.ifdst or &net.rtp.ifsrc meet the requirement?
https://docs.brekeke.com/sip/net-rtp-ifdst
https://docs.brekeke.com/sip/net-rtp-ifsrc
> Is there a document that describes all of these in detail where I could determine that myself?
Have you looked at the link below?
https://docs.brekeke.com/sip/dial-plan-reference
As odd as it may sound, what I'm attempting to do is make it so the phone that receives the call with that particular string can't communicate back. I want the INVITE to make it to the phone, but any return communication to never make it back so that the calling system thinks that the phone is still ringing and then eventually time out after about 120 seconds. Ideally, I'd rather block the 200 OK status from the phone itself so that Trying and Ringing still make it back.
I've looked at the docs on that page but it's hit or miss which ones are there, and there isn't much of an explanation.
I've looked at the docs on that page but it's hit or miss which ones are there, and there isn't much of an explanation.
Remove these &net.rtp.ifdst / &net.rtp.ifsrc, and insert $rtp=true in Matching Patterns.
$rtp=true makes the SIP Server handles RTP-relay.
https://docs.brekeke.com/sip/rtp
$rtp=true makes the SIP Server handles RTP-relay.
https://docs.brekeke.com/sip/rtp