0

I have installed the asterisk server and compiled the latest linphone iOS source code. Now all works great without being background and lock phone screen, calling.

When app is closed or iPhone screen lock, I can not receive call from other linphone (download from playstore).

I have registered both linphone to asterisk server using SIP.

I have also created development/distribute certificates, APNS, VOIP push on apple account.

But still i can not receive call to iOS app, So my question:

  1. Will i have to use Any push supported proxy for that like flexisip, Opensips, kamailio etc. or I can just use Asterisk and Linphone or any other way to get notification when app is closed or lock screen?

Also will have to use any third party server for push notification to wakeup the app, like pusher, onesignal?

Thanks

Rashed
  • 2,349
  • 11
  • 26
abcd gef
  • 59
  • 1
  • 11

4 Answers4

2

You can use flexisip. It semi-working and no documentation

You can use asterisk or kamailio, but you should do push yourself by external scripts and dialplan.

arheops
  • 15,544
  • 1
  • 21
  • 27
  • Thanks @arheops. I know about that but my question is, really need to use any proxy like flexisip, opensips for push.. without that i can not wakeup the app i.e. only using asterisk? – abcd gef Mar 01 '18 at 07:01
  • Sure you can. See FastAGI/AMI. But you have write that. No golden bullet. – arheops Mar 01 '18 at 13:39
  • I have created the dialplan and created the AGI script to send push to linphone app, but I have other question.. How can I get push token for a spacific iOS device, so after getting push token I can send push to that particular iOS device, because I need push token before call made, is this possible? how? can you guide me? – abcd gef Mar 04 '18 at 07:04
  • You have store token for user using your app or web in database and do lookup via func_odbc or REALTIME. Sorry, how to get token and store is out of asterisk topic. – arheops Mar 04 '18 at 16:42
  • Yes I already made those setting through database but I checked that some time (push notification server does not respond in time, so no wakeup made), I think this is due to huge load of apple push server or might be wrong on setup. – abcd gef Mar 05 '18 at 14:25
  • Apple say you have expect push delivery take upto minute. You can solve that by re-dial, re-push, using queue etc. It is not topic for SO, just programming. – arheops Mar 08 '18 at 08:26
  • can we send token in sip header? – Paresh. P Jul 15 '19 at 08:09
  • If you use kamailio/opensips - you can add any header to any packet. Asterisk - only to first INVITE. – arheops Jul 15 '19 at 17:16
1

I'm thinkering with linphone and flexisip as well and it's not working for me. I thought I could ditch flexisip and push directly from asterisk before dialing the extension. I've got a agi script that gets the pn-tok from the contact and then does a push:

$serverKey = "   long string coming from firebase   ";
$notif = ['title' => 'You have a call', 'body' => "Call from $CLI"];
$headers = [CURLOPT_HTTPHEADER => ["Authorization: key=$serverKey", 'Content-Type: application/json']];
$pjsipContact = ast_get_var("PJSIP_AOR(1000,contact)");
if(!empty($pjsipContact)) {
  $pjsipUri = ast_get_var("PJSIP_CONTACT($pjsipContact,uri)");
  preg_match('/pn-tok=([^;]+)/', $pjsipUri, $toArr);
  if (count($toArr) == 2) {
    log_cli("send noti to {$toArr[1]}");
    curlGetPage('https://fcm.googleapis.com/fcm/send', json_encode(['to' => $toArr[1], 'notification' => $notif]), $headers, 443, 'POST', TRUE);
  }
}

with this agi the phone receive the push and shows it in the notifications, but linphone doesn't come back to life. Is there a specific format for the push notification to actually wake up linphone and make it register again?

Thanks.

Syco
  • 799
  • 2
  • 14
  • 23
0

You can certainly push to your own compiled Linphone app to wake it before a call using asterisk only. The gist is to get the push token from the client contact info using the DB dialplan function and passing it out to an AGI script which will then use the token to initiate the push and wake the device. You need to add a wait delay to allow the phone to re-register first, then you can do a dial() to the extension . With Android you need to use the "data" msg type and not the "notification" type or the phone won't wake and only display a notification. Please see this post for details on how to accomplish this. Note, the post discusses Android but can be easily adapted to IOS by modifying the push.php script .

https://community.asterisk.org/t/interest-in-implementing-sip-push-notification/75563/19

0

enter image description here For voip calls mobile client has to receive push notification and then register itself with the SIP server in order to receive Call-invite . So any softswitch or PBX can have this mechanism to initiate push-notification and wait for the offline client to come online and send invite request . So PBX plays important role here to wait and forward invite after client appears online.

You can use push scripts from this github repository .