<div dir="ltr">Hi Daniel,<div><br></div><div>thank you for a reply. I have managed to solve it in a different way.</div><div><br></div><div>In a first message I forgot to add that I'm calling uac_replace_from before mentioned code. I have moved uac_replace_from function, so it is called after the dlg_manage function and right now only one callback is registered. This fixed it.</div><div><br></div><div>Isn't it possible to un-register the first callback when the second one is registered?</div><div><br></div><div>Kind regards</div><div><br></div><div>Efelin</div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-11-06 8:27 GMT+01:00 Daniel-Constantin Mierla <span dir="ltr"><<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div 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<div><div class="h5"><br>
    <br>
    <div>On 05/11/15 18:00, Efelin Novak wrote:<br>
    </div>
    </div></div><blockquote type="cite"><div><div class="h5">
      <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><sip:00421111@IP_ADDRESS></a>;tag=as017a2986</div>
          <div>  To : <a><sip:00421222@IP_ADDRESS0></a>;tag=K7ryDgH2g7gFm</div>
        </div>
        <div>Outgoing 200 OK:</div>
        <div>
          <div>  From :
<a><sip:+421111@IP_ADDRESS></a><a><sip:+421111@IP_ADDRESS></a>;tag=as017a2986</div>
          <div>  To :
<a><sip:+421222@IP_ADDRESS></a><a><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>sip:421222@IP_ADDRESS:5060</a>] </div>
          <div> 0(3133) DEBUG: <core> [parser/msg_parser.c:192]:
            get_hdr_field(): DEBUG: to body
            [<a><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><sip:00421111@IP_ADDRESS></a>></div>
          <div> 0(3133) DEBUG: uac [replace.c:714]: restore_uri_reply():
            inserting <<a><sip:+421111@IP_ADDRESS></a>></div>
          <div> 0(3133) DEBUG: uac [replace.c:705]: restore_uri_reply():
            removing <<a><sip:00421222@IP_ADDRESS></a>></div>
          <div> 0(3133) DEBUG: uac [replace.c:714]: restore_uri_reply():
            inserting <<a><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><sip:00421111@IP_ADDRESS></a>></div>
          <div> 0(3133) DEBUG: uac [replace.c:714]: restore_uri_reply():
            inserting <<a><sip:+421111@IP_ADDRESS></a>></div>
          <div> 0(3133) DEBUG: uac [replace.c:705]: restore_uri_reply():
            removing <<a><sip:00421222@IP_ADDRESS></a>></div>
          <div> 0(3133) DEBUG: uac [replace.c:714]: restore_uri_reply():
            inserting <<a><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></fieldset>
      <br>
      </div></div><pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><span class="HOEnZb"><font color="#888888">
</font></span></pre><span class="HOEnZb"><font color="#888888">
    </font></span></blockquote><span class="HOEnZb"><font color="#888888">
    <br>
    <pre cols="72">-- 
Daniel-Constantin Mierla
<a href="http://twitter.com/#!/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a>
Book: SIP Routing With Kamailio - <a href="http://www.asipto.com" target="_blank">http://www.asipto.com</a>
Kamailio Advanced Training, Nov 30-Dec 2, Berlin - <a href="http://asipto.com/kat" target="_blank">http://asipto.com/kat</a></pre>
  </font></span></div>

<br>_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
<br></blockquote></div><br></div>