Push Notifications

New features you'd like see on SIP Sorcery
Post Reply
bioflowtanks
Posts: 3
Joined: Tue Feb 09, 2010 11:02 am
Location: Dublin
Contact:

Push Notifications

Post by bioflowtanks » Tue May 13, 2014 3:13 pm

Hi Aaron,

I’m using a Nokia Windows 8 Phone and would like a SIP softphone that runs in the background but Microsoft doesn't like this.

Linphone have a feature for “Audio incoming calls in background mode using push notifications (only for sip.linphone.org accounts)”. This didn't work for me. Anyway I would prefer to use my SipSorcery account.

Zoiper softphone have push notifications but I need help with a dial plan.
http://www.windowsphone.com/en-ie/store ... 8fa1660737

Thanks, Stephen.

Aaron
Site Admin
Posts: 4652
Joined: Thu Jul 12, 2007 12:13 am

Re: Push Notifications

Post by Aaron » Sat May 17, 2014 2:48 am

I've had a look at http://www.zoiper.com/en/tutorials/push-notifications and that should be feasible with sipsorcery. It will take a few days to put the script together and I'll post back when I have something.

Aaron
Site Admin
Posts: 4652
Joined: Thu Jul 12, 2007 12:13 am

Re: Push Notifications

Post by Aaron » Thu May 22, 2014 11:57 am

The code snippet below will iterate through your sipsorcery SIP account bindings and if it finds the Zoiper X-PUSH-URI string in the binding will send a HTTP GET request to the URL. You will need to add this snippet to the extension that you want to use to place calls to your Zoiper softphone.

Code: Select all

bindings = sys.GetBindings("your_zoiper_account", "sipsorcery.com")
if bindings != nil then
 bindings.each { |binding|
  sys.Log("binding contact=#{binding.ContactURI.ToString()}")

  if binding.ContactURI.ToString() =~ /X-PUSH-URI=(.*)/ then
    sys.WebGet($1)
    sleep(2)
  end
 }
end

MGifos
Posts: 5
Joined: Thu Nov 10, 2011 9:06 pm

Re: Push Notifications

Post by MGifos » Wed Nov 11, 2015 11:45 am

Hi Aaron, Thanks for this work, some time ago, for Push notification. I have tried to use this code in my Dial Plan. The code line,
if binding.ContactURI.ToString() =~ /X-PUSH-URI=(.*)>/ then
does not find the string and does not execute the following statements. However the string "X-PUSH-URI=" does exist, and if I change the code to,
if binding.ContactURI.ToString() =~ /X-PUSH-URI=/ then
the string is found.
I am not sure what the (.*)< is mean to do and the relationship to the $1, but it seems to stop the string from being found.

An example of the binding contact string is below, truncated.
sip:xxxxxxx@nnn.nnn.nnn.nnn:16980;transport=UDP;rinstance=089abc1ee935cc85;X-PUSH-URI=http://s.notify.live.net/u/1/hk2/H2QAAA ... UcIANFwdXk

Aaron
Site Admin
Posts: 4652
Joined: Thu Jul 12, 2007 12:13 am

Re: Push Notifications

Post by Aaron » Thu Nov 12, 2015 8:56 am

How about if you just remove the '>' character from the end of the regular expression? Looks like it might have been a typo.

Example:

Code: Select all

if binding.ContactURI.ToString() =~ /X-PUSH-URI=(.*)/ then
....
The (.*) is a regular expression grouping expression and the line of code that specifies $1 is using the captured value.

MGifos
Posts: 5
Joined: Thu Nov 10, 2011 9:06 pm

Re: Push Notifications

Post by MGifos » Sat Nov 14, 2015 1:22 am

Thanks very much. That works.

Post Reply