Open nocodedweb opened 4 years ago
@nocodedweb any luck with that so far ? I'm also struggling with that.
@nocodedweb Did you managed to get this working? I am seeing the same issue. test VOIP with simplepush.php script works when app is open, but it does not when app is in background/closed
Did someone was able to make it work?
@danielehrhardt
We managed to get it working, here is a working version of the plugin that we are using
https://github.com/AleksandarTokarev/cordova-plugin-callkit/tree/trusted-care-master
Make sure you are on branch trusted-care-master
, as in the link
We are using AWS SNS to send VoiP Push Notifications with NodeJs, here is the code for that:
const caller = `${currentUser.profile.firstname} ${currentUser.profile.lastname}`
let voip_protocol = `APNS_VOIP` // `APNS_VOIP_SANDBOX` for Sandbox AWS Env
let payload = {}
let voip_protocol_value = `{"aps" : { "alert": "New Incoming Call" }, "data" : { "Caller": { "Username" : "${caller}", "ConnectionId": "${callId}", "CallbackUrl": "${getExternalRootUrl()}updateStatus", "CancelPush": "${isCancel}"}}}`
payload[`${voip_protocol}`] = voip_protocol_value
let params = {
'Message': JSON.stringify(payload),
'MessageAttributes': {
'AWS.SNS.MOBILE.APNS.PRIORITY': {
'DataType': 'String',
'StringValue': '10',
},
'AWS.SNS.MOBILE.APNS.PUSH_TYPE': {
'DataType': 'String',
'StringValue': 'voip',
},
[`AWS.SNS.MOBILE.${voip_protocol}.TTL`]: {
'DataType': 'String',
'StringValue': '0',
},
},
'MessageStructure': 'json',
'TargetArn': userWithTokenFound.endpointArn,
}
try {
sns.publish(params).promise()
Logger.info(`IOS Voip Push for user sent`, { user_id })
} catch (error) {
Logger.info(`IOS Voip Push for user sending error`, { error })
}
Basically here is the logic,
We maintain a list of statuses of the call in the database, connecting
, ringing
, active
, ended
.
We use the getExternalRootUrl()
method to get the URL of the server that the 'Mobile Device' calls an endpoint on to change the status.
Let me know if u have any questions
@danielehrhardt We managed to get it working, here is a working version of the plugin that we are using https://github.com/AleksandarTokarev/cordova-plugin-callkit/tree/trusted-care-master Make sure you are on branch
trusted-care-master
, as in the link We are using AWS SNS to send VoiP Push Notifications with NodeJs, here is the code for that:const caller = `${currentUser.profile.firstname} ${currentUser.profile.lastname}` let voip_protocol = `APNS_VOIP` // `APNS_VOIP_SANDBOX` for Sandbox AWS Env let payload = {} let voip_protocol_value = `{"aps" : { "alert": "New Incoming Call" }, "data" : { "Caller": { "Username" : "${caller}", "ConnectionId": "${callId}", "CallbackUrl": "${getExternalRootUrl()}updateStatus", "CancelPush": "${isCancel}"}}}` payload[`${voip_protocol}`] = voip_protocol_value let params = { 'Message': JSON.stringify(payload), 'MessageAttributes': { 'AWS.SNS.MOBILE.APNS.PRIORITY': { 'DataType': 'String', 'StringValue': '10', }, 'AWS.SNS.MOBILE.APNS.PUSH_TYPE': { 'DataType': 'String', 'StringValue': 'voip', }, [`AWS.SNS.MOBILE.${voip_protocol}.TTL`]: { 'DataType': 'String', 'StringValue': '0', }, }, 'MessageStructure': 'json', 'TargetArn': userWithTokenFound.endpointArn, } try { sns.publish(params).promise() Logger.info(`IOS Voip Push for user sent`, { user_id }) } catch (error) { Logger.info(`IOS Voip Push for user sending error`, { error }) }
Basically here is the logic, We maintain a list of statuses of the call in the database,
connecting
,ringing
,active
,ended
. We use thegetExternalRootUrl()
method to get the URL of the server that the 'Mobile Device' calls an endpoint on to change the status. Let me know if u have any questions
Thank you so much!!
What library do you use: https://github.com/AleksandarTokarev/phonegap-plugin-push or https://github.com/havesource/cordova-plugin-push
@danielehrhardt for Android Push Notifications and calling we are using my fork and this branch https://github.com/AleksandarTokarev/phonegap-plugin-push/tree/android-native-caller . We modified it to work with Android 10 The link on my previous comment is only for IOS
Hello there! Trying to display an incoming call using this plugin with no luck so far. I installed this plugin yesterday and was able to receive a test VoIP notification alert using an AWS SNS application endpoint once, then I didn't receive any alerts after when the app was completely closed or minimized. However, I would receive alerts with the "notification" event if the app was open and visible. Did I miss something in the implementation?
I'm on iOS 13.4, compiling in Xcode 11. Thanks in advance!