         
         outgoingCall = VoiceClient.sharedInstance().call(accessToken, params: [:], delegate: self)
         
+        if (outgoingCall == nil) {
+            NSLog("Failed to start outgoing call")
+            return
+        }
+        
         toggleUIState(isEnabled: false)
         startSpin()
     }

    
    
    // MARK: TVOIncomingCallDelegate
    func incomingCallIsConnecting(_ incomingCall: TVOIncomingCall) {
        NSLog("incomingCallIsConnecting:")
    }
    
    func incomingCallDidConnect(_ incomingCall: TVOIncomingCall) {
        NSLog("incomingCallDidConnect:")
        

                }
            }
        }
        
        self.incomingCall = nil
        
        UIApplication.shared.cancelAllLocalNotifications()
    }
    
    func notificationError(_ error: Error) {
