public static void GetRecords(CallingRecordsParameters parameters) { List<Appointments> appointments = new List<Appointments>(); List<CallingRecord> callingRecords = new List<CallingRecord>(); bool insertOutcome = false; IPatientRecords PatientRecords = new PatientRecords(); switch (parameters.Source) { case "GroveHill": insertOutcome = PatientRecords.InsertListOfPatientsToCallFromFile(parameters); break; case "File": insertOutcome = PatientRecords.InsertListOfPatientsToCallFromFile(parameters); break; case "Penchart": PatientRecords.GetListOfPatientsToCallPenChart(Common.GetDatePenchart()); break; case "FileFamily": PatientRecords.GetListOfPatientsToCallFromFileFamily(parameters); PatientRecords.ExecuteMisSql("delete from pendingtelephone where ReasonCode IN ('ADD','COMP','DEPO','DHI','DHO','HSC','IME','P ADD','P/T N','P/T T','P/TLG','PENDL','PI/HP','PROC','PT AN','PT BK','PT EL','PT FT','PT HA','PT HP','PT KN','PT NK','PT SH','PT WR','PTARM','RSC','SDA','WCEO','WCOE','WCSRG')"); PatientRecords.ExecuteMisSql("delete from pendingtelephone where ReasonCode IN ('COURD','COURT','IME','DEPOD','DEPO','PENDL','SIME')"); PatientRecords.ExecuteMisSql("delete from pendingtelephone where ReasonCode IN ('RMCDE','ORENC','ORENC','ORENC')"); PatientRecords.ExecuteMisSql("delete from pendingtelephone where Provider IN ('IVINF')"); PatientRecords.ExecuteMisSql("delete from pendingtelephone where Provider NOT IN ('SP','KM','CC','CCRB','JD','JDRB','DE','DERB','ES','MF','SG','SGRB','RPA','DBYPA','SPKM','RR','MR','MRRB','LS','LSRG','EFEL','CMOO')"); break; } }
public void ProcessRequest(HttpContext context) { string duration = context.Request.Form["RecordingDuration"]; int lengthOfCall = 1; try { lengthOfCall = int.Parse(duration); } catch { } string patientID = context.Request.QueryString["userid"]; string soundFileName = string.Empty; IPatientRecords patientRecords = new PatientRecords(); string xmlFilePath = "C:\\inetpub\\wwwroot\\Reminders\\xml\\"; Database.ReminderConnection = PatientCommunication.Response.Properties.Settings.Default.reminder; if (lengthOfCall > 5) { patientRecords.UpdatePatientCall(patientID, "Call Completed - VoiceMail"); } else { patientRecords.UpdatePatientCall(patientID, "Call Completed - Person Picked Up"); } soundFileName = patientRecords.GetPatientVoiceFileFromID(patientID); FileStream fs = System.IO.File.Create(xmlFilePath + patientID + "PlayVoice.xml"); fs.Close(); StreamWriter sw = System.IO.File.AppendText(xmlFilePath + patientID + "PlayVoice.xml"); sw.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); sw.WriteLine("<Response>"); sw.WriteLine("<Play>" + "http://reminders.grovehill.com/reminders/voice/" + soundFileName + "</Play>"); sw.WriteLine("</Response>"); sw.Flush(); sw.Close(); context.Response.ContentType = "text/xml"; context.Response.WriteFile(xmlFilePath + patientID + "PlayVoice.xml"); //foreach (string key in context.Request.Form.Keys) //{ // //Response.Write(Request.Form[key]); // Log("C:\\temp2\\", "log2.log", "The key1 is :" + key); // Log("C:\\temp2\\", "log2.log", context.Request.Form[key]); //} ////For a get request: //foreach (string key in context.Request.QueryString.Keys) //{ // //Response.Write(Request.QueryString[key]); // Log("C:\\temp2\\", "log2.log", "The key2 is :" + key); // Log("C:\\temp2\\", "log2.log", context.Request.QueryString[key]); //} }
public List<MakeCall> GetListToCall(MakeCall extras) { List<CallingRecord> callingRecords = new List<CallingRecord>(); PatientRecords patientRecords = new PatientRecords(); List<MakeCall> makeCalls = new List<MakeCall>(); if (extras.Type == "R") { callingRecords = patientRecords.GetListOfCallingRecords(); } else if (extras.Type == "M") { callingRecords = patientRecords.GetListOfCallingRecordsMonitor(); } for (int i = 0; i < callingRecords.Count; i++) { MakeCall makeCall = new MakeCall(); makeCall.CallerName = callingRecords[i].TelephoneID.ToString(); makeCall.AnswerMethod = "GET"; makeCall.FromNumber = extras.FromNumber; makeCall.ToNumber = callingRecords[i].TelephoneNumber1; makeCall.AnswerURL = extras.AnswerURL; makeCall.HangUpURL = extras.HangUpURL; makeCalls.Add(makeCall); } return makeCalls; }
private static void CreateVoiceFile(VoicingParameters voicingParameters, string toBeVoiced,string dateOfApplication,string timeOfApplication) { string fileName = string.Empty; string mp3FileName = string.Empty; SpeechSynthesizer reader; string sequence = string.Empty; string liveOrVoice = string.Empty; fileName = Common.GetFileNameFromDateTimeString() + ".wav"; //Create voice file //Save voice file //Insert live into voicing table //Insert vouce mail into voicing table reader = new SpeechSynthesizer(); // reader. reader.Volume = 100; reader.Rate = voicingParameters.Rate; reader.SelectVoice(voicingParameters.VoiceName); //reader.Rate = -2; //reader.SelectVoice("Microsoft Zira Desktop"); try { //reader.SetOutputToWaveFile(voiceFilePath + fileName, new SpeechAudioFormatInfo(11025, AudioBitsPerSample.Sixteen, AudioChannel.Mono)); //reader.SetOutputToWaveFile(voicingParameters.VoiceFilePath + fileName, new SpeechAudioFormatInfo(16025, AudioBitsPerSample.Sixteen, AudioChannel.Mono)); reader.SetOutputToWaveFile(voicingParameters.VoiceFilePath + fileName, new SpeechAudioFormatInfo(48000, AudioBitsPerSample.Sixteen,AudioChannel.Stereo)); //******************************************************************************** //used for testing //reader.SetOutputToWaveFile("\\\\1lake-reminder2\\c\\Waldenltd\\voicetest\\" + department + ".wav", new SpeechAudioFormatInfo(11025, AudioBitsPerSample.Eight, AudioChannel.Mono)); //**************************************************************************************** reader.Speak(toBeVoiced); reader.Dispose(); mp3FileName = fileName.Replace(".wav",".mp3"); ConvertWavFileTOMP3.WaveToMP3(voicingParameters.VoiceFilePath + fileName , voicingParameters.VoiceFilePath + mp3FileName); File.Delete(voicingParameters.VoiceFilePath + fileName); } catch (Exception er) { string s1 = er.Message; } //insert live sequence = "1"; liveOrVoice = "L"; PatientCommunication.Model.Voicing voicing = new Model.Voicing(); PatientRecords patientRecords = new PatientRecords(); try { voicing.NameID = int.Parse(voicingParameters.NameID); voicing.TelephoneID = int.Parse(voicingParameters.TelephoneID); voicing.CompanyID = int.Parse(voicingParameters.CompanyId); voicing.AppDate = dateOfApplication; voicing.AppTime = timeOfApplication; voicing.FileName = mp3FileName; voicing.Sequence = int.Parse(sequence); voicing.pPrevious = "Null"; voicing.nNext = "Null"; voicing.LiveorVoice = liveOrVoice; patientRecords.InsertVoiceRecord(voicing); } catch (Exception er) { //Log.WhichProgram = "Labcorp Interface"; Log.LogMessage(er.ToString()); } //insert voice sequence = "1"; liveOrVoice = "V"; try { voicing = new Model.Voicing(); voicing.NameID = int.Parse(voicingParameters.NameID); voicing.TelephoneID = int.Parse(voicingParameters.TelephoneID); voicing.CompanyID = int.Parse(voicingParameters.CompanyId); voicing.AppDate = dateOfApplication; voicing.AppTime = timeOfApplication; voicing.FileName = mp3FileName; voicing.Sequence = int.Parse(sequence); voicing.pPrevious = "Null"; voicing.nNext = "Null"; voicing.LiveorVoice = liveOrVoice; patientRecords.InsertVoiceRecord(voicing); } catch (Exception er) { //Log.WhichProgram = "Labcorp Interface"; Log.LogMessage(er.ToString()); } }
private static void CARD(VoicingParameters voicingParameters) { string theGreeting = string.Empty; string thePatientName = string.Empty; string theProvider = string.Empty; string theDayDateTime = string.Empty; string theLocation = string.Empty; string theOfficeMessage = string.Empty; string theReturnMessage = string.Empty; string theRespondMessage = string.Empty; string theCallOfficeMessage = string.Empty; string theEndMessage = string.Empty; string theCode = string.Empty; string toBeVoiced = string.Empty; PatientRecords patientRecords = new PatientRecords(); List<WhatToVoice> whatToVoice = patientRecords.GetVoicing("CARD"); for (int i = 0; i < whatToVoice.Count; i++) { if (whatToVoice[i].MessageType == "PATIENTNAME") { toBeVoiced = toBeVoiced + " " + voicingParameters.FirstName + " "; } else if (whatToVoice[i].MessageType == "PROVIDER") { toBeVoiced = toBeVoiced + ", I am calling to confirm an appointment with, " + GetProviderName(voicingParameters.Provider) + ", on,"; } else if (whatToVoice[i].MessageType == "DAYDATETIME") { toBeVoiced = toBeVoiced + " " + "on, " + voicingParameters.DayOfAppointment + ", " + voicingParameters.DateOfAppointment1 + " , " + voicingParameters.DateOfAppointment2 + ", at " + voicingParameters.TimeOfAppointment + " "; } else if (whatToVoice[i].MessageType == "LOCATION") { toBeVoiced = toBeVoiced + " " + GetLocationString(voicingParameters.Location) + " "; } else { toBeVoiced = toBeVoiced + whatToVoice[i].Message; } } /* string toBeVoiced = string.Empty; //string theLocation = string.Empty; string theCallUs = string.Empty; string newOfficelocation = string.Empty; theLocation = GetLocationString(voicingParameters.Location); theCallUs = ", if you have any questions regarding your appointment please call or office at 8,6,0,2,2,3,0,2,2,0"; //theLocation = " located at 185 East Street in Plianville"; //if you are unable to keep your appointment please call the office at 8,6,0,3,4,8,4,2,4,2 to reschedule as soon as possible toBeVoiced = "Hello, this is an automated message from the grove hill medical center department of cardiology, for " + " " + voicingParameters.FirstName + " " + ", I am calling to confirm an appointment with, " + GetProviderName(voicingParameters.Provider) + ", on," + voicingParameters.DayOfAppointment + ", " + voicingParameters.DateOfAppointment1 + " , " + voicingParameters.DateOfAppointment2 + ", at " + voicingParameters.TimeOfAppointment + " " + theLocation + newOfficelocation + " , Please arrive fifteen minutes before your scheduled appointment time in order to complete the registration process. Please be sure to bring your insurance cards and any co-pay if applicable" + theCallUs + ", to repeat this message press 2, thank you and have a great day"; */ CreateVoiceFile(voicingParameters, toBeVoiced, voicingParameters.DateOfAppointment1, voicingParameters.TimeOfAppointment); }
public static string GetLocationString(string locationID) { PatientRecords patientRecords = new PatientRecords(); return patientRecords.GetLocationNameFromID(locationID); }
private static string GetProviderName(string providerID) { PatientRecords patientRecords = new PatientRecords(); return patientRecords.GetProviderNameFromID(providerID); }
static void Main(string[] args) { string authID = System.Configuration .ConfigurationManager.AppSettings["authid"]; string authToken = System.Configuration .ConfigurationManager.AppSettings["authtoken"]; RestAPI plivo = new RestAPI(authID, authToken); string name = string.Empty; string answerURL = System.Configuration .ConfigurationManager.AppSettings["answerURL"]; string hangupURL = System.Configuration .ConfigurationManager.AppSettings["hangupURL"]; string answerMethod = System.Configuration .ConfigurationManager.AppSettings["answerMethod"]; string fromNumber = System.Configuration .ConfigurationManager.AppSettings["fromnumber"]; string connection = System.Configuration .ConfigurationManager.AppSettings["sqlconnection"]; string logpath = System.Configuration .ConfigurationManager.AppSettings["logpath"]; Database.ReminderConnection = System.Configuration .ConfigurationManager.AppSettings["reminderConnection"]; List<MakeCall> makeCalls = new List<MakeCall>(); MakeCall makeCall = new MakeCall(); MakeCall extras = new MakeCall(); PatientRecords patientRecords = new PatientRecords(); //new comment extras.AnswerURL = answerURL; extras.HangUpURL = hangupURL; extras.FromNumber = fromNumber; extras.AnswerMethod = answerMethod; extras.NameOfFirstFile = System.Configuration .ConfigurationManager.AppSettings["nameOfFirstFile"]; try { makeCalls = new List<MakeCall>(); makeCalls = patientRecords.GetListToCall(extras); //makeCalls.Add(makeCall); /* for (int i = 0; i < makeCalls.Count; i++) { // Place a call // string ss = plivo.get_cdr.PlivoVersion; IRestResponse<Call> resp = plivo.make_call(new dict { { "to", "1" + makeCalls[i].ToNumber}, { "from", makeCalls[i].FromNumber}, { "answer_url", makeCalls[i].AnswerURL + makeCalls[i].CallerName + extras.NameOfFirstFile }, { "hangup_url", makeCalls[i].HangUpURL}, { "answer_method", makeCalls[i].AnswerMethod}, { "caller_name", makeCalls[i].CallerName} }); if (resp.Data != null) { PropertyInfo[] proplist = resp.Data.GetType().GetProperties(); foreach (PropertyInfo property in proplist) Console.WriteLine("{0}: {1}", property.Name, property.GetValue(resp.Data, null)); } else { Console.WriteLine(resp.ErrorMessage); } */ for (int i = 0; i < makeCalls.Count; i++) { // Place a call // string ss = plivo.get_cdr.PlivoVersion; IRestResponse<Call> resp = plivo.make_call(new dict { { "to", "1" + "8602325449"}, { "from", fromNumber}, { "answer_url", answerURL }, { "hangup_url", hangupURL}, { "answer_method", "GET"}, { "caller_name", "None"} }); if (resp.Data != null) { PropertyInfo[] proplist = resp.Data.GetType().GetProperties(); foreach (PropertyInfo property in proplist) Console.WriteLine("{0}: {1}", property.Name, property.GetValue(resp.Data, null)); } else { Console.WriteLine(resp.ErrorMessage); } System.Threading.Thread.Sleep(2000); } } catch (Exception er) { Log(er.Message, logpath); } }
public void ProcessRequest(HttpContext context) { string digit = context.Request.QueryString["Digits"]; //string patientID = context.Request.QueryString["CallerName"]; string patientID = context.Request.QueryString["userid"]; string soundFileName = string.Empty; IPatientRecords patientRecords = new PatientRecords(); string xmlFilePath = "C:\\inetpub\\wwwroot\\Reminders\\testing\\xml\\"; string logFilePath = System.Configuration .ConfigurationManager.AppSettings["logfile"]; //Log("C:\\temp2\\", "log.log", "The digit is :" + digit); //Log("C:\\temp2\\", "log.log", "The patientid is :" + patientID); //Log("C:\\temp2\\", "log.log", " From value: " + context.Request["from"]); //Log("C:\\temp2\\", "log.log", " TotalCost value: " + context.Request["TotalCost"]); //Log("C:\\temp2\\", "log.log", " Direction value: " + context.Request["Direction"]); //Log("C:\\temp2\\", "log.log", " BillDuration value: " + context.Request["BillDuration"]); //Log("C:\\temp2\\", "log.log", " CallerName value: " + context.Request["CallerName"]); //Log("C:\\temp2\\", "log.log", " HangupCause value: " + context.Request["HangupCause"]); //Log("C:\\temp2\\", "log.log", " BillRate value: " + context.Request["BillRate"]); //Log("C:\\temp2\\", "log.log", " AnswerTime value: " + context.Request["AnswerTime"]); //Log("C:\\temp2\\", "log.log", " StartTime value: " + context.Request["StartTime"]); //Log("C:\\temp2\\", "log.log", " Duration value: " + context.Request["Duration"]); //Log("C:\\temp2\\", "log.log", " CallUUID value: " + context.Request["CallUUID"]); //Log("C:\\temp2\\", "log.log", " EndTime value: " + context.Request["EndTime"]); //Log("C:\\temp2\\", "log.log", " CallStatus value: " + context.Request["CallStatus"]); //Log("C:\\temp2\\", "log.log", " Event value: " + context.Request["Event"]); //Server=localhost;Database=reminders;Uid=root;Pwd=root; Database.ReminderConnection = "Server=localhost;Database=reminders;Uid=root;Pwd=root;"; //if (digit == "1") //{ soundFileName = patientRecords.GetPatientVoiceFileFromID(patientID); FileStream fs = System.IO.File.Create(xmlFilePath + patientID + "Play.xml"); fs.Close(); StreamWriter sw = System.IO.File.AppendText(xmlFilePath + patientID + "Play.xml"); sw.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); sw.WriteLine("<Response>"); sw.WriteLine("<Play>" + "http://reminders.grovehill.com/reminders/voice/" + soundFileName + "</Play>"); sw.WriteLine("</Response>"); sw.Flush(); sw.Close(); patientRecords.UpdateCall(patientID, "1"); context.Response.ContentType = "text/xml"; Log("C:\\temp2\\", "log.log", "http://reminders.grovehill.com/Reminders/testing/xml/" + patientID + "Play.xml"); //context.Response.Write("http://reminders.grovehill.com/Reminders/testing/xml/" + patientID + "Play.xml"); context.Response.WriteFile(xmlFilePath + patientID + "Play.xml"); //} //else if (digit == "9") //{ // patientRecords.UpdateCall(patientID, "9"); // soundFileName = patientRecords.GetPatientVoiceFileFromID(patientID); // FileStream fs = System.IO.File.Create(xmlFilePath + patientID + "9Play.xml"); // fs.Close(); // StreamWriter sw = System.IO.File.AppendText(xmlFilePath + patientID + "9Play.xml"); // sw.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); // sw.WriteLine("<Response>"); // sw.WriteLine("<Play>" + "http://reminders.grovehill.com/reminders/voice/second.wav" + "</Play>"); // sw.WriteLine("</Response>"); // sw.Flush(); // sw.Close(); // context.Response.ContentType = "text/xml"; // Log("C:\\temp2\\", "log.log", "http://reminders.grovehill.com/Reminders/testing/xml/" + patientID + "9Play.xml"); // //context.Response.Write("http://reminders.grovehill.com/Reminders/testing/xml/" + patientID + "Play.xml"); // context.Response.WriteFile(xmlFilePath + patientID + "9Play.xml"); //} //else //{ // patientRecords.UpdateCall(patientID, "0"); //} //foreach (string key in context.Request.Form.Keys) //{ // //Response.Write(Request.Form[key]); // Log("C:\\temp2\\", "log.log", "The key1 is :" + key); // Log("C:\\temp2\\", "log.log", context.Request.Form[key]); //} ////For a get request: //foreach (string key in context.Request.QueryString.Keys) //{ // //Response.Write(Request.QueryString[key]); // Log("C:\\temp2\\", "log.log", "The key2 is :" + key); // Log("C:\\temp2\\", "log.log", context.Request.QueryString[key]); //} //Log("C:\\temp2\\", "log.log", " From value: " + context.Request["from"]); //Log("C:\\temp2\\", "log.log", " TotalCost value: " + context.Request["TotalCost"]); //Log("C:\\temp2\\", "log.log", " Direction value: " + context.Request["Direction"]); //Log("C:\\temp2\\", "log.log", " BillDuration value: " + context.Request["BillDuration"]); //Log("C:\\temp2\\", "log.log", " CallerName value: " + context.Request["CallerName"]); //Log("C:\\temp2\\", "log.log", " HangupCause value: " + context.Request["HangupCause"]); //Log("C:\\temp2\\", "log.log", " BillRate value: " + context.Request["BillRate"]); //Log("C:\\temp2\\", "log.log", " AnswerTime value: " + context.Request["AnswerTime"]); //Log("C:\\temp2\\", "log.log", " StartTime value: " + context.Request["StartTime"]); //Log("C:\\temp2\\", "log.log", " Duration value: " + context.Request["Duration"]); //Log("C:\\temp2\\", "log.log", " CallUUID value: " + context.Request["CallUUID"]); //Log("C:\\temp2\\", "log.log", " EndTime value: " + context.Request["EndTime"]); //Log("C:\\temp2\\", "log.log", " CallStatus value: " + context.Request["CallStatus"]); //Log("C:\\temp2\\", "log.log", " Event value: " + context.Request["Event"]); }
public void UpdateVoiceMail(string telephoneID) { Database.ReminderConnection = System.Configuration .ConfigurationManager.AppSettings["reminderConnection"]; PatientRecords patientRecords = new PatientRecords(); patientRecords.UpdateVoiceMail(telephoneID); }
public void UpdateCallInformation(FormCollection collection) { Database.ReminderConnection = System.Configuration .ConfigurationManager.AppSettings["reminderConnection"]; PatientCommunication.Model.CallResults logCall = new PatientCommunication.Model.CallResults(); string logFilePath = System.Configuration .ConfigurationManager.AppSettings["logfile"]; string direction = string.Empty; double totalCost = 0; string hangupCause = string.Empty; string fromNumber = string.Empty; string aLegUUID = string.Empty; string callerName = string.Empty; double duration = 0; double billDuration = 0; double billRate = 0; string toNumber = string.Empty; DateTime AnswerTime = DateTime.Now; DateTime StartTime = DateTime.Now; string CallUUID = string.Empty; string ALegRequestUUID = string.Empty; string RequestUUID = string.Empty; DateTime EndTime = DateTime.Now; string CallStatus = string.Empty; string theEvent = string.Empty; try { direction = collection["Direction"]; } catch { direction = string.Empty; } logCall.Direction = direction; try { totalCost = double.Parse(collection["TotalCost"]); } catch { totalCost = 0; } logCall.TotalCost = totalCost; try { hangupCause = collection["HangupCause"]; } catch { hangupCause = string.Empty; } logCall.HangupCause = hangupCause; try { fromNumber = collection["From"]; } catch { fromNumber = string.Empty; } logCall.FromNumber = fromNumber; try { aLegUUID = collection["ALegUUID"]; } catch { aLegUUID = string.Empty; } logCall.ALegUUID = aLegUUID; try { callerName = collection["CallerName"]; } catch { callerName = string.Empty; } logCall.CallerName = callerName; try { duration = double.Parse(collection["Duration"]); } catch { duration = 0; } logCall.Duration = duration; try { billDuration = double.Parse(collection["BillDuration"]); } catch { billDuration = 0; } logCall.BillDuration = billDuration; try { billRate = double.Parse(collection["BillRate"]); } catch { billRate = 0; } logCall.BillRate = billRate; try { toNumber = collection["To"]; } catch { toNumber = string.Empty; } logCall.ToNumber = toNumber; try { AnswerTime = Convert.ToDateTime(ConvertDate(collection["AnswerTime"])); } catch { } logCall.AnswerTime = AnswerTime; try { StartTime = Convert.ToDateTime(ConvertDate(collection["StartTime"])); } catch { } logCall.StartTime = StartTime; try { CallUUID = collection["CallUUID"]; } catch { } logCall.CallUUID = CallUUID; try { ALegRequestUUID = collection["ALegRequestUUID"]; } catch { } logCall.ALegRequestUUID = ALegRequestUUID; try { RequestUUID = collection["RequestUUID"]; } catch { } logCall.RequestUUID = RequestUUID; try { EndTime = Convert.ToDateTime(ConvertDate(collection["EndTime"])); } catch { } logCall.EndTime = EndTime; try { CallStatus = collection["CallStatus"]; } catch { } logCall.CallStatus = CallStatus; try { theEvent = collection["Event"]; } catch { } logCall.Event = theEvent; PatientRecords patientRecords = new PatientRecords(); patientRecords.InsertLogCall(logCall); }