Setting up push notifications for Zoiper on Windows Phone

I recently moved to Windows Phone, and it’s a mobile OS that really makes sense to me. However, it does have one drawback: The option to run apps in the background is very limited.

The best option is described to Zoiper themselves: Set up push notifications to wake the Zoiper client. There’s a rough guide here: http://www.zoiper.com/en/tutorials/push-notifications

But that was easier said than done. I don’t even know how to edit the extensions.conf file (I’ve read that editing the file won’t do anything as FreePBX will write over any changes I do), and have no clue on how to “add additional filtering to avoid specially crafted sip headers from being executed through the system command”. I don’t even know what it means!

Have anybody here done this and could give me a few pointers?

Were you able to set this up ?

No, I’m not familiar enough with Asterisk/FreePBX to make it work myself. :frowning:

In FreePBX, looks like the right way to do that, is through a custom destination / custom application. More info may be supplied by people who know how to do that :wink:

Hope they post something in the forums. I’m still trying without any progress! :confused:

I have seen @lgaetz come up with cool stuff…

The above linked page at zoiper gives a dialplan snippet for calling a script that wakes the client. It is easy (for me anyway) to modify the dialplan to work with FreePBX, but the contents of the script, push.sh are missing, which is the most critical part.

*edit#1 - on re-reading, I see the script is here.
*edit#2 - basic testing of the push.sh and not sure it works, but don’t have a windows phone so can’t say definitively. giving up. If anyone wants to pursue this through paid support put my name on the ticket.

I have a Windows Phone and I’m VERY willing to test it.

But how? :slight_smile:

Can someone with a windows phone zoiper client registered to their system as a SIP extension provide the sanitized output from:

asterisk -x "database show SIP/Registry/1007"

where the win phone extension is substituted in place of the 1007.

Yes, I’m sorry for the delay!

[root@localhost ~]# asterisk -x "database show SIP/Registry/100"
/SIP/Registry/100                                 : 192.168.0.231:35218:3600:100:sip:[email protected]:35218;transport=UDP;rinstance=c7d3e36189c9b230;X-PUSH-URI=http://e.redacted.net/u/1/db5/H2QAAAA1sUnQXyQj-yf6qegjY9TEDLUBlhKDMQmDzZKDUtP_sVcyIl5b7qTBv9ZJ0tan2Oy-pL_lkLEi3o8_hKyEj5eOt_3BMureOe_JAQhkweQAvRv6xjeYoh2GDDUzqW6hXL1/d2luZG93c3Bob25lZGVmYXVsdA/EW_BnIu3fUOH7FePoWYHNw/lqSm8IOhCstqRiVKm24Zy4mGvpA
1 results found.

I have no idea what I’m looking at, but there’s a push URL in there…

Took a month, but finally have a sleepy Saturday. Can’t test any of this 'cause I don’t have a windows phone

Add block of code below to /etc/asterisk/extensions_custom.conf:


[zoiper-notify]
exten => _X.,1,Verbose(0, Entering user defined context [zoiper-notify] in extensions_custom.conf)
exten => _X.,n,Set(location=${DB(SIP/Registry/${EXTEN})})
exten => _X.,n,Verbose(0, getting push info ${location} );
exten => _X.,n,Set(regx="X-PUSH-URI=([0-9a-zA-Z\.\:\/\_]+)")
exten => _X.,n,Set(push=$["${location}" =~ ${regx}])
exten => _X.,n,System(/usr/bin/push.sh ${push});
exten => _X.,n,Wait(3);
exten => _X.,n,Return;

Copy push.sh to PBX:


cd /usr/bin
wget http://www.zoiper.com/downloads/push.sh
chown asterisk:asterisk /usr/bin/push.sh

To create a zoiper notify for extension 1001, browse to Admin, Custom Destination, create a new custom destination for extension 1001 with the text:
zoiper-notify,1001,1
select return, and set the destination to ring extension 1001

If a dialable feature code is required, create one in Misc Applications, otherwise use the Custom Destination as FreePBX destination where required.

The zoiper-notify context hard codes SIP, which surprisingly appears to work with PJSIP extensions as well, requires testing tho. The above method is bare bones, there are much more elegant ways of doing this. A more advanced user might consider a splice into the context func-apply-sipheaders check for the existence of the zoiper register string in the astdb, if it exists gosub to the notify context and return. Requires no additional FreePBX config and would all happen invisibly behind the scenes. Left as an exercise for the reader.

Hmm… I can’t get this to work, but I have a feeling this has more to do with Zoiper on Windows Mobile being a crappy app, than your code not working. With Zoiper I suddenly can’t receive incomming calls, but with other clients (like “Linphone”) it rings like it should.

I also have some FWconsloe not found issues :cry: , but I’m not sure it’s related.