问题
I have an iphone app in which I need to manage video call from caller to receiver and its works perfectly by using Opentok framework. Video call and audio everything working fine. But I have a problem with Ending a call from receiver side without picking up the call.
If receiver picked up the call and Then he ends the call then caller receives event of ending a call. But when if receiver doesn't picked up the call from app and directly end the call then caller doesn't get any event and it continuously showed up the calling screen. All delegates and its methods are implemented.
Delegates are OTSessionDelegate
, OTSubscriberDelegate
, OTPublisherDelegate
. And it's all required and optional methods are implemented and working fine.
objects in header file are
#import <Opentok/Opentok.h>
@interface myViewController : UIViewController
{
OTSession* session;
OTPublisher* publisher;
OTSubscriber* subscriber;
}
And I am calling doUnpublish
method to end the call. The code is
- (void)doUnpublish
{
[loaderviewView removeFromSuperview];
[_session unpublish:_publisher];
[_session disconnect];
[player stop];
[self doDisconnect];
}
- (void)doDisconnect
{
[callingView setHidden:YES];
timer invalidate];
[_session disconnect];
}
It is working fine if receiver receive the call and then ends the call. But if he doesn't receive the call and directly ends up then caller doesn't get event that call is ended by receiver.
I does not provide more code because it contains private details code which I have to manage for call information. And it is not a problem and working fine. I just need to know how can i get event in caller side that receiver ended a call without Accepting the call.
My whole app is ready and because of this situation I am paused. Any help will be appreciated.
回答1:
When Receiver clicks on end call your doUnpublish method gets called, which in turns calls session disconnect to disconnect from an opentok session. Session disconnect causes the Caller's delegate connectionDestroyed to get triggered so Caller knows that Receiver has disconnected from the session.
The problem arises when Receiver never picks up the call so he never connects to the OpenTok Session. If he never connects to the session, the Caller's connectionCreated and connectionDestroyed delegates will never get fired.
The way to solve your problem is to set a timer. On the caller's end, start the timer when he calls the Receiver. If connectionCreated delegate is not fired in 1 minute, that means that the Receiver either rejected the call or missed the call.
来源:https://stackoverflow.com/questions/25309084/caller-doesnt-get-event-of-end-call-from-receiver-in-opentok-ios-sdk