/// <summary> /// Fetches an alternate extension object filled with all the properties for a specific alternate extension identified with the ObjectId /// of the user that owns it and the ObjectId of the alternate extension itself. /// </summary> /// <param name="pConnectionServer"> /// The Connection server that the alternate extension is homed on. /// </param> /// <param name="pUserObjectId"> /// The objectID of the user that owns the alternate extension to be fetched. /// </param> /// <param name="pObjectId"> /// The ObjectId of the alternate extension /// </param> /// <param name="pAlternateExtension"> /// The out parameter that the instance of the AlternateExtension class filled in with the details of the fetched alternate extension is /// passed back on. /// </param> /// <returns> /// Instance of the WebCallResults class containing details of the items sent and recieved from the CUPI interface. /// </returns> public static WebCallResult GetAlternateExtension(ConnectionServerRest pConnectionServer, string pUserObjectId, string pObjectId, out AlternateExtension pAlternateExtension) { WebCallResult res = new WebCallResult(); res.Success = false; pAlternateExtension = null; if (pConnectionServer == null) { res.ErrorText = "Null Connection server object passed to GetAlternateExtension"; return(res); } //create a new Alternate Extension instance passing the ObjectId which fills out the data automatically try { pAlternateExtension = new AlternateExtension(pConnectionServer, pUserObjectId, pObjectId); res.Success = true; } catch (UnityConnectionRestException ex) { return(ex.WebCallResult); } catch (Exception ex) { res.ErrorText = "Failed to fetch alternate extension in GetAlternateExtension:" + ex.Message; } return(res); }
/// <summary> /// Adds an alternate extension and returns the newly added extension as an instance of the AlternateExtension class via an out param. /// You can also add an alternate extension without this optional parameter which saves the extra CUPI fetch to retrieve it. /// </summary> /// <param name="pConnectionServer"> /// The Connection server that houses the user that the alternate extension will be added for. /// </param> /// <param name="pUserObjectId"> /// The GUID identifying the user to add the alternate extension for. /// </param> /// <param name="pIdIndex"> /// The alternate extension id to add the alternate extension to. 1-10 are administrator added extensions, 11 through 20 are user added. /// </param> /// <param name="pExtension"> /// The DTMFAccessID (extension) to add. /// </param> /// <param name="pAlternateExtension"> /// the out param that the instance of the AlternateExtension class filled with the newly added Alternate Extension's datails is passed /// back on. /// </param> /// <returns> /// Instance of the WebCallResults class containing details of the items sent and recieved from the CUPI interface. /// </returns> public static WebCallResult AddAlternateExtension(ConnectionServerRest pConnectionServer, string pUserObjectId, int pIdIndex, string pExtension, out AlternateExtension pAlternateExtension) { pAlternateExtension = null; WebCallResult res = AddAlternateExtension(pConnectionServer, pUserObjectId, pIdIndex, pExtension); //if the create goes through, fetch the alternate extension as an object and return it. if (res.Success) { res = GetAlternateExtension(pConnectionServer, pUserObjectId, res.ReturnedObjectId, out pAlternateExtension); } return(res); }