Hi,

I'm trying to capture and substitute the host IP of contact header using
the subst_hf but it's not working as expected. I tested my regex in a
tester and it works fine there but not in Kamailio config.

*Regex:* @(.+?)>

*Substitution:* @PUBLIC_IP:5060>

*Three contact headers that I'm trying to match;*

Contact:<sip:0065*[email protected]:5060
>;methods="INVITE,ACK,BYE,CANCEL,OPTIONS,INFO,MESSAGE,SUBSCRIBE,NOTIFY,PRACK,UPDATE,REFER"

Contact: <sip:0065*[email protected]
;transport=udp>;expires=3600;reg-id=1;+sip.instance="<urn:uuid:03660bc5-bb70-4784-8ac5-000413B108BA>"

Contact: <sip:0925*[email protected]:5060>

*Outcome I'm expecting for the three contact headers;*

Contact:<sip:0065*7766*@PUBLIC_IP:5060>*
;methods="INVITE,ACK,BYE,CANCEL,OPTIONS,INFO,MESSAGE,SUBSCRIBE,NOTIFY,PRACK,UPDATE,REFER"

Contact: <sip:0065*7788*@PUBLIC_IP:5060>*
;expires=3600;reg-id=1;+sip.instance="<urn:uuid:03660bc5-bb70-4784-8ac5-000413B108BA>"

Contact: <sip:0925*0007*@PUBLIC_IP:5060>*

This regex in Kamailio works fine for the first and third contact header
but for the second contact header it matches all the way to the end of the
contact header excluding the quote (") sign. I've tried so many other
combinations [like *@(.+?)>;?* ] of regex but nothing seems to work.

Is there a way to accomplish this with one regex?

Thanks,
Sal
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
[email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to