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()); }