<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix"><tt>merlin,<br>
        <br>
        The SIP CANCEL must be sent by the caller, since "he wants to
        undo his INVITE request", not by the proxy. In order to break
        the call on the UAC side, have your proxy send him a generic
        "404 - Not Found" SIP reply, after your have done enough
        lookup() tries:<br>
      </tt><tt><br>
        ...<br>
        t_reply("404", "Not Found");<br>
        exit;<br>
        ...<br>
        <br>
        Best regards,<br>
      </tt>
      <pre class="moz-signature" cols="72">Liviu Chircu
OpenSIPS Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
      On 04.03.2015 13:30, <a class="moz-txt-link-abbreviated" href="mailto:merlin.li@tsingch.com">merlin.li@tsingch.com</a> wrote:<br>
    </div>
    <blockquote cite="mid:201503041930185190809@tsingch.com" type="cite">
      <meta http-equiv="content-type" content="text/html;
        charset=windows-1252">
      <style>body { line-height: 1.5; }blockquote { margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em; }body { font-size: 10.5pt; font-family: 'Microsoft YaHei UI'; color: rgb(0, 0, 0); line-height: 1.5; }</style>
      <div><span></span>Hi Chircu,</div>
      <div><br>
      </div>
      <div>Thanks for your reply.</div>
      <div>The 30s just my test value.</div>
      <div>And maybe i didn't discribe my problem clearly.</div>
      <div>I can understand that t_newtran() can create the transaction
        first , and i already did it before i send the first email.</div>
      <div>But as i said, the caller still can not cancel it, because i
        don't know how to do it.</div>
      <div>t_cancel_branch() only can be used in onreply_route <span
          style="font-size: 10.5pt; line-height: 1.5; background-color:
          window;"> </span><span style="font-size: 10.5pt; line-height:
          1.5; background-color: window;">but at that</span><span
          style="font-size: 10.5pt; line-height: 1.5; background-color:
          window;">  time, callee is offline.</span></div>
      <div><span style="font-size: 10.5pt; line-height: 1.5;
          background-color: window;"><br>
        </span></div>
      <div><span style="font-size: 10.5pt; line-height: 1.5;
          background-color: window;">Here is my cancel processing in the
          route , would you please tell me how can i cancel the invite
          which still in the while loop?</span></div>
      <div><br>
      </div>
      <div><span style="font-family: &quot;" microsoft="" yahei=""
          ui'";="" font-size:="" 14px;="" color:="" rgb(0,="" 0,=""
          0);="" background-color:="" rgba(0,="" font-weight:=""
          normal;="" font-style:="" normal;text-decoration:="" none;'=""> 
                # CANCEL processing<br>
                  if (is_method("CANCEL"))<br>
                  {<br>
                          if (t_check_trans()){<br>
                                      t_relay();<br>
                                      exit;<br>
                                  }<br>
                           <br>
                  }</span></div>
      <div><br>
      </div>
      <hr style="width: 210px; height: 1px;" size="1" align="left"
        color="#b5c4df">
      <div><span>
          <div style="MARGIN: 10px; FONT-FAMILY: verdana; FONT-SIZE:
            10pt">
            <div><a class="moz-txt-link-abbreviated" href="mailto:merlin.li@tsingch.com">merlin.li@tsingch.com</a></div>
          </div>
        </span></div>
      <blockquote style="margin-top: 0px; margin-bottom: 0px;
        margin-left: 0.5em;">
        <div><br>
        </div>
        <div>
          <div> </div>
          <div>Message: 1</div>
          <div>Date: Tue, 03 Mar 2015 14:57:32 +0200</div>
          <div>From: Liviu Chircu <a class="moz-txt-link-rfc2396E" href="mailto:liviu@opensips.org">&lt;liviu@opensips.org&gt;</a></div>
          <div>Subject: Re: [OpenSIPS-Users] how to cancel an INVITE
            before the</div>
          <div> callee receive it?</div>
          <div>To: <a class="moz-txt-link-abbreviated" href="mailto:users@lists.opensips.org">users@lists.opensips.org</a></div>
          <div>Message-ID: <a class="moz-txt-link-rfc2396E" href="mailto:54F5AFBC.1000200@opensips.org">&lt;54F5AFBC.1000200@opensips.org&gt;</a></div>
          <div>Content-Type: text/plain; charset="windows-1252";
            Format="flowed"</div>
          <div> </div>
          <div>Hello merlin,</div>
          <div> </div>
          <div>First of all, from a user's perspective, a Post-Dial
            Delay of up to 30 </div>
          <div>seconds should be quite annoying. Your SIP logic will
            also increase the </div>
          <div>amount of traffic received by your platform, due to lots
            of </div>
          <div>retransmissions for all failed calls.</div>
          <div> </div>
          <div>That being said, here is what you should add in order to
            make it work:</div>
          <div> </div>
          <div>t_newtran();</div>
          <div>...</div>
          <div>while (...) {</div>
          <div>     if (t_was_cancelled()) {</div>
          <div>         t_reply("487", "Request Cancelled");</div>
          <div>         exit;</div>
          <div>     }</div>
          <div>     ...</div>
          <div>}</div>
          <div> </div>
          <div>Best regards,</div>
          <div> </div>
          <div>Liviu Chircu</div>
          <div>OpenSIPS Developer</div>
          <div><a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></div>
          <div> </div>
          <div>On 03.03.2015 10:45, <a class="moz-txt-link-abbreviated" href="mailto:merlin.li@tsingch.com">merlin.li@tsingch.com</a> wrote:</div>
          <div>&gt; Hi,</div>
          <div>&gt;</div>
          <div>&gt; Or is there a way i can break the while loop in the
            route block when i </div>
          <div>&gt; receive the CANCEL request?</div>
          <div>&gt;</div>
          <div>&gt;
            ------------------------------------------------------------------------</div>
          <div>&gt; <a class="moz-txt-link-abbreviated" href="mailto:merlin.li@tsingch.com">merlin.li@tsingch.com</a></div>
          <div>&gt;</div>
          <div>&gt;     *From:* <a class="moz-txt-link-abbreviated" href="mailto:merlin.li@tsingch.com">merlin.li@tsingch.com</a>
            <a class="moz-txt-link-rfc2396E" href="mailto:merlin.li@tsingch.com">&lt;mailto:merlin.li@tsingch.com&gt;</a></div>
          <div>&gt;     *Date:* 2015-03-03 16:14</div>
          <div>&gt;     *To:* users
            <a class="moz-txt-link-rfc2396E" href="mailto:users@lists.opensips.org">&lt;mailto:users@lists.opensips.org&gt;</a></div>
          <div>&gt;     *Subject:* how to cancel an INVITE before the
            callee receive it?</div>
          <div>&gt;     Hi all,</div>
          <div>&gt;</div>
          <div>&gt;     Let me describe my scenario first.</div>
          <div>&gt;</div>
          <div>&gt;     if the callee is not online, opensips will wait
            for 30s.</div>
          <div>&gt;     During the 30s, if the callee be online,
            opensips will send the</div>
          <div>&gt;     invite to it.</div>
          <div>&gt;</div>
          <div>&gt;        $avp(timeout) = 30 ;</div>
          <div>&gt;                             while(
            !lookup("location","m") ){</div>
          <div>&gt;                                    if(
            $avp(timeout)==0 ){</div>
          <div>&gt;                                   
            send_reply("420","Can not find the callee!");</div>
          <div>&gt;                                     exit;</div>
          <div>&gt;                                 }</div>
          <div>&gt;                                 sleep("1");</div>
          <div>&gt;                                 $avp(timeout) =
            $avp(timeout)-1;</div>
          <div>&gt;                             }</div>
          <div>&gt;</div>
          <div>&gt;     This works well, the only problem is the caller
            can not cancel it</div>
          <div>&gt;     during that 30s</div>
          <div>&gt;     t_cancel_branch() only can be used in
            onreply_route, but at that</div>
          <div>&gt;     time, callee is offline.</div>
          <div>&gt;</div>
          <div>&gt;     My question is :</div>
          <div>&gt;     Is it possible that terminate a request in route
            block?</div>
          <div>&gt;</div>
          <div>&gt;</div>
          <div>&gt;    
            ------------------------------------------------------------------------</div>
          <div>&gt;     <a class="moz-txt-link-abbreviated" href="mailto:merlin.li@tsingch.com">merlin.li@tsingch.com</a></div>
          <div>&gt;</div>
          <div>&gt;</div>
          <div>&gt;</div>
          <div>&gt; _______________________________________________</div>
          <div>&gt; Users mailing list</div>
          <div>&gt; <a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a></div>
          <div>&gt;
            <a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a></div>
          <div> </div>
          <div>-------------- next part --------------</div>
          <div>An HTML attachment was scrubbed...</div>
          <div>URL:
<a class="moz-txt-link-rfc2396E" href="http://lists.opensips.org/pipermail/users/attachments/20150303/a9747213/attachment-0001.htm">&lt;http://lists.opensips.org/pipermail/users/attachments/20150303/a9747213/attachment-0001.htm&gt;</a></div>
          <div> </div>
          <div>------------------------------</div>
          <div> </div>
          <div>Message: 2</div>
          <div>Date: Tue, 03 Mar 2015 15:15:23 +0200</div>
          <div>From: Liviu Chircu <a class="moz-txt-link-rfc2396E" href="mailto:liviu@opensips.org">&lt;liviu@opensips.org&gt;</a></div>
          <div>Subject: Re: [OpenSIPS-Users] how to cancel an INVITE
            before the</div>
          <div> callee receive it?</div>
          <div>To: <a class="moz-txt-link-abbreviated" href="mailto:users@lists.opensips.org">users@lists.opensips.org</a></div>
          <div>Message-ID: <a class="moz-txt-link-rfc2396E" href="mailto:54F5B3EB.9050808@opensips.org">&lt;54F5B3EB.9050808@opensips.org&gt;</a></div>
          <div>Content-Type: text/plain; charset="windows-1252";
            Format="flowed"</div>
          <div> </div>
          <div>The previous solution won't work because you can't call </div>
          <div>t_was_cancelled() in the main route... You should:</div>
          <div> </div>
          <div>1) set $T_fr_timeout and $T_fr_inv_timeout to 1</div>
          <div>2) t_on_failure(...) [1]</div>
          <div>3) t_relay() to a bogus gateway [2]</div>
          <div>4) catch the 408 timeout in the failure route. Using an
            $avp counter, go </div>
          <div>back to step 1) until 30 tries have been done. In this
            failure route, </div>
          <div>you may now also use t_was_cancelled().</div>
          <div> </div>
          <div>[1] :
            <a class="moz-txt-link-freetext" href="http://www.opensips.org/Documentation/Script-Routes-2-1#toc3">http://www.opensips.org/Documentation/Script-Routes-2-1#toc3</a></div>
          <div>[2] :
            <a class="moz-txt-link-freetext" href="http://www.opensips.org/html/docs/modules/2.1.x/tm.html#trelay-1">http://www.opensips.org/html/docs/modules/2.1.x/tm.html#trelay-1</a></div>
          <div> </div>
          <div>On 03.03.2015 14:57, Liviu Chircu wrote:</div>
          <div>&gt; Hello merlin,</div>
          <div>&gt;</div>
          <div>&gt; First of all, from a user's perspective, a Post-Dial
            Delay of up to 30 </div>
          <div>&gt; seconds should be quite annoying. Your SIP logic
            will also increase </div>
          <div>&gt; the amount of traffic received by your platform, due
            to lots of </div>
          <div>&gt; retransmissions for all failed calls.</div>
          <div>&gt;</div>
          <div>&gt; That being said, here is what you should add in
            order to make it work:</div>
          <div>&gt;</div>
          <div>&gt; t_newtran();</div>
          <div>&gt; ...</div>
          <div>&gt; while (...) {</div>
          <div>&gt;     if (t_was_cancelled()) {</div>
          <div>&gt;         t_reply("487", "Request Cancelled");</div>
          <div>&gt;         exit;</div>
          <div>&gt;     }</div>
          <div>&gt;     ...</div>
          <div>&gt; }</div>
          <div>&gt;</div>
          <div>&gt; Best regards,</div>
          <div>&gt; Liviu Chircu</div>
          <div>&gt; OpenSIPS Developer</div>
          <div>&gt; <a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></div>
          <div>&gt; On 03.03.2015 10:45, <a class="moz-txt-link-abbreviated" href="mailto:merlin.li@tsingch.com">merlin.li@tsingch.com</a> wrote:</div>
          <div>&gt;&gt; Hi,</div>
          <div>&gt;&gt;</div>
          <div>&gt;&gt; Or is there a way i can break the while loop in
            the route block when </div>
          <div>&gt;&gt; i receive the CANCEL request?</div>
          <div>&gt;&gt;</div>
          <div>&gt;&gt;
            ------------------------------------------------------------------------</div>
          <div>&gt;&gt; <a class="moz-txt-link-abbreviated" href="mailto:merlin.li@tsingch.com">merlin.li@tsingch.com</a></div>
          <div>&gt;&gt;</div>
          <div>&gt;&gt;     *From:* <a class="moz-txt-link-abbreviated" href="mailto:merlin.li@tsingch.com">merlin.li@tsingch.com</a>
            <a class="moz-txt-link-rfc2396E" href="mailto:merlin.li@tsingch.com">&lt;mailto:merlin.li@tsingch.com&gt;</a></div>
          <div>&gt;&gt;     *Date:* 2015-03-03 16:14</div>
          <div>&gt;&gt;     *To:* users
            <a class="moz-txt-link-rfc2396E" href="mailto:users@lists.opensips.org">&lt;mailto:users@lists.opensips.org&gt;</a></div>
          <div>&gt;&gt;     *Subject:* how to cancel an INVITE before
            the callee receive it?</div>
          <div>&gt;&gt;     Hi all,</div>
          <div>&gt;&gt;</div>
          <div>&gt;&gt;     Let me describe my scenario first.</div>
          <div>&gt;&gt;</div>
          <div>&gt;&gt;     if the callee is not online, opensips will
            wait for 30s.</div>
          <div>&gt;&gt;     During the 30s, if the callee be online,
            opensips will send the</div>
          <div>&gt;&gt;     invite to it.</div>
          <div>&gt;&gt;</div>
          <div>&gt;&gt;          $avp(timeout) = 30 ;</div>
          <div>&gt;&gt;                             while(
            !lookup("location","m") ){</div>
          <div>&gt;&gt;                                    if(
            $avp(timeout)==0 ){</div>
          <div>&gt;&gt;                                   
            send_reply("420","Can not find the callee!");</div>
          <div>&gt;&gt;                                     exit;</div>
          <div>&gt;&gt;                                 }</div>
          <div>&gt;&gt;                                 sleep("1");</div>
          <div>&gt;&gt;                                 $avp(timeout) =
            $avp(timeout)-1;</div>
          <div>&gt;&gt;                             }</div>
          <div>&gt;&gt;</div>
          <div>&gt;&gt;     This works well, the only problem is the
            caller can not cancel it</div>
          <div>&gt;&gt;     during that 30s</div>
          <div>&gt;&gt;     t_cancel_branch() only can be used in
            onreply_route, but at that</div>
          <div>&gt;&gt;     time, callee is offline.</div>
          <div>&gt;&gt;</div>
          <div>&gt;&gt;     My question is :</div>
          <div>&gt;&gt;     Is it possible that terminate a request in
            route block?</div>
          <div>&gt;&gt;</div>
          <div>&gt;&gt;</div>
          <div>&gt;&gt;    
            ------------------------------------------------------------------------</div>
          <div>&gt;&gt;     <a class="moz-txt-link-abbreviated" href="mailto:merlin.li@tsingch.com">merlin.li@tsingch.com</a></div>
          <div>&gt;&gt;</div>
          <div>&gt;&gt;</div>
          <div>&gt;&gt;</div>
          <div>&gt;&gt; _______________________________________________</div>
          <div>&gt;&gt; Users mailing list</div>
          <div>&gt;&gt; <a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a></div>
          <div>&gt;&gt;
            <a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a></div>
          <div>&gt;</div>
          <div>&gt;</div>
          <div>&gt;</div>
          <div>&gt; _______________________________________________</div>
          <div>&gt; Users mailing list</div>
          <div>&gt; <a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a></div>
          <div>&gt;
            <a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a></div>
          <div> </div>
          <div>-------------- next part --------------</div>
          <div>An HTML attachment was scrubbed...</div>
          <div>URL:
<a class="moz-txt-link-rfc2396E" href="http://lists.opensips.org/pipermail/users/attachments/20150303/31768207/attachment-0001.htm">&lt;http://lists.opensips.org/pipermail/users/attachments/20150303/31768207/attachment-0001.htm&gt;</a></div>
          <div> </div>
          <div>------------------------------</div>
          <div> </div>
          <div>Message: 3</div>
          <div>Date: Tue, 3 Mar 2015 17:02:44 +0100</div>
          <div>From: Adri? Vidal <a class="moz-txt-link-rfc2396E" href="mailto:adriavidal@gmail.com">&lt;adriavidal@gmail.com&gt;</a></div>
          <div>Subject: Re: [OpenSIPS-Users] CDRtool 9.3 web interface</div>
          <div>To: OpenSIPS users mailling list
            <a class="moz-txt-link-rfc2396E" href="mailto:users@lists.opensips.org">&lt;users@lists.opensips.org&gt;</a></div>
          <div>Message-ID:</div>
          <div>
<a class="moz-txt-link-rfc2396E" href="mailto:CAFYw3-dR_RcmaN=yXsm3gRB2urSWw325ANAcvm+VE_-kaoA15A@mail.gmail.com">&lt;CAFYw3-dR_RcmaN=yXsm3gRB2urSWw325ANAcvm+VE_-kaoA15A@mail.gmail.com&gt;</a></div>
          <div>Content-Type: text/plain; charset="utf-8"</div>
          <div> </div>
          <div>2015-03-03 11:30 GMT+01:00 Tijmen de Mes
            <a class="moz-txt-link-rfc2396E" href="mailto:tijmen@ag-projects.com">&lt;tijmen@ag-projects.com&gt;</a>:</div>
          <div> </div>
          <div>&gt; Hi,</div>
          <div>&gt;</div>
          <div>&gt; Clicking on the icons does not work. If you click on
            the input field you</div>
          <div>&gt; should get a date picker.</div>
          <div>&gt;</div>
          <div>&gt; If you don?t get it please take a look at the
            webbrowsers console if get</div>
          <div>&gt; any error or exception.</div>
          <div>&gt;</div>
          <div>&gt; Best regards,</div>
          <div>&gt;</div>
          <div>&gt; Tijmen de Mes</div>
          <div>&gt;</div>
          <div> </div>
          <div>I see no input field to click on</div>
          <div> </div>
          <div><a class="moz-txt-link-freetext" href="https://www.dropbox.com/s/w55ynwrc1kbps6d/Captura%20de%20pantalla%202015-03-03%2017.02.14.png?dl=0">https://www.dropbox.com/s/w55ynwrc1kbps6d/Captura%20de%20pantalla%202015-03-03%2017.02.14.png?dl=0</a></div>
          <div> </div>
          <div> </div>
          <div> </div>
          <div> </div>
          <div>-- </div>
          <div>--</div>
          <div>Adri? Vidal</div>
          <div> </div>
          <div>T. 93 150 31 80 | M 607 28 89 56</div>
          <div> </div>
          <div>@ <a class="moz-txt-link-abbreviated" href="mailto:adria@gmail.com">adria@gmail.com</a></div>
          <div> </div>
          <div>www <a class="moz-txt-link-abbreviated" href="http://www.xpreme.net">www.xpreme.net</a> | centralitaip.xpreme.net</div>
          <div> </div>
          <div>twitter xpreme_it
            <a class="moz-txt-link-rfc2396E" href="https://twitter.com/intent/user?screen_name=xpreme_it">&lt;https://twitter.com/intent/user?screen_name=xpreme_it&gt;</a></div>
          <div>-------------- next part --------------</div>
          <div>An HTML attachment was scrubbed...</div>
          <div>URL:
<a class="moz-txt-link-rfc2396E" href="http://lists.opensips.org/pipermail/users/attachments/20150303/7b382bc0/attachment.htm">&lt;http://lists.opensips.org/pipermail/users/attachments/20150303/7b382bc0/attachment.htm&gt;</a></div>
          <div> </div>
          <div>------------------------------</div>
          <div> </div>
          <div>_______________________________________________</div>
          <div>Users mailing list</div>
          <div><a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a></div>
          <div><a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a></div>
          <div> </div>
          <div> </div>
          <div>End of Users Digest, Vol 80, Issue 6</div>
          <div>************************************</div>
        </div>
      </blockquote>
    </blockquote>
    <br>
  </body>
</html>