<div dir="ltr">Hi,<div>If I understood correctly the original question was to identify, in a reply route, a 200 OK coming for an initial INVITE.</div><div>In the reply route the 200 OK will always have a to tag (unless the UAS is broken), so you cannot this condition.</div><div><br></div><div>Regards,</div><div><br></div><div>Federico</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 3, 2016 at 9:05 AM, Serge S. Yuriev <span dir="ltr"><<a href="mailto:me@nevian.org" target="_blank">me@nevian.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br><br>Sorry, but why not to check has_totag again? Why we need a flag?<span class="HOEnZb"><font color="#888888"><br><br>-- <br>Wbr, Serge via mobile<br><br>03.03.2016, 09:31, "Federico Cabiddu" <<a href="mailto:federico.cabiddu@gmail.com" target="_blank">federico.cabiddu@gmail.com</a>>:</font></span><div class="HOEnZb"><div class="h5"><br><blockquote type="cite"><br>Hi,<br>$dlg_var is not available at this stage of the dialog:<br><br><br><a href="http://www.kamailio.org/docs/modules/devel/modules/dialog.html#idp19330392" target="_blank">http://www.kamailio.org/docs/modules/devel/modules/dialog.html#idp19330392</a><br><br><br><br>To achieve your goal you can use there an avp or a flag, which are bound to transactions.<br>Something like:<br><br><br><br>#define INIT_FLAG<br><br><br>if (is_method("INVITE") && !has_totag()) {<br><br>        $avp(is_init_invite) = 1;<br>        # or<br>        # setflag(INIT_FLAG);<br>}<br><br><br>onreply_route {<br>    if (is_method("INVITE") && t_check_status("200") && $avp(is_init_invite) == "1") {<br>        # or <br>        # if (is_method("INVITE") && t_check_status("200") && isflagset(INIT_FLAG))<br>        #<br>        # do somting     <br>    }<br>}<br><br><br>Regards,<br><br><br>Federico<br><br><br>On Thu, Mar 3, 2016 at 4:55 AM, 张顺通 <<a href="mailto:shuntongzhang@gmail.com" target="_blank">shuntongzhang@gmail.com</a>> wrote:<br><blockquote type="cite"><br>I want to distingguish 200 OK is for INVITE or reINVITE。<br><br><br>so I do this:<br>request_route {<br>    if (is_method("INVITE") && !has_totag()) {<br>        $dlg_var(is_init_invite) = "1";<br>    }<br>}<br><br><br>onreply_route {<br>    xlog("L_INFO","[$rs-$rr][is_init_invite:$dlg_var(is_init_invite)]");<br>    if (is_method("INVITE") && t_check_status("200") && $dlg_var(is_init_invite) == "1") {<br>        # do somting<br>        $dlg_var(is_init_invite) = "0";<br>    }<br>    xlog("L_INFO","[$rs-$rr][is_init_invite:$dlg_var(is_init_invite)]");<br>}<br><br><br>What I confuse is:<br>When I recive 100 Trying LOG is<br>[100 - Trying][is_init_invite:0]<br>[100 - Trying][is_init_invite:1]<br><br><br><br>why is_init_invite is 0?<br><br>_______________________________________________<br> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br> <a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br> <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><br> <br></blockquote><br><br><br> <br><br>_______________________________________________<br>SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br><a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br><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><br><br></blockquote></div></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>