public InitiateOutboundCall ( CallOptions options ) : Call | ||
options | CallOptions | Call settings. Only properties with values set will be used. |
return | Call |
/// <summary> /// Initiate a new outgoing call /// </summary> /// <param name="from">The phone number to call from</param> /// <param name="to">The phone number to call to</param> /// <param name="url">The TwiML URL to use for controlling this call</param> /// <param name="statusCallback">The URL to notify upon completion of the call</param> /// <param name="statusCallbackMethod">The HTTP method to use when requesting the statusCallback URL</param> /// <param name="fallbackUrl">The URL to request upon encountering an in-call error</param> /// <param name="fallbackMethod">The HTTP method to use when requesting the fallbackUrl</param> /// <param name="ifMachine">The action to take when encountering an answering machine</param> /// <param name="sendDigits">The DTMF touch tone digits to transmit when the call is answered</param> /// <param name="timeout">The amount of time to allow a call to ring before ending</param> /// <returns>A Call Instance resource</returns> public static Call MakeCall(string from, string to, string url, string statusCallback, string statusCallbackMethod, string fallbackUrl, string fallbackMethod, string ifMachine, string sendDigits, int? timeout = null) { CheckForCredentials(); var twilio = new TwilioRestClient(AccountSid, AuthToken); var options = new CallOptions(); options.From = from; options.To = to; if (!string.IsNullOrEmpty(url)) { options.Url = url; } else { options.Url = HttpContext.Current.Request.Url.ToString(); } options.StatusCallback = statusCallback; options.StatusCallbackMethod = statusCallbackMethod; options.FallbackUrl = fallbackUrl; options.FallbackMethod = fallbackMethod; options.IfMachine = ifMachine; options.SendDigits = sendDigits; options.Timeout = timeout; return twilio.InitiateOutboundCall(options); }
public void lanzar() { try { // Find your Account Sid and Auth Token at twilio.com/user/account string AccountSid = "AC5ee97f763eb14e6754a03570fcd1b269"; string AuthToken = "3fec4bfd5ff5cd6379df62ac78a0e460"; var twilio = new TwilioRestClient(AccountSid, AuthToken); string url = "http://tiendapasteleria.esy.es/texttospeechc.php?Message%5B0%5D="; url += "Estimado " + ped.contacto_nom + " " + ped.contacto_ape + " este es un mensaje de la pasteleria San Elias. Le Notificamos que su pedido numero " + ped.idpedido + " esta " + ped.estado.descrip + " .Que tenga un buen dia"; url = url.Replace(" ", "%20"); // Build the parameters var options = new CallOptions(); options.Url = url; options.To = "+51" + "979085281"; options.From = "+12019890396"; var call = twilio.InitiateOutboundCall(options); Console.WriteLine(call.Sid); } catch (Exception e) { Console.WriteLine(e); } }
public string Get([FromUri] string phoneNumber, string flatteristId, string flattery) { const string accountSid = "YOURSIDE"; const string authToken = "YOURTOKEN"; const string fromNumber = "YOURNUMBER"; var client = new TwilioRestClient(accountSid, authToken); if (string.IsNullOrEmpty(flattery)) { var call = client.InitiateOutboundCall( fromNumber, // The number of the phone initiating the call string.Format("+{0}", phoneNumber), // The number of the phone receiving call string.Format("http://www.flatterist.com/{0}.mp3", flatteristId) // The URL Twilio will request when the call is answered ); if (call.RestException == null) { return string.Format("Started call: {0}", call.Sid); } return string.Format("Error: {0}", call.RestException.Message); } client.SendMessage(fromNumber, phoneNumber, flattery); return string.Format("Sent message to {0}", phoneNumber); }
public TwilioResponse ResponseToSms(SmsRequest request) { var response = new TwilioResponse(); try { string outboundPhoneNumber = request.From; var client = new TwilioRestClient(accountSid, authToken); var call = client.InitiateOutboundCall( twilioPhoneNumber, outboundPhoneNumber, "http://refuniteivr.azurewebsites.net/api/IVREntry"); if (call.RestException == null) { response.Sms("starting call to " + outboundPhoneNumber); } else { response.Sms("failed call to " + outboundPhoneNumber + " " + call.RestException.Message); } return response; } catch (Exception ex) { response.Sms("exception: " + ex.Message); return response; } }
static void Main(string[] args) { System.Console.WriteLine("通話を開始します。何かキーを入力してください。"); System.Console.ReadKey(); var accountSid = "12345"; var authToken = "abcde"; var twilioPhonenumber = "+815098765432"; var client = new TwilioRestClient(accountSid, authToken); var options = new CallOptions(); options.Url = "http://hogehoge.net/twiliosample/callbound"; options.To = "+819012345678"; options.From = twilioPhonenumber; options.IfMachine = "Continue"; var call = client.InitiateOutboundCall(options); if (call.RestException == null) { System.Console.WriteLine("通話を開始しました"); System.Console.WriteLine(string.Format("Started call: {0}", call.Sid)); } else { System.Console.WriteLine("通話は異常終了しました。"); System.Console.WriteLine(string.Format("Error: {0}", call.RestException.Message)); } System.Console.ReadKey(); }
public string MakeCall(string number, string message) { // Set our Account SID and AuthToken string accountSid = "AC955c4ca6365eb7628db4829d6a04966f"; string authToken = "bb63e780836aa018a012fd97f64f7b5f"; // A phone number you have previously validated with Twilio string phonenumber = "+16085127391"; // Instantiate a new Twilio Rest Client var client = new TwilioRestClient(accountSid, authToken); // Initiate a new outbound call client.InitiateOutboundCall( phonenumber, // The number of the phone initiating the call "+1" + number.ToString(), // The number of the phone receiving call call => { WebOperationContext.Current.OutgoingResponse.ContentType = "text/html"; var x = new XmlDocument(); x.LoadXml("<x>SpecialMessage</x>"); return x; } //"http://demo.twilio.com/welcome/voice/" // The URL Twilio will request when the call is answered ); if (call.RestException == null) { return string.Format("Started call: {0}", call.Sid); } else { return string.Format("Error: {0}", call.RestException.Message); } }
// // GET: /SendMessages/ public ActionResult Index() { bool messages = true; while (messages) { string storageConnectionString = "DefaultEndpointsProtocol=https;AccountName=AccountName;AccountKey=ACCOUNTKEY"; CloudStorageAccount storageAccount = CloudStorageAccount.Parse(storageConnectionString); CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient(); CloudQueue queue = queueClient.GetQueueReference("messages"); CloudQueueMessage retrievedMessage = queue.GetMessage(); if (retrievedMessage == null) { messages = false; } string phone = retrievedMessage.AsString; var twilio = new TwilioRestClient("accountSid", "authToken"); var call = twilio.InitiateOutboundCall("+YOURTWILIONUMBER", phone, "http://YOURSITE.azurewebsites.net/LookupCompliment/"); queue.DeleteMessage(retrievedMessage); } return View("Complete!"); }
public ActionResult txt2(SmsRequest request) { Demo.LogNumber(request); TwilioRestClient t = new TwilioRestClient(Constants.SID, Constants.AuthToken); t.InitiateOutboundCall(request.To, request.From, "http://onetugdemo.apphb.com/reftwilio/voice2"); TwilioResponse response = new TwilioResponse(); return TwiML(response); }
public void SendCall(string targetNumber) { string twilioNumber = "+18014299303"; string accountSid = "AC2cbe631411b305e102ac2e3ce2da0407"; string authToken = "9093223b161f8d4a9a97577b5cddbc20"; var client = new TwilioRestClient(accountSid, authToken); var url = "http://safetynet.azurewebsites.net/phone/GetCallTwiml"; client.InitiateOutboundCall(twilioNumber, targetNumber, url); }
public ActionResult Random() { CallOptions call = new CallOptions { From = Demo.GetRandom().Number, To = Demo.GetRandom().Number }; var twilio = new TwilioRestClient(Constants.SID, Constants.AuthToken); twilio.InitiateOutboundCall(call); return View(); }
public string GetCallPhone() { string AccountSid = "AC250c475896904f3249306f633df6d114"; string AuthToken = "ed3be1bdddedf301c711c4ee33f0e185"; var twilio = new TwilioRestClient(AccountSid, AuthToken); var options = new CallOptions(); options.Url = "http://demo.twilio.com/docs/voice.xml"; options.To = "+18179466874"; options.From = "+18179622556"; var call = twilio.InitiateOutboundCall(options); return "sucess"; }
public ActionResult Call(string to) { client = new TwilioRestClient(Settings.AccountSid, Settings.AuthToken); var result = client.InitiateOutboundCall(Settings.TwilioNumber, to, Settings.BaseUrl + Url.Action("Hello")); if (result.RestException!=null) { return new System.Web.Mvc.HttpStatusCodeResult(500, result.RestException.Message); } return Json(new { error=false }); }
public static void MakeACall(string to, string message) { var twilio = new TwilioRestClient(TwilioAccountSid, TwilioAuthToken); var co = new CallOptions(); co.To = to; twilio.InitiateOutboundCall(co); { } }
public ActionResult MakeCall(string number) { // Instantiate new Rest API object var client = new TwilioRestClient(Settings.AccountSid, Settings.AuthToken); var result = client.InitiateOutboundCall(Settings.MyTwilioNumber, number, "http://www.televisiontunes.com/uploads/audio/Star%20Wars%20-%20The%20Imperial%20March.mp3"); // return any exceptions that may occur if (result.RestException != null) { return Content(result.RestException.Message); } return Content("The call has been is initiated"); }
public IActionResult MakeCall(string number) { var client = new TwilioRestClient( _twilioSettings.Options.AccountSid, _twilioSettings.Options.AuthToken ); var results = client.InitiateOutboundCall( _twilioSettings.Options.MyOwnNumber, number, "http://www.televisiontunes.com/uploads/audio/Star%20Wars%20-%20The%20Imperial%20March.mp3"); if (results.RestException != null) { return Content(results.RestException.Message); } return Content("The call has been is initiated"); }
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://www.example.com/sipdial.xml"; options.To = "sip:[email protected]?hatchkey=4815162342"; options.From = "Jack"; var call = twilio.InitiateOutboundCall(options); Console.WriteLine(call.Sid); }
// // GET: /Route/ public ActionResult SMS() { string AccountSid = "AC466fd9c5fb1ec783e26fd56c3b25970b"; string AuthToken = "896c359e5a927cbddc2a38d36f1a264c"; var twilio = new TwilioRestClient(AccountSid, AuthToken); var options = new CallOptions(); options.Url = "http://twiliorouter.apphb.com/Route/SMSInstructions?Message=" + HttpUtility.UrlEncode(Request["Body"]); //options.To = "+17202808698"; options.To = Request["From"]; options.From = "+17202591415"; var call = twilio.InitiateOutboundCall(options); //Response.Write(options.Url); //Console.WriteLine(call.Sid); return View(); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; client = new TwilioRestClient(Settings.AccountSid, Settings.AuthToken); var result = client.InitiateOutboundCall(Settings.TwilioNumber, context.Request["to"], "http://twilio-elearning.herokuapp.com/starter/voice.php"); if (result.RestException != null) { context.Response.StatusCode = 500; context.Response.Write(result.RestException.Message); } else { context.Response.Write("Call enroute!"); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; client = new TwilioRestClient(Settings.AccountSid, Settings.AuthToken); var result = client.InitiateOutboundCall(Settings.TwilioNumber, context.Request["to"], Settings.BaseUrl + "/Hello.ashx"); if (result.RestException != null) { context.Response.StatusCode = 500; context.Response.Write(result.RestException.Message); } else { context.Response.Write("{ \"error\":false }"); } }
public static void OutgoingCall(string url, string toNumber, int contactGroup,int notification) { var accountSid = ConfigurationManager.AppSettings["TwilioAccountSid"]; var authToken = ConfigurationManager.AppSettings["TwilioAuthToken"]; var applicationSid = ConfigurationManager.AppSettings["ApplicationSid"]; var from = ConfigurationManager.AppSettings["TwilioNumber"]; var twilio = new TwilioRestClient(accountSid, authToken); var options = new CallOptions(); options.From = from; options.Url = url + "?ContactGroupId=" + contactGroup + "&NotificationId=" + notification; options.ApplicationSid = applicationSid; options.Method = "POST"; options.Record = false; var call = twilio.InitiateOutboundCall(options); }
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); }
private void btn_Call_Click(object sender, EventArgs e) { // Find your Account Sid and Auth Token at twilio.com/user/account string AccountSid = "ACd80adc88fe6a85be2e789aa0f866b661"; string AuthToken = "db4cc0d6a7b98e9d42583cbd57d819d2"; var twilio = new TwilioRestClient(AccountSid, AuthToken); // Build the parameters var options = new CallOptions(); options.To = "+1"+tbx_Number.Text; options.From = "+15812000231"; options.Url = "https://www.google.ca/?gfe_rd=cr&ei=dBiUVb26IYaN8Qeo0oGABQ"; options.Method = "GET"; options.FallbackMethod = "GET"; options.StatusCallbackMethod = "GET"; options.Record = false; var call = twilio.InitiateOutboundCall(options); Console.WriteLine(call.Sid); }
public string SendCall(string Message, string phone ) { string error = ""; string FROM = Twilio_FromNumber; var client = new TwilioRestClient(Twilio_AccountSid, Twilio_AuthtTok); CallOptions options = new CallOptions(); options.From = FROM; options.To = phone; options.Url = WebURL + "twiliomessagesHandler.ashx?message=" + HttpContext.Current.Server.UrlEncode(Message) + ""; // Place the call. var call = client.InitiateOutboundCall(options); if (call.RestException != null ) { error = call.RestException.Message; } return error; }
public static void OutgoingCall(string url, string toNumber) { var accountSid = ConfigurationManager.AppSettings["TwilioAccountSid"]; var authToken = ConfigurationManager.AppSettings["TwilioAuthToken"]; //var applicationSid = ConfigurationManager.AppSettings["ApplicationSid"]; var from = ConfigurationManager.AppSettings["TwilioNumber"]; var twilio = new TwilioRestClient(accountSid, authToken); var options = new CallOptions(); options.To = toNumber; options.From = from; options.Url = url; var call = twilio.InitiateOutboundCall(options); if (call.RestException != null) { string temp = call.RestException.Message; } }
protected void btn_Click(object sender, EventArgs e) { string accountSid = "AC49ecef1b877e244ea13ada1b5fe92b85"; //string applicationsid = "AP5556f6cd1af5cfa5317acae7a49eeb5c"; string sid = "CA748c6019014ca0ac151908a81299f927"; string authToken = "4eeeaf7ed6459dcd02ec7888149d5ea1"; string recordingSid = "RE5dabfb2da314b39cd87dc151bf669e78"; DateTime datecreated=DateTime.Now; TwilioRestClient client; client = new TwilioRestClient(accountSid, authToken); string APIversuion = client.ApiVersion; string TwilioBaseURL = client.BaseUrl; Account account = client.GetAccount(accountSid); client.GetRecording(recordingSid); client.GetRecordingText(recordingSid); client.ListRecordings(sid, datecreated, 1, 2); client.ListQueues(); client.ListIncomingPhoneNumbers(); this.varDisplay.Items.Clear(); if (this.txtcall.Text == "" || this.message.Text == "") { this.varDisplay.Items.Add( "You must enter a phone number and a message."); } else { // Retrieve the values entered by the user. string to = this.txtcall.Text; string myMessage = this.message.Text; //string Url = "http://demo.twilio.com/Welcome/Call/"; String Url = "http://twimlets.com/message?Message%5B0%5D=" + myMessage.Replace(" ", "%20"); // Diplay the enpoint, API version, and the URL for the message. this.varDisplay.Items.Add("Using Tilio endpoint " + TwilioBaseURL); this.varDisplay.Items.Add("Twilioclient API Version is " + APIversuion); this.varDisplay.Items.Add("The URL is " + Url); // Instantiate the call options that are passed // to the outbound call. CallOptions options = new CallOptions(); // Set the call From, To, and URL values into a hash map. // This sample uses the sandbox number provided by Twilio // to make the call. options.From = "+14242165015"; options.To = to; options.Url = Url; // Place the call. options.Record = true; var call = client.InitiateOutboundCall(options); this.varDisplay.Items.Add("Call status: " + call.Status); } }
private void SendPhoneAGram(string CallSid) { var RestClient = new TwilioRestClient(TwilioAccountSid, TwilioAuthToken); var call = Calls.FindOneAs<BsonDocument>(new QueryDocument("_id", CallSid)); if (call == null || string.IsNullOrEmpty(call["number"].AsString) || string.IsNullOrEmpty(CallSid)) throw new ArgumentNullException("Call is null = " + call == null ? "true" : "false" + ", CallSid is null = " + string.IsNullOrEmpty(CallSid)); call["status"] = "sending phone-a-gram"; Calls.Save(call); var RestCall = RestClient.InitiateOutboundCall(CallerId, call["number"].AsString, string.Format("http://" + Request.Url.Host + "/Call/PhoneAGram?callsid={0}", call["_id"].AsString)); if (RestCall.RestException != null) throw new Exception(RestCall.RestException.Message); }
//Call User on Click with Verification Code private void loginWindow_button_CallUse_Click(object sender, RoutedEventArgs e) { //Get Users Phone Number string UsersPhoneNumber = grabPhoneNumber(); //If users number is null, stop Method. if (UsersPhoneNumber == null) { return; } //Generate Random 10 Digit Code for user //Save Randomly Generated Number RandomGeneratedNumber = GenerateRandomNumber(); RandomGeneratedNumberString = RandomGeneratedNumber.ToString(); //Find your Account Sid and Auth Token string AccountSid = "AC61b76d7cf5033d39d3fdf1a6816e3e61"; string AuthToken = "1f4545334cf64e12d68a224de622178c"; string myTwilioPhoneNumber = "+16508351288"; //Create XML file and save Locally XDocument RandomlyGeneratedNumberXMLFile = writeXMLFile(RandomGeneratedNumberString); SaveXMLFileLocally(RandomlyGeneratedNumberXMLFile); //Write to FTP WriteToFTP(FullFilePath); //Instantaiate a new Twilio Rest Client var client = new TwilioRestClient(AccountSid, AuthToken); //Build Call Option var options = new CallOptions(); // options.Url = "C:\\Users\\jward01\\Documents\\Visual Studio 2015\\Projects\\WPFSMSAuth\\ContactManagementApp\\TwilioVoice.xml"; // options.Url = "http://demo.twilio.com/docs/voice.xml"; //Get file from FTP Server options.To = UsersPhoneNumber; options.From = myTwilioPhoneNumber; options.Url = "http://jeffwarddevelopment.com/twilio_calls/call.xml"; options.Method = "GET"; options.FallbackMethod = "GET"; options.StatusCallbackMethod = "GET"; options.Record = false; //Initiate a new Outbound Call var call = client.InitiateOutboundCall(options); // var twilio = new TwilioRestClient(AccountSid, AuthToken); // var message = twilio.SendMessage(myTwilioPhoneNumber, UsersPhoneNumber, "Hello, I am the computer security guard! Here is your 10-digit pass code: +" + RandomGeneratedNumberString + "."); MessageBox.Show("Users phone number: " + UsersPhoneNumber); MessageBox.Show("Here is your number: " + RandomGeneratedNumberString); }
protected void ContactBarber_Click(object sender, EventArgs e) { BindDataList(); string sql = "SELECT idMembership FROM member WHERE idMember = " + Request.QueryString["id"]; DataTable dt = Worker.SqlTransaction(sql, connect_string); if (dt.Rows.Count > 0) { if ((dt.Rows[0]["idMembership"].ToString() == "2") || (dt.Rows[0]["idMembership"].ToString() == "1")) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "AddResource('440','415');", true); } else { phoneno = (string)Session["phoneno"]; string accountSid = "AC49ecef1b877e244ea13ada1b5fe92b85"; //string applicationsid = "AP5556f6cd1af5cfa5317acae7a49eeb5c"; string sid = "CA748c6019014ca0ac151908a81299f927"; string authToken = "4eeeaf7ed6459dcd02ec7888149d5ea1"; string recordingSid = "RE5dabfb2da314b39cd87dc151bf669e78"; DateTime datecreated = DateTime.Now; TwilioRestClient client; client = new TwilioRestClient(accountSid, authToken); string APIversuion = client.ApiVersion; string TwilioBaseURL = client.BaseUrl; Account account = client.GetAccount(accountSid); client.GetRecording(recordingSid); client.GetRecordingText(recordingSid); client.ListRecordings(sid, datecreated, 1, 2); client.ListQueues(); client.ListIncomingPhoneNumbers(); //string Url = "http://demo.twilio.com/Welcome/Call/"; String Url = "http://twimlets.com/message"; CallOptions options = new CallOptions(); // Set the call From, To, and URL values into a hash map. // This sample uses the sandbox number provided by Twilio // to make the call. options.From = "+14242165015"; options.To = phoneno; options.Url = Url; // Place the call. options.Record = true; var call = client.InitiateOutboundCall(options); Session.Remove("phoneno"); } } }