public DialResult Dial(string number, CallType callType) { CommandArgs args = new CommandArgs("Number", number); args.Add("CallType", callType.ToString()); return(Dial(args)); }
/// <summary> /// Returns a string array of all the entities data /// </summary> public string[] ToString() { // Work out time from seconds TimeSpan st = TimeSpan.FromSeconds(StartTime); TimeSpan wt = TimeSpan.FromSeconds(BeginWait); // Format the hours int stHours = st.Hours + (Global.StartSimulationTime / Constants.DATE_TIME_FACTOR); int wtHours = wt.Hours + (Global.StartSimulationTime / Constants.DATE_TIME_FACTOR); // Setup strings for formatting string entityID = ID.ToString(); string eventType = "---"; string eventTime = "---"; // When a calltype has been assigned string entityCallType = (CallType == null) ? "---" : CallType.ToString(); // When no time has been set string entityStartTime = (StartTime == 0) ? "---" : string.Format("{0:D1}:{1:D2}:{2:D2}", stHours, st.Minutes, st.Seconds); string entityBeginWait = (BeginWait == 0) ? "---" : string.Format("{0:D1}:{1:D2}:{2:D2}", wtHours, wt.Minutes, wt.Seconds); // Return list for datagridviews return(new string[] { entityID, eventType, eventTime, entityCallType, entityStartTime, entityBeginWait }); }
private static Type ValidateCallType(ref CallType callType, Type type, string parameterName, out FieldInfo fieldInfo, out PropertyInfo propInfo, out MethodInfo methodInfo) { fieldInfo = (callType == CallType.Field || callType == CallType.auto) ? type.GetField(parameterName) : null; propInfo = (callType == CallType.Property || callType == CallType.auto) ? type.GetProperty(parameterName) : null; methodInfo = (callType == CallType.Method || callType == CallType.auto) ? type.GetMethod(parameterName) : null; if (propInfo == null && fieldInfo == null && methodInfo == null) { throw new ArgumentException($"There is no {callType.ToString()} {parameterName} on the component {type.Name}!"); } else if (callType == CallType.auto) { Exception throwIfMultiple = new ArgumentException($"There is multiple parameters called {callType.ToString()} on the component {type.Name}! Please specify the call type."); if (propInfo != null) { callType = CallType.Property; } if (fieldInfo != null) { if (callType == CallType.auto) { callType = CallType.Field; } else { throw throwIfMultiple; } } if (methodInfo != null) { if (callType == CallType.auto) { callType = CallType.Method; } else { throw throwIfMultiple; } } } switch (callType) { case CallType.Field: return(fieldInfo.FieldType); case CallType.Property: return(propInfo.PropertyType); case CallType.Method: return(typeof(object[])); default: return(null); } }
/// <summary> /// Builds a ZAP API request url. /// </summary> /// <param name="dataType">The data type of the request.</param> /// <param name="component">The component the API call resides in.</param> /// <param name="callType">The call type of the request.</param> /// <param name="method">The method name of the API call.</param> /// <param name="parameters">Optional parameters to send to the API method.</param> /// <returns>ZAP API request url.</returns> public static string BuildRequestUrl(DataType dataType, string component, CallType callType, string method, IDictionary <string, object> parameters) { var urlPath = $"http://zap/{dataType.ToString().ToLower()}/{component}/{callType.ToString().ToLower()}/{method}/"; if (parameters != null && parameters.Any()) { var queryString = parameters.ToQueryString(); urlPath = $"{urlPath}?{queryString}"; } return(urlPath); }
static void Throw(CallType callType, string method, Type type, IList <Operator> arguments) { string message = string.Format("No {0} function with name {1} found in the type {2}", callType.ToString().ToLowerInvariant(), method, type.FullName); if (arguments.Count != 0) { message = message + " having the following argument types: " + string.Join(", ", arguments.Select(arg => arg.Expression.Type.FullName).ToArray()); } throw new ExpressionConfigException(message); }
protected virtual HttpsClientRequest GetClientRequest() { HttpsClientRequest result = null; try { result = HttpsRequestFactory.GetClientRequest(CallType); } catch (Exception ex) { CrestronConsole.PrintLine("SimplTeslaMaster.Results.BaseResult.GetClientRequest()::Failed to create client request for call type '" + CallType.ToString() + "' " + ex.ToString()); } return(result); }
/// <summary> /// Get diagnostic exception message /// </summary> /// <param name="comObject">caller instance</param> /// <param name="name">name of invoke target</param> /// <param name="type">type of invoke target</param> /// <param name="versionHandler">optional version providers for application instances</param> /// <param name="arguments">arguments as any</param> /// <returns>diagnostic exception message or error message if an exception occurs</returns> private static string GetExceptionDiagnosticsMessage(ICOMObject comObject, string name, CallType type, CoreServices.Internal.ApplicationVersionHandler versionHandler, object[] arguments = null) { try { Settings settings = comObject.Settings; string diagMessage = settings.ExceptionDiagnosticsMessage; if (String.IsNullOrWhiteSpace(diagMessage)) { return(diagMessage); } if (diagMessage.Contains("{ApplicationVersions}") || diagMessage.Contains("{NlApplicationVersions}")) { if (null != versionHandler) { string versionString = String.Empty; foreach (var item in versionHandler.ThreadSafeEnumerable()) { if (!item.VersionRequested) { item.TryRequestVersion(); } object version = item.Version; if (null != version) { versionString += item.Name + " " + version.ToString() + ";"; } } if (versionString != String.Empty) { if (diagMessage.Contains("{ApplicationVersions}")) { diagMessage = diagMessage.Replace("{ApplicationVersions}", "Application Versions:" + versionString); } else { diagMessage = diagMessage.Replace("{NlApplicationVersions}", Environment.NewLine + "Application Versions:" + versionString); } } else { diagMessage = diagMessage.Replace("{ApplicationVersions}", String.Empty); diagMessage = diagMessage.Replace("{NlApplicationVersions}", String.Empty); } } else { diagMessage = diagMessage.Replace("{ApplicationVersions}", String.Empty); diagMessage = diagMessage.Replace("{NlApplicationVersions}", String.Empty); } } diagMessage = diagMessage.Replace("{CallType}", type.ToString()); diagMessage = diagMessage.Replace("{CallInstance}", comObject.InstanceFriendlyName); diagMessage = diagMessage.Replace("{Name}", name); if (diagMessage.IndexOf("{Args}") > -1 || diagMessage.IndexOf("{ParenthesizedArgs}") > -1) { string argsString = String.Empty; if (null != arguments && arguments.Length > 0) { for (int i = 0; i < arguments.Length; i++) { object arg = arguments[i]; if (null != arg) { if (arg == Type.Missing) { argsString += "<Type.Missing>"; } else { ICOMObject comObjectArg = arg as ICOMObject; if (null != comObjectArg) { argsString += comObjectArg.InstanceFriendlyName; } else if (arg is MarshalByRefObject) { argsString += TryGetProxyClassName(arg); } else { argsString += arg.ToString(); } } } else { argsString += "<null>"; } if (i < arguments.Length - 1) { argsString += ", "; } } } diagMessage = diagMessage.Replace("{NewLine}", Environment.NewLine); diagMessage = diagMessage.Replace("{Args}", argsString); diagMessage = diagMessage.Replace("{ParenthesizedArgs}", argsString != String.Empty ? "(" + argsString + ")" : ""); } return(diagMessage); } catch { return("<Failed to create exception message. Please report this error.>"); } }
/// <summary> /// Attach to phone device which will act as our media recording/playback interface. /// </summary> /// <returns> /// A ConnectionCUPIClientFunctions.WebCallResult value... /// </returns> private WebCallResult AttachToPhone() { string strUrl = string.Format("{0}calls", _homeServer.BaseUrl); Dictionary <string, string> oParams = new Dictionary <string, string>(); oParams.Add("number", _phoneNumber); oParams.Add("maximumRings", _rings.ToString()); if (_homeServer.Version.IsVersionAtLeast(10, 5, 2, 0)) { oParams.Add("callType", _callType.ToString()); } WebCallResult res = _homeServer.GetCupiResponse(strUrl, MethodType.POST, oParams); if (res.Success == false) { return(res); } //the response will be in the form of: // "vmrest/calls/2" // where "2" there can be different - this is the call ID we need to use for this instance of the phone recording // class as there may be many calls active on the server at the same time. res.Success = false; res.ErrorText = "Failed to get CallId back on phone call creation - could not parse from response text."; if (string.IsNullOrEmpty(res.ResponseText) || res.ResponseText.Contains("vmrest/calls/") == false) { //oops return(res); } //get the trailing number after the last "/" int iPos = res.ResponseText.LastIndexOf('/'); int iPos2 = res.ResponseText.LastIndexOf('\n'); if (iPos2 < 0) { iPos2 = res.ResponseText.Length - 1; } if (res.ResponseText.Length - 1 <= iPos) { return(res); } string strId = res.ResponseText.Substring(iPos + 1, iPos2 - iPos); if (int.TryParse(strId, out _callId) == false) { return(res); } //if we requested video and didn't get it, fail the call. if (_homeServer.Version.IsVersionAtLeast(10, 5, 2, 0)) { object oValue; if (res.JsonDictionary.TryGetValue("callType", out oValue)) { if (!oValue.ToString().ToLower().Equals(_callType.ToString().ToLower())) { res.ErrorText = "Failed to get video chanel on TRAP request"; return(res); } } } res.Success = true; res.ErrorText = ""; return(res); }
public override string ToString() => CallType.ToString();
/// <summary> /// Get diagnostic exception message /// </summary> /// <param name="comObject">caller instance</param> /// <param name="name">name of invoke target</param> /// <param name="type">type of invoke target</param> /// <param name="arguments">arguments as any</param> /// <returns>diagnostic exception message or error message if an exception occurs</returns> internal static string GetExceptionDiagnosticsMessage(ICOMObject comObject, string name, CallType type, object[] arguments = null) { try { Settings settings = comObject.Settings; string diagMessage = settings.ExceptionDiagnosticsMessage; if (String.IsNullOrWhiteSpace(diagMessage)) { return(diagMessage); } diagMessage = diagMessage.Replace("{CallType}", type.ToString()); diagMessage = diagMessage.Replace("{CallInstance}", comObject.InstanceFriendlyName); diagMessage = diagMessage.Replace("{Name}", name); if (diagMessage.IndexOf("{Args}") > -1) { string argsString = String.Empty; if (null != arguments && arguments.Length > 0) { for (int i = 0; i < arguments.Length; i++) { object arg = argsString[i]; if (null != argsString) { if (arg == Type.Missing) { argsString += "<Type.Missing>"; } else { ICOMObject comObjectArg = arg as ICOMObject; if (null != comObjectArg) { argsString += comObjectArg.InstanceFriendlyName; } else if (arg is MarshalByRefObject) { argsString += TryGetProxyClassName(arg); } else { argsString += arg.ToString(); } } } else { argsString += "<null>"; } if (i < arguments.Length - 1) { argsString += ", "; } } } diagMessage = diagMessage.Replace("{Args}", argsString); } return(diagMessage); } catch { return("<Failed to create Exception Message. Please report this bug.>"); } }
private void OnCallDelivered(string str) { try { XmlDocument xdoc = new XmlDocument(); xdoc.LoadXml(str); XmlNode node = xdoc.SelectSingleNode("DE/callingD/extn/dID/text()"); XmlNode node1 = xdoc.SelectSingleNode("DE/calledD/extn/dID/text()"); XmlNode callIdNode = xdoc.SelectSingleNode("DE/con/cID/text()"); XmlNode UUINode = xdoc.SelectSingleNode("DE/uD/text()"); XmlNode UUINode2 = xdoc.SelectSingleNode("DE/orgCinfo/ui/text()"); XmlNode Didnode = xdoc.SelectSingleNode("DE/con/dID/text()"); XmlNode isconsultcalling = xdoc.SelectSingleNode("DE/orgCinfo/callingD/text()"); XmlNode isconsultcalled = xdoc.SelectSingleNode("DE/orgCinfo/calledD/text()"); string UUI = ""; if (UUINode.Value == "|") { UUI = UUINode2 != null ? UUINode2.Value : ""; } else { UUI = UUINode.Value.Split('|')[0]; } string ani = node.Value; string dnis = node1.Value; if (activeCallId != 0) { previousCall = activeCallId; } activeCallId = Int32.Parse(callIdNode.Value); Dictionary <string, string> dict = new Dictionary <string, string>(); dict.Add("UUI", UUI); CallType calltype = CallType.Inbound; bool ConferencedCall = false; if (isconsultcalling != null) { string consultcalling = isconsultcalling != null ? isconsultcalling.Value : ""; string consultcalled = isconsultcalled != null ? isconsultcalled.Value : ""; dict.Add("Consult", consultcalling + "|" + consultcalled); calltype = CallType.Consult; //ConferencedCall = true; } if (ani != ctiCallInfo.CurrentStation) { if (callsList.FirstOrDefault(x => x.Key == activeCallId).Value != ani) { callsList.Add(activeCallId, ani); ctiCallInfo.SetActiveCall(activeCallId); ctiCallInfo.SetCallData(activeCallId, ani); ctiCallInfo.SetExtensionAniData(ani, Didnode.Value); ctiSimCtrl.CreateCall(ani, dnis, dict, calltype, activeCallId, ani, ConferencedCall);//true Logger.Logger.Log.Info(string.Format("CtiServiceProvider: Creating {0}", calltype.ToString())); } } else { if (ctiCallInfo.blindTransfer) { ctiCallInfo.blindTransfer = false; return; } if (ctiCallInfo.blindConference) { ctiCallInfo.blindConference = false; return; } if (callsList.FirstOrDefault(x => x.Key == activeCallId).Value != dnis) { callsList.Add(activeCallId, dnis); ctiCallInfo.SetActiveCall(activeCallId); ctiCallInfo.SetCallData(activeCallId, dnis); Logger.Logger.Log.Info(string.Format("CtiServiceProvider: Creating {0}", CallType.Outbound.ToString())); } ctiCallInfo.SetExtensionAniData(dnis, Didnode.Value); SwitchInteraction inter = ctiSimCtrl.Interactions.FirstOrDefault(p => p.CallID == activeCallId); if (inter != null) { inter.CallType = calltype; inter.ConferencedCall = ConferencedCall; } } } catch (Exception ex) { Logger.Logger.Log.Error("CtiServiceProvider", ex); } }
public static void cstRemCall(uint ret, CallType rettype) { #if !optimised_b if (cstCallStack.Count > 0) { callstack_frame t = cstCallStack.Pop(); if (t.retadr != ret) { mem.WriteLine("Call stack wrong Ret address;" + sh4_disasm.UintToHex(ret) + "!=" + sh4_disasm.UintToHex(t.retadr) + " sub start : " + sh4_disasm.UintToHex(t.startadr)); dc.dbger.mode = 1; } if (t.calltype != rettype) { mem.WriteLine("Call stack wrong TYPE address;" + t.calltype.ToString() + "!=" + rettype.ToString() + " sub start : " + sh4_disasm.UintToHex(t.startadr)); //cstCallStack.Push(t); //dc.dbger.SetBP(t.startadr); dc.dbger.mode = 1; //sh4.pc = t.retadr; } } else { mem.WriteLine("Call stack unexpected ret"); } #endif }
public override string ToString() { return(((Name == null) ? "0x" + Convert.ToString(retadr, 16) : Name) + "+0x" + Convert.ToString((fromadr & 0x1FFFFFFF) - (startadr & 0x1FFFFFFF), 16) + " ;call type :" + calltype.ToString()); }