[Users] How to change To and From URI in SIP message ?

Stéphane Alnet stephane at carrierclass.net
Sat May 26 03:12:06 CEST 2007


Mika,

>   At the moment: To: sip:test1 at test.com;tag=.....
>   To be like: To: "test1"<sip:test1 at test.com>;tag=...

Do you actually mean that the user part of the URI needs to be
duplicated into the display name? Something like the following?

    subst('/^To:(.*)sip:([^@]*)@([^;]*)(.*)$/To:\1"\2"<sip:\2@\3>\4/ig')


Or that the To: display name needs to be rewritten based on content
pre-stored in a database (for example because the users have to
pre-register via a web GUI)? In that case you could combine a line
like
   avp_db_load( "$to/username", "$avp(label)" )
with a subst (for example replacing the first \2 in the example above
with $avp(label), I guess).


Finally, if the username/display-name pairs aren't pre-registered, you
could store them in the AVP database (using the username or
username+domain as a key) at the time the user registers/subscribes,
and then retrieve them when processing NOTIFYs (using the
avp_db_load() + subst() combination).

HTH,
S.

PS: I haven't tested any of this, although I do use a subst() on To:
similar to the one I showed.

-- 
http://carrierclass.net/
http://www.linkedin.com/in/stephalnet




More information about the Users mailing list