public HttpResponseMessage Wait() { try { LogQueryString("Wait"); if (Convert.ToInt32(GetQueryParam("QueueTime")) == 0) { ApiHelper.SaveOrUpdateCallHistory(GetQueryParam("CallSid"), GetQueryParam("CallSid"), queueDate: DateTime.UtcNow); var to = GetQueryParam("RedirectTo"); if (string.IsNullOrEmpty(to)) { SignalRHelper.Enqueue(GetQueryParam("CallSid")); } else { SignalRHelper.Incoming(GetQueryParam("CallSid"), to); } } return(GetHttpResponse(TwilioResponseHelper.Wait(GetQueryParam("QueueSid"), GetQueryParam("QueueTime"), GetQueryParam("CurrentQueueSize")))); } catch (Exception e) { Log.Error(e); throw; } }
public HttpResponseMessage Dial() { try { LogQueryString("Dial"); ApiHelper.UploadRecord(GetQueryParam("DialCallSid"), GetQueryParam("CallSid"), GetQueryParam("RecordingUrl")); ApiHelper.SaveOrUpdateCallHistory(GetQueryParam("DialCallSid"), GetQueryParam("CallSid"), endDialDate: DateTime.UtcNow, recordUrl: GetQueryParam("RecordingUrl"), recordDuration: GetQueryParam("RecordingDuration")); if (!Settings.Pause) { SignalRHelper.ChangeAgentStatus((int)AgentStatus.Online); } SignalRHelper.End(); Task.Run(() => new ApiHelper(GetQueryParam("Tenant"), GetQueryParam("CallerId")).SavePrice(GetQueryParam("DialCallSid"), GetQueryParam("CallSid"))); return(GetHttpResponse(TwilioResponseHelper.Dial())); } catch (Exception e) { Log.Error(e); throw; } }
public HttpResponseMessage GatherQueue() { try { LogQueryString("GatherQueue"); return(GetHttpResponse(TwilioResponseHelper.GatherQueue(GetQueryParam("Digits"), GetQueryParam("To").Substring(1)))); } catch (Exception e) { Log.Error(e); throw; } }
public HttpResponseMessage Redirect() { try { LogQueryString("Redirect"); return(GetHttpResponse(TwilioResponseHelper.Redirect(GetQueryParam("RedirectTo")))); } catch (Exception e) { Log.Error(e); throw; } }
public HttpResponseMessage Queue() { try { LogQueryString("Queue"); return(GetHttpResponse(TwilioResponseHelper.Queue())); } catch (Exception e) { Log.Error(e); throw; } }
public HttpResponseMessage VoiceMail() { try { LogQueryString("VoiceMail"); ApiHelper.SaveOrUpdateCall(GetQueryParam("CallSid"), status: VoipCallStatus.Missed); SignalRHelper.VoiceMail(GetQueryParam("CallSid")); return(GetHttpResponse(TwilioResponseHelper.VoiceMail())); } catch (Exception e) { Log.Error(e); throw; } }
public HttpResponseMessage Enqueue() { try { LogQueryString("Enqueue"); if (GetQueryParam("QueueResult") != "bridged" && GetQueryParam("QueueResult") != "redirected") { ApiHelper.SaveOrUpdateCall(GetQueryParam("CallSid"), status: VoipCallStatus.Missed); SignalRHelper.MissCall(GetQueryParam("CallSid")); } return(GetHttpResponse(TwilioResponseHelper.Enqueue(GetQueryParam("QueueResult")))); } catch (Exception e) { Log.Error(e); throw; } }
public HttpResponseMessage Dequeue() { try { LogQueryString("Dequeue"); if (Convert.ToBoolean(GetQueryParam("Reject"))) { ApiHelper.SaveOrUpdateCall(GetQueryParam("CallSid"), status: VoipCallStatus.Missed); SignalRHelper.MissCall(GetQueryParam("CallSid")); return(GetHttpResponse(TwilioResponseHelper.Leave())); } ApiHelper.AnswerCall(GetQueryParam("CallSid"), GetQueryParam("From"), GetQueryParam("To")); return(GetHttpResponse(TwilioResponseHelper.Dequeue())); } catch (Exception e) { Log.Error(e); throw; } }
private HttpResponseMessage Outbound() { SignalRHelper.ChangeAgentStatus((int)AgentStatus.Paused); ApiHelper.SaveOrUpdateCall(GetQueryParam("CallSid"), GetQueryParam("From"), GetQueryParam("To"), GetQueryParam("CallerId"), status: VoipCallStatus.Outcoming, contactId: GetQueryParam("ContactId")); return(GetHttpResponse(TwilioResponseHelper.Outbound())); }
private HttpResponseMessage Inbound() { ApiHelper.SaveCall(GetQueryParam("CallSid"), GetQueryParam("From"), GetQueryParam("To"), VoipCallStatus.Incoming); return(GetHttpResponse(TwilioResponseHelper.Inbound())); }
private TwilioResponseHelper GetTwilioResponseHelper() { return(twilioResponseHelper ?? (twilioResponseHelper = new TwilioResponseHelper(GetSettings(), CommonLinkUtility.GetFullAbsolutePath("")))); }