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");
but it seems to go on the second line. How do I remove the line feed?
Max-Forwards: 69. Contact: sip:1001@192.168.1.2:44114. tgrp=DMS19 .
--Matteo
El Lunes, 24 de Noviembre de 2008, Matteo D'Amato escribió:
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");
but it seems to go on the second line. How do I remove the line feed?
Max-Forwards: 69. Contact: sip:1001@192.168.1.2:44114. tgrp=DMS19 .
1.3.18. append_hf(txt, hdr) Appends 'txt' as header after first 'hdr' header field.
I don't understand why you think that "append_hf" can be used to add text in an exisintg header. It just creates a new header (in your case an invalid header "tgrp=DMS19") after the *first* Contact header. Nothing to do with your aim.
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");
Cheers, Daniel
but it seems to go on the second line. How do I remove the line feed?
Max-Forwards: 69. Contact: sip:1001@192.168.1.2:44114. tgrp=DMS19
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_transformati... but they don't allow adding/modifying/deleting a param, just reading it.
PD: I consider SIP URI BNF grammar a pain.
On 11/24/08 11:34, Iñaki Baz Castillo wrote:
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
SIP is always 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).
right.
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 < >.
right.
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 < >.
right.
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.
subst() is a solution here. It is up to him to identify and use best option. I just gave some hints.
As you said, he can use transformations for more precise processing.
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_transformati... but they don't allow adding/modifying/deleting a param, just reading it.
Indeed, still one can use them to build a new contact header as he wishes. There will be some config file scripting, but you get what you want at the end.
PD: I consider SIP URI BNF grammar a pain.
Is there a fan club? I seriously consider subscribing ;-) ...
Cheers, Daniel
El Lunes, 24 de Noviembre de 2008, Daniel-Constantin Mierla escribió:
PD: I consider SIP URI BNF grammar a pain.
Is there a fan club? I seriously consider subscribing ;-) ...
Yes! it's called... IETF ! (but you must be born in other galaxy, sorry XD).
On 11/24/08 12:09, Iñaki Baz Castillo wrote:
El Lunes, 24 de Noviembre de 2008, Daniel-Constantin Mierla escribió:
PD: I consider SIP URI BNF grammar a pain.
Is there a fan club? I seriously consider subscribing ;-) ...
Yes! it's called... IETF !
so I should hurry and make a replica (or is it called fork?!?!) on Facebook Galaxy ... OpenIETFs (... Internet Extraterrestrial and Terrestrial ForceS) ... does it sound good?
(but you must be born in other galaxy, sorry XD).
who said I am not :-) ?!?! Have you seen any human bothering with sip? My neighbors don't...
Cheers, Daniel
El Lunes, 24 de Noviembre de 2008, Daniel-Constantin Mierla escribió:
On 11/24/08 12:09, Iñaki Baz Castillo wrote:
El Lunes, 24 de Noviembre de 2008, Daniel-Constantin Mierla escribió:
PD: I consider SIP URI BNF grammar a pain.
Is there a fan club? I seriously consider subscribing ;-) ...
Yes! it's called... IETF !
so I should hurry and make a replica (or is it called fork?!?!) on Facebook Galaxy ... OpenIETFs (... Internet Extraterrestrial and Terrestrial ForceS) ... does it sound good?
(but you must be born in other galaxy, sorry XD).
who said I am not :-) ?!?! Have you seen any human bothering with sip? My neighbors don't...
Humm, not enough... in your galaxy NAT MUST NOT exist and IPv6 MUST be widely extended. Also, most common SIP devices must use SCTP as transport protocol and implement at least 235 SIP related RFC's and 148 drafts.
XD
On 11/24/08 15:26, Iñaki Baz Castillo wrote:
El Lunes, 24 de Noviembre de 2008, Daniel-Constantin Mierla escribió:
On 11/24/08 12:09, Iñaki Baz Castillo wrote:
El Lunes, 24 de Noviembre de 2008, Daniel-Constantin Mierla escribió:
PD: I consider SIP URI BNF grammar a pain.
Is there a fan club? I seriously consider subscribing ;-) ...
Yes! it's called... IETF !
so I should hurry and make a replica (or is it called fork?!?!) on Facebook Galaxy ... OpenIETFs (... Internet Extraterrestrial and Terrestrial ForceS) ... does it sound good?
(but you must be born in other galaxy, sorry XD).
who said I am not :-) ?!?! Have you seen any human bothering with sip? My neighbors don't...
Humm, not enough... in your galaxy NAT MUST NOT exist and IPv6 MUST be widely extended.
so now you understand why I moved here -- too boring without NAT and with IPv6/IPv9 only there...
Also, most common SIP devices must use SCTP as transport protocol and implement at least 235 SIP related RFC's and 148 drafts.
XD