示例#1
0
        /// <summary>
        /// Fetches a port group server by ObjectId and passes it back as an out parameter as an instance of the PortGroupServer class.
        /// </summary>
        /// <param name="pPortGroupServer">
        /// Out param that the information is passed back on.
        /// </param>
        /// <param name="pConnectionServer">
        /// Connection server that the portgroup lives on.
        /// </param>
        /// <param name="pObjectId">
        /// ObjectId of the portgroup server to load.
        /// </param>
        /// <param name="pPortGroupObjectId">
        /// PortGroup that the port group server is tied to.
        /// </param>
        /// <returns>
        ///  Instance of the WebCallResults class containing details of the items sent and recieved from the CUPI interface.
        /// </returns>
        public static WebCallResult GetPortGroupServer(out PortGroupServer pPortGroupServer, ConnectionServerRest pConnectionServer, string pObjectId,
                                                       string pPortGroupObjectId)
        {
            WebCallResult res = new WebCallResult {
                Success = false
            };

            pPortGroupServer = null;

            if (pConnectionServer == null)
            {
                res.ErrorText = "Null Connection server object passed to GetPortGroupServer";
                return(res);
            }

            //you need an objectID and a PortGroupObjectId
            if (string.IsNullOrEmpty(pObjectId) | string.IsNullOrEmpty(pPortGroupObjectId))
            {
                res.ErrorText = "Empty objectId or PortGroupObjectId passed to GetPortGroupServer";
                return(res);
            }

            //create a new PortGroupServer instance passing the ObjectId (or display name) which fills out the data automatically
            try
            {
                pPortGroupServer = new PortGroupServer(pConnectionServer, pPortGroupObjectId, pObjectId);
                res.Success      = true;
            }
            catch (UnityConnectionRestException ex)
            {
                return(ex.WebCallResult);
            }
            catch (Exception ex)
            {
                res.ErrorText = "Failed to fetch port group server in GetPortGroupServer:" + ex.Message;
            }

            return(res);
        }
示例#2
0
        /// <summary>
        /// Adds a new port group server to a port group.
        /// </summary>
        /// <param name="pConnectionServer">
        /// The Connection server to add the port group server to.
        /// </param>
        /// <param name="pPortGroupObjectId">
        /// Port group to add the port group server to.
        /// </param>
        /// <param name="pMediaPortGroupServiceEnum"></param>
        /// <param name="pHostOrIpAddress">
        /// Host address or IP address of the server to add.
        /// </param>
        /// <param name="pHostOrIpAddressV6">
        /// IPV6 host or ip address
        /// </param>
        /// <param name="pPortGroupServer">
        /// Instance of the new PortGroupServer is passed back on this out parameter
        /// </param>
        /// <returns>
        /// Instance of the WebCallResults class containing details of the items sent and recieved from the CUPI interface.
        /// </returns>
        public static WebCallResult AddPortGroupServer(ConnectionServerRest pConnectionServer, string pPortGroupObjectId, int pMediaPortGroupServiceEnum,
                                                       string pHostOrIpAddress, string pHostOrIpAddressV6, out PortGroupServer pPortGroupServer)
        {
            pPortGroupServer = null;

            WebCallResult res = AddPortGroupServer(pConnectionServer, pPortGroupObjectId, pMediaPortGroupServiceEnum, pHostOrIpAddress, pHostOrIpAddressV6);

            //if the create goes through, fetch the phone system as an object and return it.
            if (res.Success)
            {
                res = GetPortGroupServer(out pPortGroupServer, pConnectionServer, res.ReturnedObjectId, pPortGroupObjectId);
            }

            return(res);
        }