<div dir="ltr">Hi Babil,<br><br>I use the rest_post() method to send a query to my server:<br><br> > rest_post("$var(pns_push_url)", "{ \"user\": { \"uri\":\"$var(uri)\", \"type\":\"INCOMING_CALL\" } }", "application/json", "$var(ct)", "$var(rcode)");<br><br>You can use async with rest_post if it takes too long.<div>The server is just a Ruby on Rails server that uses the houston gem to send the notifications: <a href="https://github.com/nomad/houston">https://github.com/nomad/houston</a><div><br></div><div>About having Alice retying... How do you do so? Do you send multiple INVITEs to the SIP server until Bob becomes online?<br><div><br></div><div>Jose</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-03-02 14:48 GMT+01:00 Babil (Golam Sarwar) <span dir="ltr"><<a href="mailto:gsbabil@gmail.com" target="_blank">gsbabil@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi José,<br>
thank you. I have a somewhat similar implementation but on top of OpenSIPS<br>
1.11.<br>
<br>
I run a daemon that waits for signals from OpenSIPS for triggering push<br>
notifications. Then the rest of the REST-API call (implementing the APN<br>
functionality) is handled within that separate daemon's thread. OpenSIPS is<br>
blocked for minimum amount of time during the REST call. How do you make your<br>
REST calls from the OpenSIPS script? Can you add an example?<br>
<br>
Also, in order to wake up Bob and receive calls, in my system I have basically<br>
made Alice to retry a given number of times. Since in my scenario, I control<br>
my SIP clients, it is feasible. But this may not apply to your case.<br>
<span class=""><br>
<br>
On 3/2/16 5:13 AM, José Expósito wrote:<br>
> Hi Babil,<br>
><br>
> Thank you very much for your answer.<br>
><br>
> I have another server that offers a RESTful API to send the push notifications,<br>
> store the tokens, etc.<br>
><br>
</span>> I'm using OpenSIPS *2.1.2*<br>
<span class="">><br>
> Jose<br>
><br>
> 2016-03-02 14:00 GMT+01:00 Babil (Golam Sarwar) <<a href="mailto:gsbabil@gmail.com">gsbabil@gmail.com</a><br>
</span>> <mailto:<a href="mailto:gsbabil@gmail.com">gsbabil@gmail.com</a>>>:<br>
<div class="HOEnZb"><div class="h5">><br>
> Hi José,<br>
> what is your mechanism to initiate sending the push? For example, what<br>
> function/script are you calling? Please also add the OpenSIPS version you are<br>
> using.<br>
><br>
> On 3/2/16 4:47 AM, José Expósito wrote:<br>
> > Hi all,<br>
> ><br>
> > I'm trying to implement Apple Push Notifications with OpenSIPS.<br>
> ><br>
> > At the moment, when Alice calls Bob and Bob is offline, I send the push<br>
> > notification to Bob and call async sleep until Bob becomes online and I<br>
> proceed<br>
> > whit the call as usual:<br>
> ><br>
> > > if (!lookup("location","m")) {<br>
> > > if (is_method("INVITE")) {<br>
> > > # Sends the notification here<br>
> > > t_reply("100", "Trying");<br>
> > > t_reply("180", "Ringing");<br>
> > > async(sleep("5"), wait_bob);<br>
> > > }<br>
> > ><br>
> > > [...]<br>
> > ><br>
> > > route[wait_bob] {<br>
> > > if (!lookup("location","m")) {<br>
> > > async(sleep("2"), wait_bob);<br>
> > > }<br>
> > > if (!t_relay()) { # This establishes the call as usual when Bob<br>
> > becomes online<br>
> > > send_reply("500","Internal Error");<br>
> > > }<br>
> > > exit;<br>
> > > }<br>
> ><br>
> ><br>
> > This mechanism works without problems, but, when integrating and RTP proxy<br>
> > OpenSIPS is randomly crashing after a while.<br>
> ><br>
> > That's why I'm trying to avoid the use of async sleep and switch to another<br>
> > mechanism.<br>
> ><br>
> > As usual, how do you solve this problem?<br>
> > Is there any way to send a new (re)INVITE when Bob becomes online?<br>
> ><br>
> > I'm trying to use create_dialog() when Bob registers, but it doesn't look to<br>
> > work -I'm probably using it wrong.<br>
> ><br>
> > Thank you very much in advance<br></div></div></blockquote></div></div></div></div>