[OpenSIPS-Users] How to change Contact header

David Santiago david.santiago at almiralabs.com
Wed Oct 6 15:02:20 CEST 2010


Fair enough, I'll check it.

Thx Andrew!

On Wed, Oct 6, 2010 at 2:58 PM, Andrew Pogrebennyk <
andrew.pogrebennyk at portaone.com> wrote:

> David,
> Also if rewriting Contact with the opensips address is what you want to
> achieve, you should look no further than b2b_logic "top hiding"
> scenario: http://www.opensips.org/Resources/B2buaTutorial16#toc12
>
> On 06.10.2010 14:15, Bogdan-Andrei Iancu wrote:
> > Hi David,
> >
> > take when using such regexps as the contact hdr may have multiple
> syntaxes:
> >      Contact: sip:user at domain
> >      Contact: sip:user at domain;hdr_params
> >      Contact:<sip:user at domain>;hdr_params
> >      Contact:<sip:user at domain;uri_params>;hdr_params
> >      Contact: "display"<sip:user at domain>;hdr_params
> >      Contact: display<sip:user at domain>;hdr_params
> >
> >      etc....
> >
> > So having a regexp to match all case may be difficult....better try to
> > focus only on the domain part, like matching the "@IP" part...., like
> >      (Contact: .*@)[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}
> >
> > Regards,
> > Bogdan
> >
> > David Santiago wrote:
> >> Solved!
> >>
> >> Adding a \r did the thing...
> >>
> >> if ( subst('/^Contact:<sip:([0-9]+)@(.*)$/Contact:
> >> <sip:\1 at NEW_IP_ADDRESS_HERE>\r/ig') ) {
> >>                 xlog("contact modified!");
> >>         };
> >>
> >> On Tue, Oct 5, 2010 at 6:34 PM, David Santiago
> >> <david.santiago at almiralabs.com<mailto:david.santiago at almiralabs.com>>
> >> wrote:
> >>
> >>      Hi all,
> >>
> >>      I need to modify the host part of a contact header. I'm trying
> >>      something like:
> >>
> >>      if ( subst('/^Contact:<sip:([0-9]+)@(.*)$/Contact:
> >>      <sip:\1 at NEW_IP_ADDRESS_HERE>/ig') ) {
> >>                     xlog("contact modified!");
> >>             };
> >>
> >>      but the resulting Contact header is wrong and cannot be processed.
> >>
> >>      Having a look at the header with wireshark shows that the "Contact
> >>      Binding" entry is missing the ending ">", but the "Contact", "URI"
> or
> >>      "SIP contact address" have the ">" at the end  :L
> >>
> >>      May be this is not the right way to modify a Contact header...
> >>
> >>
> >>      Thanks in advance,
> >>      David
>
> --
> Sincerely,
> Andrew Pogrebennyk
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20101006/cf91ae4c/attachment-0001.htm 


More information about the Users mailing list