/// <summary> /// Click to call /// </summary> /// <param name="entity"></param> /// <returns></returns> public static async Task<LG.Data.Models.Doctors.ConsultWizard.CallInstance> StartClickToCall(LG.Data.Models.Doctors.ConsultWizard.StartClickToCall entity) { var client = ClientConnection.GetOMS_Connection(); var result = new CallInstance() { ConsultationID = entity.ConsultationID }; try { client.Open(); var response = await client.StartClickToCallPhoneConsultationAsync(new StartClickToCallPhoneConsultationRequest() { PropBag = PropBag, MessageGuid = Guid.NewGuid(), ConsultationID = entity.ConsultationID, MedicalPractitionerRID = entity.MedicalPractionerRID, MedicalPractitionerPhoneNumber = entity.MedicalPractionerPhoneNumber, }); result.PinCode = response.PinCode; result.CallSid = response.CallSid; entity.IsError = response.ReturnStatus.IsError; entity.Message = response.ReturnStatus.ErrorMessage; } catch (Exception ex) { client.Abort(); entity.IsError = true; entity.Message = ex.ToString(); } finally { if (client.State != CommunicationState.Closed) { client.Close(); } } return result; }
public static async Task <LG.Data.Models.Doctors.ConsultWizard.CallInstance> GetCallStatus(LG.Data.Models.Doctors.ConsultWizard.CallInstance entity) { var client = ClientConnection.GetOMS_Connection(); try { client.Open(); var response = await client.GetCallStatusAsync(new GetCallStatusRequest() { CallSid = entity.CallSid, MessageGuid = Guid.NewGuid(), IVRProvider = IVRProvidersEnum.Twilio }); entity.CallStatus = response.CallStatus; } catch (Exception ex) { client.Abort(); entity.IsError = true; entity.Message = ex.ToString(); } finally { if (client.State != CommunicationState.Closed) { client.Close(); } } return(entity); }