Пример #1
0
        private AsyncUnaryCall <TResponse> UseNewMethod <TResponse>(object[] parameters = null)
            where TResponse : class
        {
            var assemblyArrary = FallbackMethod.Split("|");
            var assembly       = Assembly.Load(assemblyArrary?.FirstOrDefault());

            var instance = Activator.CreateInstance(assembly.GetType());
            var obj      = assembly?.GetType().GetMethod(assemblyArrary.LastOrDefault()).Invoke(instance, parameters);

            return(obj as AsyncUnaryCall <TResponse>);
        }
Пример #2
0
        /// <summary>
        /// Generate the necessary parameters
        /// </summary>
        public List <KeyValuePair <string, string> > GetParams()
        {
            var p = new List <KeyValuePair <string, string> >();

            if (Url != null)
            {
                p.Add(new KeyValuePair <string, string>("Url", Serializers.Url(Url)));
            }

            if (Method != null)
            {
                p.Add(new KeyValuePair <string, string>("Method", Method.ToString()));
            }

            if (Status != null)
            {
                p.Add(new KeyValuePair <string, string>("Status", Status.ToString()));
            }

            if (FallbackUrl != null)
            {
                p.Add(new KeyValuePair <string, string>("FallbackUrl", Serializers.Url(FallbackUrl)));
            }

            if (FallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("FallbackMethod", FallbackMethod.ToString()));
            }

            if (StatusCallback != null)
            {
                p.Add(new KeyValuePair <string, string>("StatusCallback", Serializers.Url(StatusCallback)));
            }

            if (StatusCallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("StatusCallbackMethod", StatusCallbackMethod.ToString()));
            }

            if (Twiml != null)
            {
                p.Add(new KeyValuePair <string, string>("Twiml", Twiml.ToString()));
            }

            return(p);
        }
Пример #3
0
        /// <summary>
        /// Generate the necessary parameters
        /// </summary>
        public List <KeyValuePair <string, string> > GetParams()
        {
            var p = new List <KeyValuePair <string, string> >();

            if (Url != null)
            {
                p.Add(new KeyValuePair <string, string>("Url", Url.AbsoluteUri.TrimEnd('/')));
            }

            if (Method != null)
            {
                p.Add(new KeyValuePair <string, string>("Method", Method.ToString()));
            }

            if (Status != null)
            {
                p.Add(new KeyValuePair <string, string>("Status", Status.ToString()));
            }

            if (FallbackUrl != null)
            {
                p.Add(new KeyValuePair <string, string>("FallbackUrl", FallbackUrl.AbsoluteUri.TrimEnd('/')));
            }

            if (FallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("FallbackMethod", FallbackMethod.ToString()));
            }

            if (StatusCallback != null)
            {
                p.Add(new KeyValuePair <string, string>("StatusCallback", StatusCallback.AbsoluteUri.TrimEnd('/')));
            }

            if (StatusCallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("StatusCallbackMethod", StatusCallbackMethod.ToString()));
            }

            return(p);
        }
Пример #4
0
        /// <summary>
        /// Generate the necessary parameters
        /// </summary>
        public List <KeyValuePair <string, string> > GetParams()
        {
            var p = new List <KeyValuePair <string, string> >();

            if (FriendlyName != null)
            {
                p.Add(new KeyValuePair <string, string>("FriendlyName", FriendlyName));
            }

            if (InboundRequestUrl != null)
            {
                p.Add(new KeyValuePair <string, string>("InboundRequestUrl", Serializers.Url(InboundRequestUrl)));
            }

            if (InboundMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("InboundMethod", InboundMethod.ToString()));
            }

            if (FallbackUrl != null)
            {
                p.Add(new KeyValuePair <string, string>("FallbackUrl", Serializers.Url(FallbackUrl)));
            }

            if (FallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("FallbackMethod", FallbackMethod.ToString()));
            }

            if (StatusCallback != null)
            {
                p.Add(new KeyValuePair <string, string>("StatusCallback", Serializers.Url(StatusCallback)));
            }

            if (StickySender != null)
            {
                p.Add(new KeyValuePair <string, string>("StickySender", StickySender.Value.ToString().ToLower()));
            }

            if (MmsConverter != null)
            {
                p.Add(new KeyValuePair <string, string>("MmsConverter", MmsConverter.Value.ToString().ToLower()));
            }

            if (SmartEncoding != null)
            {
                p.Add(new KeyValuePair <string, string>("SmartEncoding", SmartEncoding.Value.ToString().ToLower()));
            }

            if (ScanMessageContent != null)
            {
                p.Add(new KeyValuePair <string, string>("ScanMessageContent", ScanMessageContent.ToString()));
            }

            if (FallbackToLongCode != null)
            {
                p.Add(new KeyValuePair <string, string>("FallbackToLongCode", FallbackToLongCode.Value.ToString().ToLower()));
            }

            if (AreaCodeGeomatch != null)
            {
                p.Add(new KeyValuePair <string, string>("AreaCodeGeomatch", AreaCodeGeomatch.Value.ToString().ToLower()));
            }

            if (ValidityPeriod != null)
            {
                p.Add(new KeyValuePair <string, string>("ValidityPeriod", ValidityPeriod.Value.ToString()));
            }

            if (SynchronousValidation != null)
            {
                p.Add(new KeyValuePair <string, string>("SynchronousValidation", SynchronousValidation.Value.ToString().ToLower()));
            }

            return(p);
        }
Пример #5
0
        /// <summary>
        /// Generate the necessary parameters
        /// </summary>
        public List <KeyValuePair <string, string> > GetParams()
        {
            var p = new List <KeyValuePair <string, string> >();

            if (To != null)
            {
                p.Add(new KeyValuePair <string, string>("To", To.ToString()));
            }

            if (From != null)
            {
                p.Add(new KeyValuePair <string, string>("From", From.ToString()));
            }

            if (Url != null)
            {
                p.Add(new KeyValuePair <string, string>("Url", Serializers.Url(Url)));
            }

            if (Twiml != null)
            {
                p.Add(new KeyValuePair <string, string>("Twiml", Twiml.ToString()));
            }

            if (ApplicationSid != null)
            {
                p.Add(new KeyValuePair <string, string>("ApplicationSid", ApplicationSid.ToString()));
            }

            if (Method != null)
            {
                p.Add(new KeyValuePair <string, string>("Method", Method.ToString()));
            }

            if (FallbackUrl != null)
            {
                p.Add(new KeyValuePair <string, string>("FallbackUrl", Serializers.Url(FallbackUrl)));
            }

            if (FallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("FallbackMethod", FallbackMethod.ToString()));
            }

            if (StatusCallback != null)
            {
                p.Add(new KeyValuePair <string, string>("StatusCallback", Serializers.Url(StatusCallback)));
            }

            if (StatusCallbackEvent != null)
            {
                p.AddRange(StatusCallbackEvent.Select(prop => new KeyValuePair <string, string>("StatusCallbackEvent", prop)));
            }

            if (StatusCallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("StatusCallbackMethod", StatusCallbackMethod.ToString()));
            }

            if (SendDigits != null)
            {
                p.Add(new KeyValuePair <string, string>("SendDigits", SendDigits));
            }

            if (Timeout != null)
            {
                p.Add(new KeyValuePair <string, string>("Timeout", Timeout.ToString()));
            }

            if (Record != null)
            {
                p.Add(new KeyValuePair <string, string>("Record", Record.Value.ToString().ToLower()));
            }

            if (RecordingChannels != null)
            {
                p.Add(new KeyValuePair <string, string>("RecordingChannels", RecordingChannels));
            }

            if (RecordingStatusCallback != null)
            {
                p.Add(new KeyValuePair <string, string>("RecordingStatusCallback", RecordingStatusCallback));
            }

            if (RecordingStatusCallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("RecordingStatusCallbackMethod", RecordingStatusCallbackMethod.ToString()));
            }

            if (SipAuthUsername != null)
            {
                p.Add(new KeyValuePair <string, string>("SipAuthUsername", SipAuthUsername));
            }

            if (SipAuthPassword != null)
            {
                p.Add(new KeyValuePair <string, string>("SipAuthPassword", SipAuthPassword));
            }

            if (MachineDetection != null)
            {
                p.Add(new KeyValuePair <string, string>("MachineDetection", MachineDetection));
            }

            if (MachineDetectionTimeout != null)
            {
                p.Add(new KeyValuePair <string, string>("MachineDetectionTimeout", MachineDetectionTimeout.ToString()));
            }

            if (RecordingStatusCallbackEvent != null)
            {
                p.AddRange(RecordingStatusCallbackEvent.Select(prop => new KeyValuePair <string, string>("RecordingStatusCallbackEvent", prop)));
            }

            if (Trim != null)
            {
                p.Add(new KeyValuePair <string, string>("Trim", Trim));
            }

            if (CallerId != null)
            {
                p.Add(new KeyValuePair <string, string>("CallerId", CallerId));
            }

            if (MachineDetectionSpeechThreshold != null)
            {
                p.Add(new KeyValuePair <string, string>("MachineDetectionSpeechThreshold", MachineDetectionSpeechThreshold.ToString()));
            }

            if (MachineDetectionSpeechEndThreshold != null)
            {
                p.Add(new KeyValuePair <string, string>("MachineDetectionSpeechEndThreshold", MachineDetectionSpeechEndThreshold.ToString()));
            }

            if (MachineDetectionSilenceTimeout != null)
            {
                p.Add(new KeyValuePair <string, string>("MachineDetectionSilenceTimeout", MachineDetectionSilenceTimeout.ToString()));
            }

            if (AsyncAmd != null)
            {
                p.Add(new KeyValuePair <string, string>("AsyncAmd", AsyncAmd));
            }

            if (AsyncAmdStatusCallback != null)
            {
                p.Add(new KeyValuePair <string, string>("AsyncAmdStatusCallback", Serializers.Url(AsyncAmdStatusCallback)));
            }

            if (AsyncAmdStatusCallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("AsyncAmdStatusCallbackMethod", AsyncAmdStatusCallbackMethod.ToString()));
            }

            if (Byoc != null)
            {
                p.Add(new KeyValuePair <string, string>("Byoc", Byoc.ToString()));
            }

            if (CallReason != null)
            {
                p.Add(new KeyValuePair <string, string>("CallReason", CallReason));
            }

            return(p);
        }
Пример #6
0
        /// <summary>
        /// Generate the necessary parameters
        /// </summary>
        public List <KeyValuePair <string, string> > GetParams()
        {
            var p = new List <KeyValuePair <string, string> >();

            if (To != null)
            {
                p.Add(new KeyValuePair <string, string>("To", To.ToString()));
            }

            if (From != null)
            {
                p.Add(new KeyValuePair <string, string>("From", From.ToString()));
            }

            if (Url != null)
            {
                p.Add(new KeyValuePair <string, string>("Url", Url.AbsoluteUri.TrimEnd('/')));
            }

            if (ApplicationSid != null)
            {
                p.Add(new KeyValuePair <string, string>("ApplicationSid", ApplicationSid.ToString()));
            }

            if (Method != null)
            {
                p.Add(new KeyValuePair <string, string>("Method", Method.ToString()));
            }

            if (FallbackUrl != null)
            {
                p.Add(new KeyValuePair <string, string>("FallbackUrl", FallbackUrl.AbsoluteUri.TrimEnd('/')));
            }

            if (FallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("FallbackMethod", FallbackMethod.ToString()));
            }

            if (StatusCallback != null)
            {
                p.Add(new KeyValuePair <string, string>("StatusCallback", StatusCallback.AbsoluteUri.TrimEnd('/')));
            }

            if (StatusCallbackEvent != null)
            {
                p.AddRange(StatusCallbackEvent.Select(prop => new KeyValuePair <string, string>("StatusCallbackEvent", prop)));
            }

            if (StatusCallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("StatusCallbackMethod", StatusCallbackMethod.ToString()));
            }

            if (SendDigits != null)
            {
                p.Add(new KeyValuePair <string, string>("SendDigits", SendDigits));
            }

            if (IfMachine != null)
            {
                p.Add(new KeyValuePair <string, string>("IfMachine", IfMachine));
            }

            if (Timeout != null)
            {
                p.Add(new KeyValuePair <string, string>("Timeout", Timeout.Value.ToString()));
            }

            if (Record != null)
            {
                p.Add(new KeyValuePair <string, string>("Record", Record.Value.ToString().ToLower()));
            }

            if (RecordingChannels != null)
            {
                p.Add(new KeyValuePair <string, string>("RecordingChannels", RecordingChannels));
            }

            if (RecordingStatusCallback != null)
            {
                p.Add(new KeyValuePair <string, string>("RecordingStatusCallback", RecordingStatusCallback));
            }

            if (RecordingStatusCallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("RecordingStatusCallbackMethod", RecordingStatusCallbackMethod.ToString()));
            }

            if (SipAuthUsername != null)
            {
                p.Add(new KeyValuePair <string, string>("SipAuthUsername", SipAuthUsername));
            }

            if (SipAuthPassword != null)
            {
                p.Add(new KeyValuePair <string, string>("SipAuthPassword", SipAuthPassword));
            }

            if (MachineDetection != null)
            {
                p.Add(new KeyValuePair <string, string>("MachineDetection", MachineDetection));
            }

            if (MachineDetectionTimeout != null)
            {
                p.Add(new KeyValuePair <string, string>("MachineDetectionTimeout", MachineDetectionTimeout.Value.ToString()));
            }

            if (RecordingStatusCallbackEvent != null)
            {
                p.AddRange(RecordingStatusCallbackEvent.Select(prop => new KeyValuePair <string, string>("RecordingStatusCallbackEvent", prop)));
            }

            return(p);
        }