Configuring push notification

This example is written for the Canistracci OIL tenant. Create the objects with a Docs Demo prefix, test them on non-production numbers, and then adapt the same structure for the production tenant.

Configuring push notification

If you have a mobile phone and you have developed your own softphone application, you may need to trigger a push notification to wake up your mobile application to be able to get your call. When you are dialing an extension and you have activated the "Push notification" checkbox, the script at /var/lib/asterisk/agi-bin/the related application page is triggered. You can't customize directly the the related application page script or otherwise it will be overwritten at each MiRTA PBX upgrade, instead you need to create a /var/lib/asterisk/agi-bin/the related application page script contaning at least a function like:

function pushnotification_custom($tenantid,$peername) {

...

}

The parameters will be the id of the tenant and the extension name, like 100-DEVEL. Nothing is expected in return. You pushnotification_custom function will do the real push notification.

If you need to wait until the extension is online, you can add the following code to your function:

$dbpeername=$dbconn->qstr($peername);

$steps=0;

while ($steps<30) {

$sql="select * from st_states where st_extension=$dbpeername";

$rs=$dbconn->Execute($sql);

$agi->verbose("Extension is in ".$rs->fields['st_state']);

if ($rs->fields['st_state']!='NOT_INUSE') {

sleep(1);

$steps++;

} else {

break;

}

}

Don't forget to use a global $dbconn command to inherit the database connection.

Canistracci OIL example screen for Configuring push notification.
Canistracci OIL example screen for Configuring push notification.

Validation


Revision #5
Created 2026-06-02 22:01:36 UTC by Admin
Updated 2026-06-02 22:14:21 UTC by Admin