<div dir="ltr">something with your regex. each header has a \r\n in the end too, also I'm not sure you need \ before =</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Nov 25, 2020 at 4:26 PM Mark Farmer <<a href="mailto:farmorg@gmail.com">farmorg@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi everyone<div><br></div><div>I am trying to detect a string using sdp.line,m and a regex pattern but it is failing to match.</div><div>I am trying to match the 101 at the end of the m=audio line:</div><div><br></div><div>m=audio 25224 RTP/AVP 8 18 101</div><div><br></div><div>This is my code:</div><div><br></div><div><div><div>if (is_method("INVITE") && has_body_part("application/sdp")) {</div><div>                $var(audio_stream) = $(rb{sdp.line,m});</div><div>                xlog("CUSTOM_LOG: Audio stream is $var(audio_stream)\n");</div><div>                if ($var(audio_stream) =~ "^m\=audio.*101$") {</div><div>                        $var(dtmf_compat)=1;<br></div><div>                } else $var(dtmf_compat)=0;</div><div>                if ($var(dtmf_compat)=0) {</div><div>                        xlog("CUSTOM_LOG: Would do something else now");<br></div><div>                }</div><div>                xlog("CUSTOM_LOG: DTMF validity = $var(dtmf_compat)");</div><div>        }</div></div><div><br></div><div>I can see that var(audio_stream) is being set correctly:</div><div>CUSTOM_LOG: Audio stream is m=audio 25914 RTP/AVP 8 18 101<br></div><div><br></div><div>But it seems not to match:</div><div>CUSTOM_LOG: DTMF validity = 0<br></div><div><br></div><div>Is anyone able to help me solve this please?</div><div><br></div><div>Many thanks!</div><div>Mark.</div><div><br></div><div><br></div><div dir="ltr"></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</blockquote></div>