<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    You can define as many rtimer processes as you want and tell them to
    execute same route block, consuming from the same queue.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="moz-cite-prefix">On 19/03/15 09:39, Mickael Marrache
      wrote:<br>
    </div>
    <blockquote cite="mid:0a5601d06220$2feab1d0$8fc01570$@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;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Texte de bulles Car";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        color:black;
        mso-fareast-language:EN-US;}
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.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.TextedebullesCar
        {mso-style-name:"Texte de bulles Car";
        mso-style-priority:99;
        mso-style-link:"Texte de bulles";
        font-family:"Tahoma","sans-serif";
        color:black;
        mso-fareast-language:EN-US;}
.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">Thanks,
            it helps.<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">However,
            if I create a timer and specify mode to 1, I will only have
            one extra process to send all PUSH notifications. Therefore,
            at some point, this extra process will be continuously busy
            handling messages in the queue, and the queue will grow over
            and over.<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">Is
            it possible to have a pool of timers fetching from the same
            message queue?<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"
                  lang="EN-US">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:FR"
                lang="EN-US"> Daniel-Constantin Mierla [<a class="moz-txt-link-freetext" href="mailto:miconda@g">mailto:miconda@g</a></span><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:FR">mail.com]
                <br>
                <b>Sent:</b> Thursday, March 19, 2015 10:28 AM<br>
                <b>To:</b> Mickael Marrache; '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">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<o:p></o:p></p>
        <div>
          <p class="MsoNormal">On 19/03/15 09:14, Mickael Marrache
            wrote:<o:p></o:p></p>
        </div>
        <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
          <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">I
              already looked at your presentation, the PUSH is send
              synchronously.</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"> </span><o:p></o:p></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.</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">In
              your presentation, I see the following:</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">route[PUSHASYNC]
              {</span><o:p></o:p></p>
          <p class="MsoNormal" style="text-indent:35.4pt"><span
              style="color:#1F497D" lang="EN-US">if
              (!is_method("INVITE"))</span><o:p></o:p></p>
          <p class="MsoNormal"
            style="margin-left:35.4pt;text-indent:35.4pt"><span
              style="color:#1F497D" lang="EN-US">return;</span><o:p></o:p></p>
          <p class="MsoNormal" style="text-indent:35.4pt"><span
              style="color:#1F497D" lang="EN-US">if(registered("location"))</span><o:p></o:p></p>
          <p class="MsoNormal"
            style="margin-left:35.4pt;text-indent:35.4pt"><span
              style="color:#1F497D" lang="EN-US">return;</span><o:p></o:p></p>
          <p class="MsoNormal" style="text-indent:35.4pt"><span
              style="color:#1F497D" lang="EN-US">route(SENDPUSH);</span><o:p></o:p></p>
          <p class="MsoNormal" style="text-indent:35.4pt"><span
              style="color:#1F497D" lang="EN-US">if(!t_suspend()) {</span><o:p></o:p></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");</span><o:p></o:p></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");</span><o:p></o:p></p>
          <p class="MsoNormal"
            style="margin-left:35.4pt;text-indent:35.4pt"><span
              style="color:#1F497D" lang="EN-US">exit;</span><o:p></o:p></p>
          <p class="MsoNormal" style="text-indent:35.4pt"><span
              style="color:#1F497D" lang="EN-US">}</span><o:p></o:p></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");</span><o:p></o:p></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);</span><o:p></o:p></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");</span><o:p></o:p></p>
          <p class="MsoNormal" style="text-indent:35.4pt"><span
              style="color:#1F497D" lang="EN-US">exit;</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">}</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"> </span><o:p></o:p></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).</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">Mickael</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"> </span><o:p></o:p></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 moz-do-not-send="true"
                    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</span><o:p></o:p></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"><br>
                <br>
                <br>
                <br>
              </span><o:p></o:p></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"><br>
              <br>
              <br>
            </span><o:p></o:p></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>
        </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>