[OpenSIPS-Users] Regex to test variable
Mark Farmer
farmorg at gmail.com
Wed Nov 25 15:23:16 EST 2020
Hi everyone
I am trying to detect a string using sdp.line,m and a regex pattern but it
is failing to match.
I am trying to match the 101 at the end of the m=audio line:
m=audio 25224 RTP/AVP 8 18 101
This is my code:
if (is_method("INVITE") && has_body_part("application/sdp")) {
$var(audio_stream) = $(rb{sdp.line,m});
xlog("CUSTOM_LOG: Audio stream is $var(audio_stream)\n");
if ($var(audio_stream) =~ "^m\=audio.*101$") {
$var(dtmf_compat)=1;
} else $var(dtmf_compat)=0;
if ($var(dtmf_compat)=0) {
xlog("CUSTOM_LOG: Would do something else now");
}
xlog("CUSTOM_LOG: DTMF validity = $var(dtmf_compat)");
}
I can see that var(audio_stream) is being set correctly:
CUSTOM_LOG: Audio stream is m=audio 25914 RTP/AVP 8 18 101
But it seems not to match:
CUSTOM_LOG: DTMF validity = 0
Is anyone able to help me solve this please?
Many thanks!
Mark.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20201125/927016a0/attachment.html>
More information about the Users
mailing list