示例#1
0
        public TelephonyProfileInfoResult TelephonyProfileUpdate(TelephonyProfileUpdateItem updateItem, bool isUpdate)
        {
            // act: "telephony-profile-update"
            if (updateItem == null)
            {
                throw new ArgumentNullException(nameof(updateItem));
            }

            var commandParams = QueryStringBuilder.EntityToQueryString(updateItem);

            if (updateItem.ProviderFields != null)
            {
                commandParams += updateItem.ProviderFields.ToQueryString();
            }

            StatusInfo status;
            var        doc = this.requestProcessor.Process(Commands.Telephony.ProfileUpdate, commandParams, out status);

            if (!ResponseIsOk(doc, status))
            {
                return(new TelephonyProfileInfoResult(status));
            }

            if (isUpdate)
            {
                return(this.TelephonyProfileInfo(updateItem.ProfileId));
            }

            // notice: no 'profile' will be returned during update!!
            //https://helpx.adobe.com/adobe-connect/webservices/telephony-provider-update.html
            var detailNode = doc.SelectSingleNode("results/telephony-profile");

            if (detailNode == null || detailNode.Attributes == null)
            {
                return(new TelephonyProfileInfoResult(status));
            }

            TelephonyProfile detail = null;

            try
            {
                detail = TelephonyProfileParser.Parse(detailNode);
            }
            catch (Exception ex)
            {
                TraceTool.TraceException(ex);
                status.Code    = StatusCodes.invalid;
                status.SubCode = StatusSubCodes.format;
                status.UnderlyingExceptionInfo = ex;
            }

            return(new TelephonyProfileInfoResult(status, detail));
        }
示例#2
0
        public TelephonyProfileInfoResult TelephonyProfileInfo(string profileId)
        {
            if (string.IsNullOrWhiteSpace(profileId))
            {
                throw new ArgumentException("Non-empty value expected", nameof(profileId));
            }

            // act: "telephony-profile-info"
            StatusInfo status;

            var doc = this.requestProcessor.Process(Commands.Telephony.ProfileInfo, string.Format(CommandParams.Telephony.ProfileId, profileId), out status);

            return(ResponseIsOk(doc, status)
                       ? new TelephonyProfileInfoResult(status, TelephonyProfileParser.Parse(doc.SelectSingleNode(TelephonyProfileHome)),
                                                        TelephonyProfileFieldsParser.Parse(doc.SelectSingleNode(TelephonyProfileFieldsHome)))
                       : new TelephonyProfileInfoResult(status));
        }