/** * Invoke a phone call * * @param number to call * @return Status of the call * @since v2.0 */ public ITelephonyStatus Call(string number) { // Start logging elapsed time. long tIn = TimerUtil.CurrentTimeMillis(); ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge(); if (logger != null) { logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "TelephonyBridge executing call..."); } ITelephonyStatus result = ITelephonyStatus.Unknown; if (this._delegate != null) { result = this._delegate.Call(number); if (logger != null) { logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "TelephonyBridge executed 'call' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms."); } } else { if (logger != null) { logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "TelephonyBridge no delegate for 'call'."); } } return(result); }
/** * Invokes the given method specified in the API request object. * * @param request APIRequest object containing method name and parameters. * @return APIResponse with status code, message and JSON response or a JSON null string for void functions. Status code 200 is OK, all others are HTTP standard error conditions. */ public new APIResponse Invoke(APIRequest request) { APIResponse response = new APIResponse(); int responseCode = 200; String responseMessage = "OK"; String responseJSON = "null"; switch (request.GetMethodName()) { case "call": string number0 = GetJSONProcessor().DeserializeObject <string>(request.GetParameters()[0]); ITelephonyStatus response0 = this.Call(number0); responseJSON = GetJSONProcessor().SerializeObject(response0); break; default: // 404 - response null. responseCode = 404; responseMessage = "TelephonyBridge does not provide the function '" + request.GetMethodName() + "' Please check your client-side API version; should be API version >= v2.2.15."; break; } response.SetResponse(responseJSON); response.SetStatusCode(responseCode); response.SetStatusMessage(responseMessage); return(response); }