[SR-Users] Malformed To header, or?

Tobias the_fx at hotmail.com
Wed Nov 2 14:57:27 CET 2016


Hello!


Correct, we're using uac_replace_from() when passing along the initial INVITE. That INVITE looks good so it's not until this reINVITE that the header is scrambled.


Kind regards,

/Tobias

________________________________
From: Daniel-Constantin Mierla <miconda at gmail.com>
Sent: Wednesday, November 2, 2016 10:12 AM
To: Tobias; Kamailio (SER) - Users Mailing List
Subject: Re: [SR-Users] Malformed To header, or?


Hello,


kamailio is not adding user=phone to To header by itself, it has to be something in the kamailio.cfg. What do you use to change the To? Or for changing From in initial INVITE?


Cheers,
Daniel

On 01/11/16 20:35, Tobias wrote:

Hi Daniel,


Thanks for your quick response. Makes totally sense, I'll need to debug why I'm getting that malformed header.


Do you think my second question is related? I cannot see the same malformed data in the example where the to-header is rewritten, it just looks like Kamailio adds ";user=phone" but the ip address is all obfuscated:

A similar issue seen, which for some reason doesn't create an ERROR, is when Kamailio receives a reINVITE looking like this which it's supposed to proxy:
To: +123456789 <sip:123456789 at 127.0.0.1><sip:123456789 at 127.0.0.1>;tag=SD1sf9001--45026-530b969-77c7543f-530b969.
which is rewritten into:
To: +123456789 <sip:123456789 at 127*0-)'.:/)&7'...0;user=phone><sip:123456789 at 127*0-)'.:/)&7'...0;user=phone>;tag=SD1sf9001--45026-530b969-77c7543f-530b969.
and sent out..

Thanks,
/Tobias



________________________________
From: sr-users <sr-users-bounces at lists.sip-router.org><mailto:sr-users-bounces at lists.sip-router.org> on behalf of Daniel-Constantin Mierla <miconda at gmail.com><mailto:miconda at gmail.com>
Sent: Monday, October 31, 2016 9:07 AM
To: Kamailio (SER) - Users Mailing List
Subject: Re: [SR-Users] Malformed To header, or?


Hello,


the to header doesn't have the ending '>' after its uri:


<<+123456789 <sip:123456789 at 127.0.0.1;tag=as4aa27bd0><sip:123456789 at 127.0.0.1;tag=as4aa27bd0>>


The first << and last >> are from the log messages, but before ;tag=, it has to be another >, to close the one started before <sip:


Cheers,
Daniel

On 28/10/16 21:14, Tobias wrote:
Hi!

Having some issues with Kamailio 4.3 reporting a malformed header, but I cannot seem to figure out what's wrong.

The problem seen is:
Oct 27 13:48:56  /usr/sbin/kamailio[13765]: ERROR: <core> [parser/parse_addr_spec.c:678]: parse_addr_spec(): ERROR: parse_to : unexpected char [#015] in status 6: <<+123456789 <sip:123456789 at 127.0.0.1;tag=as4aa27bd0><sip:123456789 at 127.0.0.1;tag=as4aa27bd0>> .
Oct 27 13:48:56  /usr/sbin/kamailio[13765]: ERROR: <core> [parser/msg_parser.c:165]: get_hdr_field(): ERROR: get_hdr_field: bad to header
Oct 27 13:48:56  /usr/sbin/kamailio[13765]: INFO: <core> [parser/msg_parser.c:338]: parse_headers(): ERROR: bad header field [To: +123456789 <si]
Oct 27 13:48:56  /usr/sbin/kamailio[13765]: ERROR: tm [t_lookup.c:1050]: t_check_msg(): ERROR: reply cannot be parsed
Oct 27 13:48:56  /usr/sbin/kamailio[13765]: ERROR: <core> [parser/parse_addr_spec.c:678]: parse_addr_spec(): ERROR: parse_to : unexpected char [#015] in status 6: <<+123456789 <sip:123456789 at 127.0.0.1;tag=as4aa27bd0><sip:123456789 at 127.0.0.1;tag=as4aa27bd0>> .
Oct 27 13:48:56  /usr/sbin/kamailio[13765]: ERROR: <core> [parser/msg_parser.c:165]: get_hdr_field(): ERROR: get_hdr_field: bad to header
Oct 27 13:48:56  /usr/sbin/kamailio[13765]: INFO: <core> [parser/msg_parser.c:338]: parse_headers(): ERROR: bad header field [To: +123456789 <si]
Oct 27 13:48:56  /usr/sbin/kamailio[13765]: ERROR: <core> [msg_translator.c:1457]: adjust_clen(): error parsing content-length
Oct 27 13:48:56  /usr/sbin/kamailio[13765]: ERROR: <core> [msg_translator.c:2214]: generate_res_buf_from_sip_res(): error while adjusting Content-Length
Oct 27 13:48:56  /usr/sbin/kamailio[13765]: ERROR: <core> [forward.c:760]: do_forward_reply(): building failed

And the To header seen at this point is:
To: +123456789 <sip:123456789 at 127.0.0.1><sip:123456789 at 127.0.0.1>;tag=as24ed5606.

version: kamailio 4.3.4 (x86_64/linux)
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, DBG_QM_MALLOC, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown
compiled with gcc 4.7.2

I obviously understand Kamailio views this To header as malformed, but what I cannot understand is why? Is it as simple as the number +123456789 is not enclosed with ", i.e. it should be sent as "+123456789"?

A similar issue seen, which for some reason doesn't create an ERROR, is when Kamailio receives a reINVITE looking like this which it's supposed to proxy:
To: +123456789 <sip:123456789 at 127.0.0.1>;tag=SD1sf9001--45026-530b969-77c7543f-530b969.
which is rewritten into:
To: +123456789 <sip:123456789 at 127*0-)'.:/)&7'...0;user=phone>;tag=SD1sf9001--45026-530b969-77c7543f-530b969.
and sent out..


Thanks for your help,
/Tobias




_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users at lists.sip-router.org<mailto:sr-users at lists.sip-router.org>
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users



--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda<http://twitter.com/#%21/miconda> - http://www.linkedin.com/in/miconda
Kamailio Advanced Training, Berlin, Nov 28-30, 2016 - http://www.asipto.com


--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Training, Berlin, Nov 28-30, 2016 - http://www.asipto.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20161102/91dc0128/attachment.html>


More information about the sr-users mailing list