Ejemplo n.º 1
0
        public void Dispose()
        {
            if (CallInvite != null)
            {
                CallInvite.Reject();
                CallInvite.Dispose();
                CallInvite = null;
            }

            if (Call != null)
            {
                Call.Disconnect();
                Call.Dispose();
                Call = null;
            }

            if (_callDelegate != null)
            {
                _callDelegate.CallDidConnectEvent                -= CallDelegateOnCallDidConnectEvent;
                _callDelegate.CallDidDisconnectWithErrorEvent    -= CallDelegateOnCallDidDisconnectWithError;
                _callDelegate.CallDidFailToConnectWithErrorEvent -= CallDelegateOnCallDidFailToConnectWithErrorEvent;
                _callDelegate = null;
            }

            if (_notificationDelegate != null)
            {
                _notificationDelegate.CallInviteReceivedEvent -= NotificationDelegateOnCallInviteReceivedEvent;
                _notificationDelegate.NotificationErrorEvent  -= NotificationDelegateOnNotificationErrorEvent;
                _notificationDelegate = null;
            }
        }
Ejemplo n.º 2
0
        public TwilioVoiceHelper()
        {
#if DEBUG
            TwilioVoice.LogLevel = TVOLogLevel.Debug;
#endif
            _callDelegate                                     = CallDelegate.Instance;
            _notificationDelegate                             = NotificationDelegate.Instance;
            _callDelegate.CallDidConnectEvent                -= CallDelegateOnCallDidConnectEvent;
            _callDelegate.CallDidDisconnectWithErrorEvent    -= CallDelegateOnCallDidDisconnectWithError;
            _callDelegate.CallDidFailToConnectWithErrorEvent -= CallDelegateOnCallDidFailToConnectWithErrorEvent;
            _notificationDelegate.CallInviteReceivedEvent    -= NotificationDelegateOnCallInviteReceivedEvent;
            _notificationDelegate.NotificationErrorEvent     -= NotificationDelegateOnNotificationErrorEvent;
            _callDelegate.CallDidConnectEvent                += CallDelegateOnCallDidConnectEvent;
            _callDelegate.CallDidDisconnectWithErrorEvent    += CallDelegateOnCallDidDisconnectWithError;
            _callDelegate.CallDidFailToConnectWithErrorEvent += CallDelegateOnCallDidFailToConnectWithErrorEvent;
            _notificationDelegate.CallInviteReceivedEvent    += NotificationDelegateOnCallInviteReceivedEvent;
            _notificationDelegate.NotificationErrorEvent     += NotificationDelegateOnNotificationErrorEvent;
        }