public HttpResponseMessage Dial(TwilioVoiceRequest request, [FromUri] Guid callerId, [FromUri] int contactId = 0, [FromUri] string reject = null) { try { request.AddAdditionalFields(callerId, contactId, reject); var call = CallFromTwilioRequest(request); call = voipEngine.SaveOrUpdateCall(call); var parentCall = Global.DaoFactory.GetVoipDao().GetCall(call.ParentID); if (!string.IsNullOrEmpty(request.RecordingSid)) { if (parentCall.VoipRecord == null || string.IsNullOrEmpty(parentCall.VoipRecord.Id)) { parentCall.VoipRecord = new VoipRecord { Id = request.RecordingSid }; } Global.DaoFactory.GetVoipDao().SaveOrUpdateCall(parentCall); } voipEngine.SaveAdditionalInfo(parentCall.Id); return(GetHttpResponse(request.Dial())); } catch (Exception e) { Log.Error(e); throw; } }
public HttpResponseMessage Dequeue(TwilioVoiceRequest request, [FromUri] Guid?callerId = null, [FromUri] int contactId = 0, [FromUri] string reject = "") { try { using (var scope = DIHelper.Resolve()) { var voipEngine = new VoipEngine(scope.Resolve <DaoFactory>()); request.AddAdditionalFields(callerId, contactId, reject); if (Convert.ToBoolean(request.Reject)) { MissCall(request, voipEngine); return(GetHttpResponse(request.Leave())); } voipEngine.AnswerCall(CallFromTwilioRequest(request)); return(GetHttpResponse(request.Dequeue())); } } catch (Exception e) { Log.Error(e); throw; } }
public HttpResponseMessage Wait(TwilioVoiceRequest request, [FromUri] Guid?callerId = null, [FromUri] int contactId = 0, [FromUri] string redirectTo = null) { try { request.AddAdditionalFields(callerId, contactId, redirectTo: redirectTo); if (Convert.ToInt32(request.QueueTime) == 0) { var history = CallFromTwilioRequest(request); history.ParentID = history.Id; voipEngine.SaveOrUpdateCall(history); var to = request.RedirectTo; if (string.IsNullOrEmpty(to)) { request.GetSignalRHelper().Enqueue(request.CallSid, callerId.HasValue ? callerId.Value.ToString() : ""); } else { request.GetSignalRHelper().Incoming(request.CallSid, to); } } return(GetHttpResponse(request.Wait())); } catch (Exception e) { Log.Error(e); throw; } }
public HttpResponseMessage Redirect(TwilioVoiceRequest request, [FromUri] string redirectTo, [FromUri] Guid?callerId = null) { try { request.AddAdditionalFields(callerId, redirectTo: redirectTo); return(GetHttpResponse(request.Redirect())); } catch (Exception e) { Log.Error(e); throw; } }
public HttpResponseMessage GatherQueue(TwilioVoiceRequest request, [FromUri] Guid?callerId = null, [FromUri] int contactId = 0) { try { request.AddAdditionalFields(callerId, contactId); return(GetHttpResponse(request.GatherQueue())); } catch (Exception e) { Log.Error(e); throw; } }
public HttpResponseMessage Client(TwilioVoiceRequest request, [FromUri] Guid callerId) { try { request.AddAdditionalFields(callerId); voipEngine.SaveOrUpdateCall(CallFromTwilioRequest(request)); return(GetHttpResponse(new VoiceResponse())); } catch (Exception e) { Log.Error(e); throw; } }
public HttpResponseMessage Index(TwilioVoiceRequest request, [FromUri] Guid?callerId = null, [FromUri] int contactId = 0) { try { lock (LockObj) { request.AddAdditionalFields(callerId, contactId); var response = request.IsInbound ? Inbound(request) : Outbound(request); return(GetHttpResponse(response)); } } catch (Exception e) { Log.Error(e); throw; } }
public HttpResponseMessage Enqueue(TwilioVoiceRequest request, [FromUri] Guid?callerId = null, [FromUri] int contactId = 0) { try { request.AddAdditionalFields(callerId, contactId); if (request.QueueResult != "bridged" && request.QueueResult != "redirected") { MissCall(request); } return(GetHttpResponse(request.Enqueue(request.QueueResult))); } catch (Exception e) { Log.Error(e); throw; } }
public HttpResponseMessage Client(TwilioVoiceRequest request, [FromUri] Guid callerId) { try { using (var scope = DIHelper.Resolve()) { request.AddAdditionalFields(callerId); new VoipEngine(scope.Resolve <DaoFactory>()).SaveOrUpdateCall(CallFromTwilioRequest(request)); return(GetHttpResponse(new VoiceResponse())); } } catch (Exception e) { Log.Error(e); throw; } }
public HttpResponseMessage Index(TwilioVoiceRequest request, [FromUri] Guid?callerId = null, [FromUri] int contactId = 0) { try { lock (LockObj) { using (var scope = DIHelper.Resolve()) { var daoFactory = scope.Resolve <DaoFactory>(); request.AddAdditionalFields(callerId, contactId); var response = request.IsInbound ? Inbound(request, daoFactory) : Outbound(request, daoFactory); return(GetHttpResponse(response)); } } } catch (Exception e) { Log.Error(e); throw; } }
public HttpResponseMessage VoiceMail(TwilioVoiceRequest request, [FromUri] Guid?callerId = null, [FromUri] int contactId = 0) { try { using (var scope = DIHelper.Resolve()) { var daoFactory = scope.Resolve <DaoFactory>(); var voipEngine = new VoipEngine(daoFactory); request.AddAdditionalFields(callerId, contactId); MissCall(request, voipEngine); return(GetHttpResponse(request.VoiceMail())); } } catch (Exception e) { Log.Error(e); throw; } }
public HttpResponseMessage Enqueue(TwilioVoiceRequest request, [FromUri] Guid?callerId = null, [FromUri] int contactId = 0) { try { using (var scope = DIHelper.Resolve()) { var daoFactory = scope.Resolve <DaoFactory>(); var voipEngine = new VoipEngine(daoFactory); request.AddAdditionalFields(callerId, contactId); if (request.QueueResult != "bridged" && request.QueueResult != "redirected") { MissCall(request, voipEngine); } return(GetHttpResponse(request.Enqueue(request.QueueResult))); } } catch (Exception e) { Log.Error(e); throw; } }