<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
You can delegate to send of the push to a rtimer process using
mqueue -- see same presentation, the section about tweeting.<br>
<br>
Cheers,<br>
Daniel<br>
<br>
<div class="moz-cite-prefix">On 19/03/15 09:14, Mickael Marrache
wrote:<br>
</div>
<blockquote cite="mid:09f501d0621c$abec2290$03c467b0$@gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
color:black;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"Pr\00E9format\00E9 HTML Car";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";
color:black;}
span.EmailStyle17
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.PrformatHTMLCar
{mso-style-name:"Pr\00E9format\00E9 HTML Car";
mso-style-priority:99;
mso-style-link:"Pr\00E9format\00E9 HTML";
font-family:Consolas;
color:black;
mso-fareast-language:EN-US;}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">I
already looked at your presentation, the PUSH is send
synchronously.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">What
I'm trying to achieve is sending the PUSH asynchronously.
So, when I receive an incoming call and the callee has no
registration, I would like to suspend the transaction and
then delegate PUSH sending to another process.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">In
your presentation, I see the following:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">route[PUSHASYNC]
{<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:35.4pt"><span
style="color:#1F497D" lang="EN-US">if (!is_method("INVITE"))<o:p></o:p></span></p>
<p class="MsoNormal"
style="margin-left:35.4pt;text-indent:35.4pt"><span
style="color:#1F497D" lang="EN-US">return;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:35.4pt"><span
style="color:#1F497D" lang="EN-US">if(registered("location"))<o:p></o:p></span></p>
<p class="MsoNormal"
style="margin-left:35.4pt;text-indent:35.4pt"><span
style="color:#1F497D" lang="EN-US">return;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:35.4pt"><span
style="color:#1F497D" lang="EN-US">route(SENDPUSH);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:35.4pt"><span
style="color:#1F497D" lang="EN-US">if(!t_suspend()) {<o:p></o:p></span></p>
<p class="MsoNormal"
style="margin-left:35.4pt;text-indent:35.4pt"><span
style="color:#1F497D" lang="EN-US">xlog("failed suspending
trasaction [$T(id_index):$T(id_label)]\n");<o:p></o:p></span></p>
<p class="MsoNormal"
style="margin-left:35.4pt;text-indent:35.4pt"><span
style="color:#1F497D" lang="EN-US">send_reply("501",
"Unknown destination");<o:p></o:p></span></p>
<p class="MsoNormal"
style="margin-left:35.4pt;text-indent:35.4pt"><span
style="color:#1F497D" lang="EN-US">exit;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:35.4pt"><span
style="color:#1F497D" lang="EN-US">}<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:35.4pt"><span
style="color:#1F497D" lang="EN-US">xdbg("suspended
transaction [$T(id_index):$T(id_label)] $fU => $rU\n");<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:35.4pt"><span
style="color:#1F497D" lang="EN-US">$sht(vtp=>join::$rU) =
"" + $T(id_index) + ":" + $T(id_label);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:35.4pt"><span
style="color:#1F497D" lang="EN-US">xdbg("htale key value
[$sht(vtp=>join::$rU)]\n");<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:35.4pt"><span
style="color:#1F497D" lang="EN-US">exit;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">The
route block is not execute asynchronously since it is called
by the calling block using regular way (i.e.
route(PUSHASYNC)). Therefore, all these operations are
executed by the same process which is a worker process. I
would like to delegate execution of all the route block to a
separate process (at least execution of the SENDPUSH route
block).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">Mickael<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF
1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:FR">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:FR">
sr-users [<a class="moz-txt-link-freetext" href="mailto:sr-users-bounces@lists.sip-router.org">mailto:sr-users-bounces@lists.sip-router.org</a>]
<b>On Behalf Of </b>Daniel-Constantin Mierla<br>
<b>Sent:</b> Thursday, March 19, 2015 10:04 AM<br>
<b>To:</b> Kamailio (SER) - Users Mailing List<br>
<b>Subject:</b> Re: [SR-Users] Sending PUSH notification
asynchronously<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">Hello,<br>
<br>
don't do explicit t_suspend() if you are calling the
async_task_route() because it is done internally.<br>
<br>
I presented a way for async push notifications during the
Kamailio World Conference 2014, see:<br>
<br>
- <a moz-do-not-send="true"
href="http://www.kamailio.org/events/2014-KamailioWorld/day2/26-Daniel-Constantin.Mierla-Kamailio.cfg-Async.pdf">http://www.kamailio.org/events/2014-KamailioWorld/day2/26-Daniel-Constantin.Mierla-Kamailio.cfg-Async.pdf</a><br>
<br>
A video should be also on youtube.<br>
<br>
Cheers,<br>
Daniel<o:p></o:p></p>
<div>
<p class="MsoNormal">On 19/03/15 08:49, Mickael Marrache
wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal">Hi<span lang="EN-US">,</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">I'm trying to add PUSH
support to my system using Kamailio.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">When a call is
received and the callee has no active registration, a PUSH
is sent to the callee endpoint. In order to send this
PUSH, my proxy sends an HTTP requests to another server
that will send the PUSH.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">So, my route block is
as follows:</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">route[PUSH] {</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> #Send PUSH
notification using a custom module I wrote</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> #Suspend
transaction execution.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span>t_on_failure("MANAGE_FAILURE");<o:p></o:p></p>
<p class="MsoNormal"> <span lang="EN-US">if(!t_suspend())
{</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">
send_reply("503", "Service Unavailable");</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> exit;</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> }</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">
$sht(push=>join::$rU) = "" + $T(id_index) + ":" +
$T(id_label);</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> exit;</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">}</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">I would like to
execute this route block asynchronously (i.e. in a
separate process).</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">I tried using the
async_task_route command, and I can see the route block is
execute in a separate process, however some stuffs are
broken (e.g. transaction timeout, failure route). So, I
thought it may be related to the fact asynchronous
execution is implemented using t_suspend/t_continue and in
this case, t_suspend/t_continue would be called twice.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">The important point is
to make the interaction with the PUSH server asynchronous.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">Any idea?</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">Thanks,</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">Mickael</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:12.0pt;font-family:"Times New
Roman","serif";mso-fareast-language:FR"><br>
<br>
<br>
<o:p></o:p></span></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<o:p></o:p></pre>
<pre><a moz-do-not-send="true" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><o:p></o:p></pre>
<pre><a moz-do-not-send="true" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><o:p></o:p></pre>
</blockquote>
<p class="MsoNormal"><span
style="font-size:12.0pt;font-family:"Times New
Roman","serif";mso-fareast-language:FR"><br>
<br>
<o:p></o:p></span></p>
<pre>-- <o:p></o:p></pre>
<pre>Daniel-Constantin Mierla<o:p></o:p></pre>
<pre><a moz-do-not-send="true" href="http://twitter.com/#%21/miconda">http://twitter.com/#!/miconda</a> - <a moz-do-not-send="true" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a><o:p></o:p></pre>
<pre>Kamailio World Conference, May 27-29, 2015<o:p></o:p></pre>
<pre>Berlin, Germany - <a moz-do-not-send="true" href="http://www.kamailioworld.com">http://www.kamailioworld.com</a><o:p></o:p></pre>
</div>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Kamailio World Conference, May 27-29, 2015
Berlin, Germany - <a class="moz-txt-link-freetext" href="http://www.kamailioworld.com">http://www.kamailioworld.com</a></pre>
</body>
</html>