<div dir="ltr">Okay, I see. <div>Thanks a lot. :D</div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-10-11 16:59 GMT+08: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 text="#000000" bgcolor="#FFFFFF">
    <p>A reply is re-sent in case of retransmission if the transaction
      of the first subscribe sent out already a reply, otherwise no --
      you can see in the c code you pasted the function to retransmit
      reply.<br>
    </p>
    Anyhow, it is up to yiou if you want to do retransmission handling
    as per default config, you can skip that part of config for
    subscribe by enclosing it inside an if block like:<br>
    <br>
    if(!is_method("SUBSCRIBE")) {<br>
      ...<br>
    }<br>
    <br>
    Cheers,<br>
    Daniel<div><div class="h5"><br>
    <br>
    <div class="m_5079111095679703637moz-cite-prefix">On 11.10.17 10:43, Jack Wang wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">Yes, the SUBSCRIBE was sent continuously 2~3 times
        captured by wireshark,
        <div>I tested using Ekiga as the sip client on windows 7.</div>
        <div><br>
        </div>
        <div>However, after I rebooted the pc and re-test  this,</div>
        <div>it only send one SUBSCRIBE now no matter how I tried,</div>
        <div>even I changed the codes back.</div>
        <div><br>
        </div>
        <div>And as you said, "<span style="font-size:14px">it means
            that the same SUBSCRIBE was already processed...</span>",<br>
        </div>
        <div>but I think it should send 200 OK and the NOTIFY back in a
          normal situation if it is indeed processed,</div>
        <div>rather than stopping there when it received a retransmitted
          SIP message.</div>
        <div><br>
        </div>
        <div>I can not generate the situation now, but I'll keep
          watching for this. </div>
        <div><br>
        </div>
        <div>Thanks. :)</div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">2017-10-11 15:52 GMT+08: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 text="#000000" bgcolor="#FFFFFF">
              <p>Hello,</p>
              <p>it means that the same SUBSCRIBE was aready processed
                and the current one is a retransmission. Can you look at
                sip network traffic (using ngrep, sngrep, ...) and see
                if there are two SUBSCRIBE requests received?</p>
              <p>Cheers,<br>
                Daniel<br>
              </p>
              <div>
                <div class="m_5079111095679703637h5"> <br>
                  <div class="m_5079111095679703637m_225713757218305049moz-cite-prefix">On
                    05.10.17 11:34, Jack Wang wrote:<br>
                  </div>
                </div>
              </div>
              <blockquote type="cite">
                <div>
                  <div class="m_5079111095679703637h5">
                    <div dir="ltr">Hello everyone,
                      <div><br>
                        According to the routing flow set in
                        kamailio.cfg
                        <div><br>
                        </div>
                        <div> # handle retransmissions<br>
                        </div>
                        <div>
                          <div> if(t_precheck_trans()) {</div>
                          <div>             t_check_trans();</div>
                          <div>             exit;</div>
                          <div> }</div>
                        </div>
                        <div><span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap">t_check_trans()</span><span class="m_5079111095679703637m_225713757218305049gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap"><span class="m_5079111095679703637m_225713757218305049gmail-pl-c" style="box-sizing:border-box">;</span></span><br>
                        </div>
                        <div><span class="m_5079111095679703637m_225713757218305049gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap"><span class="m_5079111095679703637m_225713757218305049gmail-pl-c" style="box-sizing:border-box">
</span></span></div>
                        <div><font face="SFMono-Regular, Consolas,
                            Liberation Mono, Menlo, Courier, monospace" color="#000000"><span style="font-size:12px;white-space:pre-wrap">After I traced the flow  it seems that SUBSCRIBE message failed on </span></font><span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap">t_check_trans() and stopped there.</span></div>
                        <div><span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap">I add some logs to keep tracing this function and found that:</span></div>
                        <div><span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap">
</span></div>
                        <div><span style="white-space:pre-wrap">int t_check_trans(struct sip_msg* msg)
{
        struct cell* t;
        int branch;
        int ret;
        
        /* already processing a T */
        if(is_route_type(FAILURE_ROUTE<wbr>)
                        || is_route_type(BRANCH_ROUTE)
                        || is_route_type(BRANCH_FAILURE_R<wbr>OUTE)
                        || is_route_type(TM_ONREPLY_ROUTE<wbr>)) {
                return 1;
        }

        if (msg->first_line.type==SIP_REP<wbr>LY) {
                branch = 0;
                ret = (t_check_msg( msg , &branch)==1) ? 1 : -1;
                tm_ctx_set_branch_index(branch<wbr>);
                return ret;
        } else if (msg->REQ_METHOD==METHOD_CANCE<wbr>L) {
                return w_t_lookup_cancel(msg, 0, 0);
        } else {
                switch(t_check_msg(msg, 0)){
                        case -2: /* possible e2e ack */
                                return 1;
                        case 1: /* found */
                                t=get_t();
                                if (msg->REQ_METHOD==METHOD_ACK){
                                        /* ack to neg. reply  or ack to local trans.
                                           => process it and end the script */
                                        /* FIXME: there's no way to distinguish here 
                                           between acks to local trans. and neg. acks */
                                        if (unlikely(has_tran_tmcbs(t, TMCB_ACK_NEG_IN)))
                                                run_trans_callbacks(TMCB_ACK_N<wbr>EG_IN, t, msg,
                                                                                        0, msg->REQ_METHOD);
                                        t_release_transaction(t);
                                } else {
                                        /* is a retransmission */
                                        if (unlikely(has_tran_tmcbs(t, TMCB_REQ_RETR_IN)))
                                                run_trans_callbacks(TMCB_REQ_R<wbr>ETR_IN, t, msg,
                                                                                        0, msg->REQ_METHOD);
                                        t_retransmit_reply(t);
                                }
                                /* no need for UNREF(t); set_t(0) - the end-of-script
                                   t_unref callback will take care of them */
                                return 0; /* exit from the script */</span> <--------------------------<wbr>--
                          THE POINT !!<span style="white-space:pre-wrap">
                }
                /* not found or error */
        }
        return -1;
}</span> </div>
                        <div><br>
                        </div>
                        <div>If the line "<span style="white-space:pre-wrap">return 0; /* exit from the script */"    was changed to </span>"<span style="white-space:pre-wrap">return 1; /* exit from the script */" , it works ---- means that the configuration script can keep being proceeded now.</span></div>
                        <div><span style="white-space:pre-wrap">
</span></div>
                        <div><span style="white-space:pre-wrap">Any suggestions?</span></div>
                        <div><span style="white-space:pre-wrap">
</span></div>
                        <div><span style="white-space:pre-wrap">

</span></div>
                      </div>
                    </div>
                    <br>
                    <fieldset class="m_5079111095679703637m_225713757218305049mimeAttachmentHeader"></fieldset>
                    <br>
                  </div>
                </div>
                <pre>______________________________<wbr>_________________
Kamailio (SER) - Users Mailing List
<a class="m_5079111095679703637m_225713757218305049moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a>
<a class="m_5079111095679703637m_225713757218305049moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">https://lists.kamailio.org/cgi<wbr>-bin/mailman/listinfo/sr-users</a><span class="m_5079111095679703637HOEnZb"><font color="#888888">
</font></span></pre>
                <span class="m_5079111095679703637HOEnZb"><font color="#888888"> </font></span></blockquote>
              <span class="m_5079111095679703637HOEnZb"><font color="#888888"> <br>
                  <pre class="m_5079111095679703637m_225713757218305049moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="m_5079111095679703637m_225713757218305049moz-txt-link-abbreviated" href="http://www.twitter.com/miconda" target="_blank">www.twitter.com/miconda</a> -- <a class="m_5079111095679703637m_225713757218305049moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda" target="_blank">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - <a class="m_5079111095679703637m_225713757218305049moz-txt-link-abbreviated" href="http://www.asipto.com" target="_blank">www.asipto.com</a>
Kamailio World Conference - <a class="m_5079111095679703637m_225713757218305049moz-txt-link-abbreviated" href="http://www.kamailioworld.com" target="_blank">www.kamailioworld.com</a></pre>
                </font></span></div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
    <pre class="m_5079111095679703637moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="m_5079111095679703637moz-txt-link-abbreviated" href="http://www.twitter.com/miconda" target="_blank">www.twitter.com/miconda</a> -- <a class="m_5079111095679703637moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda" target="_blank">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - <a class="m_5079111095679703637moz-txt-link-abbreviated" href="http://www.asipto.com" target="_blank">www.asipto.com</a>
Kamailio World Conference - <a class="m_5079111095679703637moz-txt-link-abbreviated" href="http://www.kamailioworld.com" target="_blank">www.kamailioworld.com</a></pre>
  </div></div></div>

</blockquote></div><br></div>