El Lunes, 24 de Noviembre de 2008, Daniel-Constantin Mierla escribió:
Hello,
On 11/24/08 04:01, Matteo D'Amato wrote:
Hello,
I'm trying to append trunk group information to my Contact header
so I'm, using append_hf as follows
append_hf("tgrp=30001 \r\n", "Contact");
this appends a new header. For what you need try subst() or
search_append() functions.
Alternative:
remove_hf("Contact");
append_hf("Contact: $hdr(contact);tgrp=30001\r\n", "Contact");
Anyway I consider operations like this on SIP URI very dangerous due to
complex SIP URI syntax:
a) Contact: sip:user@domain.org;param=AAA
Here "param=AAA" is a *header* param since SIP URI uses addr_spec form (there
is no < > enclosing the SIP URI).
b) Contact: <sip:user@domain.org>;param=AAA
Here "param=AAA" is a *header* param since SIP URI uses name_addr form (there
are < >) and the param is out of the < >.
c) Contact: <sip:user@domain.org;param=AAA>
Here "param=AAA" is a *SIP URI* param since SIP URI uses name_addr form (there
are < >) and the param is INTO the < >.
If Matteo want to adds a header param then the above solution will work, but
if he wants to add a SIP URI param then it won't work.
Note that when creating an in-dialog request, the Request URI must be the
Contact previously received in the initial INVITE (or 200 OK), and the RURI
must include Contact *SIP URI* params (case c), but *NOT* the Contact header
params (cases a and b).
There are URI Transformations to get URI params:
http://kamailio.org/dokuwiki/doku.php/transformations:devel#uri_transformat…
but they don't allow adding/modifying/deleting a param, just reading it.
PD: I consider SIP URI BNF grammar a pain.
--
Iñaki Baz Castillo