Esempio n. 1
0
        /// <summary>
        /// Create a new call handler template in the Connection directory
        /// </summary>
        /// <param name="pConnectionServer">
        /// Connection server being edited
        /// </param>
        /// <param name="pDisplayName">
        /// Display Name of the new call handler template - must be unique.
        /// </param>
        /// <param name="pRecipientUserId">
        /// If a user is a recipient, pass the objectId in here - must pass either recipient or distribution list
        /// </param>
        /// <param name="pPropList">
        /// List ConnectionProperty pairs that identify a property name and a new value for that property to apply to the template being created.
        /// This is passed in as a ConnectionPropertyList instance which contains 1 or more ConnectionProperty instances.  Can be passed as null here.
        /// </param>
        /// <param name="pCallHandlerTemplate">
        /// Newly created call handler template instance is passed back in this out parameter
        /// </param>
        /// <param name="pMediaSwitchObjectId">
        /// Phone system the interviewer will be associated with.
        /// </param>
        /// <param name="pRecipientDistributionListId">
        /// If a list is a recipient, pass the objectId in here - must pass either recipient or distribution list
        /// </param>
        /// <returns>
        /// Instance of the WebCallResult class.
        /// </returns>
        public static WebCallResult AddCallHandlerTemplate(ConnectionServerRest pConnectionServer,
                                                           string pDisplayName,
                                                           string pMediaSwitchObjectId,
                                                           string pRecipientDistributionListId,
                                                           string pRecipientUserId,
                                                           ConnectionPropertyList pPropList,
                                                           out CallHandlerTemplate pCallHandlerTemplate)
        {
            pCallHandlerTemplate = null;

            WebCallResult res = AddCallHandlerTemplate(pConnectionServer, pDisplayName, pMediaSwitchObjectId, pRecipientDistributionListId,
                                                       pRecipientUserId, pPropList);

            //if the call went through then the ObjectId will be returned in the URI form.
            if (res.Success)
            {
                //fetc the instance of the template just created.
                try
                {
                    pCallHandlerTemplate = new CallHandlerTemplate(pConnectionServer, res.ReturnedObjectId);
                }
                catch (Exception)
                {
                    res.Success   = false;
                    res.ErrorText = "Could not find newly created handler template by objectId:" + res;
                }
            }

            return(res);
        }
Esempio n. 2
0
        /// <summary>
        /// Fetch a single instance of a CallHandlerTemplate using the objectId or name of the template
        /// </summary>
        /// <param name="pCallHandlerTemplate">
        /// Pass back the instance of the handler template on this parameter
        /// </param>
        /// <param name="pConnectionServer">
        /// Connection server being searched
        /// </param>
        /// <param name="pObjectId">
        /// ObjectId of the template to fetch
        /// </param>
        /// <param name="pDisplayName">
        /// Display name of template to search for
        /// </param>
        /// <returns>
        /// Instance of the WebCallResult class.
        /// </returns>
        public static WebCallResult GetCallHandlerTemplate(out CallHandlerTemplate pCallHandlerTemplate, ConnectionServerRest pConnectionServer,
                                                           string pObjectId = "", string pDisplayName = "")
        {
            WebCallResult res = new WebCallResult();

            res.Success = false;

            pCallHandlerTemplate = null;

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

            //you need an objectID and/or a display name - both being blank is not acceptable
            if ((string.IsNullOrEmpty(pObjectId)) & (string.IsNullOrEmpty(pDisplayName)))
            {
                res.ErrorText = "Empty objectId and DisplayName passed to GetCallHandlerTemplate";
                return(res);
            }

            //create a new CallHandlerTemplate instance passing the ObjectId (or alias) which fills out the data automatically
            try
            {
                pCallHandlerTemplate = new CallHandlerTemplate(pConnectionServer, pObjectId, pDisplayName);
                res.Success          = true;
            }
            catch (UnityConnectionRestException ex)
            {
                return(ex.WebCallResult);
            }

            return(res);
        }