<html><head><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><style>body { line-height: 1.5; }blockquote { margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em; }div.foxdiv20150305185417060651 { }body { font-size: 10.5pt; font-family: 'Microsoft YaHei UI'; color: rgb(0, 0, 0); line-height: 1.5; }</style></head><body>
<div><span></span>Hi Chircu,</div><div><br></div><div>Thanks</div><div>I didn't received your mail which contain the solution, because i'm in China, we have fucking GFW, so sometimes we always miss something.</div><div>I will test it , and let you know the result.</div><div><br></div><div>Thanks again.</div>
<div><br></div><hr style="width: 210px; height: 1px;" color="#b5c4df" size="1" align="left">
<div><span><div style="MARGIN: 10px; FONT-FAMILY: verdana; FONT-SIZE: 10pt"><div>merlin.li@tsingch.com</div></div></span></div>
<blockquote style="margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em;"><div> </div><div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm"><div style="PADDING-RIGHT: 8px; PADDING-LEFT: 8px; FONT-SIZE: 12px;FONT-FAMILY:tahoma;COLOR:#000000; BACKGROUND: #efefef; PADDING-BOTTOM: 8px; PADDING-TOP: 8px"><div><b>From:</b> <a href="mailto:liviu@opensips.org">Liviu Chircu</a></div><div><b>Date:</b> 2015-03-05 18:47</div><div><b>To:</b> <a href="mailto:merlin.li@tsingch.com">merlin.li@tsingch.com</a>; <a href="mailto:users@lists.opensips.org">users</a></div><div><b>Subject:</b> Re: [OpenSIPS-Users] how to cancel an INVITE before the callee receive it?</div></div></div><div><div class="FoxDiv20150305185417060651">
<small><font face="monospace">Hello merlin,<br>
<br>
I have already given you the solution [1], but you did not read
the email. It is also A LOT more efficient than your while+sleep
loop, since it does not block the OpenSIPS workers at all - they
are free to process all incoming traffic. Please implement it,
send "404 Not Found" to the _caller_ when you decide to stop the
call, and let me know if there are any problems :)<br>
<br>
[1] :
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/pipermail/users/2015-March/031022.html">http://lists.opensips.org/pipermail/users/2015-March/031022.html</a><br>
</font></small>
<pre class="moz-signature" cols="72"><small>Liviu Chircu
OpenSIPS Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></small></pre>
<div class="moz-cite-prefix">On 05.03.2015 12:16,
<a class="moz-txt-link-abbreviated" href="mailto:merlin.li@tsingch.com">merlin.li@tsingch.com</a> wrote:<br>
</div>
<blockquote cite="mid:201503051816424658682@tsingch.com" type="cite" style="margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em;">
<div><span></span><br>
</div>
<blockquote style="margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em;">
<div>
<div class="FoxDiv20150305181618155747">
<div><span></span>Hi Chircu,</div>
<div><br>
</div>
<div>I got an idea, and tested it, but the result confuse
me. </div>
<div>In the CANCEL processing block, i use <span style="font-family: ''; font-size: 10.5pt; line-height:
1.5; background-color: window;"> set_dlg_flag("1") to
set a dialog flag,</span></div>
<div><span style="font-family: ''; font-size: 10.5pt;
line-height: 1.5; background-color: window;"><br>
</span></div>
<div><span style="font-family: "" microsoft="" yahei="" ui'";="" font-size:="" 14px;="" color:="" rgb(0,="" 0,="" 0);="" background-color:="" rgb(255,="" 255,="" 255);="" font-weight:="" normal;="" font-style:="" normal;text-decoration:="" none;'="">if (is_method("CANCEL"))
# in the route block<br>
{<br>
if (t_check_trans()){<br>
if(!is_dlg_flag_set("1")){<br>
<b> set_dlg_flag("1");</b><br>
t_relay();<br>
exit;<br>
}</span></div>
<div><span style="font-family: ''; font-size: 10.5pt;
line-height: 1.5; background-color: window;">}</span></div>
<div><span style="font-family: ''; font-size: 10.5pt;
line-height: 1.5; background-color: window;">}</span></div>
<div><span style="font-family: ''; font-size: 10.5pt;
line-height: 1.5; background-color: window;"><br>
</span></div>
<div><span style="font-family: ''; font-size: 10.5pt;
line-height: 1.5; background-color: window;">and in the
while loop:</span></div>
<div><span style="font-family: "" microsoft="" yahei="" ui'";="" font-size:="" 14px;="" color:="" rgb(0,="" 0,="" 0);="" background-color:="" rgba(0,="" font-weight:="" normal;="" font-style:="" normal;text-decoration:="" none;'="">while( !lookup("location","m") ){<br>
if(is_dlg_flag_set("1")){<br>
t_reply("404","cancel the request!");<br>
exit;<br>
}</span></div>
<div> .....</div>
<div>}</div>
<div><br>
</div>
<div>Sometimes , it works well, but sometimes, the CANCEL
process is not executed until the loop finished.</div>
<div>What i said is i got two result, and i don't know why.</div>
<div>result 1:</div>
<div>when opensips received the CANCEL request , the dialog
flag is set, then break the while loop.</div>
<div><br>
</div>
<div>result 2:</div>
<div>Caller issue a CANCEL request, but opensips didn't
entering the CANCEL process until the while loop is
finished.</div>
<div><br>
</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>
<div class="FoxDiv20150305145914717007">
<blockquote style="margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em;">
<div>
<div class="FoxDiv20150305133500088028"><br>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</blockquote>
<br>
</div></div></blockquote>
</body></html>