Exemple #1
0
        /// <summary>
        /// returns a single RoutingRuleCondition object from an ObjectId string passed in.
        /// </summary>
        /// <param name="pCondition">
        /// The resulting condition is pulled out on this out param
        /// </param>
        /// <param name="pConnectionServer">
        /// Connection server that the rule condition is homed on.
        /// </param>
        /// <param name="pRoutingRuleObjectId">
        /// The routing rule that owns teh condition to fetch
        /// </param>
        /// <param name="pObjectId">
        /// The ObjectId of the condition to load
        /// </param>
        /// <returns>
        /// Instance of the WebCallResults class containing details of the items sent and recieved from the CUPI interface.
        /// </returns>
        public static WebCallResult GetRoutingRuleCondition(out RoutingRuleCondition pCondition, ConnectionServerRest pConnectionServer,
                                                            string pRoutingRuleObjectId, string pObjectId)
        {
            WebCallResult res = new WebCallResult();

            res.Success = false;

            pCondition = null;

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

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

            if (string.IsNullOrEmpty(pRoutingRuleObjectId))
            {
                res.ErrorText = "Empty RoutingRuleObjectId passed to GetRoutingRuleCondition";
                return(res);
            }

            //create a new routingRuleCondition instance passing the ObjectId which fills out the data automatically
            try
            {
                pCondition  = new RoutingRuleCondition(pConnectionServer, pRoutingRuleObjectId, pObjectId);
                res.Success = true;
            }
            catch (UnityConnectionRestException ex)
            {
                return(ex.WebCallResult);
            }
            catch (Exception ex)
            {
                res.ErrorText = "Failed to fetch condition in GetRoutingRuleCondition:" + ex.Message;
            }

            return(res);
        }
Exemple #2
0
        /// <summary>
        /// Add a new routing rule condition to a routing rule
        /// </summary>
        /// <param name="pConnectionServer">ConnectionServer the rule is homed on</param>
        /// <param name="pRoutingRuleObjectId">Identifier for the rule to add the condition for</param>
        /// <param name="pOperator">operator (equals, less than...)</param>
        /// <param name="pParameter">parameter (calling number, dialed number, port...)</param>
        /// <param name="pOperandValue">value to evaluate the parameter for using the operator</param>
        /// <param name="pCondition">New condition object is returned on this out parameter</param>
        /// <returns></returns>
        public static WebCallResult AddRoutingRuleCondition(ConnectionServerRest pConnectionServer,
                                                            string pRoutingRuleObjectId,
                                                            RoutingRuleConditionOperator pOperator,
                                                            RoutingRuleConditionParameter pParameter,
                                                            string pOperandValue,
                                                            out RoutingRuleCondition pCondition)
        {
            pCondition = null;

            WebCallResult res = AddRoutingRuleCondition(pConnectionServer, pRoutingRuleObjectId, pOperator, pParameter, pOperandValue);

            //if the create goes through, fetch the condition as an object and return it all filled in.
            if (res.Success)
            {
                res = GetRoutingRuleCondition(out pCondition, pConnectionServer, pRoutingRuleObjectId, res.ReturnedObjectId);
            }

            return(res);
        }
Exemple #3
0
 /// <summary>
 /// Add a condition that must be met for this routing rule to fire.
 /// </summary>
 /// <param name="pOperator">
 /// Operator to use (equals, less than etc...)
 /// </param>
 /// <param name="pParameter">
 /// Which parameter to evaluate (calling number, dialed number etc...)
 /// </param>
 /// <param name="pOperand">
 /// Value to apply the operator on against the parameter.
 /// </param>
 /// <returns></returns>
 public WebCallResult AddRoutingRuleCondition(RoutingRuleConditionOperator pOperator, RoutingRuleConditionParameter pParameter,
                                              string pOperand)
 {
     return(RoutingRuleCondition.AddRoutingRuleCondition(HomeServer, ObjectId, pOperator, pParameter, pOperand));
 }