[OpenSIPS-Users] Fwd: Push notifications

Babil (Golam Sarwar) gsbabil at gmail.com
Thu Mar 3 12:07:24 CET 2016


Hi José,
thanks for the details. I have Grocer gem with Rails.

> Do you send multiple INVITEs to the SIP server until Bob becomes online?

Yes. If Alice receives 404 when trying to reach Bob, we retry for a given
number of seconds, until Bob registers and can accept the call.


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

--
Regards,
Babil (Golam Sarwar)

PGP Key Download URL: http://bit.ly/gsbabil-pgp-key
PGP Key Fingerprint : D3A1 EED0 5BA0 72D3 A011 75CB 8EA6 7D99 F433 E92D



More information about the Users mailing list