<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 : <sip:00421111@IP_ADDRESS>;tag=as017a2986</div><div>  To : <sip:00421222@IP_ADDRESS0>;tag=K7ryDgH2g7gFm</div></div><div>Outgoing 200 OK:</div><div><div>  From : <sip:+421111@IP_ADDRESS><sip:+421111@IP_ADDRESS>;tag=as017a2986</div><div>  To : <sip:+421222@IP_ADDRESS><sip:+421222@IP_ADDRESS>;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=[sip:421222@IP_ADDRESS:5060] </div><div> 0(3133) DEBUG: <core> [parser/msg_parser.c:192]: get_hdr_field(): DEBUG: to body [<sip:421222@IP_ADDRESS:5060>]</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 <<sip:00421111@IP_ADDRESS>></div><div> 0(3133) DEBUG: uac [replace.c:714]: restore_uri_reply(): inserting <<sip:+421111@IP_ADDRESS>></div><div> 0(3133) DEBUG: uac [replace.c:705]: restore_uri_reply(): removing <<sip:00421222@IP_ADDRESS>></div><div> 0(3133) DEBUG: uac [replace.c:714]: restore_uri_reply(): inserting <<sip:+421222@IP_ADDRESS>></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 <<sip:00421111@IP_ADDRESS>></div><div> 0(3133) DEBUG: uac [replace.c:714]: restore_uri_reply(): inserting <<sip:+421111@IP_ADDRESS>></div><div> 0(3133) DEBUG: uac [replace.c:705]: restore_uri_reply(): removing <<sip:00421222@IP_ADDRESS>></div><div> 0(3133) DEBUG: uac [replace.c:714]: restore_uri_reply(): inserting <<sip:+421222@IP_ADDRESS>></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>