private void SendInterruptControl(string option) { log.Info(String.Format("{0} - option for Interrupt is {1}", ANI, option)); switch (option) { case "Visual_Response": { SendURLToCV("http://cvnet.radishsystems.com/choiceview/samples/generic_order_status.html", "CVOrderStatus.xml"); Thread.Sleep(10000); ContinueCVSession(); break; } case "Radish_Website": { SendURLToCV("http://www.radishsystems.com", "CVWebsite.xml"); // log.Info(String.Format("{0} - sleeping for 5", ANI)); Thread.Sleep(5000); log.Info(String.Format("{0} - going to DeleteCVSession", ANI)); DeleteCVSession(); // log.Info(String.Format("{0} - back from DeleteCVSession", ANI)); break; } case "Customer_Support": { SendURLToCV("http://cvnet.radishsystems.com/choiceview/samples/radish_transfer.html", "AnnounceTransfer.xml"); var newProperty = new ClientProperty { name = "transfer", value = "twilio_demo" }; log.Info(String.Format("{0} - ready to Post property", ANI)); PostCVProperty(newProperty); log.Info(String.Format("{0} - back from Post of property", ANI)); // log.Info(String.Format("{0} - waiting 1", ANI)); Thread.Sleep(1000); TransferCVSession(); break; } default: { log.Info(String.Format("{0} - taking default in SendInterruptControl", ANI)); ContinueCVSession(); break; } } }
private void PostCVProperty(ClientProperty newProperty) { Client.PostAsJsonAsync(SessionPropertiesUri.AbsoluteUri, newProperty).ContinueWith( responseTask => { log.Info(String.Format("{0} - inside PostCVProperty task ", ANI)); if (responseTask.Exception != null) { log.Info(String.Format("{0} - Post failed - {1}", ANI, responseTask.Exception.InnerException.Message)); } else if (responseTask.Result.IsSuccessStatusCode) { log.Info("CV session properties updated"); } else { var msg = responseTask.Result.Content.ReadAsStringAsync().Result; log.Info(String.Format("{0} - Property Update to {1} failed! Reason - {2}, {3}, {4}", ANI, SessionPropertiesUri.AbsoluteUri, responseTask.Result.StatusCode, responseTask.Result.ReasonPhrase, msg)); } }); log.Info(String.Format("{0} - leaving PostCVProperty", ANI)); }