<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello,<br>
<br>
try without restore_mode auto if you want that restore_dlg to be 1.<br>
<br>
Cheers,<br>
Daniel<br>
<br>
<div class="moz-cite-prefix">On 05/11/15 18:00, Efelin Novak wrote:<br>
</div>
<blockquote
cite="mid:CABKTgArJrMdHwYOJdism47Q=nwsVHh3DTifB+qCUX4nVhCMqnQ@mail.gmail.com"
type="cite">
<div dir="ltr">Hi Folks,
<div><br>
</div>
<div>I have a problem with To and From headers in 200 OK to BYE
request. Their URI is doubled when leaving Kamailio.</div>
<div><br>
</div>
<div>Incoming 200 OK:</div>
<div>
<div> From : <a class="moz-txt-link-rfc2396E" href="sip:00421111@IP_ADDRESS"><sip:00421111@IP_ADDRESS></a>;tag=as017a2986</div>
<div> To : <a class="moz-txt-link-rfc2396E" href="sip:00421222@IP_ADDRESS0"><sip:00421222@IP_ADDRESS0></a>;tag=K7ryDgH2g7gFm</div>
</div>
<div>Outgoing 200 OK:</div>
<div>
<div> From :
<a class="moz-txt-link-rfc2396E" href="sip:+421111@IP_ADDRESS"><sip:+421111@IP_ADDRESS></a><a class="moz-txt-link-rfc2396E" href="sip:+421111@IP_ADDRESS"><sip:+421111@IP_ADDRESS></a>;tag=as017a2986</div>
<div> To :
<a class="moz-txt-link-rfc2396E" href="sip:+421222@IP_ADDRESS"><sip:+421222@IP_ADDRESS></a><a class="moz-txt-link-rfc2396E" href="sip:+421222@IP_ADDRESS"><sip:+421222@IP_ADDRESS></a>;tag=K7ryDgH2g7gFm</div>
</div>
<div><br>
</div>
<div>I'm using uac module to replace these headers in auto and
dialog mode:</div>
<div>
<div><br>
</div>
<div>modparam("uac", "restore_mode", "auto")</div>
<div>modparam("uac", "restore_dlg", 1)</div>
</div>
<div><br>
</div>
<div>append_fromtag is also set:</div>
<div><br>
</div>
<div>modparam("rr", "append_fromtag", 1)<br>
</div>
<div><br>
</div>
<div>When I run kamailio in debug mode I can see the function
restore_uri_reply() is called twice:</div>
<div><br>
</div>
<div>.</div>
<div>.</div>
<div>.</div>
<div>
<div> 0(3133) DEBUG: <core> [parser/parse_via.c:1284]:
parse_via_param(): Found param type 234, <received> =
<IP_ADDRESS>; state=6</div>
<div> 0(3133) DEBUG: <core> [parser/parse_via.c:1284]:
parse_via_param(): Found param type 232, <branch> =
<z9hG4bK0bb8c5b2>; state=6</div>
<div> 0(3133) DEBUG: <core> [parser/parse_via.c:1284]:
parse_via_param(): Found param type 235, <rport> =
<5060>; state=16</div>
<div> 0(3133) DEBUG: <core> [parser/parse_via.c:2672]:
parse_via(): end of header reached, state=5</div>
<div> 0(3133) DEBUG: <core> [parser/msg_parser.c:513]:
parse_headers(): parse_headers: Via found, flags=62</div>
<div> 0(3133) DEBUG: <core> [parser/msg_parser.c:526]:
parse_headers(): parse_headers: this is the second via</div>
<div> 0(3133) DEBUG: <core>
[parser/parse_addr_spec.c:176]: parse_to_param(): DEBUG:
add_param: tag=teHD72X67aQUm</div>
<div> 0(3133) DEBUG: <core>
[parser/parse_addr_spec.c:898]: parse_addr_spec(): end of
header reached, state=29</div>
<div> 0(3133) DEBUG: <core> [parser/msg_parser.c:190]:
get_hdr_field(): DEBUG: get_hdr_field: <To> [60];
uri=[<a class="moz-txt-link-freetext" href="sip:421222@IP_ADDRESS:5060">sip:421222@IP_ADDRESS:5060</a>] </div>
<div> 0(3133) DEBUG: <core> [parser/msg_parser.c:192]:
get_hdr_field(): DEBUG: to body
[<a class="moz-txt-link-rfc2396E" href="sip:421222@IP_ADDRESS:5060"><sip:421222@IP_ADDRESS:5060></a>]</div>
<div> 0(3133) DEBUG: <core> [parser/msg_parser.c:170]:
get_hdr_field(): get_hdr_field: cseq <CSeq>:
<103> <BYE></div>
<div> 0(3133) DEBUG: tm [t_lookup.c:949]: t_reply_matching():
DEBUG: t_reply_matching: hash 10806 label 0 branch 0</div>
<div> 0(3133) DEBUG: tm [t_lookup.c:1004]: t_reply_matching():
DEBUG: t_reply_matching: reply matched (T=0x220071b4)!</div>
<div> 0(3133) DEBUG: tm [t_hooks.c:288]:
run_trans_callbacks_internal(): DBG: trans=0x220071b4,
callback type 2, id 0 entered</div>
<div> 0(3133) DEBUG: <core>
[parser/parse_addr_spec.c:176]: parse_to_param(): DEBUG:
add_param: tag=as46bccb83</div>
<div> 0(3133) DEBUG: <core>
[parser/parse_addr_spec.c:898]: parse_addr_spec(): end of
header reached, state=29</div>
<div> 0(3133) DEBUG: uac [replace.c:705]: restore_uri_reply():
removing <<a class="moz-txt-link-rfc2396E" href="sip:00421111@IP_ADDRESS"><sip:00421111@IP_ADDRESS></a>></div>
<div> 0(3133) DEBUG: uac [replace.c:714]: restore_uri_reply():
inserting <<a class="moz-txt-link-rfc2396E" href="sip:+421111@IP_ADDRESS"><sip:+421111@IP_ADDRESS></a>></div>
<div> 0(3133) DEBUG: uac [replace.c:705]: restore_uri_reply():
removing <<a class="moz-txt-link-rfc2396E" href="sip:00421222@IP_ADDRESS"><sip:00421222@IP_ADDRESS></a>></div>
<div> 0(3133) DEBUG: uac [replace.c:714]: restore_uri_reply():
inserting <<a class="moz-txt-link-rfc2396E" href="sip:+421222@IP_ADDRESS"><sip:+421222@IP_ADDRESS></a>></div>
<div> 0(3133) DEBUG: tm [t_hooks.c:288]:
run_trans_callbacks_internal(): DBG: trans=0x220071b4,
callback type 2, id 0 entered</div>
<div> 0(3133) DEBUG: uac [replace.c:705]: restore_uri_reply():
removing <<a class="moz-txt-link-rfc2396E" href="sip:00421111@IP_ADDRESS"><sip:00421111@IP_ADDRESS></a>></div>
<div> 0(3133) DEBUG: uac [replace.c:714]: restore_uri_reply():
inserting <<a class="moz-txt-link-rfc2396E" href="sip:+421111@IP_ADDRESS"><sip:+421111@IP_ADDRESS></a>></div>
<div> 0(3133) DEBUG: uac [replace.c:705]: restore_uri_reply():
removing <<a class="moz-txt-link-rfc2396E" href="sip:00421222@IP_ADDRESS"><sip:00421222@IP_ADDRESS></a>></div>
<div> 0(3133) DEBUG: uac [replace.c:714]: restore_uri_reply():
inserting <<a class="moz-txt-link-rfc2396E" href="sip:+421222@IP_ADDRESS"><sip:+421222@IP_ADDRESS></a>></div>
</div>
<div>.</div>
<div>.</div>
<div>.</div>
<div><br>
</div>
<div>I think the problem is in registering a
function restore_uris_reply() in callbacks in functions (both
in replace.c of uac module)</div>
<div>* void rr_checker(struct sip_msg *msg, str *r_param, void
*cb_param)</div>
<div>* static void replace_callback(struct dlg_cell *dlg, int
type, struct dlg_cb_params *_params)</div>
<div><br>
</div>
<div>Both of these callbacks are registered for BYE and ACK
requests (INVITE request is using different callback),
therefore running restore_uri_reply() twice.</div>
<div>For testing purposes after I have removed the callback in
rr_checker and recompile the uac module, To and From headers
were OK.</div>
<div><br>
</div>
<div>In my configuration I'm calling uac_replace_to in RELAY
route:</div>
<div>
<div>route[RELAY]</div>
<div>{</div>
<div><br>
</div>
<div> if ( !has_totag() ) {<br>
</div>
<div> dlg_manage();</div>
<div> uac_replace_to("$ru"); </div>
<div> }</div>
<div><br>
</div>
<div> if (!t_relay())</div>
<div> {</div>
<div> sl_reply_error();</div>
<div> }</div>
<div>}</div>
</div>
<div><br>
</div>
<div>So I think there is a bug in uac module, when one function
is registered twice in callbacks for NON-INVITE requests. </div>
<div><br>
</div>
<div>Or is there a problem with my configuration script?</div>
<div><br>
</div>
<div>Can anyone point me to the direction how to solve this
issue?</div>
<div><br>
</div>
<div>Thank you</div>
<div><br>
</div>
<div>Efelin</div>
<div><br>
</div>
<div>Kamailio version: kamailio 4.4.0-dev6 (i386/linux)
a66e22-dirty</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.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-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Book: SIP Routing With Kamailio - <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
Kamailio Advanced Training, Nov 30-Dec 2, Berlin - <a class="moz-txt-link-freetext" href="http://asipto.com/kat">http://asipto.com/kat</a></pre>
</body>
</html>