<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><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: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:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
tt
        {mso-style-priority:99;
        font-family:"Courier New";}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:black;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle22
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle23
        {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:2.0cm 42.5pt 2.0cm 3.0cm;}
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]--></head><body bgcolor=white lang=RU link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span lang=EN-US style='font-size:12.0pt;color:#1F497D;mso-fareast-language:RU'>Hi Bogdan-Andrei,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:12.0pt;color:#1F497D;mso-fareast-language:RU'>Exactly. <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:12.0pt;color:#1F497D;mso-fareast-language:RU'>Script send a push via iOS server, the server send the push notification for wake up a client, it wakes up and send REGISTER to my proxy, and authenticated. Then the client go to background again. That’s all. <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:12.0pt;color:#1F497D;mso-fareast-language:RU'>I don't use nathelper module, because it is not make sense (client will not respond, because it frozen)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:12.0pt;color:#1F497D;mso-fareast-language:RU'>So, I need to concern about keep alive _useragent_ in DB by himself.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='color:windowtext;mso-fareast-language:RU'>From:</span></b><span lang=EN-US style='color:windowtext;mso-fareast-language:RU'> Bogdan-Andrei Iancu [mailto:bogdan@opensips.org] <br><b>Sent:</b> Friday, November 24, 2017 2:35 PM<br><b>To:</b> netaskd@gmail.com; 'OpenSIPS users mailling list' <users@lists.opensips.org><br><b>Subject:</b> Re: [OpenSIPS-Users] Question about run exec from route script periodically.<o:p></o:p></span></p></div></div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><tt><span style='font-size:10.0pt'>Hi Dmitry,</span></tt><span style='font-size:10.0pt;font-family:"Courier New"'><br><br><tt>So, basically you want to do a kind of user pinging, but not via SIP (as nathelper is doing), but via PN, using your external script ?</tt><br><br><tt>Regards,</tt><br><br></span><span style='font-size:12.0pt;mso-fareast-language:RU'><o:p></o:p></span></p><pre>Bogdan-Andrei Iancu<o:p></o:p></pre><pre>  OpenSIPS Founder and Developer<o:p></o:p></pre><pre>  <a href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a><o:p></o:p></pre><div><p class=MsoNormal>On 11/24/2017 12:19 AM, <a href="mailto:netaskd@gmail.com">netaskd@gmail.com</a> wrote:<o:p></o:p></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><div><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D;mso-fareast-language:RU'>Hi Bogdan-Andrei,<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D;mso-fareast-language:RU'>I've tested the timer_route, it works well. But ,as it turned out, my issue is broader. <br>===<br>So, if I use the timer_route, it runs some logic at specific time. I'm imagine, that users will be more then 100, so 100+ requests at one time will send keepalive to iOS server...<br>Thereby, I'll try to rephrase my question:<br></span><span lang=EN-US style='font-size:12.0pt;color:#1F497D;mso-fareast-language:RU'>How can I run an external script _periodically_ for keep alive _<i>useragent</i>_ record in location table, and do not do it simultaneously. I guess, I need to bind the logic to expires time of the acc. </span><span style='font-size:12.0pt;color:#1F497D;mso-fareast-language:RU'>I can try to get it time from the location table, but maybe exists some graceful way for it?<br>BR,<br>Dmitry<o:p></o:p></span></p></div><div id=signature-x><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D;mso-fareast-language:RU'><o:p> </o:p></span></p></div></div><div><div id="quoted_header"><div class=MsoNormal align=center style='text-align:center'><span style='font-size:12.0pt;font-family:"Times New Roman",serif;mso-fareast-language:RU'><hr size=1 width="100%" noshade style='color:#E1E1E1' align=center></span></div><div><p class=MsoNormal><b><span style='mso-fareast-language:RU'>From:</span></b><span style='mso-fareast-language:RU'> Dmitry<br><b>Sent:</b> Nov 23, 2017 5:56 PM<br><b>To:</b> 'Bogdan-Andrei Iancu'; 'OpenSIPS users mailling list'<br><b>Subject:</b> RE: [OpenSIPS-Users] Question about run exec from route script periodically.</span><span style='font-size:12.0pt;font-family:"Times New Roman",serif;mso-fareast-language:RU'><o:p></o:p></span></p></div></div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif;mso-fareast-language:RU'><o:p> </o:p></span></p><div id="quoted_body"><div><div><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Hello Bogdan-Andrei,</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Thank you for reply. It seems like that’s what I need.</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>BR,</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Dmitry</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'> </span><o:p></o:p></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US>From:</span></b><span lang=EN-US> Bogdan-Andrei Iancu [<a href="mailto:bogdan@opensips.org">mailto:bogdan@opensips.org</a>]<br><b>Sent:</b> Thursday, November 23, 2017 5:11 PM<br><b>To:</b> OpenSIPS users mailling list <a href="mailto:users@lists.opensips.org"><users@lists.opensips.org></a>; Dmitry <a href="mailto:netaskd@gmail.com"><netaskd@gmail.com></a><br><b>Subject:</b> Re: [OpenSIPS-Users] Question about run exec from route script periodically.</span><o:p></o:p></p></div></div><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'><tt><span style='font-size:10.0pt'>Hello Dmitry,</span></tt><span style='font-size:10.0pt;font-family:"Courier New"'><br><br><tt>Maybe the timer_route[] will help with this ?</tt><br><tt>    <a href="http://www.opensips.org/Documentation/Script-Routes-2-3#toc8">http://www.opensips.org/Documentation/Script-Routes-2-3#toc8</a></tt><br><br><tt>Regards,</tt><br><br></span><o:p></o:p></p><pre>Bogdan-Andrei Iancu<o:p></o:p></pre><pre>  OpenSIPS Founder and Developer<o:p></o:p></pre><pre>  <a href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a><o:p></o:p></pre><div><p class=MsoNormal>On 11/23/2017 01:10 PM, Dmitry wrote:<o:p></o:p></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><p class=MsoNormal><span lang=EN-US>Hello All,</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>I don’t found the info in google, so I’ll try to ask here.</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>Data:</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>I have some custom SIP client for iIOS with logic wake up via push notification and most of the time it working in a background. The client send REGISTER in first time and go to the background. Now I have a special _<i>useragent</i>_ for next steps for detect it as my app. When a caller try to call to special client, opensips detect _useragent_ and run php script for send push notification (before send INVITE forth) to iOS server and will wait 2 sec in async mode. In this time, iOS client (callee) receive push, “wake up” and send REGISTER to opensips. So, registration completed, we run LOOKUP route with search updated “Contact” data for callee.</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>==opensips router snippet ==</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>async(exec("/etc/opensips/ios/wakeup.php '$var(ua)' '$var(key)'", "$var(out)", "$var(err)"), LOOKUP);</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>My question is:</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>How can I run an external script (via exec/etc app inside the routing script) _periodically_ for keep alive _<i>useragent</i>_ record in location table? Something like a cron inside opensips maybe. I’ll glad to any ideas.</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>PS. For keep alive “normal” users I use nathelper directives:</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>sipping_bflag</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>remove_on_timeout_bflag</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>natping_interval</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>ping_threshold</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>max_pings_lost</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>BR,</span><o:p></o:p></p><p class=MsoNormal><span lang=EN-US>Dmitry</span><o:p></o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'><br><br></span><o:p></o:p></p><pre>_______________________________________________<o:p></o:p></pre><pre>Users mailing list<o:p></o:p></pre><pre><a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><o:p></o:p></pre><pre><a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><o:p></o:p></pre></blockquote><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'> </span><o:p></o:p></p></div></div></div></div></blockquote><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif;mso-fareast-language:RU'><o:p> </o:p></span></p></div></body></html>