<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hello,</p>
<p>it would be useful to know also the version of kamailio that is
run there. The latest release series should have a safety check in
order to prevent setting an invalid restored From/To URI.</p>
<p>On the other hand, if the UA doesn't preserve the From/To, then
it doesn't require to be unchanged, so the update (without auto
restore) of the From/To can be done only for initial INVITE, when
UA takes the caller/callee ids. For requests within the dialog,
these headers can be left unchanged or changed to something like
<a class="moz-txt-link-abbreviated" href="mailto:anonymous@anonymous.invalid">anonymous@anonymous.invalid</a></p>
<p>The last option here, which is the safest, is to use dialog
module together with uac, so uac module stores the From/To values
inside the dialog and restores them from there, instead of relying
on record-routing and the masking algorithm for values.</p>
<p>Cheers,<br>
Daniel<br>
</p>
<br>
<div class="moz-cite-prefix">On 14.11.17 08:04, Julia Boudniatsky
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAASaakZ=UM-12QCU6Ygm5BwHgM0Jo39zhp1Kk4M7PNuS3W+NYg@mail.gmail.com">
<div dir="ltr"><span style="font-size:12.8px">Hello,</span>
<div style="font-size:12.8px"><br>
<div>It looks like headers "From" in initial INVITE and
received message are different.</div>
<div><br>
</div>
<div>For example:</div>
<div> in INVITE : <<span style="font-size:12.8px"><a class="moz-txt-link-freetext" href="sip:useragent7122@kamailio_">sip:useragent7122@kamailio_</a></span><span
style="font-size:12.8px">ad<wbr>dress:5068></span></div>
<div><span style="font-size:12.8px"> in received message : </span><span
style="font-size:12.8px"><</span><span
style="font-size:12.8px"><a class="moz-txt-link-freetext" href="sip:useragent7122@kamailio_">sip:useragent7122@kamailio_</a></span><span
style="font-size:12.8px">ad<wbr>dress></span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div>When you use header "From" transformation (I see Route
with vsf), restore may be correct only for exactly the same
header "From".</div>
</div>
<div style="font-size:12.8px"><span style="font-size:12.8px">Check
may be port number is missing/added in received message
header "From".</span><br>
</div>
<div style="font-size:12.8px"><span style="font-size:12.8px"><br>
</span></div>
<div style="font-size:12.8px"><span style="font-size:12.8px">Best
regards,</span></div>
<div style="font-size:12.8px">Julia</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Mon, Nov 13, 2017 at 5:05 PM, Donat
Zenichev <span dir="ltr"><<a
href="mailto:donat.zenichev@gmail.com" target="_blank"
moz-do-not-send="true">donat.zenichev@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div>Hi community.</div>
<div>We experience the problem with malformed messages.</div>
<div><br>
</div>
<div>First of all, I want to say, that most of time
kamailio works well and nothing happens that can drop
sessions.</div>
<div>But from time-to-time something changes (may be in
the network) and kamailio receives requests with
malformed headers (To or From hfs).</div>
<div><br>
</div>
<div>The schema:</div>
<div>uplinks -> kamailio <-> routing server
(asterisk)</div>
<div><br>
</div>
<div>Malformed messages were received only from asterisk
server.<br>
Sip debug on asterisk showed that messages were
transmitted correctly and headers were nice.</div>
<div>But kamailio obtains changed (broken) packets or
perhaps can't read them properly.</div>
<div><br>
</div>
<div>How does it look like:</div>
<div>
<div>Nov 10 12:37:06 kamailio-name kamailio[965]: INFO:
<script>: Going to NATMANAGE for BYE from
<a class="moz-txt-link-freetext" href="sip:useragent7122@kamailio_">sip:useragent7122@kamailio_</a><wbr>address:5068
(IP=<a class="moz-txt-link-freetext" href="wss:client_address:62881">wss:client_address:62881</a>) -
R=<a class="moz-txt-link-freetext" href="sip:dialed_did_service@">sip:dialed_did_service@</a><wbr>asterisk_address:50600
ID=<wbr>1b0044070de406153bf0e4b84d6bb7<wbr>93@asterisk_address:50600</div>
<div>Nov 10 12:37:06 kamailio-name kamailio[965]:
NOTICE: <script>: Relaying request to
<null> - R=<a class="moz-txt-link-freetext" href="sip:dialed_did_service@">sip:dialed_did_service@</a><wbr>asterisk_address:50600
ID=<wbr>1b0044070de406153bf0e4b84d6bb7<wbr>93@asterisk_address:50600</div>
<div>Nov 10 12:37:06 kamailio-name kamailio[965]: ERROR:
<core> [parser/parse_addr_spec.c:719]<wbr>:
parse_addr_spec(): unexpected char [<] in status 6:
[<<a class="moz-txt-link-freetext" href="sip:useragent6">sip:useragent6</a>] .</div>
<div>Nov 10 12:37:06 kamailio-name kamailio[965]: ERROR:
<core> [parser/parse_from.c:75]:
parse_from_header(): bad From header
[<<a class="moz-txt-link-freetext" href="sip:useragent6">sip:useragent6</a><+.w>;tag=<wbr>jja7l45gd1]</div>
<div>Nov 10 12:37:06 kamailio-name kamailio[965]: ERROR:
dialog [dlg_cseq.c:89]: dlg_cseq_prepare_msg(): cannot
parse FROM header</div>
<div>Nov 10 12:37:06 kamailio-name kamailio[937]: ERROR:
<core> [parser/parse_addr_spec.c:719]<wbr>:
parse_addr_spec(): unexpected char [<] in status 6:
[<<a class="moz-txt-link-freetext" href="sip:useragent6">sip:useragent6</a>] .</div>
<div>Nov 10 12:37:06 kamailio-name kamailio[937]: ERROR:
<core> [parser/parse_from.c:75]:
parse_from_header(): bad From header
[<<a class="moz-txt-link-freetext" href="sip:useragent6">sip:useragent6</a><+.w>;tag=<wbr>jja7l45gd1]</div>
<div>Nov 10 12:37:06 kamailio-name kamailio[937]: ERROR:
dialog [dlg_cseq.c:89]: dlg_cseq_prepare_msg(): cannot
parse FROM header</div>
<div>Nov 10 12:37:06 kamailio-name kamailio[937]: ERROR:
<core> [parser/parse_addr_spec.c:719]<wbr>:
parse_addr_spec(): unexpected char [<] in status 6:
[<<a class="moz-txt-link-freetext" href="sip:useragent6">sip:useragent6</a>] .</div>
<div>Nov 10 12:37:06 kamailio-name kamailio[937]: ERROR:
<core> [parser/parse_from.c:75]:
parse_from_header(): bad From header
[<<a class="moz-txt-link-freetext" href="sip:useragent6">sip:useragent6</a><+.w>;tag=<wbr>jja7l45gd1]</div>
<div>Nov 10 12:37:06 kamailio-name kamailio[937]: ERROR:
uac [replace.c:783]: restore_uris_reply(): failed to
find/parse FROM hdr</div>
<div>Nov 10 12:37:06 kamailio-name kamailio[937]: ERROR:
<core> [parser/parse_addr_spec.c:719]<wbr>:
parse_addr_spec(): unexpected char [<] in status 6:
[<<a class="moz-txt-link-freetext" href="sip:useragent6">sip:useragent6</a>] .</div>
<div>Nov 10 12:37:06 kamailio-name kamailio[937]: ERROR:
<core> [parser/parse_from.c:75]:
parse_from_header(): bad From header
[<<a class="moz-txt-link-freetext" href="sip:useragent6">sip:useragent6</a><+.w>;tag=<wbr>jja7l45gd1]</div>
<div>Nov 10 12:37:06 kamailio-name kamailio[937]: ERROR:
pv [pv_core.c:465]: pv_get_from_attr(): cannot parse
From header</div>
<div>Nov 10 12:37:06 kamailio-name kamailio[937]: INFO:
<script>: Skip manage DEVICE_STATE for BYE from
<null> (IP=<a class="moz-txt-link-freetext" href="udp:asterisk_address">udp:asterisk_address</a>:<wbr>50600) with
(200 - OK) - R=<null> ID=<wbr>1b0044070de406153bf0e4b84d6bb7<wbr>93@asterisk_address:50600</div>
<div>Nov 10 12:37:06 kamailio-name kamailio[937]: INFO:
<script>: ------------------------------<wbr>------MANAGE
BYE by DEVICE_STATE_BYE_MANAGE route - 200 - OK M=BYE
IP=<a class="moz-txt-link-freetext" href="udp:asterisk_address:50600">udp:asterisk_address:50600</a> ID=<wbr>1b0044070de406153bf0e4b84d6bb7<wbr>93@asterisk_address:50600</div>
<div>Nov 10 12:37:06 kamailio-name kamailio[937]: ERROR:
<core> [parser/parse_addr_spec.c:719]<wbr>:
parse_addr_spec(): unexpected char [<] in status 6:
[<<a class="moz-txt-link-freetext" href="sip:useragent6">sip:useragent6</a>] .</div>
<div>Nov 10 12:37:06 kamailio-name kamailio[937]: ERROR:
<core> [parser/parse_from.c:75]:
parse_from_header(): bad From header
[<<a class="moz-txt-link-freetext" href="sip:useragent6">sip:useragent6</a><+.w>;tag=<wbr>jja7l45gd1]</div>
<div>Nov 10 12:37:06 kamailio-name kamailio[937]: ERROR:
pv [pv_core.c:465]: pv_get_from_attr(): cannot parse
From header</div>
<div>Nov 10 12:37:06 kamailio-name kamailio[937]: ERROR:
<core> [parser/parse_addr_spec.c:719]<wbr>:
parse_addr_spec(): unexpected char [<] in status 6:
[<<a class="moz-txt-link-freetext" href="sip:useragent6">sip:useragent6</a>] .</div>
<div>Nov 10 12:37:06 kamailio-name kamailio[937]: ERROR:
<core> [parser/parse_from.c:75]:
parse_from_header(): bad From header
[<<a class="moz-txt-link-freetext" href="sip:useragent6">sip:useragent6</a><+.w>;tag=<wbr>jja7l45gd1]</div>
<div>Nov 10 12:37:06 kamailio-name kamailio[937]: ERROR:
rtpengine [rtpengine_funcs.c:331]: get_from_tag():
failed to parse From header</div>
<div>Nov 10 12:37:06 kamailio-name kamailio[937]: ERROR:
rtpengine [rtpengine.c:2252]: rtpp_function_call():
can't get From tag</div>
<div>Nov 10 12:37:06 kamailio-name kamailio[937]: ERROR:
<core> [parser/parse_addr_spec.c:719]<wbr>:
parse_addr_spec(): unexpected char [<] in status 6:
[<<a class="moz-txt-link-freetext" href="sip:useragent6">sip:useragent6</a>] .</div>
<div>Nov 10 12:37:06 kamailio-name kamailio[937]: ERROR:
<core> [parser/parse_from.c:75]:
parse_from_header(): bad From header
[<<a class="moz-txt-link-freetext" href="sip:useragent6">sip:useragent6</a><+.w>;tag=<wbr>jja7l45gd1]</div>
<div>Nov 10 12:37:06 kamailio-name kamailio[937]: ERROR:
pv [pv_core.c:465]: pv_get_from_attr(): cannot parse
From header</div>
<div>Nov 10 12:37:06 kamailio-name kamailio[937]: ERROR:
<core> [parser/parse_addr_spec.c:719]<wbr>:
parse_addr_spec(): unexpected char [<] in status 6:
[<<a class="moz-txt-link-freetext" href="sip:useragent6">sip:useragent6</a>] .</div>
<div>Nov 10 12:37:06 kamailio-name kamailio[937]: ERROR:
<core> [parser/parse_from.c:75]:
parse_from_header(): bad From header
[<<a class="moz-txt-link-freetext" href="sip:useragent6">sip:useragent6</a><+.w>;tag=<wbr>jja7l45gd1]</div>
<div>Nov 10 12:37:06 kamailio-name kamailio[937]: ERROR:
pv [pv_core.c:465]: pv_get_from_attr(): cannot parse
From header<br>
<br>
How the packet looks like:<br>
<div>ACK <a class="moz-txt-link-freetext" href="sip:tt7etmau@bb0pd5t63b26">sip:tt7etmau@bb0pd5t63b26</a>.<wbr>invalid;alias=client_address~<wbr>57573~6;transport=ws
SIP/2.0</div>
<div>Via: SIP/2.0/UDP asterisk_address:50600;branch=<wbr>z9hG4bK117106ca;rport</div>
<div>Route: <<a class="moz-txt-link-freetext" href="sip:kam2.domain.com:5068;nat=">sip:kam2.domain.com:5068;nat=</a><wbr>yes;transport=udp;r2=on;ftag=<wbr>as06869a5d;lr=on;vsf=<wbr>AAAAAEZZSVVDVV1VRBlUUkUpFQxdVU<wbr>ZYXiRCHU1RQl1HRVNaXhhAQ3RuLnR3<wbr>aWxpby5jb20-;vst=<wbr>AAAAAAAAAAAAAAAAAAAAAAAfBwQRQE<wbr>8NBR9BChIFAwddCgADFEVDQlYudHdp<wbr>bGlvLmNvbQ--;did=b0c.7331>,<<wbr>sip:<a
href="http://kam2.callision.com:5068"
moz-do-not-send="true">kam2.callision.com:5068</a>;<wbr>nat=yes;transport=ws;r2=on;<wbr>ftag=as06869a5d;lr=on;vsf=<wbr>AAAAAEZZSVVDVV1VRBlUUkUpFQxdVU<wbr>ZYXiRCHU1RQl1HRVNaXhhAQ3RuLnR3<wbr>aWxpby5jb20-;vst=<wbr>AAAAAAAAAAAAAAAAAAAAAAAfBwQRQE<wbr>8NBR9BChIFAwddCgADFEVDQlYudHdp<wbr>bGlvLmNvbQ--;did=b0c.7331></div>
<div>Max-Forwards: 70</div>
<div>From: "<a href="tel:%28917%29%20242-3539"
value="+19172423539" target="_blank"
moz-do-not-send="true">19172423539</a>" <sip:<a
href="tel:%28917%29%20242-3539"
value="+19172423539" target="_blank"
moz-do-not-send="true">19172423539</a>@asterisk_<wbr>address:50600>;tag=as06869a5d</div>
<div>To: <<a
href="http://sip:useragent7122@10.0.1.18:5068"
target="_blank" moz-do-not-send="true">sip:useragent7122@10.0.1.18:<wbr>5068</a>>;tag=nmv7kmpau3</div>
<div>Contact: <sip:<a
href="tel:%28917%29%20242-3539"
value="+19172423539" target="_blank"
moz-do-not-send="true">19172423539</a>@asterisk_<wbr>address:50600></div>
<div>Call-ID: 629d5a132c194c536b5f5c1a2a3c6e<wbr>32@asterisk_address:50600</div>
<div>CSeq: 102 ACK</div>
<div>User-Agent: asterisk PBX</div>
<div>Content-Length: 0</div>
<br>
<br>
The transport is used to send messages between
asterisk and kamailio is TCP.</div>
</div>
<div>TCP configurations:</div>
<div>
<div>tcp_connection_lifetime=3604</div>
<div>tcp_accept_no_cl=yes</div>
<div>tcp_connect_timeout=5</div>
<div>tcp_send_timeout=5</div>
<div>tcp_rd_buf_size=16384</div>
<div>tcp_keepalive=yes</div>
<div>tcp_crlf_ping=yes</div>
<div>tcp_keepcnt=3</div>
<div>tcp_keepidle=30</div>
<div>tcp_keepintvl=15</div>
<div>tcp_max_connections=4096 </div>
</div>
<div><br>
</div>
<div>I found the idea, that we need to change following
parameters:<br>
<div>modparam("uac","restore_mode",<wbr>"auto")</div>
<div>modparam("uac","restore_dlg",<wbr>1)<br>
<br>
to:<br>
<div>modparam("uac","restore_mode",<wbr>"none")</div>
<div>modparam("uac","restore_dlg",<wbr>0)<br>
<br>
I did that, now it looks like all is fine, but I
think it can get back.</div>
</div>
</div>
<div>Thanks in advance.</div>
<span class="HOEnZb"><font color="#888888">
<div><br>
</div>
<br clear="all">
<div><br>
</div>
-- <br>
<div class="m_-5027898973591578420gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr"><font
style="background-color:rgb(255,255,255)"
color="#0b5394">-- <br>
BR, Donat Zenichev
<br>
Wnet VoIP team<br>
Tel Ukraine: +380(44) 5-900-800
<br>
Tel USA: +164(67) 8-174-17<br>
<a href="http://wnet.ua" target="_blank"
moz-do-not-send="true">https://w-net.us/</a></font></div>
</div>
</div>
</div>
</font></span></div>
<br>
______________________________<wbr>_________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org"
moz-do-not-send="true">sr-users@lists.kamailio.org</a><br>
<a
href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users"
rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.kamailio.org/<wbr>cgi-bin/mailman/listinfo/sr-<wbr>users</a><br>
<br>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training, Nov 13-15, 2017, in Berlin - <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
Kamailio World Conference - <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
</body>
</html>