public async Task Can_I_Make_Call_With_Options() { var callOptions = new CallOptions(); callOptions.From = PhoneNumberFrom; callOptions.To = PhoneNumberTo; callOptions.Url = "http://liveoutput.com/EATCN84c"; callOptions.Method = HttpMethod.Get; callOptions.Timeout = 5; callOptions.SendDigits = "5"; callOptions.StatusCallback = "http://liveoutput.com/EATCN84c"; callOptions.StatusCallbackMethod = HttpMethod.Post; callOptions.FallbackUrl = "http://liveoutput.com/EATCN84c"; callOptions.FallbackMethod = HttpMethod.Get; callOptions.HeartbeatUrl = "http://liveoutput.com/EATCN84c"; callOptions.HeartbeatMethod = HttpMethod.Get; callOptions.HideCallerId = false; callOptions.Record = false; callOptions.RecordCallback = "http://liveoutput.com/EATCN84c"; callOptions.RecordCallbackMethod = HttpMethod.Post; callOptions.Transcribe = true; callOptions.TranscribeCallback = "http://liveoutput.com/EATCN84c"; var receivedCall = await Client.MakeCall(callOptions); var hangupCall = await Client.HangupCall(receivedCall.Sid); Assert.NotNull(receivedCall); Assert.Equal(receivedCall.Sid, hangupCall.Sid); }
static void Main(string[] args) { // Find your Account Sid and Auth Token at twilio.com/user/account string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; string AuthToken = "your_auth_token"; var twilio = new TwilioRestClient(AccountSid, AuthToken); var options = new CallOptions(); options.Url = "http://www.example.com/sipdial.xml"; options.To = "sip:[email protected]?hatchkey=4815162342"; options.From = "Jack"; var call = twilio.InitiateOutboundCall(options); Console.WriteLine(call.Sid); }
static void Main(string[] args) { // Find your Account Sid and Auth Token at twilio.com/user/account string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; string AuthToken = "your_auth_token"; var twilio = new TwilioRestClient(AccountSid, AuthToken); var options = new CallOptions(); options.Url = "http://demo.twilio.com/docs/voice.xml"; options.To = "+14155551212"; options.From = "+15017250604"; var call = twilio.InitiateOutboundCall(options); Console.WriteLine(call.Sid); }
static void Main(string[] args) { // Find your Account Sid and Auth Token at twilio.com/user/account string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; string AuthToken = "your_auth_token"; var twilio = new TwilioRestClient(AccountSid, AuthToken); var options = new CallOptions(); options.Url = "http://demo.twilio.com/docs/voice.xml"; options.From = "+18668675309"; options.Method = "GET"; options.StatusCallback = "https://www.myapp.com/events"; options.StatusCallbackMethod = "POST"; options.StatusCallbackEvents = new string[] { "initiated", "ringing", "answered", "completed" }; var call = twilio.InitiateOutboundCall(options); Console.WriteLine(call.Sid); }
public void ShouldInitiateOutboundCallWithCallbackEvents() { IRestRequest savedRequest = null; mockClient.Setup(trc => trc.Execute<Call>(It.IsAny<IRestRequest>())) .Callback<IRestRequest>((request) => savedRequest = request) .Returns(new Call()); var client = mockClient.Object; var options = new CallOptions(); options.To = TO; options.From = FROM; options.Url = URL; options.StatusCallback = "http://example.com"; string[] events = { "initiated", "ringing", "completed" }; options.StatusCallbackEvents = events; client.InitiateOutboundCall(options); mockClient.Verify(trc => trc.Execute<Call>(It.IsAny<IRestRequest>()), Times.Once); Assert.IsNotNull(savedRequest); Assert.AreEqual("Accounts/{AccountSid}/Calls.json", savedRequest.Resource); Assert.AreEqual(Method.POST, savedRequest.Method); Assert.AreEqual(7, savedRequest.Parameters.Count); var fromParam = savedRequest.Parameters.Find(x => x.Name == "From"); Assert.IsNotNull(fromParam); Assert.AreEqual(FROM, fromParam.Value); var toParam = savedRequest.Parameters.Find(x => x.Name == "To"); Assert.IsNotNull(toParam); Assert.AreEqual(TO, toParam.Value); var urlParam = savedRequest.Parameters.Find(x => x.Name == "Url"); Assert.IsNotNull(urlParam); Assert.AreEqual(URL, urlParam.Value); var callbackParam = savedRequest.Parameters.Find(x => x.Name == "StatusCallback"); Assert.IsNotNull(callbackParam); Assert.AreEqual("http://example.com", callbackParam.Value); var eventParams = savedRequest.Parameters.FindAll(x => x.Name == "StatusCallbackEvent"); Assert.IsNotNull(eventParams); Assert.AreEqual(3, eventParams.Count); var values = new System.Collections.Generic.List<string>(); eventParams.ForEach((p => values.Add(p.Value.ToString()))); values.Sort(); Assert.AreEqual(new List<string>() { "completed", "initiated", "ringing" }, values); }
/// <summary> /// Initiates a new phone call. /// </summary> /// <param name="options">Call settings. Only properties with values set will be used.</param> /// <param name="callback">Method to call upon successful completion</param> public void InitiateOutboundCall(CallOptions options, Action<Call> callback) { Require.Argument("From", options.From); Require.Argument("To", options.To); Require.Argument("Url", options.Url); var request = new RestRequest(Method.POST); request.Resource = "Accounts/{AccountSid}/Calls"; request.RootElement = "Calls"; AddCallOptions(options, request); ExecuteAsync<Call>(request, (response) => callback(response)); }
public Response PlainExtract(SimpleRequest request, CallOptions options) => throw new NotImplementedException();
public override TResponse BlockingUnaryCall <TRequest, TResponse>(Method <TRequest, TResponse> method, string host, CallOptions options, TRequest request) { Metadata = options.Headers; return((TResponse)Activator.CreateInstance(typeof(TResponse))); }
public override AsyncDuplexStreamingCall <TRequest, TResponse> AsyncDuplexStreamingCall <TRequest, TResponse>(Method <TRequest, TResponse> method, string host, CallOptions options) => throw new NotImplementedException();
public virtual AsyncUnaryCall <global::HOLMS.Types.Booking.Groups.GroupBookingExt> GetByIdFullAsync(global::HOLMS.Types.Booking.Indicators.GroupBookingIndicator request, CallOptions options) { return(CallInvoker.AsyncUnaryCall(__Method_GetByIdFull, null, options, request)); }
public virtual AsyncUnaryCall <global::HOLMS.Types.Booking.RPC.GroupBookingSvcGetReservationsWithTagResponse> GetReservationSummariesWithGBTagAsync(global::HOLMS.Types.Booking.Indicators.GroupBookingIndicator request, CallOptions options) { return(CallInvoker.AsyncUnaryCall(__Method_GetReservationSummariesWithGBTag, null, options, request)); }
public virtual global::Google.Protobuf.WellKnownTypes.Empty UpdateGroupBookingPrices(global::HOLMS.Types.Booking.RPC.GroupBookingSvcPriceUpdateRequest request, CallOptions options) { return(CallInvoker.BlockingUnaryCall(__Method_UpdateGroupBookingPrices, null, options, request)); }
public virtual global::HOLMS.Types.Supply.RateSchedule GetById(global::HOLMS.Types.Supply.RateScheduleIndicator request, CallOptions options) { return(CallInvoker.BlockingUnaryCall(__Method_GetById, null, options, request)); }
public virtual AsyncUnaryCall <global::HOLMS.Types.Supply.RPC.RateScheduleSvcAllResponse> AllAsync(global::Google.Protobuf.WellKnownTypes.Empty request, CallOptions options) { return(CallInvoker.AsyncUnaryCall(__Method_All, null, options, request)); }
public GrpcCall(Method <TRequest, TResponse> method, GrpcMethodInfo grpcMethodInfo, CallOptions options, GrpcChannel channel) : base(options, channel) { // Validate deadline before creating any objects that require cleanup ValidateDeadline(options.Deadline); _callCts = new CancellationTokenSource(); // Run the callTcs continuation immediately to keep the same context. Required for Activity. _callTcs = new TaskCompletionSource <Status>(); Method = method; _grpcMethodInfo = grpcMethodInfo; _deadline = options.Deadline ?? DateTime.MaxValue; Channel.RegisterActiveCall(this); }
/// <summary> /// Invokes a duplex streaming call asynchronously. /// In duplex streaming scenario, client sends a stream of requests and server responds with a stream of responses. /// The response stream is completely independent and both side can be sending messages at the same time. /// </summary> public override AsyncDuplexStreamingCall <TRequest, TResponse> AsyncDuplexStreamingCall <TRequest, TResponse>(Method <TRequest, TResponse> method, string host, CallOptions options) { host = InterceptHost(host); options = InterceptCallOptions(options); return(callInvoker.AsyncDuplexStreamingCall(method, host, options)); }
/// <summary> /// Intercepts a unary call. /// </summary> public override TResponse BlockingUnaryCall <TRequest, TResponse>(Method <TRequest, TResponse> method, string host, CallOptions options, TRequest request) { host = InterceptHost(host); options = InterceptCallOptions(options); return(callInvoker.BlockingUnaryCall(method, host, options, request)); }
public AsyncUnaryCall <global::Explainer.ExplainerReply> TellMeWhyAsync(global::Explainer.ExplainerRequest request, CallOptions options) { var call = CreateCall(__Method_TellMeWhy, options); return(Calls.AsyncUnaryCall(call, request)); }
public global::Explainer.ExplainerReply TellMeWhy(global::Explainer.ExplainerRequest request, CallOptions options) { var call = CreateCall(__Method_TellMeWhy, options); return(Calls.BlockingUnaryCall(call, request)); }
public virtual AsyncUnaryCall <global::HOLMS.Types.Supply.RateSchedule> GetByIdAsync(global::HOLMS.Types.Supply.RateScheduleIndicator request, CallOptions options) { return(CallInvoker.AsyncUnaryCall(__Method_GetById, null, options, request)); }
public AsyncUnaryCall <Response> ComplexAsync(NestedRequest request, CallOptions options) => throw new NotImplementedException();
public virtual global::HOLMS.Types.Supply.RateSchedule Update(global::HOLMS.Types.Supply.RateSchedule request, CallOptions options) { return(CallInvoker.BlockingUnaryCall(__Method_Update, null, options, request)); }
public virtual AsyncUnaryCall <global::Google.Protobuf.WellKnownTypes.Empty> UpdateQuantitiesAsync(global::HOLMS.Types.Booking.RPC.GroupBookingSvcQuantityUpdateRequest request, CallOptions options) { return(CallInvoker.AsyncUnaryCall(__Method_UpdateQuantities, null, options, request)); }
public virtual AsyncUnaryCall <global::HOLMS.Types.Supply.RateSchedule> UpdateAsync(global::HOLMS.Types.Supply.RateSchedule request, CallOptions options) { return(CallInvoker.AsyncUnaryCall(__Method_Update, null, options, request)); }
public virtual global::HOLMS.Types.Booking.Groups.GroupBooking GetById(global::HOLMS.Types.Booking.Indicators.GroupBookingIndicator request, CallOptions options) { return(CallInvoker.BlockingUnaryCall(__Method_GetById, null, options, request)); }
public virtual AsyncUnaryCall <global::HOLMS.Types.Primitive.ServerActionConfirmation> DeleteAsync(global::HOLMS.Types.Supply.RateSchedule request, CallOptions options) { return(CallInvoker.AsyncUnaryCall(__Method_Delete, null, options, request)); }
public virtual AsyncUnaryCall <global::HOLMS.Types.Booking.RPC.GroupBookingSvcGetByIdsResponse> GetByIdsAsync(global::HOLMS.Types.Booking.RPC.GroupBookingSvcGetByIdsRequest request, CallOptions options) { return(CallInvoker.AsyncUnaryCall(__Method_GetByIds, null, options, request)); }
/// <summary> /// Creates a new instance of <see cref="Grpc.Core.Interceptors.ClientInterceptorContext{TRequest, TResponse}" /> /// with the specified method, host, and call options. /// </summary> /// <param name="method">A <see cref="Grpc.Core.Method{TRequest, TResponse}"/> object representing the method to be invoked.</param> /// <param name="host">The host to dispatch the current call to.</param> /// <param name="options">A <see cref="Grpc.Core.CallOptions"/> instance containing the call options of the current call.</param> public ClientInterceptorContext(Method <TRequest, TResponse> method, string?host, CallOptions options) { Method = method; Host = host; Options = options; }
public override AsyncUnaryCall <TResponse> AsyncUnaryCall <TRequest, TResponse>(Method <TRequest, TResponse> method, string host, CallOptions options, TRequest request) => throw new NotImplementedException();
public bool CanCall(CallOptions options, string procedure) => false;
private string create(zObject acc) { var co = new CallOptions(); SaveResult[] result = client.create(co, sessionHeader, new[] {acc}); return result[0].Id; }
public AsyncUnaryCall <Response> PlainExtractAsync(SimpleRequest request, CallOptions options) => throw new NotImplementedException();
/// <summary> /// Initiates a new phone call. /// </summary> /// <param name="options">Call settings. Only properties with values set will be used.</param> public Call InitiateOutboundCall(CallOptions options) { Require.Argument("From", options.From); Require.Argument("To", options.To); Require.Argument("Url", options.Url); var request = new RestRequest(Method.POST); request.Resource = "Accounts/{AccountSid}/Calls"; request.RootElement = "Calls"; AddCallOptions(options, request); return Execute<Call>(request); }
public Response PlainFullField(SimpleRequest request, CallOptions options) => throw new NotImplementedException();
private static void AddCallOptions(CallOptions options, RestRequest request) { request.AddParameter("From", options.From); request.AddParameter("To", options.To); request.AddParameter("Url", options.Url); if (options.StatusCallback.HasValue()) request.AddParameter("StatusCallback", options.StatusCallback); if (options.StatusCallbackMethod.HasValue) request.AddParameter("StatusCallbackMethod", options.StatusCallbackMethod); if (options.FallbackUrl.HasValue()) request.AddParameter("FallbackUrl", options.FallbackUrl); if (options.FallbackMethod.HasValue) request.AddParameter("FallbackMethod", options.FallbackMethod); if (options.Method.HasValue) request.AddParameter("Method", options.Method); if (options.SendDigits.HasValue()) request.AddParameter("SendDigits", options.SendDigits); if (options.IfMachine.HasValue) request.AddParameter("IfMachine", options.IfMachine.Value); if (options.Timeout.HasValue) request.AddParameter("Timeout", options.Timeout.Value); }
public virtual AsyncUnaryCall <global::HOLMS.Types.Booking.Groups.GroupBookingExt> UpdateAsync(global::HOLMS.Types.Booking.Groups.GroupBooking request, CallOptions options) { return(CallInvoker.AsyncUnaryCall(__Method_Update, null, options, request)); }
public virtual AsyncUnaryCall <global::HOLMS.Types.Booking.RPC.GroupBookingSvcAllBookings> AllAsync(global::Google.Protobuf.WellKnownTypes.Empty request, CallOptions options) { return(CallInvoker.AsyncUnaryCall(__Method_All, null, options, request)); }
public Response Complex(NestedRequest request, CallOptions options) => throw new NotImplementedException();
public virtual global::HOLMS.Types.Booking.Groups.GroupBookingExt Update(global::HOLMS.Types.Booking.Groups.GroupBooking request, CallOptions options) { return(CallInvoker.BlockingUnaryCall(__Method_Update, null, options, request)); }
//create a list of objects in zuora public List<ResponseHolder> Create(List<zObject> input, bool singleTransaction) { List<ResponseHolder> results = new List<ResponseHolder>(); CallOptions co = new CallOptions(); SaveResult[] sr = new SaveResult[]{}; bool done = false; int createNum = 50; if (singleTransaction) { co.useSingleTransaction = true; co.useSingleTransactionSpecified = true; } while (!done) { List<zObject> doWork = new List<zObject>() { }; if (input.Count > createNum) { List<zObject> createList = input.GetRange(0, createNum); for (int i = 0; i < createNum; i++) { zObject temp = createList[i]; doWork.Add(temp); input.Remove(temp); } } else { done = true; doWork = input; } CheckTime(); try { sr = svc.create(co, sh, doWork.ToArray()); } catch (FaultException e) { ResponseHolder error = new ResponseHolder(); error.Message = e.Message; error.Success = false; results.Add(error); return results; } foreach (SaveResult s in sr) { ResponseHolder temp = new ResponseHolder(); if (s.Success) { temp.Success = true; temp.Id = s.Id; } else { temp.Success = false; temp.Message = s.Errors[0].Message; if(s.Errors[0].CodeSpecified) { temp.ErrorCode = s.Errors[0].Code.ToString(); } } results.Add(temp); } } return results; }