<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<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">
<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; }div.foxdiv20150305181618155747 { }body { font-size: 10.5pt; font-family: 'Microsoft YaHei UI'; color: rgb(0, 0, 0); line-height: 1.5; }</style>
<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>
</body>
</html>