[SR-Users] Malformed To header, or?

Daniel-Constantin Mierla miconda at gmail.com
Thu Nov 3 13:59:20 CET 2016


Hello,


the question is if the value in the step 5 is the same as in step 3, or
the endpoint does further modifications (changing what it received in
step 3)?


Cheers,
Daniel


On 03/11/16 10:20, Tobias wrote:
>
> Hi,
>
>
> The To-header in the reINVITE is changed by the endpoint as far as I
> can see (if I understand your question correctly), i.e. something like
> this:
>
> 1) INVITE from endpoint to Kamailio
>
> 2) Kamailio performs uac_replace_from()
>
> 3) INVITE from Kamailio to endpoint (From-header modified)
>
> 4) dialogue goes on..
>
> 5) reINVITE from endpoint to Kamailio (To-header modified using data
> from modified From-header in step #3)
>
> 6) reINVITE from Kamailio to endpoint, ip-address becomes scrambled
>
>
> I can send you the whole SIP conversation if it helps.
>
>
> Kind regards,
>
> /Tobias
>
>
>
> ------------------------------------------------------------------------
> *From:* Daniel-Constantin Mierla <miconda at gmail.com>
> *Sent:* Thursday, November 3, 2016 9:57 AM
> *To:* Tobias; Kamailio (SER) - Users Mailing List
> *Subject:* Re: [SR-Users] Malformed To header, or?
>  
>
> Hello,
>
>
> are the From/To headers changed by the endpoint? Or the are the same
> as in the initial INVITE/200ok?
>
>
> Cheers,
> Daniel
>
>
> On 02/11/16 14:57, Tobias wrote:
>>
>> 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>;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,
>>> /Tobias
>>>
>>>
>>>
>>> ------------------------------------------------------------------------
>>> *From:* sr-users <sr-users-bounces at lists.sip-router.org> on behalf
>>> of Daniel-Constantin Mierla <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>>
>>>
>>>
>>> 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>> .
>>>> 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>> .
>>>> 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>;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
>>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>>
>>> -- 
>>> 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
>>
>> -- 
>> 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
>
> -- 
> 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

-- 
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/20161103/47fcb77c/attachment.html>


More information about the sr-users mailing list