public void StartCall(ActiveCallbackDelegate completionHandler) { // todo: make sure the start call and call status cahnged events are handled correctly. callDelegate = new ValidTVOCallDelegate(completionHandler, this); // todo: make the delegate methods call the relevant ACTION delegates (connect/hangup) NSDictionary <NSString, NSString> twimlParam = new NSDictionary <NSString, NSString>(); // The application needs to use this method to set up the AVAudioSession // with desired configuration before letting the CallKit framework activate the audio session. TwilioVoice.SharedInstance.ConfigureAudioSession(); var client = new RestClient("http://privatevoice.azurewebsites.net/"); var request = new RestRequest("BurnerPhone/Token?clientName=test", Method.GET); //request.AddParameter("To", "+17143913337"); //request.AddParameter("From", "+15416677319"); //request.AddParameter("Body", "Yo yo yo remove the json!"); client.Authenticator = new RestSharp.Authenticators.HttpBasicAuthenticator("ACda7fae80dbacc70808a453daf19951db", "c50527004eebf9ff58cb3749f51d540f"); var response = new RestResponse(); Task.Run(async() => { response = await GetResponseContentAsync(client, request) as RestResponse; }).Wait(); var output = response.Content; Console.WriteLine("JWT= " + output); callInstance = TwilioVoice.SharedInstance.Call( output, twimlParam, callDelegate ); // Simulate the call starting successfully completionHandler(true); //// Simulate making a starting and completing a connection //DispatchQueue.MainQueue.DispatchAfter(new DispatchTime(DispatchTime.Now, 3000), () => //{ // // Note that the call is starting // isConnecting = true; // // Simulate pause before connecting // DispatchQueue.MainQueue.DispatchAfter(new DispatchTime(DispatchTime.Now, 1500), () => // { // // Note that the call has connected // isConnecting = false; // isConnected = true; // }); //}); }
public void EndCall(ActiveCallbackDelegate completionHandler) { TwilioVoice.SharedInstance.StopAudioDevice(); if (callInstance != null) { isConnected = false; // Calling this method on a TVOCall that does not have the state of TVOCallStateConnected will have no effect. callInstance.Disconnect(); completionHandler(true); } else { completionHandler(false); } }
public void AnswerCall(ActiveCallbackDelegate completionHandler) { ValidTVONotificationDelegate incomingDelegate = new ValidTVONotificationDelegate(); // RCP: Workaround from https://forums.developer.apple.com/message/169511 suggests configuring audio in the // completion block of the `reportNewIncomingCallWithUUID:update:completion:` method instead of in // `provider:performAnswerCallAction:` per the WWDC examples. // [[TwilioVoice sharedInstance] configureAudioSession]; NSDictionary <NSString, NSString> twimlParam = new NSDictionary <NSString, NSString>(); // incomingDelegate // Simulate the call being answered isConnected = true; completionHandler(true); }
public void StartCall(ActiveCallbackDelegate completionHandler) { // Simulate the call starting successfully completionHandler(true); // Simulate making a starting and completing a connection DispatchQueue.MainQueue.DispatchAfter(new DispatchTime(DispatchTime.Now, 3000), () => { // Note that the call is starting IsConnecting = true; // Simulate pause before connecting DispatchQueue.MainQueue.DispatchAfter(new DispatchTime(DispatchTime.Now, 1500), () => { // Note that the call has connected IsConnecting = false; IsConnected = true; }); }); }
public void EndCall(ActiveCallbackDelegate completionHandler) { // Simulate the call ending IsConnected = false; completionHandler(true); }
public void AnswerCall(ActiveCallbackDelegate completionHandler) { // Simulate the call being answered IsConnected = true; completionHandler(true); }