public IActionResult Index() { var parameters = ToDictionary(this.Request.Form); var response = new VoiceResponse(); string CallSid = ""; parameters.TryGetValue("CallSid", out CallSid); if (!String.IsNullOrWhiteSpace(CallSid)) { Call call = null; memoryCache.TryGetValue(CallSid, out call); if (call != null) { response.Say("Giupiter.com la sta mettendo in contatto.", voice: "alice", language: "it-IT"); response.Dial(call.UserNumber, timeLimit: call.TimeLimit); response.Hangup(); HttpTools.UpdateCall(call, "dtm"); } else { response.Say("Mi spiace c'è stato un errore!", voice: "alice", language: "it-IT"); response.Hangup(); } } else { response.Say("Mi spiace c'è stato un errore cache!", voice: "alice", language: "it-IT"); response.Hangup(); } return(Content(response.ToString(), "application/xml")); }
public IActionResult Index() { var parameters = ToDictionary(this.Request.Form); string CallSid = ""; string Status = ""; parameters.TryGetValue("CallSid", out CallSid); parameters.TryGetValue("CallStatus", out Status); if (!String.IsNullOrWhiteSpace(CallSid)) { Call call = null; memoryCache.TryGetValue(CallSid, out call); // bool isExist = memoryCache.TryGetValue(AccountSid, out call); if (call != null) { if (Status == "completed") { string duration = ""; parameters.TryGetValue("CallDuration", out duration); HttpTools.CloseCall(call, Status, duration); } else { HttpTools.UpdateCall(call, Status); } } else { //errore tempo scaduto return(BadRequest("Time Limit")); } } else { //errore chiave non mandata return(BadRequest("Call sid not found")); } return(Ok()); }