/// <summary> /// THis Method is used to update the call status from remote server /// </summary> /// <param name="sConnString"></param> /// <param name="methodType"></param> /// <param name="callBackIpAddr"></param> /// <param name="callBackReqObj"></param> /// <param name="pusherAppId"></param> /// <param name="pusherAppKey"></param> /// <param name="pusherAppsecret"></param> /// <param name="HangupCauses"></param> /// <param name="respContext"></param> /// <param name="callBackUrl"></param> /// <returns></returns> public string UpdateCallBacks(string sConnString, string methodType, string callBackIpAddr, JObject callBackReqObj, string pusherAppId, string pusherAppKey, string pusherAppsecret, string HangupCauses, HttpContext respContext, string callBackUrl) { //Parsing The Data ParseResponse(methodType, callBackReqObj, respContext); string pusherCallStatus = callBackPropObj.CallStatus; string eventName = "call_status"; string[] hangupCasuesForRetry = null; hangupCasuesForRetry = HangupCauses.Split(",".ToCharArray()); try { //Updating GroupCall Status Method calling globalDs = UpdateCallBacksCallDb(sConnString, callBackPropObj, callBackIpAddr); Pusher pusherObj = new Pusher(pusherAppId, pusherAppKey, pusherAppsecret); JObject retryResponse = new JObject(); if (hangupCasuesForRetry.Contains(callBackPropObj.EndReason)) { BusinessLogicLayer.V_1_2.GroupCall_V120 groupcallObj = new BusinessLogicLayer.V_1_2.GroupCall_V120(); retryResponse = groupcallObj.GrpCallRetryBLL(sConnString, callBackPropObj.CallUUID, callBackPropObj.RequestUUID, callBackUrl); callBackResponse.Append("Retry Response : " + retryResponse.ToString()); if (Convert.ToBoolean(retryResponse.SelectToken("Success").ToString()) == true) { pusherCallStatus = "redial"; } } if (globalDs.Tables.Count > 0 && globalDs.Tables[0].Rows.Count > 0) { var _with1 = globalDs.Tables[0]; if (Convert.ToInt32(globalDs.Tables[0].Rows[0]["IsInterConnect"]) == 0) { ITriggerResult PusherResponse = null; PusherResponse = pusherObj.Trigger(globalDs.Tables[0].Rows[0]["ConferenceName"].ToString(), eventName, new { direction = "outbound", plivo_event = callBackPropObj.Event, plivo_conferene_action = callBackPropObj.GrpCallAction, to_num = globalDs.Tables[0].Rows[0]["MobileNumber"], conf_room = grpCallName, call_status = pusherCallStatus, mute = globalDs.Tables[0].Rows[0]["Mute"], deaf = globalDs.Tables[0].Rows[0]["Deaf"], member = globalDs.Tables[0].Rows[0]["Member"], conf_type = globalDs.Tables[0].Rows[0]["ConferenceType"], conf_digits = callBackPropObj.Digits, conf_id = globalDs.Tables[0].Rows[0]["ConferenceId"], record_status = globalDs.Tables[0].Rows[0]["RecordStatus"], record_count = globalDs.Tables[0].Rows[0]["RecordCount"], dig_prs_count = globalDs.Tables[0].Rows[0]["DigitPressCount"], inpro_count = globalDs.Tables[0].Rows[0]["InprogressCount"], unmute_count = globalDs.Tables[0].Rows[0]["UnmuteCount"], mute_count = globalDs.Tables[0].Rows[0]["MuteCount"], end_reason = globalDs.Tables[0].Rows[0]["end_reason"], isinprogress = isInProgress }); } callBackResponse.Append("CurrentMemberDetails ==> "); foreach (DataRow _Row in globalDs.Tables[0].Rows) { foreach (DataColumn _Column in _Row.Table.Columns) { if (_Row[_Column.ColumnName] == DBNull.Value) { callBackResponse.Append(_Column.ColumnName + " : NULL"); } else { callBackResponse.Append(_Column.ColumnName + " : " + _Row[_Column.ColumnName]); } callBackResponse.Append(" | "); } callBackResponse.Append(" @@@ "); } //If isRecording = 0 AndAlso globalglobalDs.Tables(0).Rows.Item(0)("InprogressCount") > 1 Then // logclass.LogRequest("Enters Into Conference Recording block --" & globalDs.Tables(0).Rows.Item(0)("ConferenceId").Tostring()) // ConferenceRecord(globalDs.Tables(0).Rows.Item(0)("ConferenceId"), 1) //End If } else { callBackResponse.Append("No Member Data Returned From Database"); } if (globalDs.Tables.Count > 1 && globalDs.Tables[1].Rows.Count > 0) { callBackResponse.Append("AloneMemberDetails ==> "); foreach (DataRow _Row in globalDs.Tables[1].Rows) { foreach (DataColumn _Column in _Row.Table.Columns) { if (_Row[_Column.ColumnName] == DBNull.Value) { callBackResponse.Append(_Column.ColumnName + " : NULL"); } else { callBackResponse.Append(_Column.ColumnName + " : " + _Row[_Column.ColumnName]); } callBackResponse.Append(" | "); } callBackResponse.Append(" @@@ "); } JObject aloneHangupResponse = new JObject(); JObject alonePlayResponse = new JObject(); var _with2 = globalDs.Tables[1]; V_1_2.GroupCall_V120 GrpcallObj = new V_1_2.GroupCall_V120(); alonePlayResponse = GrpcallObj.PlayToAConferenceCall(globalDs.Tables[1].Rows[0]["ConferenceRoom"].ToString(), Convert.ToInt32(globalDs.Tables[1].Rows[0]["MemberId"]), globalDs.Tables[1].Rows[0]["HttpUrl"].ToString(), "http://new.grpTalk.com/DefaultClips/thank_you.mp3"); System.Threading.Thread.Sleep(6000); //ConferenceObject.ConferenceRecording(globalDs.Tables(0).Rows.Item(0)("ConferenceId"), 2) grpcall callObj = new grpcall(); callObj.ConferenceId = Convert.ToInt32(globalDs.Tables[1].Rows[0]["ConferenceId"]); callObj.ConferenceRoom = globalDs.Tables[1].Rows[0]["ConferenceRoom"].ToString(); callObj.CallUUID = globalDs.Tables[1].Rows[0]["CallUUID"].ToString(); callObj.ConferenceAction = "HANGUP_ALL"; callObj.IsAll = true; callObj.HttpConferenceApiUrl = globalDs.Tables[1].Rows[0]["HttpUrl"].ToString(); aloneHangupResponse = GrpcallObj.GrpCallHanUp(sConnString, callObj); //Send Notification to App PusherNotifier mobileNotifierObj = new PusherNotifier(); mobileNotifierObj.IsStarted = 0; mobileNotifierObj.GrpCallID = Convert.ToInt32(globalDs.Tables[1].Rows[0]["ConferenceId"]); GrpcallObj.MobileNotifier(sConnString, mobileNotifierObj); callBackResponse.Append("Alone Play Response Is : " + alonePlayResponse.ToString()); callBackResponse.Append("Alone Hangup Response Is : " + aloneHangupResponse.ToString()); } else { callBackResponse.Append("No Alone Member"); } } catch (Exception ex) { Logger.ExceptionLog("exception at callBackresponseBLL : " + ex.ToString()); callBackResponse.Append("Exception : " + ex.ToString()).ToString(); } return(callBackResponse.ToString()); }
public string ValidateInboundCall() { grpcall grpCallPropObj = new grpcall(); String responseXml = "<Response><Hangup reason='start'/></Response>"; string voiceClipUrl = ConfigurationManager.AppSettings["GrpTalkVoiceClipsUrl"].ToString(); this.WelcomeClip = voiceClipUrl + "GrpTalkWelcomeClipNew.mp3"; if ((this.Event == "newcall") || (this.Event == "getkeys")) { int nodeGatewayId = 0; nodeGatewayId = CheckIsInterConnectCall(this.FromNumber, this.ToNumber); this.NodeGatewayId = nodeGatewayId; if (nodeGatewayId > 0) { string[] digitsObj = null; if (this.Event == "newcall") { responseXml = "<Response><GetDigits timeout='20' numDigits='100' action='" + this.InboundAnswerUrl + "' validDigits='1234567890@*#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'><Play>silence_stream://1000</Play></GetDigits></Response>"; return(responseXml); } else if (this.Event == "getkeys") { digitsObj = this.Digits.Split('A'); this.IsAll = false; DataSet interConnectCallsData = GetInterConnectCallssData(Convert.ToInt32(Digits)); if (interConnectCallsData.Tables.Count > 0) { this.IsAll = Convert.ToBoolean(interConnectCallsData.Tables[0].Rows[0]["IsAll"]); this.BatchId = Convert.ToString(interConnectCallsData.Tables[0].Rows[0]["BatchId"]); this.ConferenceId = Convert.ToInt32(interConnectCallsData.Tables[0].Rows[0]["ConfId"]); this.MobileNumber = Convert.ToString(interConnectCallsData.Tables[0].Rows[0]["MobileNumber"]); grpCallPropObj.IsAll = Convert.ToBoolean(interConnectCallsData.Tables[0].Rows[0]["IsAll"]); grpCallPropObj.IsMute = false; grpCallPropObj.CallUUID = interConnectCallsData.Tables[0].Rows[0]["BatchId"].ToString(); grpCallPropObj.ConferenceId = Convert.ToInt32(interConnectCallsData.Tables[0].Rows[0]["ConfId"]); grpCallPropObj.MobileNumber = interConnectCallsData.Tables[0].Rows[0]["MobileNumber"].ToString(); responseXml = this.IsAll.ToString() + "---" + this.BatchId + "---conf_id=" + this.ConferenceId.ToString(); } else { responseXml = "<Response><Hangup reason='InterConnect Calls data not found'/></Response>"; return(responseXml); } int TimeLimit = 0; DataSet interConnectMembersData = new DataSet(); interConnectMembersData = GetInterConnectMembersData(out TimeLimit); if (interConnectMembersData.Tables.Count > 0) { grpCallPropObj.TimeLimit = TimeLimit; grpCallPropObj.WaitClip = this.WaitClip; grpCallPropObj.WelcomeClip = this.WelcomeClip; grpCallPropObj.ConferenceRoom = this.ConferenceRoom; responseXml = this.IsAll.ToString() + "---" + this.BatchId + "---conf_id inter connect members > 0=" + this.ConferenceId.ToString(); this.NodeDependedMobileNumberReportIdTable = interConnectMembersData.Tables[0]; this.NodeDependendGateWaysTable = interConnectMembersData.Tables[1]; V_1_2.GroupCall_V120 grpCallObj = new V_1_2.GroupCall_V120(); grpCallObj.Dial(this.ConnString, grpCallPropObj, this.PreJoinCallBackUrl, this.NodeDependedMobileNumberReportIdTable, this.NodeDependendGateWaysTable); responseXml = "<Response><Conference stayAlone='false'>" + this.ConferenceRoom + "</Conference></Response>"; return(responseXml); } } ; } else { responseXml = this.IsAll.ToString() + "---" + this.BatchId + "---conf_id all public calls here =" + this.ConferenceId.ToString() + this.Event; DataSet newcallData = null; DataSet InBoundCallData = new DataSet(); string dbMessage = ""; int mode = 0; Boolean isModetator = false; newcallData = NewInboundCall(out dbMessage); try { if (dbMessage != "") { Logger.TraceLog("dbMessage " + dbMessage); if (dbMessage.ToLower() == "joinconf") { Logger.TraceLog("table count" + newcallData.Tables[0].Rows.Count.ToString()); if (newcallData.Tables[0].Rows.Count > 0) { mode = Convert.ToInt32(newcallData.Tables[0].Rows[0]["Mode"]); Logger.TraceLog("Mode : " + mode.ToString()); if (Convert.ToInt32(newcallData.Tables[0].Rows[0]["IsValidatePin"]) == 1) { if (newcallData.Tables[0].Rows[0]["AccessKey"].ToString() == this.Digits) { responseXml = InBoundCallDial(Convert.ToInt64(newcallData.Tables[0].Rows[0]["GrpCallId"].ToString()), this.FromNumber, this.ToNumber, this.CallUuid, mode); } else { responseXml = "<Response><play>" + voiceClipUrl + "InvalidPIN.mp3" + "</play></Response>"; } } else { Logger.TraceLog("from " + this.FromNumber); responseXml = InBoundCallDial(Convert.ToInt64(newcallData.Tables[0].Rows[0]["GrpCallId"].ToString()), this.FromNumber, this.ToNumber, this.CallUuid, mode); } } else { responseXml = "<Response><Speak>No Group Call</Speak></Response>"; } Logger.TraceLog("responseXml : " + responseXml); return(responseXml); } else if (dbMessage.ToLower() == "playivrforpin") { responseXml = "<Response><GetDigits action='" + this.PreJoinCallBackUrl + "' method='GET' numDigits='6' timeout='15'><Play>" + voiceClipUrl + "EnterPin.mp3" + "</Play></GetDigits></Response>"; Logger.TraceLog("Response Xml : " + responseXml); } else if (dbMessage.ToLower() == "pleasewait") { responseXml = "<Response><play>" + voiceClipUrl + "NonLiveGroupCall.mp3 " + "</play></Response>"; Logger.TraceLog("Response Xml : " + responseXml); } else if (dbMessage.ToLower() == "playivr") { Logger.TraceLog("playivr Started"); int i = 0; string ivrMessage = "<play>" + voiceClipUrl + "PleasePress.mp3" + "</play>"; for (i = 0; i <= newcallData.Tables[0].Rows.Count - 1; i++) { if (Convert.ToInt32(newcallData.Tables[0].Rows[i]["slno"]) == 1) { ivrMessage = ivrMessage + "<play>" + voiceClipUrl + "One.mp3" + "</play><play>" + voiceClipUrl + "ToJoin.mp3" + "</play>"; } else if (Convert.ToInt32(newcallData.Tables[0].Rows[i]["slno"]) == 2) { ivrMessage = ivrMessage + "<play>" + voiceClipUrl + "Two.mp3" + "</play><play>" + voiceClipUrl + "ToJoin.mp3" + "</play>"; } else if (Convert.ToInt32(newcallData.Tables[0].Rows[i]["slno"]) == 3) { ivrMessage = ivrMessage + "<play>" + voiceClipUrl + "Three.mp3" + "</play><play>" + voiceClipUrl + "ToJoin.mp3" + "</play>"; } else if (Convert.ToInt32(newcallData.Tables[0].Rows[i]["slno"]) == 4) { ivrMessage = ivrMessage + "<play>" + voiceClipUrl + "Four.mp3" + "</play><play>" + voiceClipUrl + "ToJoin.mp3" + "</play>"; } else if (Convert.ToInt32(newcallData.Tables[0].Rows[i]["slno"]) == 5) { ivrMessage = ivrMessage + "<play>" + voiceClipUrl + "Five.mp3" + "</play><play>" + voiceClipUrl + "ToJoin.mp3" + "</play>"; } else if (Convert.ToInt32(newcallData.Tables[0].Rows[i]["slno"]) == 6) { ivrMessage = ivrMessage + "<play>" + voiceClipUrl + "Six.mp3" + "</play><play>" + voiceClipUrl + "ToJoin.mp3" + "</play>"; } else if (Convert.ToInt32(newcallData.Tables[0].Rows[i]["slno"]) == 7) { ivrMessage = ivrMessage + "<play>" + voiceClipUrl + "Seven.mp3" + "</play><play>" + voiceClipUrl + "ToJoin.mp3" + "</play>"; } else if (Convert.ToInt32(newcallData.Tables[0].Rows[i]["slno"]) == 8) { ivrMessage = ivrMessage + "<play>" + voiceClipUrl + "Eight.mp3" + "</play><play>" + voiceClipUrl + "ToJoin.mp3" + "</play>"; } else if (Convert.ToInt32(newcallData.Tables[0].Rows[i]["slno"]) == 9) { ivrMessage = ivrMessage + "<play>" + voiceClipUrl + "Nine.mp3" + "</play><play>" + voiceClipUrl + "ToJoin.mp3" + "</play>"; } ivrMessage = ivrMessage + "<speak>" + newcallData.Tables[0].Rows[i]["ConfName"].ToString() + "</speak>"; } ivrMessage = ivrMessage + "<play>" + voiceClipUrl + "PleasePressStar.mp3" + "</play>"; ivrMessage = "<play>" + voiceClipUrl + "MorethanOneCalls.mp3" + "</play>" + ivrMessage; responseXml = "<Response><GetDigits validDigits ='1234567890*' action='" + this.InboundAnswerUrl + "' numDigits='1' timeout='15' method='GET'>" + ivrMessage + "</GetDigits></Response>"; Logger.TraceLog("responseXml " + responseXml); } else if (dbMessage.ToLower() == "justcompleted") { responseXml = "<Response><Speak>Selected Group was just before completed</Speak><Hangup/></Response>"; } else if (dbMessage.ToLower() == "noconf") { responseXml = "<Response><Speak>No group created With your number</Speak><Hangup/></Response>"; } else if (dbMessage.ToLower() == "invalidaccesskey") { responseXml = "<Response><play>" + voiceClipUrl + "InvalidPIN.mp3" + "</play></Response>"; } else if (dbMessage.ToLower() == "hangup") { responseXml = "<Response><Hangup 'hangup'/></Response>"; } else if (dbMessage.ToLower() == "exception") { responseXml = "<Response><Hangup data= '" + dbMessage + "'/></Response>"; } else { responseXml = "<Response><Hangup data= '" + dbMessage + "'/></Response>"; } } } catch (Exception ex) { Logger.ExceptionLog("exception at xml creation : " + ex.ToString()); } } } ; return(responseXml); }