예제 #1
0
 public OutboundCall(CallOrigOptions callOptions) : base()
 {
     if (callOptions != null)
     {
         this.setIfMachine(callOptions.getIfMachine);
         this.setSendDigits(callOptions.getSendDigits);
         this.setTimeout(callOptions.getTimeout);
     }
 }
예제 #2
0
        /// <summary>
        /// Create a new call through the FreeClimb API using a registered
        /// FreeClimb application.
        /// </summary>
        /// <param name="to">The number to call out to (DNIS). This can be any valid phone number formatted in E.164 format.</param>
        /// <param name="from">The number to call from (ANI). This must be a number purchase from FreeClimb or a verified phone number owned by the user.</param>
        /// <param name="applicationId">The applicationId for the registered FreeClimb application which should handle this call.</param>
        /// <param name="callOptions">Optional CallOrigOptions instance to be used when creating a call.</param>
        /// <returns>A Call object returned by FreeClimb that represents the call that was created.</returns>
        /// <exception cref="FreeClimbException">Thrown upon failed request.</exception>
        /// <see cref="CallOrigOptions">CallOrigOptions class.</see>
        public Call create(string to, string from, string applicationId, CallOrigOptions callOptions = null)
        {
            OutboundCall outboundCall = new OutboundCall(callOptions);

            outboundCall.setTo(to);
            outboundCall.setFrom(from);
            outboundCall.setApplicationId(applicationId);

            string json = base.POST(this.path, outboundCall.toJson());

            if (string.IsNullOrEmpty(json) == true)
            {
                throw new FreeClimbException(string.Format("Failed to connect to {0} from {1}", to ?? string.Empty, from ?? string.Empty));
            }

            return(Call.fromJson(json));
        }