Page 1 of 1

Push Notifications

Posted: Tue May 13, 2014 3:13 pm
by bioflowtanks
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.

Re: Push Notifications

Posted: Sat May 17, 2014 2:48 am
by Aaron
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.

Re: Push Notifications

Posted: Thu May 22, 2014 11:57 am
by Aaron
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

Re: Push Notifications

Posted: Wed Nov 11, 2015 11:45 am
by MGifos
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

Re: Push Notifications

Posted: Thu Nov 12, 2015 8:56 am
by Aaron
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.

Re: Push Notifications

Posted: Sat Nov 14, 2015 1:22 am
by MGifos
Thanks very much. That works.