<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hello,</p>
<p>the uac_replace_from()/_to() rely on the UA preserving the
From/To headers to be able to properly restore the values when
used with the rr (record-route) mechanism.</p>
<p>If you can't ensure that the UA preserve these headers, then you
can:</p>
<p>1) configure uac module to use dialog module for update/restore
operations of From/To header</p>
<p>2) do not restore the From/To -- the restore is done for the old
devices that use full Form/To headers for matching transactions
and dialogs, instead of From-tag and To-tag parameters, so
practically the restore is needed when the UA is not implementing
RFC 3261, but older SIP specs. What I typically do when I have
only RFC3261 devices is to replace From/To headers with what I
need in the initial INVITE and for the rest of the requests within
the dialog I replace them with <a class="moz-txt-link-abbreviated" href="mailto:anonymous@anonymous.invalid">anonymous@anonymous.invalid</a>.</p>
<p>Cheers,<br>
Daniel<br>
</p>
<br>
<div class="moz-cite-prefix">On 24.06.18 10:21, Kjeld Flarup wrote:<br>
</div>
<blockquote type="cite"
cite="mid:714c0f78-f770-66a5-9825-6f487d5783f4@liberalismen.dk">I
have a system where the calls is not disconnected properly.
<br>
<br>
I get this error in syslog when receiving BYE:
<br>
<br>
Jun 24 08:23:54 scantronpbx /usr/local/sbin/kamailio[31588]:
WARNING: uac [replace.c:645]: restore_uri(): invalid char found in
the new uri at pos 30 (#012)
[<a class="moz-txt-link-freetext" href="sip:004540294149@127.0.0.1:507#01257441;transport=TCP;ob">sip:004540294149@127.0.0.1:507#01257441;transport=TCP;ob</a>]
<br>
Jun 24 08:23:54 scantronpbx /usr/local/sbin/kamailio[31588]:
WARNING: uac [replace.c:647]: restore_uri(): this can happen when
URI values are altered by end points - skipping the update
<br>
Jun 24 08:23:54 scantronpbx /usr/local/sbin/kamailio[31588]:
WARNING: uac [replace.c:645]: restore_uri(): invalid char found in
the new uri at pos 30 (#012)
[<a class="moz-txt-link-freetext" href="sip:004540294149@127.0.0.1:507#01257441;transport=TCP;ob">sip:004540294149@127.0.0.1:507#01257441;transport=TCP;ob</a>]
<br>
Jun 24 08:23:54 scantronpbx /usr/local/sbin/kamailio[31588]:
WARNING: uac [replace.c:647]: restore_uri(): this can happen when
URI values are altered by end points - skipping the update
<br>
Jun 24 08:24:11 scantronpbx /usr/local/sbin/kamailio[31588]:
WARNING: uac [replace.c:645]: restore_uri(): invalid char found in
the new uri at pos 30 (#012)
[<a class="moz-txt-link-freetext" href="sip:004540294149@127.0.0.1:507#01257441;transport=TCP;ob">sip:004540294149@127.0.0.1:507#01257441;transport=TCP;ob</a>]
<br>
Jun 24 08:24:11 scantronpbx /usr/local/sbin/kamailio[31588]:
WARNING: uac [replace.c:647]: restore_uri(): this can happen when
URI values are altered by end points - skipping the update
<br>
<br>
Kamailio receives this From header:
<br>
f:
<a class="moz-txt-link-rfc2396E" href="sip:004540294149@194.255.22.44"><sip:004540294149@194.255.22.44></a>;tag=e042cfe1-40f7-410d-95fd-e5bb4f8976d7;transport=TCP;ob<br>
<br>
And passes this on, where it is obvious that '%' may give a
problem
<br>
f:
<a class="moz-txt-link-rfc2396E" href="sip:0001@192.168.2%:"><sip:0001@192.168.2%:></a>;tag=e042cfe1-40f7-410d-95fd-e5bb4f8976d7;transport=TCP;ob<br>
<br>
The RR headers send forward with INVITE looks like this:
<br>
Record-Route:
<a class="moz-txt-link-rfc2396E" href="sip:127.0.0.1:5069;r2=on;lr=on;ftag=MYEMZIUn-UWwH-R7g9CktpyvOn1ZFuZu;vsf=AAAAAEUAcAB5AxcDGAkYCgALLjEwMQ--;did=2f6.6cc;vst=AAAAAAAABAR0AQsLGgACAW4DHA4uMC4wLjE6NTA3MA--"><sip:127.0.0.1:5069;r2=on;lr=on;ftag=MYEMZIUn-UWwH-R7g9CktpyvOn1ZFuZu;vsf=AAAAAEUAcAB5AxcDGAkYCgALLjEwMQ--;did=2f6.6cc;vst=AAAAAAAABAR0AQsLGgACAW4DHA4uMC4wLjE6NTA3MA--></a><br>
Record-Route:
<a class="moz-txt-link-rfc2396E" href="sip:192.168.2.9:5069;r2=on;lr=on;ftag=MYEMZIUn-UWwH-R7g9CktpyvOn1ZFuZu;vsf=AAAAAEUAcAB5AxcDGAkYCgALLjEwMQ--;did=2f6.6cc;vst=AAAAAAAABAR0AQsLGgACAW4DHA4uMC4wLjE6NTA3MA--"><sip:192.168.2.9:5069;r2=on;lr=on;ftag=MYEMZIUn-UWwH-R7g9CktpyvOn1ZFuZu;vsf=AAAAAEUAcAB5AxcDGAkYCgALLjEwMQ--;did=2f6.6cc;vst=AAAAAAAABAR0AQsLGgACAW4DHA4uMC4wLjE6NTA3MA--></a><br>
<br>
And received on BYE
<br>
Route:
<a class="moz-txt-link-rfc2396E" href="sip:127.0.0.1:5069;lr;r2=on;ftag=MYEMZIUn-UWwH-R7g9CktpyvOn1ZFuZu;vsf=AAAAAEUAcAB5AxcDGAkYCgALLjEwMQ--;did=2f6.6cc;vst=AAAAAAAABAR0AQsLGgACAW4DHA4uMC4wLjE6NTA3MA--"><sip:127.0.0.1:5069;lr;r2=on;ftag=MYEMZIUn-UWwH-R7g9CktpyvOn1ZFuZu;vsf=AAAAAEUAcAB5AxcDGAkYCgALLjEwMQ--;did=2f6.6cc;vst=AAAAAAAABAR0AQsLGgACAW4DHA4uMC4wLjE6NTA3MA--></a><br>
Route:
<a class="moz-txt-link-rfc2396E" href="sip:192.168.2.9:5069;lr;r2=on;ftag=MYEMZIUn-UWwH-R7g9CktpyvOn1ZFuZu;vsf=AAAAAEUAcAB5AxcDGAkYCgALLjEwMQ--;did=2f6.6cc;vst=AAAAAAAABAR0AQsLGgACAW4DHA4uMC4wLjE6NTA3MA--"><sip:192.168.2.9:5069;lr;r2=on;ftag=MYEMZIUn-UWwH-R7g9CktpyvOn1ZFuZu;vsf=AAAAAEUAcAB5AxcDGAkYCgALLjEwMQ--;did=2f6.6cc;vst=AAAAAAAABAR0AQsLGgACAW4DHA4uMC4wLjE6NTA3MA--></a><br>
<br>
RR does not seem to be the problem as mentioned here:
<a class="moz-txt-link-freetext" href="https://opensips.org/pipermail/users/2010-October/014999.html">https://opensips.org/pipermail/users/2010-October/014999.html</a>
<br>
<br>
I have attached a pcap file with the full trace. The error appears
in frame 101
<br>
<br>
<br>
The setup is a bit complex, as I have 8 Kamailio's running, where
6 is identical.
<br>
<br>
The first Kamailio is on port 5069, which receives a call from a
door phone. It then branches the call to registrations or GSM
targets, which is handled by the other Kamailio's
<br>
Thus 5069 is only doing a lookup in a database and branching, plus
it handles rtpengine.
<br>
<br>
I first saw the error on version 4.4, and now I replicated it on
5.1.4. My hardware is a Raspberry Pi.
<br>
<br>
/usr/local/sbin/kamailio -v
<br>
version: kamailio 5.1.4 (arm6/linux)
<br>
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS,
DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP,
PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY,
USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT-NOSMP, USE_DNS_CACHE,
USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
<br>
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN
16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
<br>
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
<br>
id: unknown
<br>
compiled on 23:45:36 Jun 19 2018 with gcc 4.9.2
<br>
<br>
<!--'"--><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.asipto.com">www.asipto.com</a>
<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 World Conference -- <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
</body>
</html>