[SR-Users] subst_hf to rewrite a contact header

Ben Hood ben at relops.com
Mon Sep 24 18:54:04 CEST 2018


Hi,

I’m wondering how to use subst_hf() properly.

I’m trying to debug a broken flow by manually rewriting the contact header from

Contact: <sip:b73c6f29-0101-4802-afcd-efb63f1e6d8f at 10.10.10.12:5090;transport=udp>

to

Contact: <sip:2018092417381900003 at 81.x.x.x>

by using

$var(ctct) = "<sip:2018092417381900003 at 81.x.x.x>";
subst_hf("Contact", “/\<.+\>/$var(ctct)\r\n/", "a”);

but the result is

Contact: <sip:2018092417381900003 at 81.x.x.x>
sip:b73c6f29-0101-4802-afcd-efb63f1e6d8f at 10.10.10.12:5090;transport=udp

Testing the regex with an external tool appears to match all of the original header, so I’m wondering why subst_hf doesn’t appear to rewrite the entire header.

Is there something I’m doing wrong?

TIA,

Ben






More information about the sr-users mailing list