-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for multiples calls (End and Accept/Decline) #115
Merged
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
50c6570
Support for multiples calls (End and Accept/Decline)
isaacakakpo1 9299945
Update ReadMe
isaacakakpo1 86742c8
Multiple Calls Update
isaacakakpo1 8a327a7
ReadMe Update
isaacakakpo1 c4d3655
Appdelegte CleanUp
isaacakakpo1 dbf305a
ReadMe Update
isaacakakpo1 4c8d0db
Remove Build Folder
isaacakakpo1 5a92657
Updated PodSpec File
isaacakakpo1 5ca203c
Delete Index.noindex directory
isaacakakpo1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -611,7 +611,7 @@ func onPushCall(call: Call) { | |
``` | ||
|
||
Likewise for ending calls, the `endCallFromCallkit(endAction:action)` method should be called from : | ||
|
||
```Swift | ||
func provider(_ provider: CXProvider, perform action: CXEndCallAction) { | ||
|
||
|
@@ -625,7 +625,68 @@ func provider(_ provider: CXProvider, perform action: CXEndCallAction) { | |
|
||
2. Logs on the receiver's end are essential for thorough debugging of issues related to push notifications. However, the debugger is not attached when the app is completely killed. To address this, you can simply put the app in the background. VOIP push notifications should then come through, and the debugger should capture all logs. | ||
|
||
|
||
__*Handling Multiple Calls*__ | ||
|
||
To handle multiples, we can rely on the `CXProviderDelegate` delegate which invokes functions corresponding to | ||
what action was performed on the callkit user interface. | ||
|
||
1. End and Accept or Decline : The **end and accept** button on the callkit user interface accepts the nwe call and ends the previous call. | ||
Callkit then invokes the `CXAnswerCallAction` and `CXEndCallAction` when the **end and accept** button is pressed. | ||
You can handle this scenario by : | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove the space before |
||
|
||
```Swift | ||
var currentCall: Call? | ||
var previousCall: Call? | ||
//current calkit uuid | ||
var callKitUUID: UUID? | ||
|
||
func onIncomingCall(call: Call) { | ||
guard let callId = call.callInfo?.callId else { | ||
print("AppDelegate:: TxClientDelegate onIncomingCall() Error unknown call UUID") | ||
return | ||
} | ||
print("AppDelegate:: TxClientDelegate onIncomingCall() callKitUUID [\(String(describing: self.callKitUUID))] callId [\(callId)]") | ||
|
||
self.callKitUUID = call.callInfo?.callId | ||
|
||
//Update the previous call with the current call | ||
self.previousCall = self.currentCall | ||
|
||
//Update the current call with the incoming call | ||
self.currentCall = call | ||
.. | ||
} | ||
|
||
``` | ||
Subsequently, when the user clicks on the End and Accept or Decline Button, you will need to determine which og these buttons was clicked. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. og -> of |
||
You can do that as follows: | ||
|
||
```Swift | ||
//Callkit invokes CXEndCallAction and CXAnswerCallAction delegate function for accept and answer | ||
func provider(_ provider: CXProvider, perform action: CXEndCallAction) { | ||
print("AppDelegate:: END call action: callKitUUID [\(String(describing: self.callKitUUID))] action [\(action.callUUID)]") | ||
|
||
// if the callKitUUID is the same as the one provided by the action | ||
// callkit expects you to end the current call | ||
if(self.callKitUUID == action.callUUID){ | ||
if let onGoingCall = self.previousCall { | ||
self.currentCall = onGoingCall | ||
self.callKitUUID = onGoingCall.callInfo?.callId | ||
} | ||
}else { | ||
//endPrevious Call | ||
self.callKitUUID = self.currentCall?.callInfo?.callId | ||
} | ||
self.telnyxClient?.endCallFromCallkit(endAction:action) | ||
} | ||
``` | ||
|
||
**Note** | ||
|
||
While handling multiple calls, you should **not** report the **call end** to callkit. This will keep your calls active with the callkit | ||
user interface until there are no more active sessions. | ||
|
||
|
||
|
||
### Disable Push Notification | ||
Push notfications can be disabled for the current user by calling : | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nwe -> new