diff --git a/TWILIO b/TWILIO index 013f4d0..65b2513 100644 --- a/TWILIO +++ b/TWILIO @@ -1,16091 +1,426 @@ - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GitHub - webtechnicom/stripe: repository - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Skip to content - - - - - - - - -
- -
- - - - - -
- - - -
- - - - - - - - - -
-
-
- - - - - - - - - - - - -
- -
- -
-

- - - / - - stripe - - Template -

- - -
- -
    -
  • - -
  • - -
  • - - - Watch - - -
  • +// Find your Account Sid and Auth Token at twilio.com/console +// DANGER! This is insecure. See http://twil.io/secure +$sid = "ACcc67c045cffaea7653952cf73b7443a5"; +$token = "4a48ef16988eca378188b06fd8d433e0"; +$twilio = new Client($sid, $token); -
  • - - - Star - - +$message = $twilio->messages + ->create("++41765203630", // to + [ + "body" => "This will be the body of the new message!", + "from" => "+17708008448" + ] + ); -
  • +print($message->sid); +{ + "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", + "api_version": "2010-04-01", + "body": "This will be the body of the new message!", + "date_created": "Thu, 30 Jul 2015 20:12:31 +0000", + "date_sent": "Thu, 30 Jul 2015 20:12:33 +0000", + "date_updated": "Thu, 30 Jul 2015 20:12:33 +0000", + "direction": "outbound-api", + "error_code": null, + "error_message": null, + "from": "+14155552345", + "messaging_service_sid": "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", + "num_media": "0", + "num_segments": "1", + "price": null, + "price_unit": null, + "sid": "SMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", + "status": "sent", + "subresource_uris": { + "media": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/SMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Media.json" + }, + "to": "+14155552345", + "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/SMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json" +} + - - - Fork - - - -
+// Update the path below to your autoload.php, +// see https://getcomposer.org/doc/01-basic-usage.md +require_once '/path/to/vendor/autoload.php'; -
-
-

- repository -

- -
-
- - - Star - +use Twilio\Rest\Client; -
- -
-
+// Find your Account Sid and Auth Token at twilio.com/console +// DANGER! This is insecure. See http://twil.io/secure +$sid = "ACcc67c045cffaea7653952cf73b7443a5"; +$token = "4a48ef16988eca378188b06fd8d433e0"; +$twilio = new Client($sid, $token); - - -
+class TwilioRequestValidator +{ + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle($request, Closure $next) + { + // Be sure TWILIO_AUTH_TOKEN is set in your .env file. + // You can get your authentication token in your twilio console https://www.twilio.com/console + $requestValidator = new RequestValidator(env('TWILIO_AUTH_TOKEN')); + $requestData = $request->toArray(); -
-
+ // Switch to the body content if this is a JSON request. + if (array_key_exists('bodySHA256', $requestData)) { + $requestData = $request->getContent(); + } - - + $isValid = $requestValidator->validate( + $request->header('X-Twilio-Signature'), + $request->fullUrl(), + $requestData + ); -
- -
+ if ($isValid) { + return $next($request); + } else { + return new Response('You are not Twilio :(', 403); + } + } +} + - - +// Your Account SID and Auth Token from twilio.com/console +$account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; +$auth_token = '4a48ef16988eca378188b06fd8d433e0'; +// In production, these should be environment variables. E.g.: +// $auth_token = $_ENV["TWILIO_ACCOUNT_SID"] +// A Twilio number you own with Voice capabilities +$twilio_number = "+15017122661"; +// Where to make a voice call (your cell phone?) +$to_number = "+15558675310"; -
+$client = new Client($account_sid, $auth_token); +$client->account->calls->create( + $to_number, + $twilio_number, + array( + "url" => "http://demo.twilio.com/docs/voice.xml" + ) +); + - +// Start our TwiML response +$response = new VoiceResponse; +// Read a message aloud to the caller +$response->say( + "Thank you for calling! Have a great day.", + array("voice" => "alice") +); +echo $response; +say( + "Thank you for calling! Have a great day.", + array("voice" => "alice") +); -
- -
-
- - - master - - +echo $response; + -
- - - -
- -
+namespace App\Http\Controllers; -
+use App\Http\Requests; +use Illuminate\Http\Request; +use Twilio\Twiml; +class IvrController extends Controller +{ + public function __construct() + { + $this->_thankYouMessage = 'Thank you for calling the ET Phone Home' . + ' Service - the adventurous alien\'s first choice' . + ' in intergalactic travel.'; - + } -
+ /** + * Responds with a welcome message with instructions + * + * @return \Illuminate\Http\Response + */ + public function showWelcome() + { + $response = new Twiml(); + $gather = $response->gather( + [ + 'numDigits' => 1, + 'action' => route('menu-response', [], false) + ] + ); - - Go to file - + $gather->say( + 'Thanks for calling the E T Phone Home Service.' . + 'Please press 1 for directions. Press 2 for a ' . + 'list of planets to call.', + ['loop' => 3] + ); + return $response; + } + /** + * Responds to selection of an option by the caller + * + * @return \Illuminate\Http\Response + */ + public function showMenuResponse(Request $request) + { + $selectedOption = $request->input('Digits'); - - - -
- - - Code - -
- +namespace App\Http\Controllers; - +use Illuminate\Http\Request; +use Illuminate\Database\Eloquent\ModelNotFoundException; +use App\Http\Requests; +use App\Http\Controllers\Controller; +use App\Agent; +use Twilio\Twiml; -
-
- - +class ExtensionController extends Controller +{ + /** + * Responds with a to the caller's planet + * + * @return \Illuminate\Http\Response + */ + public function showExtensionConnection(Request $request) + { + $selectedOption = $request->input('Digits'); + try { + $agent = $this->_getAgentForDigit($selectedOption); + } + catch (ModelNotFoundException $e){ + return redirect()->route('main-menu-redirect'); + } - - -
+ $numberToDial = $agent->phone_number; + $response = new Twiml(); + $response->say( + "You'll be connected shortly to your planet. " . + $this->_thankYouMessage, + ['voice' => 'alice', 'language' => 'en-GB'] + ); - + $dialCommand = $response->dial( + ['action' => route('agent-voicemail', ['agent' => $agent->id], false), + 'method' => 'POST'] + ); + $dialCommand->number( + $numberToDial, + ['url' => route('screen-call', [], false)] + ); -
-
-

Latest commit

-
- -
- -
-
- - @webtechnicom -
-
+ return $response; + } -
-
-
- - webtechnicom + private function _getAgentForDigit($digit) + { + $planetExtensions = [ + '2' => 'Brodo', + '3' => 'Dagobah', + '4' => 'Oober' + ]; + $planetExtensionExists = isset($planetExtensions[$digit]); + if ($planetExtensionExists) { + $agent = Agent::where( + 'extension', '=', $planetExtensions[$digit] + )->firstOrFail(); - + return $agent; + } else { + throw new ModelNotFoundException; + } + } +} + - calls + ->create("sip:UserA@Trunk1.sip.us1.twilio.com", // to + "+15017122661", // from [ - "twiml" => "<Response><Say>Hello and thanks for connecting to your SIP network!</Say></Response>" + "twiml" => "Hello and thanks for connecting to your SIP network!" ] ); -print($call->sid); -{ - "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "annotation": null, - "answered_by": null, - "api_version": "2010-04-01", - "caller_name": null, - "date_created": "Tue, 31 Aug 2010 20:36:28 +0000", - "date_updated": "Tue, 31 Aug 2010 20:36:44 +0000", - "direction": "inbound", - "duration": "15", - "end_time": "Tue, 31 Aug 2010 20:36:44 +0000", - "forwarded_from": "+17708008448", - "from": "+15017122661", - "from_formatted": "(501) 712-2661", - "group_sid": null, - "parent_call_sid": null, - "phone_number_sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "price": "-0.03000", - "price_unit": "USD", - "sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "start_time": "Tue, 31 Aug 2010 20:36:29 +0000", - "status": "completed", - "subresource_uris": { - "notifications": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications.json", - "recordings": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Recordings.json", - "feedback": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Feedback.json", - "feedback_summaries": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/FeedbackSummary.json", - "payments": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Payments.json" - }, - "to": "sip:sip.webtechnicom.net", - "to_formatted": "sip:sip.webtechnicom.net", - "trunk_sid": null, - "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json", - "queue_time": "1000" -} -<?php - -// Update the path below to your autoload.php, -// see https://getcomposer.org/doc/01-basic-usage.md -require_once '/path/to/vendor/autoload.php'; - -use Twilio\Rest\Client; - -// Find your Account Sid and Auth Token at twilio.com/console -// DANGER! This is insecure. See http://twil.io/secure -$sid = "ACcc67c045cffaea7653952cf73b7443a5"; -$token = "4a48ef16988eca378188b06fd8d433e0"; -$twilio = new Client($sid, $token); - -$available_phone_number_country = $twilio->availablePhoneNumbers("US") - ->fetch(); - -print($available_phone_number_country->countryCode); -{ - "beta": null, - "country": "United States", - "country_code": "US", - "subresource_uris": { - "local": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json", - "toll_free": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/TollFree.json" - }, - "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US.json" -} -<?php - -// Update the path below to your autoload.php, -// see https://getcomposer.org/doc/01-basic-usage.md -require_once '/path/to/vendor/autoload.php'; - -use Twilio\Rest\Client; - -// Find your Account Sid and Auth Token at twilio.com/console -// DANGER! This is insecure. See http://twil.io/secure -$sid = "ACcc67c045cffaea7653952cf73b7443a5"; -$token = "4a48ef16988eca378188b06fd8d433e0"; -$twilio = new Client($sid, $token); - -$local = $twilio->availablePhoneNumbers("US") - ->local - ->read(["areaCode" => 510], 20); - -foreach ($local as $record) { - print($record->friendlyName); -} -{ - "available_phone_numbers": [ - { - "address_requirements": "none", - "beta": false, - "capabilities": { - "mms": true, - "sms": false, - "voice": true - }, - "friendly_name": "(808) 925-1571", - "iso_country": "US", - "lata": "834", - "latitude": "19.720000", - "locality": "Hilo", - "longitude": "-155.090000", - "phone_number": "+18089251571", - "postal_code": "96720", - "rate_center": "HILO", - "region": "HI" - } - ], - "end": 1, - "first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0", - "last_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0", - "next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=50", - "num_pages": 1, - "page": 0, - "page_size": 50, - "previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0", - "start": 0, - "total": 1, - "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=1" -} -<?php - -// Update the path below to your autoload.php, -// see https://getcomposer.org/doc/01-basic-usage.md -require_once '/path/to/vendor/autoload.php'; - -use Twilio\Rest\Client; - -// Find your Account Sid and Auth Token at twilio.com/console -// DANGER! This is insecure. See http://twil.io/secure -$sid = "ACcc67c045cffaea7653952cf73b7443a5"; -$token = "4a48ef16988eca378188b06fd8d433e0"; -$twilio = new Client($sid, $token); - -$local = $twilio->availablePhoneNumbers("US") - ->local - ->read(["areaCode" => 510], 20); - -foreach ($local as $record) { - print($record->friendlyName); -} -{ - "available_phone_numbers": [ - { - "address_requirements": "none", - "beta": false, - "capabilities": { - "mms": true, - "sms": false, - "voice": true - }, - "friendly_name": "(808) 925-1571", - "iso_country": "US", - "lata": "834", - "latitude": "19.720000", - "locality": "Hilo", - "longitude": "-155.090000", - "phone_number": "+18089251571", - "postal_code": "96720", - "rate_center": "HILO", - "region": "HI" - } - ], - "end": 1, - "first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0", - "last_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0", - "next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=50", - "num_pages": 1, - "page": 0, - "page_size": 50, - "previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0", - "start": 0, - "total": 1, - "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=1" -} -<?php - -// Update the path below to your autoload.php, -// see https://getcomposer.org/doc/01-basic-usage.md -require_once '/path/to/vendor/autoload.php'; - -use Twilio\Rest\Client; - -// Find your Account Sid and Auth Token at twilio.com/console -// DANGER! This is insecure. See http://twil.io/secure -$sid = "ACcc67c045cffaea7653952cf73b7443a5"; -$token = "4a48ef16988eca378188b06fd8d433e0"; -$twilio = new Client($sid, $token); - -$local = $twilio->availablePhoneNumbers("US") - ->local - ->read(["contains" => "510555****"], 20); - -foreach ($local as $record) { - print($record->friendlyName); -} -{ - "available_phone_numbers": [ - { - "address_requirements": "none", - "beta": false, - "capabilities": { - "mms": true, - "sms": false, - "voice": true - }, - "friendly_name": "(808) 925-1571", - "iso_country": "US", - "lata": "834", - "latitude": "19.720000", - "locality": "Hilo", - "longitude": "-155.090000", - "phone_number": "+18089251571", - "postal_code": "96720", - "rate_center": "HILO", - "region": "HI" - } - ], - "end": 1, - "first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0", - "last_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0", - "next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=50", - "num_pages": 1, - "page": 0, - "page_size": 50, - "previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0", - "start": 0, - "total": 1, - "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=1" -} -<?php - -// Update the path below to your autoload.php, -// see https://getcomposer.org/doc/01-basic-usage.md -require_once '/path/to/vendor/autoload.php'; - -use Twilio\Rest\Client; - -// Find your Account Sid and Auth Token at twilio.com/console -// DANGER! This is insecure. See http://twil.io/secure -$sid = "ACcc67c045cffaea7653952cf73b7443a5"; -$token = "4a48ef16988eca378188b06fd8d433e0"; -$twilio = new Client($sid, $token); - -$local = $twilio->availablePhoneNumbers("US") - ->local - ->read(["contains" => "STORM"], 20); - -foreach ($local as $record) { - print($record->friendlyName); -} -{ - "available_phone_numbers": [ - { - "address_requirements": "none", - "beta": false, - "capabilities": { - "mms": true, - "sms": false, - "voice": true - }, - "friendly_name": "(808) 925-1571", - "iso_country": "US", - "lata": "834", - "latitude": "19.720000", - "locality": "Hilo", - "longitude": "-155.090000", - "phone_number": "+18089251571", - "postal_code": "96720", - "rate_center": "HILO", - "region": "HI" - } - ], - "end": 1, - "first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0", - "last_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0", - "next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=50", - "num_pages": 1, - "page": 0, - "page_size": 50, - "previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0", - "start": 0, - "total": 1, - "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=1" -} -<?php - -// Update the path below to your autoload.php, -// see https://getcomposer.org/doc/01-basic-usage.md -require_once '/path/to/vendor/autoload.php'; - -use Twilio\Rest\Client; - -// Find your Account Sid and Auth Token at twilio.com/console -// DANGER! This is insecure. See http://twil.io/secure -$sid = "ACcc67c045cffaea7653952cf73b7443a5"; -$token = "4a48ef16988eca378188b06fd8d433e0"; -$twilio = new Client($sid, $token); - -$local = $twilio->availablePhoneNumbers("US") - ->local - ->read(["inRegion" => "AR"], 20); - -foreach ($local as $record) { - print($record->friendlyName); -} -<?php - -// Update the path below to your autoload.php, -// see https://getcomposer.org/doc/01-basic-usage.md -require_once '/path/to/vendor/autoload.php'; - -use Twilio\Rest\Client; - -// Find your Account Sid and Auth Token at twilio.com/console -// DANGER! This is insecure. See http://twil.io/secure -$sid = "ACcc67c045cffaea7653952cf73b7443a5"; -$token = "4a48ef16988eca378188b06fd8d433e0"; -$twilio = new Client($sid, $token); - -$local = $twilio->availablePhoneNumbers("GB") - ->local - ->read(["contains" => "+4420"], 20); - -foreach ($local as $record) { - print($record->friendlyName); -} -<?php - -// Update the path below to your autoload.php, -// see https://getcomposer.org/doc/01-basic-usage.md -require_once '/path/to/vendor/autoload.php'; - -use Twilio\Rest\Client; - -// Find your Account Sid and Auth Token at twilio.com/console -// DANGER! This is insecure. See http://twil.io/secure -$sid = "ACcc67c045cffaea7653952cf73b7443a5"; -$token = "4a48ef16988eca378188b06fd8d433e0"; -$twilio = new Client($sid, $token); - -$local = $twilio->availablePhoneNumbers("GB") - ->local - ->read(["smsEnabled" => True, "voiceEnabled" => True], 20); - -foreach ($local as $record) { - print($record->friendlyName); -} -<?php - -// Update the path below to your autoload.php, -// see https://getcomposer.org/doc/01-basic-usage.md -require_once '/path/to/vendor/autoload.php'; - -use Twilio\Rest\Client; - -// Find your Account Sid and Auth Token at twilio.com/console -// DANGER! This is insecure. See http://twil.io/secure -$sid = "ACcc67c045cffaea7653952cf73b7443a5"; -$token = "4a48ef16988eca378188b06fd8d433e0"; -$twilio = new Client($sid, $token); - -$local = $twilio->availablePhoneNumbers("US") - ->local - ->read([ - "nearLatLong" => "37.840699,-122.461853", - "distance" => 50, - "contains" => "555", - "inRegion" => "CA" - ], - 20 - ); - -foreach ($local as $record) { - print($record->friendlyName); -} -<?php - -// Update the path below to your autoload.php, -// see https://getcomposer.org/doc/01-basic-usage.md -require_once '/path/to/vendor/autoload.php'; - -use Twilio\Rest\Client; - -// Find your Account Sid and Auth Token at twilio.com/console -// DANGER! This is insecure. See http://twil.io/secure -$sid = "ACcc67c045cffaea7653952cf73b7443a5"; -$token = "4a48ef16988eca378188b06fd8d433e0"; -$twilio = new Client($sid, $token); - -$local = $twilio->availablePhoneNumbers("US") - ->local - ->read(["areaCode" => 510], 20); - -foreach ($local as $record) { - print($record->friendlyName); -} -<?php - -// Update the path below to your autoload.php, -// see https://getcomposer.org/doc/01-basic-usage.md -require_once '/path/to/vendor/autoload.php'; - -use Twilio\Rest\Client; - -// Find your Account Sid and Auth Token at twilio.com/console -// DANGER! This is insecure. See http://twil.io/secure -$sid = "ACcc67c045cffaea7653952cf73b7443a5"; -$token = "4a48ef16988eca378188b06fd8d433e0"; -$twilio = new Client($sid, $token); - -$local = $twilio->availablePhoneNumbers("US") - ->local - ->read(["areaCode" => 510], 20); - -foreach ($local as $record) { - print($record->friendlyName); -} -<?php - -// Update the path below to your autoload.php, -// see https://getcomposer.org/doc/01-basic-usage.md -require_once '/path/to/vendor/autoload.php'; - -use Twilio\Rest\Client; - -// Find your Account Sid and Auth Token at twilio.com/console -// DANGER! This is insecure. See http://twil.io/secure -$sid = "ACcc67c045cffaea7653952cf73b7443a5"; -$token = "4a48ef16988eca378188b06fd8d433e0"; -$twilio = new Client($sid, $token); - -$local = $twilio->availablePhoneNumbers("US") - ->local - ->read([ - "nearLatLong" => "37.840699,-122.461853", - "distance" => 50, - "contains" => "555", - "inRegion" => "CA" - ], - 20 - ); - -foreach ($local as $record) { - print($record->friendlyName); -} -<?php - -// Update the path below to your autoload.php, -// see https://getcomposer.org/doc/01-basic-usage.md -require_once '/path/to/vendor/autoload.php'; - -use Twilio\Rest\Client; - -// Find your Account Sid and Auth Token at twilio.com/console -// DANGER! This is insecure. See http://twil.io/secure -$sid = "ACcc67c045cffaea7653952cf73b7443a5"; -$token = "4a48ef16988eca378188b06fd8d433e0"; -$twilio = new Client($sid, $token); - -$country = $twilio->pricing->v1->phoneNumbers - ->countries("US") - ->fetch(); - -print($country->country); -<?php" class="link-gray-dark" href="/webtechnicom/stripe/commit/e1c785f95e6db2a72288005bfcf57d1b8cfb8fe2">Create webtechnicom - -
- - - - -
-
- - -
<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$call = $twilio->calls
-               ->create("sip:sip.webtechnicom.net", // to
-                        "+17708008448", // from
-                        [
-                            "twiml" => "<Response><Say>Hello and thanks for connecting to your SIP network!</Say></Response>"
-                        ]
-               );
-
-print($call->sid);
-{
-  "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
-  "annotation": null,
-  "answered_by": null,
-  "api_version": "2010-04-01",
-  "caller_name": null,
-  "date_created": "Tue, 31 Aug 2010 20:36:28 +0000",
-  "date_updated": "Tue, 31 Aug 2010 20:36:44 +0000",
-  "direction": "inbound",
-  "duration": "15",
-  "end_time": "Tue, 31 Aug 2010 20:36:44 +0000",
-  "forwarded_from": "+17708008448",
-  "from": "+15017122661",
-  "from_formatted": "(501) 712-2661",
-  "group_sid": null,
-  "parent_call_sid": null,
-  "phone_number_sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
-  "price": "-0.03000",
-  "price_unit": "USD",
-  "sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
-  "start_time": "Tue, 31 Aug 2010 20:36:29 +0000",
-  "status": "completed",
-  "subresource_uris": {
-    "notifications": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications.json",
-    "recordings": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Recordings.json",
-    "feedback": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Feedback.json",
-    "feedback_summaries": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/FeedbackSummary.json",
-    "payments": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Payments.json"
-  },
-  "to": "sip:sip.webtechnicom.net",
-  "to_formatted": "sip:sip.webtechnicom.net",
-  "trunk_sid": null,
-  "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json",
-  "queue_time": "1000"
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$available_phone_number_country = $twilio->availablePhoneNumbers("US")
-                                         ->fetch();
-
-print($available_phone_number_country->countryCode);
-{
-  "beta": null,
-  "country": "United States",
-  "country_code": "US",
-  "subresource_uris": {
-    "local": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json",
-    "toll_free": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/TollFree.json"
-  },
-  "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US.json"
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read(["areaCode" => 510], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-{
-  "available_phone_numbers": [
-    {
-      "address_requirements": "none",
-      "beta": false,
-      "capabilities": {
-        "mms": true,
-        "sms": false,
-        "voice": true
-      },
-      "friendly_name": "(808) 925-1571",
-      "iso_country": "US",
-      "lata": "834",
-      "latitude": "19.720000",
-      "locality": "Hilo",
-      "longitude": "-155.090000",
-      "phone_number": "+18089251571",
-      "postal_code": "96720",
-      "rate_center": "HILO",
-      "region": "HI"
-    }
-  ],
-  "end": 1,
-  "first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "last_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=50",
-  "num_pages": 1,
-  "page": 0,
-  "page_size": 50,
-  "previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "start": 0,
-  "total": 1,
-  "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=1"
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read(["areaCode" => 510], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-{
-  "available_phone_numbers": [
-    {
-      "address_requirements": "none",
-      "beta": false,
-      "capabilities": {
-        "mms": true,
-        "sms": false,
-        "voice": true
-      },
-      "friendly_name": "(808) 925-1571",
-      "iso_country": "US",
-      "lata": "834",
-      "latitude": "19.720000",
-      "locality": "Hilo",
-      "longitude": "-155.090000",
-      "phone_number": "+18089251571",
-      "postal_code": "96720",
-      "rate_center": "HILO",
-      "region": "HI"
-    }
-  ],
-  "end": 1,
-  "first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "last_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=50",
-  "num_pages": 1,
-  "page": 0,
-  "page_size": 50,
-  "previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "start": 0,
-  "total": 1,
-  "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=1"
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read(["contains" => "510555****"], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-{
-  "available_phone_numbers": [
-    {
-      "address_requirements": "none",
-      "beta": false,
-      "capabilities": {
-        "mms": true,
-        "sms": false,
-        "voice": true
-      },
-      "friendly_name": "(808) 925-1571",
-      "iso_country": "US",
-      "lata": "834",
-      "latitude": "19.720000",
-      "locality": "Hilo",
-      "longitude": "-155.090000",
-      "phone_number": "+18089251571",
-      "postal_code": "96720",
-      "rate_center": "HILO",
-      "region": "HI"
-    }
-  ],
-  "end": 1,
-  "first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "last_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=50",
-  "num_pages": 1,
-  "page": 0,
-  "page_size": 50,
-  "previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "start": 0,
-  "total": 1,
-  "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=1"
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read(["contains" => "STORM"], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-{
-  "available_phone_numbers": [
-    {
-      "address_requirements": "none",
-      "beta": false,
-      "capabilities": {
-        "mms": true,
-        "sms": false,
-        "voice": true
-      },
-      "friendly_name": "(808) 925-1571",
-      "iso_country": "US",
-      "lata": "834",
-      "latitude": "19.720000",
-      "locality": "Hilo",
-      "longitude": "-155.090000",
-      "phone_number": "+18089251571",
-      "postal_code": "96720",
-      "rate_center": "HILO",
-      "region": "HI"
-    }
-  ],
-  "end": 1,
-  "first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "last_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=50",
-  "num_pages": 1,
-  "page": 0,
-  "page_size": 50,
-  "previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "start": 0,
-  "total": 1,
-  "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=1"
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read(["inRegion" => "AR"], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("GB")
-                ->local
-                ->read(["contains" => "+4420"], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("GB")
-                ->local
-                ->read(["smsEnabled" => True, "voiceEnabled" => True], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read([
-                           "nearLatLong" => "37.840699,-122.461853",
-                           "distance" => 50,
-                           "contains" => "555",
-                           "inRegion" => "CA"
-                       ],
-                       20
-                );
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read(["areaCode" => 510], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read(["areaCode" => 510], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read([
-                           "nearLatLong" => "37.840699,-122.461853",
-                           "distance" => 50,
-                           "contains" => "555",
-                           "inRegion" => "CA"
-                       ],
-                       20
-                );
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$country = $twilio->pricing->v1->phoneNumbers
-                               ->countries("US")
-                               ->fetch();
-
-print($country->country);
-<?php
-
- e1c785f -
-
-
-

Git stats

- -
-
-
-

Files

- - - - - Permalink - -
- - - Failed to load latest commit information. - -
-
-
-
Type
-
Name
-
Latest commit message
-
Commit time
-
- -
-
- - -
- -
- .github -
- -
-
 
-
- -
-
 
-
- -
-
-
- - -
- -
- API -
- -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- -
- README.md -
- -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- -
- TWILIO -
- -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
- -
- -
- - -
- -
-
-

- README.md -

-
-
-

stripe

-

repository -php --version -PHP 7.2.24-0ubuntu0.18.04.1 (cli) (built: Oct 28 2019 12:07:07) ( NTS ) -Copyright (c) 1997-2018 The PHP Group -Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies -with Zend OPcache v7.2.24-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies -with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans -composer --version -composer require telnyx/telnyx-php -{ -"require": { -"telnyx/telnyx-php": "^0.0.1" -} -}

-
-
-
- - -
-
- - -
-
-
-

About

- -

- repository -

- - -

Resources

- - - -
-
- -
-
- -

Sponsor this project

- -
    -
-
-
-
-
-
-

- - Packages -

- - -
- No packages published
-
- - - -
-
- -
- -
- -
-
- - - - - - - - - - - -
- - - You can’t perform that action at this time. -
- - - - - - - - - - - # Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -phone_number = client.lookups \ - .phone_numbers('+16502530000') \ - .fetch(add_ons=['payfone_tcpa_compliance'], add_ons_data={ - 'payfone_tcpa_compliance.RightPartyContactedDate': '20160101' - }, type=['carrier']) - -print(phone_number.add_ons) -{ - "caller_name": null, - "country_code": "US", - "phone_number": "+16502530000", - "national_format": "(650) 253-0000", - "carrier": { - "mobile_country_code": null, - "mobile_network_code": null, - "name": "Level 3 Communications, LLC", - "type": "landline", - "error_code": null - }, - "add_ons": { - "status": "successful", - "message": null, - "code": null, - "results": { - "payfone_tcpa_compliance": { - "status": "successful", - "request_sid": "XRd3a2991c9108bde3ca9589ed84d31463", - "message": null, - "code": null, - "result": { - "Status": 0, - "Response": { - "MSISDNType": "NonFixedVoIP", - "NumberMatch": "I", - "VerifyNumberTransactionId": "2019459819" - }, - "RequestId": "XRd3a2991c9108bde3ca9589ed84d31463", - "Description": "Success." - } - } - } - }, - "url": "https://lookups.twilio.com/v1/PhoneNumbers/+16502530000?Type=carrier" -var appConfig = { - serviceBaseUrl: "https://dancing-owl-1234.twil.io/", - sso: { - accountSid: "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" - }, - sdkOptions: { - chat: {}, - insights: {}, - voice: {}, - worker: {} - }, - logLevel: "debug", - colorTheme: { - baseName: "GreyDark", - colors: {}, - light: false, - overrides: {} - }, - componentProps: { - CRMContainer: { - uriCallback: (task) => task - ? `https://www.bing.com/search?q=${task.attributes.name}` - : "http://bing.com" - } - }, - router: { - type: "memory", - history: { - initialEntries: [ "/agent-desktop" ] - } - } -}; -from flask import Flask, request -from twilio import twiml - -import json - - -app = Flask(__name__) - -@app.route("/voice", methods=['GET', 'POST']) -def call(): - """Responds to incoming calls using Twilio Add-ons""" - # Start our TwiML response - response = twiml.Response() - - # Decode the JSON included in the 'AddOns' field - add_ons = json.loads(request.values['AddOns']) - - # If the Whitepages add-on found nothing, return immediately - if 'whitepages_pro_caller_id' not in add_ons['results']: - response.say('Sorry, I could not learn anything about you.') - response.hangup() - - return str(response) - - # Otherwise, extract the Whitepages data - whitepages = add_ons['results']['whitepages_pro_caller_id'] - - # Grab the result Whitepages gave us - # (see the "Documentation" tab on the Whitepages add-on for more details) - caller_id = whitepages['result'] - - # See if we can get the caller's name - try: - first_name = caller_id['belongs_to'][0]['firstname'] - except (IndexError, KeyError): - first_name = 'a mystery' - - # And what city the caller lives in - try: - city = caller_id['current_addresses'][0]['city'] - except (IndexError, KeyError): - city = 'a mystery' - - # Tell the caller what we think their name and city are - response.say('Hello. Your name is {}.'.format(first_name)) - response.say('And I think you live in {}.'.format(city)) - - # Then end the call - response.hangup() - - return str(response) - -if __name__ == "__main__": - app.run(debug=True) -{ - "status": "successful", - "message": null, - "code": null, - "results": { - "whitepages_pro_caller_id": { - "code": null, - "message": null, - "request_sid": "XRb57cab3a3c0cfe0bb50f093d9bd3b0a3", - "result": { - "alternate_phones": [ - "8003361327" - ], - "associated_people": [], - "belongs_to": [ - { - "age_range": null, - "firstname": null, - "gender": null, - "id": "Business.7e29cf66-8bf2-4812-829d-356654b5b3d3.Durable", - "lastname": null, - "link_to_phone_start_date": null, - "middlename": null, - "name": "Twilio Inc", - "type": "Business" - } - ], - "carrier": "Twilio", - "country_calling_code": "1", - "current_addresses": [ - { - "city": "San Francisco", - "country_code": "US", - "delivery_point": "MultiUnit", - "id": "Location.88e44955-805c-455a-99da-d7444ca5c484.Durable", - "is_active": true, - "lat_long": { - "latitude": 37.783382, - "longitude": -122.395714, - "accuracy": "RoofTop" - }, - "link_to_person_start_date": null, - "location_type": "Address", - "postal_code": "94107", - "state_code": "CA", - "street_line_1": "Address", - "street_line_2": null, - "zip4": "3624" - } - ], - "error": null, - "historical_addresses": [], - "id": "Phone.4d796fef-a2df-4b08-cfe3-bc7128b6f6bb.Durable", - "is_commercial": true, - "is_prepaid": false, - "is_valid": true, - "line_type": "NonFixedVOIP", - "phone_number": "5558675310", - "warnings": [] - }, - "status": "successful" - } - } -} -from flask import Flask, request -from twilio import twiml - -import json - - -app = Flask(__name__) - -@app.route("/voice", methods=['GET', 'POST']) -def call(): - """Responds to incoming calls using Twilio Add-ons""" - # Start our TwiML response - response = twiml.Response() - - # Decode the JSON included in the 'AddOns' field - add_ons = json.loads(request.values['AddOns']) - - # If the Whitepages add-on found nothing, return immediately - if 'whitepages_pro_caller_id' not in add_ons['results']: - response.say('Sorry, I could not learn anything about you.') - response.hangup() - - return str(response) - - # Otherwise, extract the Whitepages data - whitepages = add_ons['results']['whitepages_pro_caller_id'] - - # Grab the result Whitepages gave us - # (see the "Documentation" tab on the Whitepages add-on for more details) - caller_id = whitepages['result'] - - # See if we can get the caller's name - try: - first_name = caller_id['belongs_to'][0]['firstname'] - except (IndexError, KeyError): - first_name = 'a mystery' - - # And what city the caller lives in - try: - city = caller_id['current_addresses'][0]['city'] - except (IndexError, KeyError): - city = 'a mystery' - - # Tell the caller what we think their name and city are - response.say('Hello. Your name is {}.'.format(first_name)) - response.say('And I think you live in {}.'.format(city)) - - # Then end the call - response.hangup() - - return str(response) - -if __name__ == "__main__": - app.run(debug=True) -{ - "status": "successful", - "message": null, - "code": null, - "results": { - "whitepages_pro_caller_id": { - "code": null, - "message": null, - "request_sid": "XRb57cab3a3c0cfe0bb50f093d9bd3b0a3", - "result": { - "alternate_phones": [ - "8003361327" - ], - "associated_people": [], - "belongs_to": [ - { - "age_range": null, - "firstname": null, - "gender": null, - "id": "Business.7e29cf66-8bf2-4812-829d-356654b5b3d3.Durable", - "lastname": null, - "link_to_phone_start_date": null, - "middlename": null, - "name": "Twilio Inc", - "type": "Business" - } - ], - "carrier": "Twilio", - "country_calling_code": "1", - "current_addresses": [ - { - "city": "San Francisco", - "country_code": "US", - "delivery_point": "MultiUnit", - "id": "Location.88e44955-805c-455a-99da-d7444ca5c484.Durable", - "is_active": true, - "lat_long": { - "latitude": 37.783382, - "longitude": -122.395714, - "accuracy": "RoofTop" - }, - "link_to_person_start_date": null, - "location_type": "Address", - "postal_code": "94107", - "state_code": "CA", - "street_line_1": "Address", - "street_line_2": null, - "zip4": "3624" - } - ], - "error": null, - "historical_addresses": [], - "id": "Phone.4d796fef-a2df-4b08-cfe3-bc7128b6f6bb.Durable", - "is_commercial": true, - "is_prepaid": false, - "is_valid": true, - "line_type": "NonFixedVOIP", - "phone_number": "5558675310", - "warnings": [] - }, - "status": "successful" - } - } -} -from flask import Flask, request -from twilio import twiml - -import json - - -app = Flask(__name__) - -@app.route("/voice", methods=['GET', 'POST']) -def call(): - """Responds to incoming calls using Twilio Add-ons""" - # Start our TwiML response - response = twiml.Response() - - # Decode the JSON included in the 'AddOns' field - add_ons = json.loads(request.values['AddOns']) - - # If the Whitepages add-on found nothing, return immediately - if 'whitepages_pro_caller_id' not in add_ons['results']: - response.say('Sorry, I could not learn anything about you.') - response.hangup() - - return str(response) - - # Otherwise, extract the Whitepages data - whitepages = add_ons['results']['whitepages_pro_caller_id'] - - # Grab the result Whitepages gave us - # (see the "Documentation" tab on the Whitepages add-on for more details) - caller_id = whitepages['result'] - - # See if we can get the caller's name - try: - first_name = caller_id['belongs_to'][0]['firstname'] - except (IndexError, KeyError): - first_name = 'a mystery' - - # And what city the caller lives in - try: - city = caller_id['current_addresses'][0]['city'] - except (IndexError, KeyError): - city = 'a mystery' - - # Tell the caller what we think their name and city are - response.say('Hello. Your name is {}.'.format(first_name)) - response.say('And I think you live in {}.'.format(city)) - - # Then end the call - response.hangup() - - return str(response) - -if __name__ == "__main__": - app.run(debug=True) -{ - "status": "successful", - "message": null, - "code": null, - "results": { - "whitepages_pro_caller_id": { - "code": null, - "message": null, - "request_sid": "XRb57cab3a3c0cfe0bb50f093d9bd3b0a3", - "result": { - "alternate_phones": [ - "8003361327" - ], - "associated_people": [], - "belongs_to": [ - { - "age_range": null, - "firstname": null, - "gender": null, - "id": "Business.7e29cf66-8bf2-4812-829d-356654b5b3d3.Durable", - "lastname": null, - "link_to_phone_start_date": null, - "middlename": null, - "name": "Twilio Inc", - "type": "Business" - } - ], - "carrier": "Twilio", - "country_calling_code": "1", - "current_addresses": [ - { - "city": "San Francisco", - "country_code": "US", - "delivery_point": "MultiUnit", - "id": "Location.88e44955-805c-455a-99da-d7444ca5c484.Durable", - "is_active": true, - "lat_long": { - "latitude": 37.783382, - "longitude": -122.395714, - "accuracy": "RoofTop" - }, - "link_to_person_start_date": null, - "location_type": "Address", - "postal_code": "94107", - "state_code": "CA", - "street_line_1": "Address", - "street_line_2": null, - "zip4": "3624" - } - ], - "error": null, - "historical_addresses": [], - "id": "Phone.4d796fef-a2df-4b08-cfe3-bc7128b6f6bb.Durable", - "is_commercial": true, - "is_prepaid": false, - "is_valid": true, - "line_type": "NonFixedVOIP", - "phone_number": "5558675310", - "warnings": [] - }, - "status": "successful" - } - } -} -from flask import Flask, request -from twilio import twiml - -import json - - -app = Flask(__name__) - -@app.route("/voice", methods=['GET', 'POST']) -def call(): - """Responds to incoming calls using Twilio Add-ons""" - # Start our TwiML response - response = twiml.Response() - - # Decode the JSON included in the 'AddOns' field - add_ons = json.loads(request.values['AddOns']) - - # If the Whitepages add-on found nothing, return immediately - if 'whitepages_pro_caller_id' not in add_ons['results']: - response.say('Sorry, I could not learn anything about you.') - response.hangup() - - return str(response) - - # Otherwise, extract the Whitepages data - whitepages = add_ons['results']['whitepages_pro_caller_id'] - - # Grab the result Whitepages gave us - # (see the "Documentation" tab on the Whitepages add-on for more details) - caller_id = whitepages['result'] - - # See if we can get the caller's name - try: - first_name = caller_id['belongs_to'][0]['firstname'] - except (IndexError, KeyError): - first_name = 'a mystery' - - # And what city the caller lives in - try: - city = caller_id['current_addresses'][0]['city'] - except (IndexError, KeyError): - city = 'a mystery' - - # Tell the caller what we think their name and city are - response.say('Hello. Your name is {}.'.format(first_name)) - response.say('And I think you live in {}.'.format(city)) - - # Then end the call - response.hangup() - - return str(response) - -if __name__ == "__main__": - app.run(debug=True) -from flask import Flask, request -from twilio import twiml - -import json - - -app = Flask(__name__) - -@app.route("/voice", methods=['GET', 'POST']) -def call(): - """Responds to incoming calls using Twilio Add-ons""" - # Start our TwiML response - response = twiml.Response() - - # Decode the JSON included in the 'AddOns' field - add_ons = json.loads(request.values['AddOns']) - - # If the Whitepages add-on found nothing, return immediately - if 'whitepages_pro_caller_id' not in add_ons['results']: - response.say('Sorry, I could not learn anything about you.') - response.hangup() - - return str(response) - - # Otherwise, extract the Whitepages data - whitepages = add_ons['results']['whitepages_pro_caller_id'] - - # Grab the result Whitepages gave us - # (see the "Documentation" tab on the Whitepages add-on for more details) - caller_id = whitepages['result'] - - # See if we can get the caller's name - try: - first_name = caller_id['belongs_to'][0]['firstname'] - except (IndexError, KeyError): - first_name = 'a mystery' - - # And what city the caller lives in - try: - city = caller_id['current_addresses'][0]['city'] - except (IndexError, KeyError): - city = 'a mystery' - - # Tell the caller what we think their name and city are - response.say('Hello. Your name is {}.'.format(first_name)) - response.say('And I think you live in {}.'.format(city)) - - # Then end the call - response.hangup() - - return str(response) - -if __name__ == "__main__": - app.run(debug=True) - -appConfig.sso = { - accountSid: string; // AccountSid of your Twilio Project - loginPopup: boolean; // whether to launch IdP login in new window - loginPopupFeatures: string; // standard window.open() features param to be applied to popup window -}; - flex.CRMContainer - .defaultProps - .uriCallback = (task) => task - ? `https://www.bing.com/search?q=${task.attributes.name}` - : "http://bing.com/"; - { - yourDefaultName?: string; - theirDefaultName?: string; - yourFriendlyNameOverride?: boolean; - theirFriendlyNameOverride?: boolean; - const mediaId = Flex.AudioPlayerManager.play( -{ - url: "sound-url", - repeatable: true -}, -(error: AudioPlayerError) => { - // handle error -} -); - Flex.Manager.getInstance().chatClient.on("messageAdded", () => { - const mediaId = Flex.AudioPlayerManager.play({ - url: "sound-url", - repeatable: true - }); -}) - -} - export interface MediaData { - url: string; - repeatable: boolean; -} - Flex.TeamsView.defaultProps.filters = [ - Flex.TeamsView.activitiesFilter, - // ... custom filters here -]; - // Install the Flex Plugin Builder and create a plugin to get this code on your own machine -// https://www.twilio.com/docs/flex/plugin-builder - -const ACTION_DISMISS_BAR = 'DISMISS_BAR'; - -const initialState = { - isOpen: true, -}; - -// Define plugin actions -export class Actions { - static dismissBar = () => ({ type: ACTION_DISMISS_BAR }); -} - -// Define how actions influence state -export function reduce(state = initialState, action) { - switch (action.type) { - case ACTION_DISMISS_BAR: { - return { - ...state, - isOpen: false, - }; - } - - default: - return state; - } -} - const initialState = { - isOpen: true, -}; - import React from 'react'; -import { VERSION } from '@twilio/flex-ui'; -import { FlexPlugin } from 'flex-plugin'; - -import CustomTaskListContainer from './components/CustomTaskList/CustomTaskList.Container'; -import reducers, { namespace } from './states'; - -const PLUGIN_NAME = 'SamplePlugin'; - -export default class SamplePlugin extends FlexPlugin { - constructor() { - super(PLUGIN_NAME); - } - - /** - * This code is run when your plugin is being started - * Use this to modify any UI components or attach to the actions framework - * - * @param flex { typeof import('@twilio/flex-ui') } - * @param manager { import('@twilio/flex-ui').Manager } - */ - init(flex, manager) { - this.registerReducers(manager); - - const options = { sortOrder: -1 }; - flex.AgentDesktopView - .Panel1 - .Content - .add(, options); - } - - /** - * Registers the plugin reducers - * - * @param manager { Flex.Manager } - */ - registerReducers(manager) { - if (!manager.store.addReducer) { - // eslint: disable-next-line - console.error(`You need FlexUI > 1.9.0 to use built-in redux; you are currently on ${VERSION}`); - return; - } - - manager.store.addReducer(namespace, reducers); - } -} - - const ACTION_DISMISS_BAR = 'DISMISS_BAR'; - export function reduce(state = initialState, action) {...} - curl -X GET 'https://flex-api.twilio.com/v1/Configuration' \ --u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN - curl -X POST 'https://flex-api.twilio.com/v1/Configuration' \ - -u AC86dafd9acccab6c0d346ed89a1202b2f:your_auth_token - -H 'Content-Type: application/json' \ - -d '{ - ...old properties - "ui_attributes": { - "logLevel": "debug" - ...old properties continued - } - }' -var appConfig = { - serviceBaseUrl: "https://dancing-owl-1234.twil.io/", - sso: { - accountSid: "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" - }, - sdkOptions: { - chat: {}, - insights: {}, - voice: {}, - worker: {} - }, - logLevel: "debug", - colorTheme: { - baseName: "GreyDark", - colors: {}, - light: false, - overrides: {} - }, - componentProps: { - CRMContainer: { - uriCallback: (task) => task - ? `https://www.bing.com/search?q=${task.attributes.name}` - : "http://bing.com" - } - }, - router: { - type: "memory", - history: { - initialEntries: [ "/agent-desktop" ] - } - } -}; -appConfig.colorTheme = { - baseName: "GreyDark", - colors: { base2: "red"}, - light: true, - overrides: { - MainHeader: { - Container: { - background: "Grey" - } - } - } -}; -appConfig.disableTransfers = false; -appConfig.logLevel = 'info'; -appConfig.pluginService = { - enabled: true, - url: "https://www.webtechnicom.net/plugins-list.json" -}; -appConfig.router = { - type: "memory", - history: { - initialEntries: [ "/agent-desktop" ] - } -}; -appConfig.sdkOptions = { - chat: {}, - insights: {}, - voice: {}, - worker: {} -}; -appConfig.sso = { - accountSid: "XRb57cab3a3c0cfe0bb50f093d9bd3b0a3" // AccountSid of your Twilio project -}; -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - url='http://webtechnicom.net/docs/voice.xml', - to='+41765203630', - from_='+17708008448' - ) - -print(call.sid) -{ - "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "annotation": null, - "answered_by": null, - "api_version": "2010-04-01", - "caller_name": null, - "date_created": "Tue, 31 Aug 2010 20:36:28 +0000", - "date_updated": "Tue, 31 Aug 2010 20:36:44 +0000", - "direction": "inbound", - "duration": "15", - "end_time": "Tue, 31 Aug 2010 20:36:44 +0000", - "forwarded_from": "+141586753093", - "from": "+15017122661", - "from_formatted": "(501) 712-2661", - "group_sid": null, - "parent_call_sid": null, - "phone_number_sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "price": "-0.03000", - "price_unit": "USD", - "sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "start_time": "Tue, 31 Aug 2010 20:36:29 +0000", - "status": "completed", - "subresource_uris": { - "notifications": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications.json", - "recordings": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Recordings.json", - "feedback": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Feedback.json", - "feedback_summaries": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/FeedbackSummary.json", - "payments": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Payments.json" - }, - "to": "+15558675310", - "to_formatted": "(555) 867-5310", - "trunk_sid": null, - "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json", - "queue_time": "1000" -} -from flask import Flask -app = Flask(__name__) - -@app.route("/") -def hello(): - return "Hello World!" - -if __name__ == "__main__": - app.run() -from flask import Flask -from twilio.twiml.voice_response import VoiceResponse - -app = Flask(__name__) - - -@app.route("/answer", methods=['GET', 'POST']) -def answer_call(): - """Respond to incoming phone calls with a brief message.""" - # Start our TwiML response - resp = VoiceResponse() - - # Read a message aloud to the caller - resp.say("Thank you for calling! Have a great day.", voice='alice') - - return str(resp) - -if __name__ == "__main__": - app.run(debug=True) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - url='http://demo.twilio.com/docs/voice.xml', - to='+15558675310', - from_='+15017122661' - ) - -print(call.sid) -{ - "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "annotation": null, - "answered_by": null, - "api_version": "2010-04-01", - "caller_name": null, - "date_created": "Tue, 31 Aug 2010 20:36:28 +0000", - "date_updated": "Tue, 31 Aug 2010 20:36:44 +0000", - "direction": "inbound", - "duration": "15", - "end_time": "Tue, 31 Aug 2010 20:36:44 +0000", - "forwarded_from": "+141586753093", - "from": "+15017122661", - "from_formatted": "(501) 712-2661", - "group_sid": null, - "parent_call_sid": null, - "phone_number_sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "price": "-0.03000", - "price_unit": "USD", - "sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "start_time": "Tue, 31 Aug 2010 20:36:29 +0000", - "status": "completed", - "subresource_uris": { - "notifications": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications.json", - "recordings": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Recordings.json", - "feedback": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Feedback.json", - "feedback_summaries": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/FeedbackSummary.json", - "payments": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Payments.json" - }, - "to": "+41765203630", - "to_formatted": "+1(770)800 8448", - "trunk_sid": null, - "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json", - "queue_time": "1000" -} -from flask import Flask -app = Flask(__name__) - -@app.route("/") -def hello(): - return "Hello World!" - -if __name__ == "__main__": - app.run() -from flask import Flask -from twilio.twiml.voice_response import VoiceResponse - -app = Flask(__name__) - - -@app.route("/answer", methods=['GET', 'POST']) -def answer_call(): - """Respond to incoming phone calls with a brief message.""" - # Start our TwiML response - resp = VoiceResponse() - - # Read a message aloud to the caller - resp.say("Thank you for calling! Have a great day.", voice='alice') - - return str(resp) - -if __name__ == "__main__": - app.run(debug=True) -require 'twilio-ruby' - -# Get your Account Sid and Auth Token from twilio.com/console -account_sid = 'AC86dafd9acccab6c0d346ed89a1202b2f' -auth_token = 'your_auth_token' - -# set up a client to talk to the Twilio REST API -@client = Twilio::REST::Client.new(account_sid, auth_token) - -call = @client.calls.create( - to: "+15558675310", - from: "+15017122661", - url: "http://demo.twilio.com/docs/voice.xml") -puts call.to - -npm install @twilio/flex-ui@1.18.0 -const defaultConfiguration: Config = { - disableLocalStorage: false, - available: true, - colorTheme: { - baseName: "BlueMediumTheme" - }, - componentProps: { - MessagingCanvas: { - avatarCallback: (identity: string) => SessionActions.getAgentAvatar(identity), - showTrayOnInactive: true - }, - MessageCanvasTray: { - onButtonClick: () => Actions.invokeAction("RestartEngagement") - } - }, - tokenServerUrl: "https://iam.twilio.com/v1/Accounts/{accountSid}/Tokens", - flexWebChannelsUrl: "https://flex-api.twilio.com/v1/WebChannels", - context: { - friendlyName: "Anonymous" - }, - startEngagementOnInit: true, - sdkOptions: { - chat: {} - } -}; - FlexWebChat.MainHeader.defaultProps.showImage = true; - - -{ - - yourDefaultName: 'You', - - theirDefaultName: 'Agent', - - yourFriendlyNameOverride: false, - - theirFriendlyNameOverride: false - -} -const brandColor1 = "#1976d2"; -const brandColor2 = "#233659"; -const brandTextColor = "#ffffff"; - - -const personalizedColors = { - darkBlueBackground: "#3C425C", - whiteText: "#FFFFFF", - entryPointBackground: "#3C425C", - lighterBackground: "#ecedf1", - primaryButtonBackground: "#1976d2", - primaryButtonColor: "#FFFFFF", - secondaryButtonBackground: "#6e7180", - secondaryButtonColor: "#FFFFFF" -}; - -// assign -const brandMessageBubbleColors = (bgColor) => ({ - Bubble: { - background: bgColor, - color: brandTextColor - }, - Avatar: { - background: bgColor, - color: brandTextColor - }, - Header: { - color: brandTextColor - } -}); - -const brandedColors = { - Chat: { - MessageListItem: { - FromOthers: brandMessageBubbleColors(brandColor2), - FromMe: brandMessageBubbleColors(brandColor1), - }, - MessageInput: { - Container:{ - Button: { - background: brandColor1, - color: brandTextColor - } - } - }, - MessageCanvasTray: { - Container: { - background: personalizedColors.darkBlueBackground, - color: personalizedColors.whiteText - } - }, - }, - - MainHeader: { - Container: { - background: personalizedColors.darkBlueBackground, - color: personalizedColors.whiteText - }, - Logo: { - fill: brandTextColor - } - }, - - EntryPoint: { - Container: { - background: personalizedColors.entryPointBackground, - color: personalizedColors.whiteText - } - }, - - PreEngagementCanvas: { - Container: { - background: personalizedColors.lighterBackground - }, - - Form: { - SubmitButton: { - background: personalizedColors.primaryButtonBackground, - color: personalizedColors.whiteText - } - } - } -}; -var appConfig = { - colorTheme: { - overrides: brandedColors - } -} - MainContainer: { - background: colors.base1 - }, - - EntryPoint: { - Container: { - backgroundImage: `linear-gradient(to top, ${colors.defaultButtonColor}, ${colors.defaultButtonColor})`, - backgroundColor: "rgba(0,0,0,0)", - color: "#ffffff", - "&:hover": { - backgroundColor: colors.buttonHoverColor, - backgroundBlendMode: "color", - } - } - }, - - MainHeader: { - Container: { - color: textColor - }, - Logo: { - fill: lightTheme ? "#000000" : "#ffffff" - } - }, - - PreEngagementCanvas: { - Container: { - color: textColor - }, - Footer: { - color: textColor - }, - Form: { - SubmitButton: { - "background-image": - `linear-gradient(to top,${colors.defaultButtonColor},${colors.defaultButtonColor})`, - color: "#ffffff" - }, - Label: {} - } - }, - - InvalidPreEngagementCanvas: { - Container: { - color: textColor - }, - Button: { - background: colors.defaultButtonColor, - color: colors.lightTextColor - } - }, - - Modal: { - Container: { - background: colors.base2, - color: textColor, - }, - Title: { - color: textColor - }, - PrimaryButton: { - background: colors.base2, - color: textColor, - }, - SecondaryButton: { - background: colors.base2, - color: textColor, - } - }, - - Chat: { - MessagingCanvas: { - Container: { - background: colors.base1 - } - }, - - MessageList: { - DateSeparatorLine: { - borderColor: colors.base4 - }, - DateSeparatorText: { - color: textColor - }, - TypingIndicator: { - color: textColor - } - }, - - MessageInput: { - Container: { - background: colors.base2, - color: textColor, - "::placeholder": { - color: textColor - }, - Button: { - color: "#ffffff", - background: "#1976D2" - } - } - }, - - MessageListItem: { - FromMe: { - Avatar: { - color: "#ffffff", - background: "#1976D2" - }, - Bubble: { - color: "#ffffff", - background: "#1976D2" - }, - Header: { - color: "#ffffff", - } - }, - FromOthers: { - Avatar: { - color: colors.base11, - background: colors.base2 - }, - Bubble: { - color: textColor, - background: colors.base2 - }, - Header: { - color: textColor - } - }, - ReadStatus: { - color: textColor - } - }, - - MessageCanvasTray: { - Container: { - background: colors.base2, - color: textColor - }, - Button: { - color: colors.lightTextColor, - background: colors.defaultButtonColor, - lightHover: false, - } - }, - - WelcomeMessage: { - Container: { - color: textColor - }, - Icon: { - color: colors.base11 - } - } - }, - - Progress: { - Circular: { - staticBackgroundBorderColor: colors.lightTextColor, - animatingBackgroundBorderColor: colors.base4, - animatingForegroundBorderColor: colors.defaultButtonColor, - } - }, - - FormComponents: { - TextArea: { - borderColor: colors.base4, - color: textColor, - background: "transparent", - - "&:focus": { - background: colors.base1, - boxShadow: `0px 0px 0px 2px ${colors.focusGlow}`, - border: `1px solid ${colors.focusColor}` - } - }, - Input: { - color: textColor - } - }, - MainContainer: { - background: colors.base1 - }, - - EntryPoint: { - Container: { - backgroundImage: `linear-gradient(to top, ${colors.defaultButtonColor}, ${colors.defaultButtonColor})`, - backgroundColor: "rgba(0,0,0,0)", - color: "#ffffff", - "&:hover": { - backgroundColor: colors.buttonHoverColor, - backgroundBlendMode: "color", - } - } - }, - - MainHeader: { - Container: { - color: textColor - }, - Logo: { - fill: lightTheme ? "#000000" : "#ffffff" - } - }, - - PreEngagementCanvas: { - Container: { - color: textColor - }, - Footer: { - color: textColor - }, - Form: { - SubmitButton: { - "background-image": - `linear-gradient(to top,${colors.defaultButtonColor},${colors.defaultButtonColor})`, - color: "#ffffff" - }, - Label: {} - } - }, - - InvalidPreEngagementCanvas: { - Container: { - color: textColor - }, - Button: { - background: colors.defaultButtonColor, - color: colors.lightTextColor - } - }, - - Modal: { - Container: { - background: colors.base2, - color: textColor, - }, - Title: { - color: textColor - }, - PrimaryButton: { - background: colors.base2, - color: textColor, - }, - SecondaryButton: { - background: colors.base2, - color: textColor, - } - }, - - Chat: { - MessagingCanvas: { - Container: { - background: colors.base1 - } - }, - - MessageList: { - DateSeparatorLine: { - borderColor: colors.base4 - }, - DateSeparatorText: { - color: textColor - }, - TypingIndicator: { - color: textColor - } - }, - - MessageInput: { - Container: { - background: colors.base2, - color: textColor, - "::placeholder": { - color: textColor - }, - Button: { - color: "#ffffff", - background: "#1976D2" - } - } - }, - - MessageListItem: { - FromMe: { - Avatar: { - color: "#ffffff", - background: "#1976D2" - }, - Bubble: { - color: "#ffffff", - background: "#1976D2" - }, - Header: { - color: "#ffffff", - } - }, - FromOthers: { - Avatar: { - color: colors.base11, - background: colors.base2 - }, - Bubble: { - color: textColor, - background: colors.base2 - }, - Header: { - color: textColor - } - }, - ReadStatus: { - color: textColor - } - }, - - MessageCanvasTray: { - Container: { - background: colors.base2, - color: textColor - }, - Button: { - color: colors.lightTextColor, - background: colors.defaultButtonColor, - lightHover: false, - } - }, - - WelcomeMessage: { - Container: { - color: textColor - }, - Icon: { - color: colors.base11 - } - } - }, - - Progress: { - Circular: { - staticBackgroundBorderColor: colors.lightTextColor, - animatingBackgroundBorderColor: colors.base4, - anim - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GitHub - webtechnicom/stripe: repository - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Skip to content - - - - - - - - -
- -
- - - - - -
- - - -
- - - - - - - - - -
-
-
- - - - - - - - - - - - -
- -
- -
-

- - - / - - stripe - - Template -

- - -
- - - -
-
-

- repository -

- -
- - -
-
- - - -
- - -
-
- - - - -
- -
- - - - - -
- -
- - - - - - -
- -
-
- - - master - - - - -
- - - -
-
-
- -
- - - - -
- - - Go to file - - - - - - - -
- - - Code - -
- -
-
-
- - - -
-
- - - - -
-
-

Latest commit

-
- -
- -
-
- - @webtechnicom -
-
- -
-
-
- - webtechnicom - - - - - - Create webtechnicom - -
- - - - -
-
- - -
<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$call = $twilio->calls
-               ->create("sip:sip.webtechnicom.net", // to
-                        "+17708008448", // from
-                        [
-                            "twiml" => "<Response><Say>Hello and thanks for connecting to your SIP network!</Say></Response>"
-                        ]
-               );
-
-print($call->sid);
-{
-  "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
-  "annotation": null,
-  "answered_by": null,
-  "api_version": "2010-04-01",
-  "caller_name": null,
-  "date_created": "Tue, 31 Aug 2010 20:36:28 +0000",
-  "date_updated": "Tue, 31 Aug 2010 20:36:44 +0000",
-  "direction": "inbound",
-  "duration": "15",
-  "end_time": "Tue, 31 Aug 2010 20:36:44 +0000",
-  "forwarded_from": "+17708008448",
-  "from": "+15017122661",
-  "from_formatted": "(501) 712-2661",
-  "group_sid": null,
-  "parent_call_sid": null,
-  "phone_number_sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
-  "price": "-0.03000",
-  "price_unit": "USD",
-  "sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
-  "start_time": "Tue, 31 Aug 2010 20:36:29 +0000",
-  "status": "completed",
-  "subresource_uris": {
-    "notifications": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications.json",
-    "recordings": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Recordings.json",
-    "feedback": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Feedback.json",
-    "feedback_summaries": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/FeedbackSummary.json",
-    "payments": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Payments.json"
-  },
-  "to": "sip:sip.webtechnicom.net",
-  "to_formatted": "sip:sip.webtechnicom.net",
-  "trunk_sid": null,
-  "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json",
-  "queue_time": "1000"
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$available_phone_number_country = $twilio->availablePhoneNumbers("US")
-                                         ->fetch();
-
-print($available_phone_number_country->countryCode);
-{
-  "beta": null,
-  "country": "United States",
-  "country_code": "US",
-  "subresource_uris": {
-    "local": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json",
-    "toll_free": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/TollFree.json"
-  },
-  "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US.json"
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read(["areaCode" => 510], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-{
-  "available_phone_numbers": [
-    {
-      "address_requirements": "none",
-      "beta": false,
-      "capabilities": {
-        "mms": true,
-        "sms": false,
-        "voice": true
-      },
-      "friendly_name": "(808) 925-1571",
-      "iso_country": "US",
-      "lata": "834",
-      "latitude": "19.720000",
-      "locality": "Hilo",
-      "longitude": "-155.090000",
-      "phone_number": "+18089251571",
-      "postal_code": "96720",
-      "rate_center": "HILO",
-      "region": "HI"
-    }
-  ],
-  "end": 1,
-  "first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "last_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=50",
-  "num_pages": 1,
-  "page": 0,
-  "page_size": 50,
-  "previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "start": 0,
-  "total": 1,
-  "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=1"
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read(["areaCode" => 510], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-{
-  "available_phone_numbers": [
-    {
-      "address_requirements": "none",
-      "beta": false,
-      "capabilities": {
-        "mms": true,
-        "sms": false,
-        "voice": true
-      },
-      "friendly_name": "(808) 925-1571",
-      "iso_country": "US",
-      "lata": "834",
-      "latitude": "19.720000",
-      "locality": "Hilo",
-      "longitude": "-155.090000",
-      "phone_number": "+18089251571",
-      "postal_code": "96720",
-      "rate_center": "HILO",
-      "region": "HI"
-    }
-  ],
-  "end": 1,
-  "first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "last_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=50",
-  "num_pages": 1,
-  "page": 0,
-  "page_size": 50,
-  "previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "start": 0,
-  "total": 1,
-  "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=1"
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read(["contains" => "510555****"], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-{
-  "available_phone_numbers": [
-    {
-      "address_requirements": "none",
-      "beta": false,
-      "capabilities": {
-        "mms": true,
-        "sms": false,
-        "voice": true
-      },
-      "friendly_name": "(808) 925-1571",
-      "iso_country": "US",
-      "lata": "834",
-      "latitude": "19.720000",
-      "locality": "Hilo",
-      "longitude": "-155.090000",
-      "phone_number": "+18089251571",
-      "postal_code": "96720",
-      "rate_center": "HILO",
-      "region": "HI"
-    }
-  ],
-  "end": 1,
-  "first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "last_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=50",
-  "num_pages": 1,
-  "page": 0,
-  "page_size": 50,
-  "previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "start": 0,
-  "total": 1,
-  "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=1"
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read(["contains" => "STORM"], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-{
-  "available_phone_numbers": [
-    {
-      "address_requirements": "none",
-      "beta": false,
-      "capabilities": {
-        "mms": true,
-        "sms": false,
-        "voice": true
-      },
-      "friendly_name": "(808) 925-1571",
-      "iso_country": "US",
-      "lata": "834",
-      "latitude": "19.720000",
-      "locality": "Hilo",
-      "longitude": "-155.090000",
-      "phone_number": "+18089251571",
-      "postal_code": "96720",
-      "rate_center": "HILO",
-      "region": "HI"
-    }
-  ],
-  "end": 1,
-  "first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "last_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=50",
-  "num_pages": 1,
-  "page": 0,
-  "page_size": 50,
-  "previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "start": 0,
-  "total": 1,
-  "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=1"
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read(["inRegion" => "AR"], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("GB")
-                ->local
-                ->read(["contains" => "+4420"], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("GB")
-                ->local
-                ->read(["smsEnabled" => True, "voiceEnabled" => True], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read([
-                           "nearLatLong" => "37.840699,-122.461853",
-                           "distance" => 50,
-                           "contains" => "555",
-                           "inRegion" => "CA"
-                       ],
-                       20
-                );
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read(["areaCode" => 510], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read(["areaCode" => 510], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read([
-                           "nearLatLong" => "37.840699,-122.461853",
-                           "distance" => 50,
-                           "contains" => "555",
-                           "inRegion" => "CA"
-                       ],
-                       20
-                );
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$country = $twilio->pricing->v1->phoneNumbers
-                               ->countries("US")
-                               ->fetch();
-
-print($country->country);
-<?php
-
- e1c785f -
-
-
-

Git stats

- -
-
-
-

Files

- - - - - Permalink - -
- - - Failed to load latest commit information. - -
-
-
-
Type
-
Name
-
Latest commit message
-
Commit time
-
- -
-
- - -
- -
- .github -
- -
-
 
-
- -
-
 
-
- -
-
-
- - -
- -
- API -
- -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- -
- README.md -
- -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- -
- TWILIO -
- -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
- -
- -
- - -
- -
-
-

- README.md -

-
-
-

stripe

-

repository -php --version -PHP 7.2.24-0ubuntu0.18.04.1 (cli) (built: Oct 28 2019 12:07:07) ( NTS ) -Copyright (c) 1997-2018 The PHP Group -Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies -with Zend OPcache v7.2.24-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies -with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans -composer --version -composer require telnyx/telnyx-php -{ -"require": { -"telnyx/telnyx-php": "^0.0.1" -} -}

-
-
-
- - -
-
- - -
-
-
-

About

- -

- repository -

- - -

Resources

- - - -
-
- -
-
- -

Sponsor this project

- -
    -
-
-
-
-
-
-

- - Packages -

- - -
- No packages published
-
- - - -
-
- -
- -
- -
-
- -
-
- -
- - - - - - -
- - - You can’t perform that action at this time. -
- - - - - - - - - - - # Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -phone_number = client.lookups \ - .phone_numbers('+16502530000') \ - .fetch(add_ons=['payfone_tcpa_compliance'], add_ons_data={ - 'payfone_tcpa_compliance.RightPartyContactedDate': '20160101' - }, type=['carrier']) - -print(phone_number.add_ons) -{ - "caller_name": null, - "country_code": "US", - "phone_number": "+16502530000", - "national_format": "(650) 253-0000", - "carrier": { - "mobile_country_code": null, - "mobile_network_code": null, - "name": "Level 3 Communications, LLC", - "type": "landline", - "error_code": null - }, - "add_ons": { - "status": "successful", - "message": null, - "code": null, - "results": { - "payfone_tcpa_compliance": { - "status": "successful", - "request_sid": "XRd3a2991c9108bde3ca9589ed84d31463", - "message": null, - "code": null, - "result": { - "Status": 0, - "Response": { - "MSISDNType": "NonFixedVoIP", - "NumberMatch": "I", - "VerifyNumberTransactionId": "2019459819" - }, - "RequestId": "XRd3a2991c9108bde3ca9589ed84d31463", - "Description": "Success." - } - } - } - }, - "url": "https://lookups.twilio.com/v1/PhoneNumbers/+16502530000?Type=carrier" -var appConfig = { - serviceBaseUrl: "https://dancing-owl-1234.twil.io/", - sso: { - accountSid: "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" - }, - sdkOptions: { - chat: {}, - insights: {}, - voice: {}, - worker: {} - }, - logLevel: "debug", - colorTheme: { - baseName: "GreyDark", - colors: {}, - light: false, - overrides: {} - }, - componentProps: { - CRMContainer: { - uriCallback: (task) => task - ? `https://www.bing.com/search?q=${task.attributes.name}` - : "http://bing.com" - } - }, - router: { - type: "memory", - history: { - initialEntries: [ "/agent-desktop" ] - } - } -}; -from flask import Flask, request -from twilio import twiml - -import json - - -app = Flask(__name__) - -@app.route("/voice", methods=['GET', 'POST']) -def call(): - """Responds to incoming calls using Twilio Add-ons""" - # Start our TwiML response - response = twiml.Response() - - # Decode the JSON included in the 'AddOns' field - add_ons = json.loads(request.values['AddOns']) - - # If the Whitepages add-on found nothing, return immediately - if 'whitepages_pro_caller_id' not in add_ons['results']: - response.say('Sorry, I could not learn anything about you.') - response.hangup() - - return str(response) - - # Otherwise, extract the Whitepages data - whitepages = add_ons['results']['whitepages_pro_caller_id'] - - # Grab the result Whitepages gave us - # (see the "Documentation" tab on the Whitepages add-on for more details) - caller_id = whitepages['result'] - - # See if we can get the caller's name - try: - first_name = caller_id['belongs_to'][0]['firstname'] - except (IndexError, KeyError): - first_name = 'a mystery' - - # And what city the caller lives in - try: - city = caller_id['current_addresses'][0]['city'] - except (IndexError, KeyError): - city = 'a mystery' - - # Tell the caller what we think their name and city are - response.say('Hello. Your name is {}.'.format(first_name)) - response.say('And I think you live in {}.'.format(city)) - - # Then end the call - response.hangup() - - return str(response) - -if __name__ == "__main__": - app.run(debug=True) -{ - "status": "successful", - "message": null, - "code": null, - "results": { - "whitepages_pro_caller_id": { - "code": null, - "message": null, - "request_sid": "XRb57cab3a3c0cfe0bb50f093d9bd3b0a3", - "result": { - "alternate_phones": [ - "8003361327" - ], - "associated_people": [], - "belongs_to": [ - { - "age_range": null, - "firstname": null, - "gender": null, - "id": "Business.7e29cf66-8bf2-4812-829d-356654b5b3d3.Durable", - "lastname": null, - "link_to_phone_start_date": null, - "middlename": null, - "name": "Twilio Inc", - "type": "Business" - } - ], - "carrier": "Twilio", - "country_calling_code": "1", - "current_addresses": [ - { - "city": "San Francisco", - "country_code": "US", - "delivery_point": "MultiUnit", - "id": "Location.88e44955-805c-455a-99da-d7444ca5c484.Durable", - "is_active": true, - "lat_long": { - "latitude": 37.783382, - "longitude": -122.395714, - "accuracy": "RoofTop" - }, - "link_to_person_start_date": null, - "location_type": "Address", - "postal_code": "94107", - "state_code": "CA", - "street_line_1": "Address", - "street_line_2": null, - "zip4": "3624" - } - ], - "error": null, - "historical_addresses": [], - "id": "Phone.4d796fef-a2df-4b08-cfe3-bc7128b6f6bb.Durable", - "is_commercial": true, - "is_prepaid": false, - "is_valid": true, - "line_type": "NonFixedVOIP", - "phone_number": "5558675310", - "warnings": [] - }, - "status": "successful" - } - } -} -from flask import Flask, request -from twilio import twiml - -import json - - -app = Flask(__name__) - -@app.route("/voice", methods=['GET', 'POST']) -def call(): - """Responds to incoming calls using Twilio Add-ons""" - # Start our TwiML response - response = twiml.Response() - - # Decode the JSON included in the 'AddOns' field - add_ons = json.loads(request.values['AddOns']) - - # If the Whitepages add-on found nothing, return immediately - if 'whitepages_pro_caller_id' not in add_ons['results']: - response.say('Sorry, I could not learn anything about you.') - response.hangup() - - return str(response) - - # Otherwise, extract the Whitepages data - whitepages = add_ons['results']['whitepages_pro_caller_id'] - - # Grab the result Whitepages gave us - # (see the "Documentation" tab on the Whitepages add-on for more details) - caller_id = whitepages['result'] - - # See if we can get the caller's name - try: - first_name = caller_id['belongs_to'][0]['firstname'] - except (IndexError, KeyError): - first_name = 'a mystery' - - # And what city the caller lives in - try: - city = caller_id['current_addresses'][0]['city'] - except (IndexError, KeyError): - city = 'a mystery' - - # Tell the caller what we think their name and city are - response.say('Hello. Your name is {}.'.format(first_name)) - response.say('And I think you live in {}.'.format(city)) - - # Then end the call - response.hangup() - - return str(response) - -if __name__ == "__main__": - app.run(debug=True) -{ - "status": "successful", - "message": null, - "code": null, - "results": { - "whitepages_pro_caller_id": { - "code": null, - "message": null, - "request_sid": "XRb57cab3a3c0cfe0bb50f093d9bd3b0a3", - "result": { - "alternate_phones": [ - "8003361327" - ], - "associated_people": [], - "belongs_to": [ - { - "age_range": null, - "firstname": null, - "gender": null, - "id": "Business.7e29cf66-8bf2-4812-829d-356654b5b3d3.Durable", - "lastname": null, - "link_to_phone_start_date": null, - "middlename": null, - "name": "Twilio Inc", - "type": "Business" - } - ], - "carrier": "Twilio", - "country_calling_code": "1", - "current_addresses": [ - { - "city": "San Francisco", - "country_code": "US", - "delivery_point": "MultiUnit", - "id": "Location.88e44955-805c-455a-99da-d7444ca5c484.Durable", - "is_active": true, - "lat_long": { - "latitude": 37.783382, - "longitude": -122.395714, - "accuracy": "RoofTop" - }, - "link_to_person_start_date": null, - "location_type": "Address", - "postal_code": "94107", - "state_code": "CA", - "street_line_1": "Address", - "street_line_2": null, - "zip4": "3624" - } - ], - "error": null, - "historical_addresses": [], - "id": "Phone.4d796fef-a2df-4b08-cfe3-bc7128b6f6bb.Durable", - "is_commercial": true, - "is_prepaid": false, - "is_valid": true, - "line_type": "NonFixedVOIP", - "phone_number": "5558675310", - "warnings": [] - }, - "status": "successful" - } - } -} -from flask import Flask, request -from twilio import twiml - -import json - - -app = Flask(__name__) - -@app.route("/voice", methods=['GET', 'POST']) -def call(): - """Responds to incoming calls using Twilio Add-ons""" - # Start our TwiML response - response = twiml.Response() - - # Decode the JSON included in the 'AddOns' field - add_ons = json.loads(request.values['AddOns']) - - # If the Whitepages add-on found nothing, return immediately - if 'whitepages_pro_caller_id' not in add_ons['results']: - response.say('Sorry, I could not learn anything about you.') - response.hangup() - - return str(response) - - # Otherwise, extract the Whitepages data - whitepages = add_ons['results']['whitepages_pro_caller_id'] - - # Grab the result Whitepages gave us - # (see the "Documentation" tab on the Whitepages add-on for more details) - caller_id = whitepages['result'] - - # See if we can get the caller's name - try: - first_name = caller_id['belongs_to'][0]['firstname'] - except (IndexError, KeyError): - first_name = 'a mystery' - - # And what city the caller lives in - try: - city = caller_id['current_addresses'][0]['city'] - except (IndexError, KeyError): - city = 'a mystery' - - # Tell the caller what we think their name and city are - response.say('Hello. Your name is {}.'.format(first_name)) - response.say('And I think you live in {}.'.format(city)) - - # Then end the call - response.hangup() - - return str(response) - -if __name__ == "__main__": - app.run(debug=True) -{ - "status": "successful", - "message": null, - "code": null, - "results": { - "whitepages_pro_caller_id": { - "code": null, - "message": null, - "request_sid": "XRb57cab3a3c0cfe0bb50f093d9bd3b0a3", - "result": { - "alternate_phones": [ - "8003361327" - ], - "associated_people": [], - "belongs_to": [ - { - "age_range": null, - "firstname": null, - "gender": null, - "id": "Business.7e29cf66-8bf2-4812-829d-356654b5b3d3.Durable", - "lastname": null, - "link_to_phone_start_date": null, - "middlename": null, - "name": "Twilio Inc", - "type": "Business" - } - ], - "carrier": "Twilio", - "country_calling_code": "1", - "current_addresses": [ - { - "city": "San Francisco", - "country_code": "US", - "delivery_point": "MultiUnit", - "id": "Location.88e44955-805c-455a-99da-d7444ca5c484.Durable", - "is_active": true, - "lat_long": { - "latitude": 37.783382, - "longitude": -122.395714, - "accuracy": "RoofTop" - }, - "link_to_person_start_date": null, - "location_type": "Address", - "postal_code": "94107", - "state_code": "CA", - "street_line_1": "Address", - "street_line_2": null, - "zip4": "3624" - } - ], - "error": null, - "historical_addresses": [], - "id": "Phone.4d796fef-a2df-4b08-cfe3-bc7128b6f6bb.Durable", - "is_commercial": true, - "is_prepaid": false, - "is_valid": true, - "line_type": "NonFixedVOIP", - "phone_number": "5558675310", - "warnings": [] - }, - "status": "successful" - } - } -} -from flask import Flask, request -from twilio import twiml - -import json - - -app = Flask(__name__) - -@app.route("/voice", methods=['GET', 'POST']) -def call(): - """Responds to incoming calls using Twilio Add-ons""" - # Start our TwiML response - response = twiml.Response() - - # Decode the JSON included in the 'AddOns' field - add_ons = json.loads(request.values['AddOns']) - - # If the Whitepages add-on found nothing, return immediately - if 'whitepages_pro_caller_id' not in add_ons['results']: - response.say('Sorry, I could not learn anything about you.') - response.hangup() - - return str(response) - - # Otherwise, extract the Whitepages data - whitepages = add_ons['results']['whitepages_pro_caller_id'] - - # Grab the result Whitepages gave us - # (see the "Documentation" tab on the Whitepages add-on for more details) - caller_id = whitepages['result'] - - # See if we can get the caller's name - try: - first_name = caller_id['belongs_to'][0]['firstname'] - except (IndexError, KeyError): - first_name = 'a mystery' - - # And what city the caller lives in - try: - city = caller_id['current_addresses'][0]['city'] - except (IndexError, KeyError): - city = 'a mystery' - - # Tell the caller what we think their name and city are - response.say('Hello. Your name is {}.'.format(first_name)) - response.say('And I think you live in {}.'.format(city)) - - # Then end the call - response.hangup() - - return str(response) - -if __name__ == "__main__": - app.run(debug=True) -from flask import Flask, request -from twilio import twiml - -import json - - -app = Flask(__name__) - -@app.route("/voice", methods=['GET', 'POST']) -def call(): - """Responds to incoming calls using Twilio Add-ons""" - # Start our TwiML response - response = twiml.Response() - - # Decode the JSON included in the 'AddOns' field - add_ons = json.loads(request.values['AddOns']) - - # If the Whitepages add-on found nothing, return immediately - if 'whitepages_pro_caller_id' not in add_ons['results']: - response.say('Sorry, I could not learn anything about you.') - response.hangup() - - return str(response) - - # Otherwise, extract the Whitepages data - whitepages = add_ons['results']['whitepages_pro_caller_id'] - - # Grab the result Whitepages gave us - # (see the "Documentation" tab on the Whitepages add-on for more details) - caller_id = whitepages['result'] - - # See if we can get the caller's name - try: - first_name = caller_id['belongs_to'][0]['firstname'] - except (IndexError, KeyError): - first_name = 'a mystery' - - # And what city the caller lives in - try: - city = caller_id['current_addresses'][0]['city'] - except (IndexError, KeyError): - city = 'a mystery' - - # Tell the caller what we think their name and city are - response.say('Hello. Your name is {}.'.format(first_name)) - response.say('And I think you live in {}.'.format(city)) - - # Then end the call - response.hangup() - - return str(response) - -if __name__ == "__main__": - app.run(debug=True) - -appConfig.sso = { - accountSid: string; // AccountSid of your Twilio Project - loginPopup: boolean; // whether to launch IdP login in new window - loginPopupFeatures: string; // standard window.open() features param to be applied to popup window -}; - flex.CRMContainer - .defaultProps - .uriCallback = (task) => task - ? `https://www.bing.com/search?q=${task.attributes.name}` - : "http://bing.com/"; - { - yourDefaultName?: string; - theirDefaultName?: string; - yourFriendlyNameOverride?: boolean; - theirFriendlyNameOverride?: boolean; - const mediaId = Flex.AudioPlayerManager.play( -{ - url: "sound-url", - repeatable: true -}, -(error: AudioPlayerError) => { - // handle error -} -); - Flex.Manager.getInstance().chatClient.on("messageAdded", () => { - const mediaId = Flex.AudioPlayerManager.play({ - url: "sound-url", - repeatable: true - }); -}) - -} - export interface MediaData { - url: string; - repeatable: boolean; -} - Flex.TeamsView.defaultProps.filters = [ - Flex.TeamsView.activitiesFilter, - // ... custom filters here -]; - // Install the Flex Plugin Builder and create a plugin to get this code on your own machine -// https://www.twilio.com/docs/flex/plugin-builder - -const ACTION_DISMISS_BAR = 'DISMISS_BAR'; - -const initialState = { - isOpen: true, -}; - -// Define plugin actions -export class Actions { - static dismissBar = () => ({ type: ACTION_DISMISS_BAR }); -} - -// Define how actions influence state -export function reduce(state = initialState, action) { - switch (action.type) { - case ACTION_DISMISS_BAR: { - return { - ...state, - isOpen: false, - }; - } - - default: - return state; - } -} - const initialState = { - isOpen: true, -}; - import React from 'react'; -import { VERSION } from '@twilio/flex-ui'; -import { FlexPlugin } from 'flex-plugin'; - -import CustomTaskListContainer from './components/CustomTaskList/CustomTaskList.Container'; -import reducers, { namespace } from './states'; - -const PLUGIN_NAME = 'SamplePlugin'; - -export default class SamplePlugin extends FlexPlugin { - constructor() { - super(PLUGIN_NAME); - } - - /** - * This code is run when your plugin is being started - * Use this to modify any UI components or attach to the actions framework - * - * @param flex { typeof import('@twilio/flex-ui') } - * @param manager { import('@twilio/flex-ui').Manager } - */ - init(flex, manager) { - this.registerReducers(manager); - - const options = { sortOrder: -1 }; - flex.AgentDesktopView - .Panel1 - .Content - .add(, options); - } - - /** - * Registers the plugin reducers - * - * @param manager { Flex.Manager } - */ - registerReducers(manager) { - if (!manager.store.addReducer) { - // eslint: disable-next-line - console.error(`You need FlexUI > 1.9.0 to use built-in redux; you are currently on ${VERSION}`); - return; - } - - manager.store.addReducer(namespace, reducers); - } -} - - const ACTION_DISMISS_BAR = 'DISMISS_BAR'; - export function reduce(state = initialState, action) {...} - curl -X GET 'https://flex-api.twilio.com/v1/Configuration' \ --u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN - curl -X POST 'https://flex-api.twilio.com/v1/Configuration' \ - -u AC86dafd9acccab6c0d346ed89a1202b2f:your_auth_token - -H 'Content-Type: application/json' \ - -d '{ - ...old properties - "ui_attributes": { - "logLevel": "debug" - ...old properties continued - } - }' -var appConfig = { - serviceBaseUrl: "https://dancing-owl-1234.twil.io/", - sso: { - accountSid: "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" - }, - sdkOptions: { - chat: {}, - insights: {}, - voice: {}, - worker: {} - }, - logLevel: "debug", - colorTheme: { - baseName: "GreyDark", - colors: {}, - light: false, - overrides: {} - }, - componentProps: { - CRMContainer: { - uriCallback: (task) => task - ? `https://www.bing.com/search?q=${task.attributes.name}` - : "http://bing.com" - } - }, - router: { - type: "memory", - history: { - initialEntries: [ "/agent-desktop" ] - } - } -}; -appConfig.colorTheme = { - baseName: "GreyDark", - colors: { base2: "red"}, - light: true, - overrides: { - MainHeader: { - Container: { - background: "Grey" - } - } - } -}; -appConfig.disableTransfers = false; -appConfig.logLevel = 'info'; -appConfig.pluginService = { - enabled: true, - url: "https://www.webtechnicom.net/plugins-list.json" -}; -appConfig.router = { - type: "memory", - history: { - initialEntries: [ "/agent-desktop" ] - } -}; -appConfig.sdkOptions = { - chat: {}, - insights: {}, - voice: {}, - worker: {} -}; -appConfig.sso = { - accountSid: "XRb57cab3a3c0cfe0bb50f093d9bd3b0a3" // AccountSid of your Twilio project -}; -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - url='http://webtechnicom.net/docs/voice.xml', - to='+41765203630', - from_='+17708008448' - ) - -print(call.sid) -{ - "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "annotation": null, - "answered_by": null, - "api_version": "2010-04-01", - "caller_name": null, - "date_created": "Tue, 31 Aug 2010 20:36:28 +0000", - "date_updated": "Tue, 31 Aug 2010 20:36:44 +0000", - "direction": "inbound", - "duration": "15", - "end_time": "Tue, 31 Aug 2010 20:36:44 +0000", - "forwarded_from": "+141586753093", - "from": "+15017122661", - "from_formatted": "(501) 712-2661", - "group_sid": null, - "parent_call_sid": null, - "phone_number_sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "price": "-0.03000", - "price_unit": "USD", - "sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "start_time": "Tue, 31 Aug 2010 20:36:29 +0000", - "status": "completed", - "subresource_uris": { - "notifications": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications.json", - "recordings": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Recordings.json", - "feedback": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Feedback.json", - "feedback_summaries": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/FeedbackSummary.json", - "payments": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Payments.json" - }, - "to": "+15558675310", - "to_formatted": "(555) 867-5310", - "trunk_sid": null, - "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json", - "queue_time": "1000" -} -from flask import Flask -app = Flask(__name__) - -@app.route("/") -def hello(): - return "Hello World!" - -if __name__ == "__main__": - app.run() -from flask import Flask -from twilio.twiml.voice_response import VoiceResponse - -app = Flask(__name__) - - -@app.route("/answer", methods=['GET', 'POST']) -def answer_call(): - """Respond to incoming phone calls with a brief message.""" - # Start our TwiML response - resp = VoiceResponse() - - # Read a message aloud to the caller - resp.say("Thank you for calling! Have a great day.", voice='alice') - - return str(resp) - -if __name__ == "__main__": - app.run(debug=True) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - url='http://demo.twilio.com/docs/voice.xml', - to='+15558675310', - from_='+15017122661' - ) - -print(call.sid) -{ - "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "annotation": null, - "answered_by": null, - "api_version": "2010-04-01", - "caller_name": null, - "date_created": "Tue, 31 Aug 2010 20:36:28 +0000", - "date_updated": "Tue, 31 Aug 2010 20:36:44 +0000", - "direction": "inbound", - "duration": "15", - "end_time": "Tue, 31 Aug 2010 20:36:44 +0000", - "forwarded_from": "+141586753093", - "from": "+15017122661", - "from_formatted": "(501) 712-2661", - "group_sid": null, - "parent_call_sid": null, - "phone_number_sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "price": "-0.03000", - "price_unit": "USD", - "sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "start_time": "Tue, 31 Aug 2010 20:36:29 +0000", - "status": "completed", - "subresource_uris": { - "notifications": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications.json", - "recordings": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Recordings.json", - "feedback": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Feedback.json", - "feedback_summaries": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/FeedbackSummary.json", - "payments": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Payments.json" - }, - "to": "+41765203630", - "to_formatted": "+1(770)800 8448", - "trunk_sid": null, - "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json", - "queue_time": "1000" -} -from flask import Flask -app = Flask(__name__) - -@app.route("/") -def hello(): - return "Hello World!" - -if __name__ == "__main__": - app.run() -from flask import Flask -from twilio.twiml.voice_response import VoiceResponse - -app = Flask(__name__) - - -@app.route("/answer", methods=['GET', 'POST']) -def answer_call(): - """Respond to incoming phone calls with a brief message.""" - # Start our TwiML response - resp = VoiceResponse() - - # Read a message aloud to the caller - resp.say("Thank you for calling! Have a great day.", voice='alice') - - return str(resp) - -if __name__ == "__main__": - app.run(debug=True) -require 'twilio-ruby' - -# Get your Account Sid and Auth Token from twilio.com/console -account_sid = 'AC86dafd9acccab6c0d346ed89a1202b2f' -auth_token = 'your_auth_token' - -# set up a client to talk to the Twilio REST API -@client = Twilio::REST::Client.new(account_sid, auth_token) - -call = @client.calls.create( - to: "+15558675310", - from: "+15017122661", - url: "http://demo.twilio.com/docs/voice.xml") -puts call.to - -npm install @twilio/flex-ui@1.18.0 -const defaultConfiguration: Config = { - disableLocalStorage: false, - available: true, - colorTheme: { - baseName: "BlueMediumTheme" - }, - componentProps: { - MessagingCanvas: { - avatarCallback: (identity: string) => SessionActions.getAgentAvatar(identity), - showTrayOnInactive: true - }, - MessageCanvasTray: { - onButtonClick: () => Actions.invokeAction("RestartEngagement") - } - }, - tokenServerUrl: "https://iam.twilio.com/v1/Accounts/{accountSid}/Tokens", - flexWebChannelsUrl: "https://flex-api.twilio.com/v1/WebChannels", - context: { - friendlyName: "Anonymous" - }, - startEngagementOnInit: true, - sdkOptions: { - chat: {} - } -}; - FlexWebChat.MainHeader.defaultProps.showImage = true; - - -{ - - yourDefaultName: 'You', - - theirDefaultName: 'Agent', - - yourFriendlyNameOverride: false, - - theirFriendlyNameOverride: false - -} -const brandColor1 = "#1976d2"; -const brandColor2 = "#233659"; -const brandTextColor = "#ffffff"; - - -const personalizedColors = { - darkBlueBackground: "#3C425C", - whiteText: "#FFFFFF", - entryPointBackground: "#3C425C", - lighterBackground: "#ecedf1", - primaryButtonBackground: "#1976d2", - primaryButtonColor: "#FFFFFF", - secondaryButtonBackground: "#6e7180", - secondaryButtonColor: "#FFFFFF" -}; - -// assign -const brandMessageBubbleColors = (bgColor) => ({ - Bubble: { - background: bgColor, - color: brandTextColor - }, - Avatar: { - background: bgColor, - color: brandTextColor - }, - Header: { - color: brandTextColor - } -}); - -const brandedColors = { - Chat: { - MessageListItem: { - FromOthers: brandMessageBubbleColors(brandColor2), - FromMe: brandMessageBubbleColors(brandColor1), - }, - MessageInput: { - Container:{ - Button: { - background: brandColor1, - color: brandTextColor - } - } - }, - MessageCanvasTray: { - Container: { - background: personalizedColors.darkBlueBackground, - color: personalizedColors.whiteText - } - }, - }, - - MainHeader: { - Container: { - background: personalizedColors.darkBlueBackground, - color: personalizedColors.whiteText - }, - Logo: { - fill: brandTextColor - } - }, - - EntryPoint: { - Container: { - background: personalizedColors.entryPointBackground, - color: personalizedColors.whiteText - } - }, - - PreEngagementCanvas: { - Container: { - background: personalizedColors.lighterBackground - }, - - Form: { - SubmitButton: { - background: personalizedColors.primaryButtonBackground, - color: personalizedColors.whiteText - } - } - } -}; -var appConfig = { - colorTheme: { - overrides: brandedColors - } -} - MainContainer: { - background: colors.base1 - }, - - EntryPoint: { - Container: { - backgroundImage: `linear-gradient(to top, ${colors.defaultButtonColor}, ${colors.defaultButtonColor})`, - backgroundColor: "rgba(0,0,0,0)", - color: "#ffffff", - "&:hover": { - backgroundColor: colors.buttonHoverColor, - backgroundBlendMode: "color", - } - } - }, - - MainHeader: { - Container: { - color: textColor - }, - Logo: { - fill: lightTheme ? "#000000" : "#ffffff" - } - }, - - PreEngagementCanvas: { - Container: { - color: textColor - }, - Footer: { - color: textColor - }, - Form: { - SubmitButton: { - "background-image": - `linear-gradient(to top,${colors.defaultButtonColor},${colors.defaultButtonColor})`, - color: "#ffffff" - }, - Label: {} - } - }, - - InvalidPreEngagementCanvas: { - Container: { - color: textColor - }, - Button: { - background: colors.defaultButtonColor, - color: colors.lightTextColor - } - }, - - Modal: { - Container: { - background: colors.base2, - color: textColor, - }, - Title: { - color: textColor - }, - PrimaryButton: { - background: colors.base2, - color: textColor, - }, - SecondaryButton: { - background: colors.base2, - color: textColor, - } - }, - - Chat: { - MessagingCanvas: { - Container: { - background: colors.base1 - } - }, - - MessageList: { - DateSeparatorLine: { - borderColor: colors.base4 - }, - DateSeparatorText: { - color: textColor - }, - TypingIndicator: { - color: textColor - } - }, - - MessageInput: { - Container: { - background: colors.base2, - color: textColor, - "::placeholder": { - color: textColor - }, - Button: { - color: "#ffffff", - background: "#1976D2" - } - } - }, - - MessageListItem: { - FromMe: { - Avatar: { - color: "#ffffff", - background: "#1976D2" - }, - Bubble: { - color: "#ffffff", - background: "#1976D2" - }, - Header: { - color: "#ffffff", - } - }, - FromOthers: { - Avatar: { - color: colors.base11, - background: colors.base2 - }, - Bubble: { - color: textColor, - background: colors.base2 - }, - Header: { - color: textColor - } - }, - ReadStatus: { - color: textColor - } - }, - - MessageCanvasTray: { - Container: { - background: colors.base2, - color: textColor - }, - Button: { - color: colors.lightTextColor, - background: colors.defaultButtonColor, - lightHover: false, - } - }, - - WelcomeMessage: { - Container: { - color: textColor - }, - Icon: { - color: colors.base11 - } - } - }, - - Progress: { - Circular: { - staticBackgroundBorderColor: colors.lightTextColor, - animatingBackgroundBorderColor: colors.base4, - animatingForegroundBorderColor: colors.defaultButtonColor, - } - }, - - FormComponents: { - TextArea: { - borderColor: colors.base4, - color: textColor, - background: "transparent", - - "&:focus": { - background: colors.base1, - boxShadow: `0px 0px 0px 2px ${colors.focusGlow}`, - border: `1px solid ${colors.focusColor}` - } - }, - Input: { - color: textColor - } - }, - MainContainer: { - background: colors.base1 - }, - - EntryPoint: { - Container: { - backgroundImage: `linear-gradient(to top, ${colors.defaultButtonColor}, ${colors.defaultButtonColor})`, - backgroundColor: "rgba(0,0,0,0)", - color: "#ffffff", - "&:hover": { - backgroundColor: colors.buttonHoverColor, - backgroundBlendMode: "color", - } - } - }, - - MainHeader: { - Container: { - color: textColor - }, - Logo: { - fill: lightTheme ? "#000000" : "#ffffff" - } - }, - - PreEngagementCanvas: { - Container: { - color: textColor - }, - Footer: { - color: textColor - }, - Form: { - SubmitButton: { - "background-image": - `linear-gradient(to top,${colors.defaultButtonColor},${colors.defaultButtonColor})`, - color: "#ffffff" - }, - Label: {} - } - }, - - InvalidPreEngagementCanvas: { - Container: { - color: textColor - }, - Button: { - background: colors.defaultButtonColor, - color: colors.lightTextColor - } - }, - - Modal: { - Container: { - background: colors.base2, - color: textColor, - }, - Title: { - color: textColor - }, - PrimaryButton: { - background: colors.base2, - color: textColor, - }, - SecondaryButton: { - background: colors.base2, - color: textColor, - } - }, - - Chat: { - MessagingCanvas: { - Container: { - background: colors.base1 - } - }, - - MessageList: { - DateSeparatorLine: { - borderColor: colors.base4 - }, - DateSeparatorText: { - color: textColor - }, - TypingIndicator: { - color: textColor - } - }, - - MessageInput: { - Container: { - background: colors.base2, - color: textColor, - "::placeholder": { - color: textColor - }, - Button: { - color: "#ffffff", - background: "#1976D2" - } - } - }, - - MessageListItem: { - FromMe: { - Avatar: { - color: "#ffffff", - background: "#1976D2" - }, - Bubble: { - color: "#ffffff", - background: "#1976D2" - }, - Header: { - color: "#ffffff", - } - }, - FromOthers: { - Avatar: { - color: colors.base11, - background: colors.base2 - }, - Bubble: { - color: textColor, - background: colors.base2 - }, - Header: { - color: textColor - } - }, - ReadStatus: { - color: textColor - } - }, - - MessageCanvasTray: { - Container: { - background: colors.base2, - color: textColor - }, - Button: { - color: colors.lightTextColor, - background: colors.defaultButtonColor, - lightHover: false, - } - }, - - WelcomeMessage: { - Container: { - color: textColor - }, - Icon: { - color: colors.base11 - } - } - }, - - Progress: { - Circular: { - staticBackgroundBorderColor: colors.lightTextColor, - animatingBackgroundBorderColor: colors.base4, - animatingFoatingForegroundBorderColor: colors.defaultButtonColor, - } - }, - - FormComponents: { - TextArea: { - borderColor: colors.base4, - color: textColor, - background: "transparent", - - "&:focus": { - background: colors.base1, - boxShadow: `0px 0px 0px 2px ${colors.focusGlow}`, - border: `1px solid ${colors.focusColor}` - } - }, - Input: { - color: textColor - } - }, - FlexWebChat.Manager.create(configuration) - .then(manager => { - - manager.strings.WelcomeMessage = "I am a new Welcome Message"; - - ReactDOM.render( - - - , - document.getElementById("root") - ); - }); - EntryPointTagline: "Chat with us", - MessageCanvasTrayContent: ` -
Thanks for chatting with us!
-

If you have any more questions please reach out to us again.

`, - MessageCanvasTrayButton: "START NEW CHAT", - InvalidPreEngagementMessage: "Pre-engagement forms have not been set and are required to initiate the web-chat. " + "Please configure these now in setup.", - InvalidPreEngagementButton: "Learn more", - PredefinedChatMessageAuthorName: "Bot", - PredefinedChatMessageBody: "Hi there! How can we help you today?", - InputPlaceHolder: "Type message", - TypingIndicator: "{{name}} is typing ... ", - Read: "Read", - MessageSendingDisabled: "Message sending has been disabled", - Today: "TODAY", - Yesterday: "YESTERDAY", - MessageCanvasTrayButton: "START NEW CHAT", - WelcomeMessage: "Welcome to customer service", - Save: "SAVE", - Reset: "RESET", - MessageCharacterCountStatus: "{{currentCharCount}} / {{maxCharCount}}", - SendMessageTooltip: "Send Message", - FieldValidationRequiredField: "Field required", - FieldValidationInvalidEmail: "Please provide a valid email address" - FlexWebChat.Actions.on("afterStartEngagement", (payload) => { - - const { channelSid } = manager.store.getState().flex.session; - manager.chatClient.getChannelBySid(channelSid) - .then(channel => { - channel.sendMessage("My awesome message"); - }); - }); - // WebchatConfig.js - -const defaultConfiguration: Config = { - disableLocalStorage: false, - available: true, - colorTheme: { - baseName: "BlueMediumTheme" - }, - componentProps: { - MessagingCanvas: { - avatarCallback: (identity: string) => SessionActions.getAgentAvatar(identity), - showTrayOnInactive: true - }, - MessageCanvasTray: { - onButtonClick: () => Actions.invokeAction("RestartEngagement") - } - PreEngagementCanvas: { - .... - }, - - tokenServerUrl: "https://iam.twilio.com/v1/Accounts/{accountSid}/Tokens", - flexWebChannelsUrl: "https://flex-api.twilio.com/v1/WebChannels", - context: { - friendlyName: "Anonymous" - }, - startEngagementOnInit: false, - preEngagementConfig: { - ... - } -}; -const defaultConfiguration: Config = { -... -preEngagementConfig: { - - description: "Please provide some information", - fields: [ - { - label: "What is your name?", - type: "InputItem", - attributes: { - name: "friendlyName", - type: "text", - required: true - } - }, - { - label: "What is your question?", - type: "TextareaItem", - attributes: { - name: "question", - type: "text", - placeholder: "Type your question here", - required: false, - rows: 5 - } - }, - ], - submitLabel: "Ok Let's Go!" -} -}; -preEngagementConfig: { - - description: "Please provide some information", - fields: [ - { - label: "What is your name?", - type: "InputItem", - attributes: { - name: "friendlyName", - type: "text", - placeholder: "Enter your name", - required: true, - value: "Bob", - readOnly: false - } - }, - { - label: "What is your email?", - type: "InputItem", - attributes: { - name: "email", - type: "email", - placeholder: "Enter yout email", - required: true, - value: "Bob@bobson.com", - readOnly: false - } - }, - { - label: "My awesome dropdown", - type: "SelectItem", - attributes: { - name: "My awesome dropdown", - required: true, - readOnly: false - - }, - options: [ - { - value: "value1", - label: "label1", - selected: false - }, - { - value: "value2", - label: "label2", - selected: true - } - ] - }, - { - label: "What is your question?", - type: "TextareaItem", - attributes: { - name: "question", - type: "text", - placeholder: "Type your question here", - required: false, - rows: 5, - value: "My awesome question", - readOnly: false - } - } - ], - footerLabel: "I am a footer", - submitLabel: "Ok Let's Go!", -} -// post question from pre-engagement into chat - - FlexWebChat.Actions.on("afterStartEngagement", (payload) => { - const { question } = payload.formData; - if (!question) return; - - const { channelSid } = manager.store.getState().flex.session; - manager.chatClient.getChannelBySid(channelSid) - .then(channel => { - channel.sendMessage(question); - }); - }); - FlexWebChat.MessagingCanvas.defaultProps.predefinedMessage = false; - const defaultConfiguration: Config = { - ... - context: { - locationOrigin: window.location.origin, - someContextProp: "ContextProp1", - } -} - // context set in the WebChat - - context: { - friendlyName: "Anonymous", - locationOrigin: "http://someOriginUrl.com", - someContextProp: "ContextProp1", - }, - -// pre-engagement config set in WebChat - -preEngagementConfig: { - - description: "Please provide some information", - fields: [ - { - label: "What is your name?", - type: "InputItem", - attributes: { - name: "friendlyName", - type: "text", - required: true - } - }, - { - label: "What is your question?", - type: "TextareaItem", - attributes: { - name: "question", - type: "text", - placeholder: "Type your question here", - required: false, - rows: 5 - } - }, - ], - submitLabel: "Ok Let's Go!" -} - -// Chat channel attributes saved on chat initiation - -"attributes": "{\"status\":\"ACTIVE\",\"long_lived\":false,\"pre_engagement_data\":{\"friendlyName\":\"Anonymous\",\"question\":\"Can you help me with my invoice?\",\"location\":\"http://localhost:8081/\",\"locationOrigin\":\"http://someOriginUrl.com\",\"someContextProp\":\"ContextProp1\"},\"from\":\"Bob\",\"channel_type\":\"web\"}" - "{{trigger.message.ChannelAttributes.pre_engagement_data.question}}" - {"initial_question": "{{trigger.message.ChannelAttributes.pre_engagement_data.question}}"} - fileAttachment: { - enabled: true - } - fileAttachment: { -readOnly: true -} - // Max file size = 10 mb = 10 x 1024 x 1024 = 10,485,760 - -interface Config { - fileAttachment?: { - enabled?: boolean; - maxFileSize?: number; - }; -} - // Accepted extensions = .png, .txt, .pdf = ["png", "txt", "pdf"] - -interface Config { - fileAttachment?: { - enabled?: boolean; - acceptedExtensions?: Array; - }; -} - fileAttachment: { - enabled: true, - maxFileSize: 26214400, - acceptedExtensions: ["png", "txt", "pdf"] -} - Actions.invokeAction("SendMediaMessage", { file: file, channelSid: "unique_channel_identifier" }); - Actions.invokeAction("AttachFile", { file: File, channelSid: "unique_channel_identifier" }); - Actions.invokeAction("DetachFile", { file: File, channelSid: "unique_channel_identifier" }); - Actions.invokeAction("DownloadMedia", { message: message, channelSid: "unique_channel_identifier" }); - // Add a delete button. to every MessageListItem - -const DeleteMessage = ({ message }) => ( - // message is the default prop passed through by the MessageListItem - -); - -Flex.MessageListItem.Content.add(, { sortOrder: -1 }); - // Implement personal storage - -const uploadFileToMyStorage = async (file) => { - const formData = new FormData(); - formData.append("image", file); - - // Upload the file to private storage - const res = await fetch("https://api.imgur.com/3/image", { - method: "POST", - headers: new Headers({ - Authorization: "Client-ID 546c25a59c58ad7" - }), - body: formData - }); - return res.json(); -}; - -// Replace the action -Flex.Actions.replaceAction("SendMediaMessage", async (payload: Flex.ActionPayload) => { - const { file, messageAttributes, channelSid } = payload; - - // Retrieve the uploaded file location - const res = await uploadFileToMyStorage(file); - - // Include the new media file when sending the message - return Flex.Actions.invokeAction("SendMessage", { - messageAttributes: { - ...messageAttributes, - media: { - url: res.data.link, - filename: file.name, - contentType: file.type, - size: file.size - } - }, - body: file.name, - channelSid - }); -}); - -// Now you need to render your uploaded file. First, delete the body of the MessageBubble. Then, add a new body, including appropriate HTML that points to your uploaded file (in this example, an image tag is sufficient for rendering the image. Don’t forget your alt text!) - -// Create new message bubble content -const PersonalStorageContent = ({ message }) => ( -
- ”file -
-); - -Flex.MessageBubble.Content.remove("body", { - if: (props) => !!props.message.source.attributes.media -}); - -Flex.MessageBubble.Content.add(, { - if: (props) => !!props.message.source.attributes.media -});// Implement personal storage - -const uploadFileToMyStorage = async (file) => { - const formData = new FormData(); - formData.append("image", file); - - // Upload the file to private storage - const res = await fetch("https://api.imgur.com/3/image", { - method: "POST", - headers: new Headers({ - Authorization: "Client-ID 546c25a59c58ad7" - }), - body: formData - }); - return res.json(); -}; - -// Replace the action -Flex.Actions.replaceAction("SendMediaMessage", async (payload: Flex.ActionPayload) => { - const { file, messageAttributes, channelSid } = payload; - - // Retrieve the uploaded file location - const res = await uploadFileToMyStorage(file); - - // Include the new media file when sending the message - return Flex.Actions.invokeAction("SendMessage", { - messageAttributes: { - ...messageAttributes, - media: { - url: res.data.link, - filename: file.name, - contentType: file.type, - size: file.size - } - }, - body: file.name, - channelSid - }); -}); - -// Now you need to render your uploaded file. First, delete the body of the MessageBubble. Then, add a new body, including appropriate HTML that points to your uploaded file (in this example, an image tag is sufficient for rendering the image. Don’t forget your alt text!) - -// Create new message bubble content -const PersonalStorageContent = ({ message }) => ( -
- ”file -
-); - -Flex.MessageBubble.Content.remove("body", { - if: (props) => !!props.message.source.attributes.media -}); - -Flex.MessageBubble.Content.add(, { - if: (props) => !!props.message.source.attributes.media -}); - // Check file content - -Flex.Actions.addListener("beforeDownloadMedia", async (payload, cancelAction) => { - - const { message } = payload; - - const url = await message.media.getContentUrl(); - - // Validate file before download (note that checkFileContent method needs to be written) - - const result = await checkFileContent(url); - - if (!result.pass) { - - // Failed to validate content of the file - - cancelAction(); - - } - -}); - -Flex.Actions.addListener("beforeSendMediaMessage", async (payload, cancelAction) => { - const { file } = payload; - - // Validate file before sending - const result = await checkFileContent(file); - - if (!result.pass) { - // Failed to validate content of the file - cancelAction(); - } -}); - -Flex.Actions.addListener("beforeAttachFile", async (payload, cancelAction) => { - - const { file } = payload; - - // Validate file before attaching - const result = await checkFileContent(file); - - if (!result.pass) { - // Failed to validate content of the file - cancelAction(); - } -}); - // Check file content - -Flex.Actions.addListener("beforeDownloadMedia", async (payload, cancelAction) => { - - const { message } = payload; - - const url = await message.media.getContentUrl(); - - // Validate file before download (note that checkFileContent method needs to be written) - - const result = await checkFileContent(url); - - if (!result.pass) { - - // Failed to validate content of the file - - cancelAction(); - - } - -}); - -Flex.Actions.addListener("beforeSendMediaMessage", async (payload, cancelAction) => { - const { file } = payload; - - // Validate file before sending - const result = await checkFileContent(file); - - if (!result.pass) { - // Failed to validate content of the file - cancelAction(); - } -}); - -Flex.Actions.addListener("beforeAttachFile", async (payload, cancelAction) => { - - const { file } = payload; - - // Validate file before attaching - const result = await checkFileContent(file); - - if (!result.pass) { - // Failed to validate content of the file - cancelAction(); - } -}); - exports.handler = function(context, event, callback) { - // Use context parameter to initialize Twilio client and retrieve stored environment variables - const twilioClient = context.getTwilioClient(); - const chatServiceSid = context.CHAT_SERVICE_SID; // // Get Chat service sid from https://www.twilio.com/console/chat/dashboard - const blockedUserSid = context.BLOCKED_USER_SID - - - // Use the event parameter to retrieve dynamic information, like the current chat channel and the member to blockedUserSid - const {chatChannelSid, memberSid} = event - - console.log(event) - - twilioClient.chat.services(chatServiceSid) - .channels(chatChannelSid) - .members(memberSid) - .update({roleSid: blockedUserSid}) - .then(member => callback(null, member.sid)) - .catch(err => callback(err, null)) -}; - // Create function to block user -const blockUser = (chatChannelSid, memberSid) => { - const body = { chatChannelSid, memberSid }; - - // Set up the HTTP options for your request - const options = { - method: 'POST', - body: new URLSearchParams(body), - headers: { - 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' - } - }; - - // Make the network request using the Fetch API - fetch('https://YOUR_DOMAIN.twil.io/block-user', options) - .then(resp => resp.json()) - .then(data => console.log(data)); - } -} - -// Create a button component to block users -const BlockUserButton = (props) => ( - -); - -// Insert Block User Button into the Flex UI -Flex.MessageBubble.Content.add(, { - if: (props) => !props.message.isFromMe -}); - import 'react-app-polyfill/ie11'; -import 'react-app-polyfill/stable'; - FlexWebChat.MessageInput.defaultProps.sendButtonAriaProps = { - ariaLabel: "Send Message", - ariaLive: FlexWebChat.AriaLive.Polite -}; - -FlexWebChat.MessageInput.defaultProps.textAreaAriaProps = { - ariaLabel: "Enter your message here to get help", - ariaLive: FlexWebChat.AriaLive.Assertive -};appConfig = { - <...> - Chat: { - MessageInput: { - Button: { - borderRadius: "5px", - width: "100px", - fontSize: "18px", - svg: { - display: "none" - }, - ":after": { - content: '"Send Button text"' - } - } - } - }, - <...> - appConfig = { - <...> - Chat: { - MessageInput: { - Button: { - borderRadius: "5px", - width: "100px", - fontSize: "18px", - svg: { - display: "none" - }, - ":after": { - content: '"Send Button text"' - } - } - } - }, - <...> - const reducers = combineReducers({ - flex: WebchatReducer, - app: appReducer -}); - -const store = createStore( - reducers, - compose( - applyWebchatMiddleware() - ) -); - -FlexWebChat.Manager.create(config, store) - .then(manager => { - ReactDOM.render( - - - - - , - document.getElementById("container") - ); - }); - const reducers = combineReducers({ - flex: WebchatReducer, - app: appReducer -}); - -const store = createStore( - reducers, - compose( - applyWebchatMiddleware() - ) -); - -FlexWebChat.Manager.create(config, store) - .then(manager => { - ReactDOM.render( - - - - - , - document.getElementById("container") - ); - }); - base1, base2, base3, base4, base5, base6, base7, base8, base9, base10, base11, defaultButtonColor, lightTextColor, darkTextColor, buttonHoverColor, tabSelectedColor, connectingColor, disconnectedColor, notificationBackgroundColorInformation, notificationBackgroundColorSuccess, notificationBackgroundColorError, notificationBackgroundColorWarning, notificationIconColorError, notificationIconColorWarning, userAvailableColor, userUnavailableColor, errorColor,​ - // Picks the default blue dark theme -config.colorTheme = "BlueDarkTheme"; -// Picks dark theme, changes all of its base colors to new ones and tells the system that we still expect it to take the theme as dark (light parameter) -config.colorTheme = { - name: "DarkTheme", - colors: { - base1: "blue", - base2: "orange", - base3: "yellow", - base4: "black", - base5: "white", - base6: "pink", - base7: "red", - base8: "blue", - base9: "brown", - base10: "black", - base11: "white" - }, - light: false; -}// Picks the default blue dark theme -config.colorTheme = "BlueDarkTheme"; -// Picks dark theme, changes all of its base colors to new ones and tells the system that we still expect it to take the theme as dark (light parameter) -config.colorTheme = { - name: "DarkTheme", - colors: { - base1: "blue", - base2: "orange", - base3: "yellow", - base4: "black", - base5: "white", - base6: "pink", - base7: "red", - base8: "blue", - base9: "brown", - base10: "black", - base11: "white" - }, - light: false; -} - # Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -phone_call = client.preview \ - .trusted_comms \ - .phone_calls \ - .create( - reason='Security notice about your account.', - url='https://amber-ox-6503.twil.io/verified', - from_='+13133951154', - to='+15017122661' - ) - -print(phone_call.sid) - - - { - "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "api_version": "2010-04-01", - "body": "This will be the body of the new message!", - "date_created": "Thu, 30 Jul 2015 20:12:31 +0000", - "date_sent": "Thu, 30 Jul 2015 20:12:33 +0000", - "date_updated": "Thu, 30 Jul 2015 20:12:33 +0000", - "direction": "outbound-api", - "error_code": null, - "error_message": null, - "from": "+14155552345", - "messaging_service_sid": "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "num_media": "0", - "num_segments": "1", - "price": null, - "price_unit": null, - "sid": "SMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "status": "sent", - "subresource_uris": { - "media": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/SMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Media.json" - }, - "to": "+14155552345", - "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/SMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json" -} - # Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -phone_call = client.preview \ - .trusted_comms \ - .phone_calls \ - .create( - reason='Security notice about your account.', - url='https://amber-ox-6503.twil.io/verified', - from_='+13133951154', - to='+15017122661' - ) - -print(phone_call.sid) -{ - "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "bg_color": "#fff", - "brand_sid": "BZXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "branded_channel_sid": "BWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "business_sid": "BXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "call_sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "caller": "Owl Bank", - "created_at": "2019-05-01T20:00:00Z", - "font_color": "#000", - "from": "+13133951154", - "logo": "https://webtechnicom.net/wp-content/uploads/2020/08/webtechnicom.png", - "phone_number_sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "reason": "Security notice about your account.", - "sid": "CQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "status": "unknown", - "to": "+15017122661", - "url": "https://amber-ox-6503.twil.io/verified", - "use_case": "conversational" -} - from flask import Flask -from twilio import twiml - -app = Flask(__name__) - - -@app.route("/voice", methods=['GET', 'POST']) -def voice(): - """Respond to incoming phone calls with a menu of options""" - # Start our TwiML response - resp = twiml.Response() - - # Start our verb - with resp.gather(numDigits=1) as gather: - gather.say('For sales, press 1. For support, press 2.') - - # If the user doesn't select an option, redirect them into a loop - resp.redirect('/voice') - - return str(resp) - -if __name__ == "__main__": - app.run(debug=True) - # Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - twiml='Ahoy there!', - to='+15558675310', - from_='+15552223214' - ) - -print(call.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - method='GET', - status_callback='https://www.myapp.com/events', - status_callback_event=['initiated', 'answered'], - status_callback_method='POST', - url='http://demo.twilio.com/docs/voice.xml', - to='+14155551212', - from_='+18668675310' - ) - -print(call.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls('CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch() - -print(call.to) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -calls = client.calls.list(limit=20) - -for record in calls: - print(record.sid) - -# Download the helper library from https://www.twilio.com/docs/python/install -from datetime import datetime -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -calls = client.calls.list( - start_time=datetime(2009, 7, 6, 0, 0, 0), - status='completed', - limit=20 - ) - -for record in calls: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -from datetime import datetime -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -calls = client.calls.list( - start_time_after=datetime(2009, 7, 6, 0, 0, 0), - status='completed', - limit=20 - ) - -for record in calls: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -calls = client.calls.list(status='busy', to='+15558675310', limit=20) - -for record in calls: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -calls = client.calls.list(status='busy', to='+15558675310', limit=20) - -for record in calls: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.calls('CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -feedback = client.messages('MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .feedback \ - .create() - -print(feedback.message_sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -feedback = client.calls('CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').feedback() \ - .fetch() - -print(feedback.date_created) -# Download the helper library from https://www.twilio.com/docs/python/install -from datetime import date -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -feedback_summary = client.calls \ - .feedback_summaries \ - .create( - start_date=date(2008, 1, 2), - end_date=date(2008, 1, 2) - ) - -print(feedback_summary.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -feedback_summary = client.calls \ - .feedback_summaries('FSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(feedback_summary.call_count) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -conference = client.conferences('CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch() - -print(conference.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -conferences = client.conferences.list(limit=20) - -for record in conferences: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -conferences = client.conferences.list( - friendly_name='MyRoom', - status='in-progress', - limit=20 - ) - -for record in conferences: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -from datetime import date -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -conferences = client.conferences.list( - date_created=date(2009, 7, 6), - status='completed', - limit=20 - ) - -for record in conferences: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -from datetime import date -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -conferences = client.conferences.list( - date_created_after=date(2009, 7, 6), - status='in-progress', - limit=20 - ) - -for record in conferences: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -conference = client.conferences('CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(status='completed') - -print(conference.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -conference = client.conferences('CFbbe46ff1274e283f7e3ac1df0072ab39') \ - .update(announce_url='http://www.myapp.com/announce') - -print(conference.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -conference = client.conferences('CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch() - -print(conference.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -conference = client.conferences('CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(status='completed') - -print(conference.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -conference = client.conferences('CFbbe46ff1274e283f7e3ac1df0072ab39') \ - .update(announce_url='http://www.myapp.com/announce') - -print(conference.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -conference = client.conferences('CFbbe46ff1274e283f7e3ac1df0072ab39') \ - .update(announce_url='http://www.myapp.com/announce') - -print(conference.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -bulk_country_update = client.voice \ - .dialing_permissions \ - .bulk_country_updates \ - .create( - update_request='[{"iso_code":"GB","low_risk_numbers_enabled":true,"high_risk_special_numbers_enabled":true,"high_risk_tollfraud_numbers_enabled":false}]' - ) - -print(bulk_country_update.update_count) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -bulk_country_update = client.voice \ - .dialing_permissions \ - .bulk_country_updates \ - .create( - update_request='[{"iso_code":"GB","low_risk_numbers_enabled":true,"high_risk_special_numbers_enabled":true,"high_risk_tollfraud_numbers_enabled":false}]' - ) - -print(bulk_country_update.update_count) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -bulk_country_update = client.voice \ - .dialing_permissions \ - .bulk_country_updates \ - .create( - update_request='[{"iso_code":"GB","low_risk_numbers_enabled":true,"high_risk_special_numbers_enabled":true,"high_risk_tollfraud_numbers_enabled":false}]' - ) - -print(bulk_country_update.update_count) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -highrisk_special_prefixes = client.voice \ - .dialing_permissions \ - .countries('LV') \ - .highrisk_special_prefixes \ - .list(limit=20) - -for record in highrisk_special_prefixes: - print(record.prefix) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -highrisk_special_prefixes = client.voice \ - .dialing_permissions \ - .countries('LV') \ - .highrisk_special_prefixes \ - .list(limit=20) - -for record in highrisk_special_prefixes: - print(record.prefix) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -highrisk_special_prefixes = client.voice \ - .dialing_permissions \ - .countries('LV') \ - .highrisk_special_prefixes \ - .list(limit=20) - -for record in highrisk_special_prefixes: - print(record.prefix) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -outgoing_caller_id = client \ - .outgoing_caller_ids('PNe905d7e6b410746a0fb08c57e5a186f3') \ - .fetch() - -print(outgoing_caller_id.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -outgoing_caller_id = client \ - .outgoing_caller_ids('PNe536d32a3c49700934481addd5ce1659') \ - .update(friendly_name='My Second Line') - -print(outgoing_caller_id.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.outgoing_caller_ids('PNe536d32a3c49700934481addd5ce1659').delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -outgoing_caller_ids = client.outgoing_caller_ids.list(limit=20) - -for record in outgoing_caller_ids: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -outgoing_caller_ids = client.outgoing_caller_ids \ - .list(phone_number='+14158675310', limit=20) - -for record in outgoing_caller_ids: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -validation_request = client.validation_requests \ - .create( - friendly_name='My Home Phone Number', - phone_number='+14158675310' - ) - -print(validation_request.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.outgoing_caller_ids('PNe536d32a3c49700934481addd5ce1659').delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -payment = client.calls('CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .payments \ - .create( - idempotency_key='idempotency_key', - status_callback='https://example.com' - ) - -print(payment.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -payment = client.calls('CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .payments('PKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update( - capture='payment-card-number', - idempotency_key='request-4', - status_callback='https://www.webtechnicom.net' - ) - -print(payment.call_sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -payment = client.calls('CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .payments('PKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update( - status='complete', - idempotency_key='idempotency_key', - status_callback='https://www.webtechnicom.net' - ) - -print(payment.call_sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -payment = client.calls('CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .payments('PKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update( - status='cancel', - idempotency_key='idempotency_key', - status_callback='https://www.webtechnicom.net' - ) - -print(payment.call_sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -queue = client.queues.create(friendly_name='friendly_name') - -print(queue.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -queue = client.queues('QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch() - -print(queue.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -queues = client.queues.list(limit=20) - -for record in queues: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -queue = client.queues('QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(friendly_name='friendly_name') - -print(queue.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.queues('QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() -from twilio.twiml.voice_response import Pay, VoiceResponse, Say - -response = VoiceResponse() -response.say('Calling Twilio Pay') -response.pay(charge_amount='20.45') - -print(response) -from twilio.twiml.voice_response import Pay, VoiceResponse, Say - -response = VoiceResponse() -response.say('Calling Twilio Pay') -response.pay( - charge_amount='20.45', - action='https://enter-your-callback-function-url.twil.io/pay' -) - -print(response) -from twilio.twiml.voice_response import Pay, VoiceResponse, Say - -response = VoiceResponse() -response.say('Calling Twilio Pay') -response.pay(charge_amount='20.45') - -print(response) -from twilio.twiml.voice_response import Pay, VoiceResponse, Say - -response = VoiceResponse() -response.say('Calling Twilio Pay') -response.pay( - charge_amount='20.45', - action='https://enter-your-callback-function-url.twil.io/pay' -) - -print(response) -from twilio.twiml.voice_response import Pay, VoiceResponse - -response = VoiceResponse() -response.pay() - -print(response) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_record = client.voice.ip_records.create(ip_address='ip_address') - -print(ip_record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_record = client.voice.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(ip_record.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_records = client.voice.ip_records.list(limit=20) - -for record in ip_records: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_record = client.voice.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(friendly_name='friendly_name') - -print(ip_record.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.voice.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -credential = client.sip.credential_lists('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .credentials \ - .create(username='username', password='password') - -print(credential.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -credential = client.sip.credential_lists('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .credentials('CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(credential.username) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -credentials = client.sip.credential_lists('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .credentials \ - .list(limit=20) - -for record in credentials: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -credential = client.sip.credential_lists('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .credentials('CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(password='password') - -print(credential.username) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.sip.credential_lists('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .credentials('CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -credential_list = client.sip \ - .credential_lists('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(credential_list.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -credential = client.sip.credential_lists('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .credentials \ - .create(username='username', password='password') - -print(credential.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -credentials = client.sip.credential_lists('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .credentials \ - .list(limit=20) - -for record in credentials: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -credential = client.sip.credential_lists('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .credentials('CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(password='password') - -print(credential.username) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.sip.credential_lists('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .credentials('CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -credential_list = client.sip.credential_lists.create( - friendly_name='friendly_name' - ) - -print(credential_list.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -credential_list = client.sip \ - .credential_lists('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(credential_list.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -credential_lists = client.sip.credential_lists.list(limit=20) - -for record in credential_lists: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -credential_list = client.sip \ - .credential_lists('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(friendly_name='friendly_name') - -print(credential_list.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.sip.credential_lists('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -auth_calls_credential_list_mapping = client.sip \ - .domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .auth \ - .calls \ - .credential_list_mappings \ - .create(credential_list_sid='CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') - -print(auth_calls_credential_list_mapping.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -auth_calls_credential_list_mapping = client.sip \ - .domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .auth \ - .calls \ - .credential_list_mappings('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(auth_calls_credential_list_mapping.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -credential_list_mappings = client.sip \ - .domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .auth \ - .calls \ - .credential_list_mappings \ - .list(limit=20) - -for record in credential_list_mappings: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.sip.domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .auth \ - .calls \ - .credential_list_mappings('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -domain = client.sip.domains.create(domain_name='domain_name') - -print(domain.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -domain = client.sip.domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch() - -print(domain.domain_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -domains = client.sip.domains.list(limit=20) - -for record in domains: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -domain = client.sip.domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(friendly_name='friendly_name') - -print(domain.domain_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.sip.domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -auth_registrations_credential_list_mapping = client.sip \ - .domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .auth \ - .registrations \ - .credential_list_mappings \ - .create(credential_list_sid='CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') - -print(auth_registrations_credential_list_mapping.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -auth_registrations_credential_list_mapping = client.sip \ - .domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .auth \ - .registrations \ - .credential_list_mappings('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(auth_registrations_credential_list_mapping.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -credential_list_mappings = client.sip \ - .domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .auth \ - .registrations \ - .credential_list_mappings \ - .list(limit=20) - -for record in credential_list_mappings: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.sip.domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .auth \ - .registrations \ - .credential_list_mappings('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_access_control_list = client.sip \ - .ip_access_control_lists \ - .create(friendly_name='friendly_name') - -print(ip_access_control_list.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_access_control_list = client.sip \ - .ip_access_control_lists('ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(ip_access_control_list.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_access_control_lists = client.sip.ip_access_control_lists.list(limit=20) - -for record in ip_access_control_lists: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_access_control_list = client.sip \ - .ip_access_control_lists('ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(friendly_name='friendly_name') - -print(ip_access_control_list.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.sip.ip_access_control_lists('ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -auth_calls_ip_access_control_list_mapping = client.sip \ - .domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .auth \ - .calls \ - .ip_access_control_list_mappings \ - .create(ip_access_control_list_sid='ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') - -print(auth_calls_ip_access_control_list_mapping.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -auth_calls_ip_access_control_list_mapping = client.sip \ - .domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .auth \ - .calls \ - .ip_access_control_list_mappings('ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(auth_calls_ip_access_control_list_mapping.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_access_control_list_mappings = client.sip \ - .domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .auth \ - .calls \ - .ip_access_control_list_mappings \ - .list(limit=20) - -for record in ip_access_control_list_mappings: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.sip.domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .auth \ - .calls \ - .ip_access_control_list_mappings('ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_address = client.sip \ - .ip_access_control_lists('ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .ip_addresses \ - .create(friendly_name='friendly_name', ip_address='ip_address') - -print(ip_address.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_address = client.sip \ - .ip_access_control_lists('ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .ip_addresses('IPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(ip_address.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_addresses = client.sip \ - .ip_access_control_lists('ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .ip_addresses \ - .list(limit=20) - -for record in ip_addresses: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_address = client.sip \ - .ip_access_control_lists('ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .ip_addresses('IPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(ip_address='ip_address') - -print(ip_address.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.sip.ip_access_control_lists('ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .ip_addresses('IPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -address = client.addresses.create( - friendly_name='Twilio', - emergency_enabled=True, - customer_name='Twilio', - street='645 Harrison St.', - city='San Francisco', - region='CA', - postal_code='94105', - iso_country='US' - ) - -print(address.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -incoming_phone_number = client \ - .incoming_phone_numbers('PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(emergency_address_sid='ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') - -print(incoming_phone_number.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -incoming_phone_number = client \ - .incoming_phone_numbers('PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(emergency_status='Active') - -print(incoming_phone_number.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -incoming_phone_number = client \ - .incoming_phone_numbers('PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(emergency_status='Inactive') - -print(incoming_phone_number.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -incoming_phone_number = client.incoming_phone_numbers('PNXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(incoming_phone_number.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.incoming_phone_numbers('ADXXXXXXXXXXXXXXXXXX').delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -byoc_trunk = client.voice.byoc_trunks.create() - -print(byoc_trunk.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -byoc_trunk = client.voice \ - .byoc_trunks('BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(byoc_trunk.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -byoc_trunks = client.voice.byoc_trunks.list(limit=20) - -for record in byoc_trunks: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -byoc_trunk = client.voice \ - .byoc_trunks('BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(friendly_name='friendly_name') - -print(byoc_trunk.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.voice.byoc_trunks('BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -connection_policy = client.voice.connection_policies.create() - -print(connection_policy.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -connection_policy = client.voice.connection_policies.create() - -print(connection_policy.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -connection_policy = client.voice \ - .connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(connection_policy.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.voice.connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -connection_policy_target = client.voice \ - .connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .targets \ - .create(target='https://example.com') - -print(connection_policy_target.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -connection_policy_target = client.voice \ - .connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .targets('NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(connection_policy_target.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -targets = client.voice \ - .connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .targets \ - .list(limit=20) - -for record in targets: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -connection_policy_target = client.voice \ - .connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .targets('NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(friendly_name='friendly_name') - -print(connection_policy_target.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.voice.connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .targets('NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -source_ip_mapping = client.voice \ - .source_ip_mappings \ - .create( - ip_record_sid='ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', - sip_domain_sid='SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' - ) - -print(source_ip_mapping.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -source_ip_mapping = client.voice \ - .source_ip_mappings('IBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(source_ip_mapping.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -source_ip_mappings = client.voice.source_ip_mappings.list(limit=20) - -for record in source_ip_mappings: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -source_ip_mapping = client.voice \ - .source_ip_mappings('IBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(sip_domain_sid='SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') - -print(source_ip_mapping.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.voice.source_ip_mappings('IBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_record = client.voice.ip_records.create(ip_address='ip_address') - -print(ip_record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_record = client.voice.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(ip_record.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_records = client.voice.ip_records.list(limit=20) - -for record in ip_records: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_record = client.voice.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(friendly_name='friendly_name') - -print(ip_record.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.voice.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_record = client.voice.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(ip_record.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_records = client.voice.ip_records.list(limit=20) - -for record in ip_records: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_record = client.voice.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(friendly_name='friendly_name') - -print(ip_record.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.voice.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_record = client.voice.ip_records.create(ip_address='ip_address') - -print(ip_record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_record = client.voice.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(ip_record.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_records = client.voice.ip_records.list(limit=20) - -for record in ip_records: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_record = client.voice.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(friendly_name='friendly_name') - -print(ip_record.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.voice.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - url='http://demo.twilio.com/docs/voice.xml', - to='+15558675310', - from_='+15017122661' - ) - -print(call.sid) -from flask import Flask -app = Flask(__name__) - -@app.route("/") -def hello(): - return "Hello World!" - -if __name__ == "__main__": - app.run() -from flask import Flask -from twilio.twiml.voice_response import VoiceResponse - -app = Flask(__name__) - - -@app.route("/answer", methods=['GET', 'POST']) -def answer_call(): - """Respond to incoming phone calls with a brief message.""" - # Start our TwiML response - resp = VoiceResponse() - - # Read a message aloud to the caller - resp.say("Thank you for calling! Have a great day.", voice='alice') - - return str(resp) - -if __name__ == "__main__": - app.run(debug=True) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - url='http://demo.twilio.com/docs/voice.xml', - to='+15558675310', - from_='+15017122661' - ) - -print(call.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - url='http://demo.twilio.com/docs/voice.xml', - to='+15558675310', - from_='+15017122661' - ) - -print(call.sid) -from flask import Flask -from twilio.twiml.voice_response import VoiceResponse - -app = Flask(__name__) - - -@app.route("/answer", methods=['GET', 'POST']) -def answer_call(): - """Respond to incoming phone calls with a brief message.""" - # Start our TwiML response - resp = VoiceResponse() - - # Read a message aloud to the caller - resp.say("Thank you for calling! Have a great day.", voice='alice') - - return str(resp) - -if __name__ == "__main__": - app.run(debug=True) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - url='http://demo.twilio.com/docs/voice.xml', - to='+15558675310', - from_='+15017122661' - ) - -print(call.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - url='http://demo.twilio.com/docs/voice.xml', - to='+15558675310', - from_='+15017122661' - ) - -print(call.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - url='http://demo.twilio.com/docs/voice.xml', - to='+14155551212', - from_='+15017122661' - ) - -print(call.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - url='http://www.example.com/sipdial.xml', - to='sip:kate@example.com?hatchkey=4815162342', - from_='Jack' - ) - -print(call.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - method='GET', - send_digits='1234#', - url='http://demo.twilio.com/docs/voice.xml', - to='+14155551212', - from_='+18668675310' - ) - -print(call.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - record=True, - url='http://demo.twilio.com/docs/voice.xml', - to='+14155551212', - from_='+15017122661' - ) - -print(call.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - method='GET', - status_callback='https://www.myapp.com/events', - status_callback_method='POST', - url='http://demo.twilio.com/docs/voice.xml', - to='+14155551212', - from_='+18668675310' - ) - -print(call.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - method='GET', - status_callback='https://www.myapp.com/events', - status_callback_event=['initiated', 'answered'], - status_callback_method='POST', - url='http://demo.twilio.com/docs/voice.xml', - to='+14155551212', - from_='+18668675310' - ) - -print(call.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -function = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .functions \ - .create(friendly_name='friendly_name') - -print(function.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -function = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .functions('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(function.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -functions = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .functions \ - .list(limit=20) - -for record in functions: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -function = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .functions('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(friendly_name='friendly_name') - -print(function.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.serverless.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .functions('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -function_version = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .functions('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .function_versions('ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(function_version.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -function_versions = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .functions('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .function_versions \ - .list(limit=20) - -for record in function_versions: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -function_version = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .functions('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .function_versions('ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(function_version.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -function_versions = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .functions('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .function_versions \ - .list(limit=20) - -for record in function_versions: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -function_version = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .functions('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .function_versions('ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(function_version.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -function_versions = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .functions('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .function_versions \ - .list(limit=20) - -for record in function_versions: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -asset = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .assets \ - .create(friendly_name='friendly_name') - -print(asset.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -asset = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .assets('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(asset.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -assets = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .assets \ - .list(limit=20) - -for record in assets: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -asset = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .assets('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(friendly_name='friendly_name') - -print(asset.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.serverless.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .assets('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -asset_version = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .assets('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .asset_versions('ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(asset_version.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -asset_versions = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .assets('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .asset_versions \ - .list(limit=20) - -for record in asset_versions: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -variable = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .variables \ - .create(key='key', value='value') - -print(variable.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -variable = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .variables('ZVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(variable.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -variables = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .variables \ - .list(limit=20) - -for record in variables: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -variable = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .variables('ZVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(key='key') - -print(variable.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.serverless.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .variables('ZVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -build = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .builds \ - .create() - -print(build.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -build = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .builds('ZBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(build.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -builds = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .builds \ - .list(limit=20) - -for record in builds: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.serverless.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .builds('ZBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -deployment = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .deployments \ - .create() - -print(deployment.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -deployment = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .deployments('ZDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(deployment.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -deployments = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .deployments \ - .list(limit=20) - -for record in deployments: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -log = client.serverless.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .logs('NOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(log.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -logs = client.serverless.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .logs \ - .list(limit=20) - -for record in logs: - print(record.sid) -// Description -// Send a single SMS - -exports.handler = function (context, event, callback) { - // Make sure under Functions Settings tab: - // "Add my Twilio Credentials (ACCOUNT_SID) and (AUTH_TOKEN) to ENV" is CHECKED - - const twilioClient = context.getTwilioClient(); - - // Pass in From, To, and Body as query parameters - // Example: https://x.x.x.x/?From=%2b15095550100&To=%2b15105550100&Body=Hello%20World - // Note URL encoding above - let from = event.From || '+15095550100'; - // If passing in To, make sure to validate, to avoid sending SMS to unexpected locations - let to = event.To || '+15105550100'; - let body = event.Body || 'Hello World!'; - - twilioClient.messages - .create({ - body: body, - to: to, - from: from, - }) - .then((message) => { - console.log('SMS successfully sent'); - console.log(message.sid); - return callback(null, 'success'); - }) - .catch((error) => { - console.log(error); - return callback(error); - }); -}; - // Description -// Send multiple SMS - -exports.handler = function (context, event, callback) { - // Make sure under Functions Settings tab: - // "Add my Twilio Credentials (ACCOUNT_SID) and (AUTH_TOKEN) to ENV" is CHECKED - - const twilioClient = context.getTwilioClient(); - - let groupMembers = [ - { - name: 'Person1', - to: '+15105550100', - body: 'Hello Alan', - from: '+15095550100', - }, - { - name: 'Person2', - to: '+15105550101', - body: 'Hello Winston', - from: '+15095550100', - }, - { - name: 'Person3', - to: '+15105550102', - body: 'Hello Deepa', - from: '+15095550100', - }, - ]; - - Promise.all( - groupMembers.map((individual) => { - return twilioClient.messages.create(individual); - }) - ) - .then((results) => { - console.log('success'); - callback(null, 'success'); - }) - .catch((err) => { - console.log(err); - callback(error); - }); -}; - // Description -// Make a call - -exports.handler = function (context, event, callback) { - // Make sure under Functions Settings tab: - // "Add my Twilio Credentials (ACCOUNT_SID) and (AUTH_TOKEN) to ENV" is CHECKED - - const twilioClient = context.getTwilioClient(); - - // Pass in From, To, and Url as query parameters - // Example: https://x.x.x.x/?From=%2b15108675310&To=%2b15108675310&Url=http%3A%2F%2Fdemo.twilio.com%2Fdocs%2Fvoice.xml - // Note URL encoding above - let from = event.From || '+15095550100'; - // If passing in To, make sure to validate, to avoid placing calls to unexpected locations - let to = event.To || '+15105550100'; - let url = event.Url || 'http://demo.twilio.com/docs/voice.xml'; - - twilioClient.calls - .create({ - url: url, - from: from, - to: to, - }) - .then((result) => { - console.log('Call successfully placed'); - console.log(result.sid); - return callback(null, 'success'); - }) - .catch((error) => { - console.log(error); - return callback(error); - }); -}; - exports.handler = function(context, event, callback) { - let twiml = new Twilio.twiml.VoiceResponse(); - twiml.say("Hello World"); - return callback(null, twiml); -}; - // Description -// This Function showcases how you can send information into your Twilio Function -// From Twilio Studio's Run Function Widget and respond back with JSON. -// Twilio Studio will parse the returned JSON and incorporate it into your flow. - -// Note: The Studio Run Function Widget provides additional flexability over the HTTP Request -// Widget but either can be used to communicate with external API's. - -exports.handler = function (context, event, callback) { - // Function Parameters Sent in from Studio Run Function Widget are accessible from the - // Function event object, for example event.key would provide the value you sent in for - // the key called key. In our example, our Run Function widget is sending in the From - // Key: From, Value: {{trigger.message.From}} (which sends in the From Telephone Number) - - let from = event.From; - - let randomQuotes = ['Good', 'Day', 'Dachshund', 'Winston']; - console.log(randomQuotes.length); - let randomArrayIndex = Math.floor(Math.random() * randomQuotes.length); - console.log(randomArrayIndex); - - // We send the results back into our Studio flow as an object so the respective - // Studio Send Message or Say/Play widget can respond with the results. - - return callback(null, { - quote: randomQuotes[randomArrayIndex], - from: from, - }); -}; - exports.handler = function(context, event, callback) { - let twiml = new Twilio.twiml.MessagingResponse() - twiml.message("Hello World") - return callback(null, twiml) -} - - // Description -// Normalize Telephone Number -// Useful for Studio to read out telephone numbers as telephone number rather then large numbers - -exports.handler = async function (context, event, callback) { - // Make sure under Functions Global Config tab: - // "Add my Twilio Credentials (ACCOUNT_SID) and (AUTH_TOKEN) to ENV" is CHECKED - const twilioClient = context.getTwilioClient(); - - // Pass in From as a URL query parameter - // Example: https://x.x.x.x/?From=%2b15108675310 - let from = event.From || '+15095550100'; - - let result = await twilioClient.lookups - .phoneNumbers(from) - .fetch({ countryCode: 'US' }); - - result = { - normalizedNum: result.nationalFormat, - }; - - return callback(null, result); -}; -© 2020 GitHub, Inc. -// Description -// Prevent blocked numbers from calling your application -// Host blocklist.json as a private Twilio asset - -const fs = require('fs'); - -exports.handler = function (context, event, callback) { - let twiml = new Twilio.twiml.VoiceResponse(); - - // Phone numbers in blocklist.json file are rejected - // blocklist.json is uploaded to Twilio Assets as a private asset - // Format of blocklist.json is plain text: - // ["+14075550100", "+18025550100"] - - let fileName = '/blocklist.json'; - let file = Runtime.getAssets()[fileName].path; - let text = fs.readFileSync(file); - let blocklist = JSON.parse(text); - let blocked = true; - - if (blocklist.length > 0) { - if (blocklist.indexOf(event.From) === -1) { - blocked = false; - } - } - - if (blocked) { - twiml.reject(); - } else { - // if the caller's number is not blocked, redirect to your existing webhook - twiml.redirect('https://demo.twilio.com/welcome/voice/'); - } - - return callback(null, twiml); -}; - // Description -// Add a delay, useful for using with Twilio Studio Run Function Widget - -exports.handler = function (context, event, callback) { - // Function can run up to 10 seconds (value of delay is milliseconds) - - // Pass in delay as a URL query parameter - // Example: https://x.x.x.x/?delay=5000 - let delayInMs = event.delay || 5000; - - let timerUp = () => { - return callback(null, `Timer Up: ${delayInMs}ms`); - }; - - // Description -// Make a read request to an external API - -// Add axios 0.20.0 as a dependency under Functions Settings, Dependencies -const axios = require('axios'); - -exports.handler = function (context, event, callback) { - let twiml = new Twilio.twiml.VoiceResponse(); - - // Open APIs From Space: http://open-notify.org/ - // Number of People in Space - axios - .get(`http://api.open-notify.org/astros.json`) - .then((response) => { - let { number, people } = response.data; - - let names = people.map((astronaut) => astronaut.name); - - twiml.say(`There are ${number} people in space.`); - twiml.say(`They are ${names.join()}`); - return callback(null, twiml); - }) - .catch((error) => { - console.log(error); - return callback(error); - }); -}; - - // Make a write request to an external API using JSON (application/json) - -// Add axios 0.20.0 as a dependency under Functions Global Config, Dependencies -const axios = require('axios'); - -exports.handler = function (context, event, callback) { - // JSONPlaceholder: https://jsonplaceholder.typicode.com/ - // Fake Online REST API for Testing and Prototyping - const instance = axios.create({ - baseURL: 'https://aklein.ngrok.io/', - timeout: 1000, - headers: { 'X-Custom-Header': 'Twilo' }, - }); - - instance - .post('/posts', { - id: 1, - title: 'Twilio', - body: 'Owl', - userId: 1, - }) - .then((response) => { - console.log(JSON.stringify(response.data)); - return callback(null, response.data); - }) - .catch((error) => { - console.log(error); - return callback(error); - }); -}; - // Make a write request to an external API using urlencoded data (application/x-www-form-urlencoded) - -// Add axios 0.20.0 as a dependency under Functions Global Config, Dependencies -const axios = require('axios'); - -// Add qs 6.9.4 as a dependency under Functions Global Config, Dependencies -const qs = require('qs'); - -exports.handler = function (context, event, callback) { - // JSONPlaceholder: https://jsonplaceholder.typicode.com/ - // Fake Online REST API for Testing and Prototyping - - const instance = axios.create({ - baseURL: 'https://jsonplaceholder.typicode.com/', - timeout: 1000, - headers: { - 'X-Custom-Header': 'Twilo', - 'Content-Type': 'application/x-www-form-urlencoded', - }, - }); - - let data = qs.stringify({ - id: 1, - title: 'Twilio', - body: 'Owl', - userId: 1, - }); - - instance - .post('/posts', data) - .then((response) => { - console.log(JSON.stringify(response.data)); - return callback(null, response.data); - }) - .catch((error) => { - console.log(error); - return callback(error); - }); -}; - // Description -// Make a write request to an external API - -// Add axios 0.20.0 as a dependency under Functions Global Config, Dependencies -const axios = require('axios'); - -exports.handler = function (context, event, callback) { - // JSONPlaceholder: https://jsonplaceholder.typicode.com/ - // Fake Online REST API for Testing and Prototyping - const instance = axios.create({ - baseURL: 'https://jsonplaceholder.typicode.com', - timeout: 1000, - headers: { 'X-Custom-Header': 'Twilo' }, - }); - - instance - .post('/posts', { - id: 1, - title: 'Twilio', - body: 'Owl', - userId: 1, - }) - .then((response) => { - console.log(JSON.stringify(response.data)); - return callback(null, response.data); - }) - .catch((error) => { - console.log(error); - return callback(error); - }); -}; - // Description -// Use Twilio Lookup to determine carrier and phone number type (mobile, landline, voip) - -exports.handler = function (context, event, callback) { - // Make sure under Functions Global Config tab: - // "Add my Twilio Credentials (ACCOUNT_SID) and (AUTH_TOKEN) to ENV" is CHECKED - const client = context.getTwilioClient(); - - // Pass in phoneNumber as a URL query parameter - // Example: https://x.x.x.x/?phoneNumber=%2b15105550100 - const phoneNumber = event.phoneNumber || '+15105550100'; - - client.lookups - .phoneNumbers(phoneNumber) - .fetch({ type: 'carrier' }) - .then((phone_number) => { - console.log(phone_number.carrier); - return callback(null, phone_number); - }) - .catch((error) => { - console.log(error); - return callback(error, null); - }); -}; - - - setTimeout(timerUp, delayInMs); -}; - // Description -// Use Twilio Sync to create, read, update, delete peristent data - -exports.handler = function (context, event, callback) { - // Make sure under Functions Global Config tab: - // "Add my Twilio Credentials (ACCOUNT_SID) and (AUTH_TOKEN) to ENV" is CHECKED - const client = context.getTwilioClient(); - - // View Sync Services - https://www.twilio.com/console/sync/services - // Set to a specific Sync Service SID - // Set to your own sync document name to create, I use dynamicMsg - - let syncServiceSid = 'IS.....'; - let syncDocumentName = 'dynamicMsg'; - - // Pass in Function to Run via URL query parameter - // Example: https:/x.x.x.x/?Function=createSyncDocument - let functionToRun = event.Function || ''; - - function createSyncDocument() { - client.sync - .services(syncServiceSid) - .documents.create({ - data: { - msg: 'Sorry we are closed.', - }, - uniqueName: syncDocumentName, - }) - .then((document) => { - console.log(JSON.stringify(document.sid)); - return callback(null, 'success'); - }) - .catch((error) => { - console.log(error); - return callback(error); - }); - } - - function readSyncDocument() { - client.sync - .services(syncServiceSid) - .documents(syncDocumentName) - .fetch() - .then((document) => { - console.log(JSON.stringify(document.data)); - return callback(null, document.data); - }) - .catch((error) => { - console.log(error); - return callback(error); - }); - } - - function updateSyncDocument() { - client.sync - .services(syncServiceSid) - .documents(syncDocumentName) - .update({ - data: { - msg: 'We are open.', - }, - }) - .then((document) => { - console.log(`Documented Updated, Document SID: ${document.sid}`); - return callback( - null, - `Documented Updated, Document SID: ${document.sid}` - ); - }) - .catch((error) => { - console.log(error); - return callback(error); - }); - } - - function deleteSyncDocument() { - client.sync - .services(syncServiceSid) - .documents(syncDocumentName) - .fetch() - .then((document) => { - client.sync.services(syncServiceSid).documents(document.sid).remove(); - return callback(null, `Document ${document.sid} Deleted`); - }) - .catch((error) => { - console.log(error); - return callback(error); - }); - } - - // Test run function via passed in parameter - switch (functionToRun) { - case 'createSyncDocument': - { - createSyncDocument(); - } - break; - case 'readSyncDocument': - { - readSyncDocument(); - } - break; - case 'updateSyncDocument': - { - updateSyncDocument(); - } - break; - case 'deleteSyncDocument': - { - deleteSyncDocument(); - } - break; - default: - console.log('Please pass in the function name to execute'); - console.log('Example: https:/x.x.x.x/?Function=createSyncDocument'); - return callback( - 'missing URL query parameter - Example: https:/x.x.x.x?Function=createSyncDocument' - ); - } -}; - // Description -// Time of Day Routing -// Useful for IVR logic, for Example in Studio, to determine which path to route to -// Add moment-timezone 0.5.31 as a dependency under Functions Settings, Dependencies - -const moment = require('moment-timezone'); - -exports.handler = function (context, event, callback) { - let twiml = new Twilio.twiml.VoiceResponse(); - - function businessHours() { - // My timezone East Coast (other choices: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) - const now = moment().tz('America/New_York'); - - // Weekday Check using moment().isoWeekday() - // Monday = 1, Tuesday = 2 ... Sunday = 7 - if ( - now.isoWeekday() <= 5 /* Check for Normal Work Week Monday - Friday */ - ) { - //Work Hours Check, 9 am to 5pm (17:00 24 hour Time) - if (now.hour() >= 9 && now.hour() < 17 /* 24h basis */) { - return true; - } - } - - // Outside of business hours, return false - return false; - } - - const isOpen = businessHours(); - if (isOpen) { - twiml.say('Business is Open'); - } else { - twiml.say('Business is Closed'); - } - return callback(null, twiml); -}; - // Description -// Time of Day Routing -// Useful for IVR logic, for Example in Studio, to determine which path to route to -// Add moment-timezone 0.5.31 as a dependency under Functions Settings, Dependencies - -const moment = require('moment-timezone'); - -exports.handler = function (context, event, callback) { - let twiml = new Twilio.twiml.VoiceResponse(); - - function businessHours() { - // My timezone East Coast (other choices: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) - const now = moment().tz('America/New_York'); - - // Weekday Check using moment().isoWeekday() - // Monday = 1, Tuesday = 2 ... Sunday = 7 - if ( - now.isoWeekday() <= 5 /* Check for Normal Work Week Monday - Friday */ - ) { - //Work Hours Check, 9 am to 5pm (17:00 24 hour Time) - if (now.hour() >= 9 && now.hour() < 17 /* 24h basis */) { - return true; - } - } - - // Outside of business hours, return false - return false; - } - - const isOpen = businessHours(); - if (isOpen) { - twiml.say('Business is Open'); - } else { - twiml.say('Business is Closed'); - } - return callback(null, twiml); -}; - // Description -// Twilio Autopilot Stub Response -// Parse Remember Action and Returns Say Action -// Additional Autopilot Actions - https://www.twilio.com/docs/autopilot/actions - -exports.handler = function (context, event, callback) { - let memory = JSON.parse(event.Memory); - console.log('User Identifier: ' + event.UserIdentifier); - console.log('Task: ' + event.CurrentTask); - console.log(memory); - let message = '😸 Hello from Winston 😸'; - let responseObject = { - actions: [ - { - say: message, - }, - ], - }; - callback(null, responseObject); -}; - // Description -// Displays Node Version and Twilio Helper Library Version in console log -// To discover a more recent version of the Twilio helper library, visit the URL -// https://github.com/twilio/twilio-node/blob/main/CHANGES.md - -const twilio_version = require('twilio/package.json').version; - -exports.handler = function (context, event, callback) { - console.log(`Entered ${context.PATH}`); - console.log(`node version ${process.version}`); - console.log(`Twilio helper library version ${twilio_version}`); - - return callback(null, { status: `complete` }); -}; - // Description -// Twilio Notify API to send bulk SMS with the same message (body) as one API request -// Upload notifyList.txt as a private Twilio asset -// notifyList.txt format (comma separated numbers w/wo spaces): +15105550100, +15105550101, +15105550102, +15105550103 -// Execute Syntax: https://x.x.x.x/?queryParamPasscode=8675309 -// (change passcode below, replace this method with a secure auth method in production) -// Make sure under Functions Global Config tab: -// "Add my Twilio Credentials (ACCOUNT_SID) and (AUTH_TOKEN) to ENV" is CHECKED - -const fs = require('fs'); - -// Add node-fetch 2.6.0 as a dependency under Settings, Dependencies -const fetch = require('node-fetch'); - -// ** START NECESSARY CONFIGURATION ** -// You must define your unique Twilio Notify SID - https://www.twilio.com/console/notify/services below -// Notify will make use of a Twilio Messaging Service which you also need to define with a Twilio number(s) -// https://www.twilio.com/console/sms/services -const notifySid = 'IS076575.....'; -const passCode = '8675309'; // CHANGE THIS -// Notify Bulk Message Body to Send -const bulkMsgBody = '😸 Hello from Winston 😸'; -// ** END NECESSARY CONFIGURATION ** - -exports.handler = function (context, event, callback) { - const params = new URLSearchParams(); - const queryParamPasscode = event.queryParamPasscode; - - let fileName = '/notifyList.txt'; - let file = Runtime.getAssets()[fileName].path; - let numbers = fs.readFileSync(file, 'utf8').trim(); - - // Must pass a URL query parameter of queryParamPasscode with value of passCode to execute - if (queryParamPasscode != passCode) return callback('invalid operation'); // You can change the error message - - params.append('Body', bulkMsgBody); - - numbers.split(',').forEach((number) => { - number.trim(); - params.append( - `ToBinding`, - `{ "binding_type": "sms", "address": "${number}" }` - ); - }); - - let headers = { - Authorization: - 'Basic ' + - new Buffer.from(context.ACCOUNT_SID + ':' + context.AUTH_TOKEN).toString( - 'base64' - ), - }; - - fetch(`https://notify.twilio.com/v1/Services/${notifySid}/Notifications`, { - method: 'POST', - headers: headers, - body: params, - }) - .then((res) => res.json()) - .then((json) => { - console.log(json); - return callback(null, { result: 'success' }); - }) - .catch((err) => { - console.log(err); - return callback({ result: 'error' }); - }); -}; - exports.handler = function(context, event, callback) { - // Providing neither error or response will result in a 200 OK - return callback(); -} - - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.AvailablePhoneNumber.list(filter={"rate_center": "CHICAGO HEIGHTS"}) - { - "data": [ - { - "best_effort": false, - "cost_information": { - "currency": "USD", - "monthly_cost": "6.54", - "upfront_cost": "3.21" - }, - "phone_number": "+19705555098", - "quickship": true, - "record_type": "available_phone_number", - "region_information": [ - { - "region_name": "US", - "region_type": "country_code" - } - ], - "regulatory_requirements": [ - { - "description": "Requirement for providing Proof of Address.", - "field_type": "address", - "label": "Proof of Address", - "requirement_type": "end user proof of address" - } - ], - "reservable": true, - "vanity_format": "" - } - ], - "meta": { - "best_effort_results": 50, - "total_results": 100 - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.NumberReservation.list(filter={"phone_numbers.phone_number": ["+18665552368"]}) - { - "data": [ - { - "created_at": "2018-01-01T00:00:00.000000Z", - "customer_reference": "MY REF 001", - "id": "12ade33a-21c0-473b-b055-b3c836e1c292", - "phone_numbers": [ - { - "created_at": "2018-01-01T00:00:00.000000Z", - "errors": "", - "expired_at": "2018-01-01T00:00:00.000000Z", - "id": "12ade33a-21c0-473b-b055-b3c836e1c292", - "phone_number": "+19705555098", - "record_type": "reserved_phone_number", - "status": "pending", - "updated_at": "2018-01-01T00:00:00.000000Z" - } - ], - "record_type": "number_reservation", - "status": "pending", - "updated_at": "2018-01-01T00:00:00.000000Z" - } - ], - "meta": { - "page_number": 2, - "page_size": 25, - "total_pages": 3, - "total_results": 55 - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.NumberReservation.create( - phone_numbers=[{"phone_number": "+18665552368"}] -) - { - "data": { - "created_at": "2018-01-01T00:00:00.000000Z", - "customer_reference": "MY REF 001", - "id": "12ade33a-21c0-473b-b055-b3c836e1c292", - "phone_numbers": [ - { - "created_at": "2018-01-01T00:00:00.000000Z", - "errors": "", - "expired_at": "2018-01-01T00:00:00.000000Z", - "id": "12ade33a-21c0-473b-b055-b3c836e1c292", - "phone_number": "+19705555098", - "record_type": "reserved_phone_number", - "status": "pending", - "updated_at": "2018-01-01T00:00:00.000000Z" - } - ], - "record_type": "number_reservation", - "status": "pending", - "updated_at": "2018-01-01T00:00:00.000000Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.NumberReservation.retrieve("uuid") - { - "data": { - "created_at": "2018-01-01T00:00:00.000000Z", - "customer_reference": "MY REF 001", - "id": "12ade33a-21c0-473b-b055-b3c836e1c292", - "phone_numbers": [ - { - "created_at": "2018-01-01T00:00:00.000000Z", - "errors": "", - "expired_at": "2018-01-01T00:00:00.000000Z", - "id": "12ade33a-21c0-473b-b055-b3c836e1c292", - "phone_number": "+19705555098", - "record_type": "reserved_phone_number", - "status": "pending", - "updated_at": "2018-01-01T00:00:00.000000Z" - } - ], - "record_type": "number_reservation", - "status": "pending", - "updated_at": "2018-01-01T00:00:00.000000Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -number_reservation = telnyx.NumberReservation.retrieve("uuid") -number_reservation.extend() - { - "data": { - "created_at": "2018-01-01T00:00:00.000000Z", - "customer_reference": "MY REF 001", - "id": "12ade33a-21c0-473b-b055-b3c836e1c292", - "phone_numbers": [ - { - "created_at": "2018-01-01T00:00:00.000000Z", - "errors": "", - "expired_at": "2018-01-01T00:00:00.000000Z", - "id": "12ade33a-21c0-473b-b055-b3c836e1c292", - "phone_number": "+19705555098", - "record_type": "reserved_phone_number", - "status": "pending", - "updated_at": "2018-01-01T00:00:00.000000Z" - } - ], - "record_type": "number_reservation", - "status": "pending", - "updated_at": "2018-01-01T00:00:00.000000Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.OutboundVoiceProfile.list(page={"number":1,"size":20}) - { - "data": [ - { - "billing_group_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "call_recording": { - "call_recording_caller_phone_numbers": [ - "+19705555098" - ], - "call_recording_channels": "dual", - "call_recording_format": "mp3", - "call_recording_type": "by_call_phone_number" - }, - "concurrent_call_limit": 10, - "connections_count": 12, - "created_at": "2018-02-02T22:25:27.521Z", - "daily_spend_limit": "100.00", - "daily_spend_limit_enabled": true, - "enabled": true, - "id": "1293384261075731499", - "max_destination_rate": 10, - "name": "office", - "record_type": "outbound_voice_profile", - "service_plan": "global", - "tags": [ - "office-profile" - ], - "traffic_type": "conversational", - "updated_at": "2018-02-02T22:25:27.521Z", - "usage_payment_method": "rate-deck", - "whitelisted_destinations": [ - "US", - "BR", - "AU" - ] - } - ], - "meta": { - "page_number": 2, - "page_size": 25, - "total_pages": 3, - "total_results": 55 - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.OutboundVoiceProfile.create(billing_group_id="6a09cdc3-8948-47f0-aa62-74ac943d6c58",concurrent_call_limit=10) - { - "data": { - "billing_group_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "call_recording": { - "call_recording_caller_phone_numbers": [ - "+19705555098" - ], - "call_recording_channels": "dual", - "call_recording_format": "mp3", - "call_recording_type": "by_call_phone_number" - }, - "concurrent_call_limit": 10, - "connections_count": 12, - "created_at": "2018-02-02T22:25:27.521Z", - "daily_spend_limit": "100.00", - "daily_spend_limit_enabled": true, - "enabled": true, - "id": "1293384261075731499", - "max_destination_rate": 10, - "name": "office", - "record_type": "outbound_voice_profile", - "service_plan": "global", - "tags": [ - "office-profile" - ], - "traffic_type": "conversational", - "updated_at": "2018-02-02T22:25:27.521Z", - "usage_payment_method": "rate-deck", - "whitelisted_destinations": [ - "US", - "BR", - "AU" - ] - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.OutboundVoiceProfile.retrieve("id") -res.billing_group_id = "6a09cdc3-8948-47f0-aa62-74ac943d6c58" -res.concurrent_call_limit = 10 - -res.save() - { - "data": { - "billing_group_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "call_recording": { - "call_recording_caller_phone_numbers": [ - "+19705555098" - ], - "call_recording_channels": "dual", - "call_recording_format": "mp3", - "call_recording_type": "by_call_phone_number" - }, - "concurrent_call_limit": 10, - "connections_count": 12, - "created_at": "2018-02-02T22:25:27.521Z", - "daily_spend_limit": "100.00", - "daily_spend_limit_enabled": true, - "enabled": true, - "id": "1293384261075731499", - "max_destination_rate": 10, - "name": "office", - "record_type": "outbound_voice_profile", - "service_plan": "global", - "tags": [ - "office-profile" - ], - "traffic_type": "conversational", - "updated_at": "2018-02-02T22:25:27.521Z", - "usage_payment_method": "rate-deck", - "whitelisted_destinations": [ - "US", - "BR", - "AU" - ] - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.OutboundVoiceProfile.retrieve("id") -res.delete() - { - "data": { - "billing_group_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "call_recording": { - "call_recording_caller_phone_numbers": [ - "+19705555098" - ], - "call_recording_channels": "dual", - "call_recording_format": "mp3", - "call_recording_type": "by_call_phone_number" - }, - "concurrent_call_limit": 10, - "connections_count": 12, - "created_at": "2018-02-02T22:25:27.521Z", - "daily_spend_limit": "100.00", - "daily_spend_limit_enabled": true, - "enabled": true, - "id": "1293384261075731499", - "max_destination_rate": 10, - "name": "office", - "record_type": "outbound_voice_profile", - "service_plan": "global", - "tags": [ - "office-profile" - ], - "traffic_type": "conversational", - "updated_at": "2018-02-02T22:25:27.521Z", - "usage_payment_method": "rate-deck", - "whitelisted_destinations": [ - "US", - "BR", - "AU" - ] - } -} - curl -X POST \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --data '{}' \ - https://api.telnyx.com/v2/telephony_credentials/{id}/token - eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJ0ZWxueXhfdGVsZXBob255IiwiZXhwIjoxNTkwMDEwMTQzLCJpYXQiOjE1ODc1OTA5NDMsImlzcyI6InRlbG55eF90ZWxlcGhvbnkiLCJqdGkiOiJiOGM3NDgzNy1kODllLTRhNjUtOWNmMi0zNGM3YTZmYTYwYzgiLCJuYmYiOjE1ODc1OTA5NDIsInN1YiI6IjVjN2FjN2QwLWRiNjUtNGYxMS05OGUxLWVlYzBkMWQ1YzZhZSIsInRlbF90b2tlbiI6InJqX1pra1pVT1pNeFpPZk9tTHBFVUIzc2lVN3U2UmpaRmVNOXMtZ2JfeENSNTZXRktGQUppTXlGMlQ2Q0JSbWxoX1N5MGlfbGZ5VDlBSThzRWlmOE1USUlzenl6U2xfYURuRzQ4YU81MHlhSEd1UlNZYlViU1ltOVdJaVEwZz09IiwidHlwIjoiYWNjZXNzIn0.gNEwzTow5MLLPLQENytca7pUN79PmPj6FyqZWW06ZeEmesxYpwKh0xRtA0TzLh6CDYIRHrI8seofOO0YFGDhpQ - curl -X GET \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --globoff "https://api.telnyx.com/v2/telephony_credentials?page[number]=1&page[size]=20" - { - "data": [ - { - "created_at": "2020-06-18T21:32:38", - "expired": "false", - "expires_at": "2042-06-18T21:32:38", - "id": "c215ade3-0d39-418e-94be-c5f780760199", - "name": "2020-06-18 21:32:38.917732Z", - "record_type": "credential", - "resource_id": "connection:804252963366242252", - "sip_password": "a92dbcfb60184a8cb330b0acb2f7617b", - "sip_username": "gencrednCvHU5IYpSBPPsXI2iQsDX", - "updated_at": "2020-06-18T21:32:38.000Z", - "user_id": "user-id" - } - ], - "meta": { - "page_number": 2, - "page_size": 25, - "total_pages": 3, - "total_results": 55 - } -} - curl -X POST \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --data '{"connection_id":"1234567890","name":"My-new-credential"}' \ - https://api.telnyx.com/v2/telephony_credentials - { - "data": { - "created_at": "2020-06-18T21:32:38", - "expired": "false", - "expires_at": "2042-06-18T21:32:38", - "id": "c215ade3-0d39-418e-94be-c5f780760199", - "name": "2020-06-18 21:32:38.917732Z", - "record_type": "credential", - "resource_id": "connection:804252963366242252", - "sip_password": "a92dbcfb60184a8cb330b0acb2f7617b", - "sip_username": "gencrednCvHU5IYpSBPPsXI2iQsDX", - "updated_at": "2020-06-18T21:32:38.000Z", - "user_id": "user-id" - } -} - curl -X GET \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --globoff "https://api.telnyx.com/v2/telephony_credentials/{id}" - { - "data": { - "created_at": "2020-06-18T21:32:38", - "expired": "false", - "expires_at": "2042-06-18T21:32:38", - "id": "c215ade3-0d39-418e-94be-c5f780760199", - "name": "2020-06-18 21:32:38.917732Z", - "record_type": "credential", - "resource_id": "connection:804252963366242252", - "sip_password": "a92dbcfb60184a8cb330b0acb2f7617b", - "sip_username": "gencrednCvHU5IYpSBPPsXI2iQsDX", - "updated_at": "2020-06-18T21:32:38.000Z", - "user_id": "user-id" - } -} - curl -X PATCH \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --data '{"connection_id":"987654321","name":"My-new-updated-credential"}' \ - https://api.telnyx.com/v2/telephony_credentials/{id} - { - "data": { - "created_at": "2020-06-18T21:32:38", - "expired": "false", - "expires_at": "2042-06-18T21:32:38", - "id": "c215ade3-0d39-418e-94be-c5f780760199", - "name": "2020-06-18 21:32:38.917732Z", - "record_type": "credential", - "resource_id": "connection:804252963366242252", - "sip_password": "a92dbcfb60184a8cb330b0acb2f7617b", - "sip_username": "gencrednCvHU5IYpSBPPsXI2iQsDX", - "updated_at": "2020-06-18T21:32:38.000Z", - "user_id": "user-id" - } -} - curl -X DELETE \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - "https://api.telnyx.com/v2/telephony_credentials/{id}" - { - "data": { - "created_at": "2020-06-18T21:32:38", - "expired": "false", - "expires_at": "2042-06-18T21:32:38", - "id": "c215ade3-0d39-418e-94be-c5f780760199", - "name": "2020-06-18 21:32:38.917732Z", - "record_type": "credential", - "resource_id": "connection:804252963366242252", - "sip_password": "a92dbcfb60184a8cb330b0acb2f7617b", - "sip_username": "gencrednCvHU5IYpSBPPsXI2iQsDX", - "updated_at": "2020-06-18T21:32:38.000Z", - "user_id": "user-id" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.BillingGroup.list(page={"number":1,"size":20}) - { - "data": [ - { - "created_at": "2019-10-15T10:07:15.527Z", - "deleted_at": null, - "id": "f5586561-8ff0-4291-a0ac-84fe544797bd", - "name": "My billing group name", - "organization_id": "f1486bae-f067-460c-ad43-73a92848f902", - "record_type": "billing_group", - "updated_at": "2019-10-15T10:07:15.527Z" - } - ], - "meta": { - "page_number": 2, - "page_size": 25, - "total_pages": 3, - "total_results": 55 - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.BillingGroup.create(name="string") - { - "data": { - "created_at": "2019-10-15T10:07:15.527Z", - "deleted_at": null, - "id": "f5586561-8ff0-4291-a0ac-84fe544797bd", - "name": "My billing group name", - "organization_id": "f1486bae-f067-460c-ad43-73a92848f902", - "record_type": "billing_group", - "updated_at": "2019-10-15T10:07:15.527Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.BillingGroup.retrieve("id") - { - "data": { - "created_at": "2019-10-15T10:07:15.527Z", - "deleted_at": null, - "id": "f5586561-8ff0-4291-a0ac-84fe544797bd", - "name": "My billing group name", - "organization_id": "f1486bae-f067-460c-ad43-73a92848f902", - "record_type": "billing_group", - "updated_at": "2019-10-15T10:07:15.527Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.BillingGroup.retrieve("id") -res.name = "string" - -res.save() - { - "data": { - "created_at": "2019-10-15T10:07:15.527Z", - "deleted_at": null, - "id": "f5586561-8ff0-4291-a0ac-84fe544797bd", - "name": "My billing group name", - "organization_id": "f1486bae-f067-460c-ad43-73a92848f902", - "record_type": "billing_group", - "updated_at": "2019-10-15T10:07:15.527Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.BillingGroup.retrieve("id") -res.delete() - { - "data": { - "created_at": "2019-10-15T10:07:15.527Z", - "deleted_at": null, - "id": "f5586561-8ff0-4291-a0ac-84fe544797bd", - "name": "My billing group name", - "organization_id": "f1486bae-f067-460c-ad43-73a92848f902", - "record_type": "billing_group", - "updated_at": "2019-10-15T10:07:15.527Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.Address.list(page={"number":1,"size":20}) - { - "data": [ - { - "address_book": false, - "administrative_area": "IL", - "borough": "Guadalajara", - "business_name": "Toy-O'Kon", - "country_code": "US", - "created_at": "2018-02-02T22:25:27.521Z", - "customer_reference": "MY REF 001", - "extended_address": "#504", - "first_name": "Alfred", - "id": "1293384261075731499", - "last_name": "Foster", - "locality": "Chicago", - "neighborhood": "Ciudad de los deportes", - "phone_number": "+12125559000", - "postal_code": "60654", - "record_type": "address", - "street_address": "311 W Superior Street", - "updated_at": "2018-02-02T22:25:27.521Z" - } - ], - "meta": { - "page_number": 2, - "page_size": 25, - "total_pages": 3, - "total_results": 55 - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.Address.create(address_book=True,administrative_area="IL") - { - "data": { - "address_book": false, - "administrative_area": "IL", - "borough": "Guadalajara", - "business_name": "Toy-O'Kon", - "country_code": "US", - "created_at": "2018-02-02T22:25:27.521Z", - "customer_reference": "MY REF 001", - "extended_address": "#504", - "first_name": "Alfred", - "id": "1293384261075731499", - "last_name": "Foster", - "locality": "Chicago", - "neighborhood": "Ciudad de los deportes", - "phone_number": "+12125559000", - "postal_code": "60654", - "record_type": "address", - "street_address": "311 W Superior Street", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.Address.retrieve("id") - { - "data": { - "address_book": false, - "administrative_area": "IL", - "borough": "Guadalajara", - "business_name": "Toy-O'Kon", - "country_code": "US", - "created_at": "2018-02-02T22:25:27.521Z", - "customer_reference": "MY REF 001", - "extended_address": "#504", - "first_name": "Alfred", - "id": "1293384261075731499", - "last_name": "Foster", - "locality": "Chicago", - "neighborhood": "Ciudad de los deportes", - "phone_number": "+12125559000", - "postal_code": "60654", - "record_type": "address", - "street_address": "311 W Superior Street", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.Address.retrieve("id") -res.delete() - { - "data": { - "address_book": false, - "administrative_area": "IL", - "borough": "Guadalajara", - "business_name": "Toy-O'Kon", - "country_code": "US", - "created_at": "2018-02-02T22:25:27.521Z", - "customer_reference": "MY REF 001", - "extended_address": "#504", - "first_name": "Alfred", - "id": "1293384261075731499", - "last_name": "Foster", - "locality": "Chicago", - "neighborhood": "Ciudad de los deportes", - "phone_number": "+12125559000", - "postal_code": "60654", - "record_type": "address", - "street_address": "311 W Superior Street", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - curl -X POST \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --data '{ - "administrative_area":"IL", - "country_code":"US", - "locality":"Chicago", - "postal_code":"60654", - "street_address":"311 W Superior Street" - }' \ - https://api.telnyx.com/v2/addresses/actions/validate - { - "data": { - "record_type": "address_validation", - "result": "valid", - "suggested": { - "administrative_area": "IL", - "country_code": "US", - "extended_address": "#504", - "locality": "Chicago", - "postal_code": "60654", - "street_address": "311 W Superior Street" - } - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.Balance.retrieve() - { - "data": { - "available_credit": "400.00", - "balance": "300.00", - "credit_limit": "100.00", - "currency": "USD", - "record_type": "balance" - } -} - curl -X GET \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --globoff "https://api.telnyx.com/v2/portouts?filter[carrier_name]=&filter[spid]=" - { - "data": [ - { - "carrier_name": "test", - "created_at": "2018-02-02T22:25:27.521Z", - "foc_date": "2018-02-02T22:25:27.521Z", - "id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0", - "phone_numbers": [ - "+35312345678" - ], - "record_type": "portout", - "requested_foc_date": "2018-02-02T22:25:27.521Z", - "spid": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0", - "status": "pending", - "updated_at": "2018-02-02T22:25:27.521Z" - } - ], - "meta": { - "page_number": 3, - "page_size": 1, - "total_pages": 13, - "total_results": 13 - } -} - - curl -X GET \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --globoff "https://api.telnyx.com/v2/portouts/{id}" - - { - "data": { - "carrier_name": "test", - "created_at": "2018-02-02T22:25:27.521Z", - "foc_date": "2018-02-02T22:25:27.521Z", - "id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0", - "phone_numbers": [ - "+35312345678" - ], - "record_type": "portout", - "requested_foc_date": "2018-02-02T22:25:27.521Z", - "spid": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0", - "status": "pending", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - curl -X PATCH \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --data '{}' \ - https://api.telnyx.com/v2/portouts/{id} - { - "data": { - "carrier_name": "test", - "created_at": "2018-02-02T22:25:27.521Z", - "foc_date": "2018-02-02T22:25:27.521Z", - "id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0", - "phone_numbers": [ - "+35312345678" - ], - "record_type": "portout", - "requested_foc_date": "2018-02-02T22:25:27.521Z", - "spid": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0", - "status": "pending", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - curl -X GET \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --globoff "https://api.telnyx.com/v2/portouts/{id}/comments" - { - "data": [ - { - "body": "This is a comment", - "created_at": "2018-02-02T22:25:27.521Z", - "id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0", - "portout_id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0", - "record_type": "portout", - "user_id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0" - } - ], - "meta": { - "page_number": 3, - "page_size": 1, - "total_pages": 13, - "total_results": 13 - } -} - curl -X POST \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --data '{"body": "Comment to post on this portout request"}' \ - https://api.telnyx.com/v2/portouts/{id}/comments - { - "data": { - "body": "This is a comment", - "created_at": "2018-02-02T22:25:27.521Z", - "id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0", - "portout_id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0", - "record_type": "portout", - "user_id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0" - } -} - curl -X POST \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --data '{"phone_numbers":["+13035550000","+13035550001","+13035550002"]}' \ - https://api.telnyx.com/v2/portability_checks - { - "data": [ - { - "fast_portable": true, - "not_portable_reason": "No coverage", - "phone_number": "+13125550123", - "portable": true, - "record_type": "portability_check_result" - } - ] -} - curl -X GET \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --globoff "https://api.telnyx.com/v2/mobile_operator_networks?page[number]=1&page[size]=20" - { - "data": [ - { - "country_code": "US", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "mcc": "310", - "mnc": "410", - "name": "AT&T Mobility (USACG)", - "record_type": "mobile_operator_network", - "tadig": "USACG" - } - ], - "meta": { - "page_number": 2, - "page_size": 25, - "total_pages": 3, - "total_results": 55 - } -} - { - "data": [ - { - "country_code": "US", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "mcc": "310", - "mnc": "410", - "name": "AT&T Mobility (USACG)", - "record_type": "mobile_operator_network", - "tadig": "USACG" - } - ], - "meta": { - "page_number": 2, - "page_size": 25, - "total_pages": 3, - "total_results": 55 - } -} - curl -X GET \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --globoff "https://api.telnyx.com/v2/ota_updates?page[number]=1&page[size]=20" - - { - "data": [ - { - "created_at": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "record_type": "ota_update", - "sim_card_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "status": "in-progress", - "type": "sim_card_network_preferences", - "updated_at": "2018-02-02T22:25:27.521Z" - } - ], - "meta": { - "page_number": 2, - "page_size": 25, - "total_pages": 3, - "total_results": 55 - } -} - curl -X GET \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --globoff "https://api.telnyx.com/v2/ota_updates/6a09cdc3-8948-47f0-aa62-74ac943d6c58" - - { - "data": { - "created_at": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "record_type": "ota_update", - "settings": { - "mobile_operator_networks_preferences": [ - { - "mobile_operator_network_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "mobile_operator_network_name": "AT&T Mobility (USACG)", - "priority": 0 - } - ] - }, - "sim_card_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "status": "in-progress", - "type": "sim_card_network_preferences", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.Wireless.list_detail_records_report.list(page={"number":1,"size":20}) - { - "data": [ - { - "created_at": "2018-02-02T22:25:27.521Z", - "end_time": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "record_type": "detail_records_report", - "report_url": "https://webtechnicom.net", - "start_time": "2018-02-02T22:25:27.521Z", - "status": "pending", - "updated_at": "2018-02-02T22:25:27.521Z" - } - ] -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.Wireless._detail_records_report.create(end_time="2018-02-02T22:25:27.521Z",start_time="2018-02-02T22:25:27.521Z") - - { - "data": { - "created_at": "2018-02-02T22:25:27.521Z", - "end_time": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "record_type": "detail_records_report", - "report_url": "http://webtechnicom.net", - "start_time": "2018-02-02T22:25:27.521Z", - "status": "pending", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - curl -X GET \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --globoff "https://api.telnyx.com/v2/wireless/detail_records_reports/6a09cdc3-8948-47f0-aa62-74ac943d6c58" - - { - "data": { - "created_at": "2018-02-02T22:25:27.521Z", - "end_time": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "record_type": "detail_records_report", - "report_url": "https://webtechnicom.net", - "start_time": "2018-02-02T22:25:27.521Z", - "status": "pending", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - curl -X DELETE \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - "https://api.telnyx.com/v2/wireless/detail_records_reports/6a09cdc3-8948-47f0-aa62-74ac943d6c58" - { - "data": { - "created_at": "2018-02-02T22:25:27.521Z", - "end_time": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "record_type": "detail_records_report", - "report_url": "http://webtechnicom.net", - "start_time": "2018-02-02T22:25:27.521Z", - "status": "pending", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.SimCardGroup.list(page={"number":1,"size":20}) - - { - "data": [ - { - "consumed_data": { - "amount": 10, - "unit": "B" - }, - "created_at": "2018-02-02T22:25:27.521Z", - "data_enabled": true, - "data_limit": 2048, - "default": true, - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "name": "My Test Group", - "record_type": "sim_card_group", - "updated_at": "2018-02-02T22:25:27.521Z" - } - ], - "meta": { - "page_number": 2, - "page_size": 25, - "total_pages": 3, - "total_results": 55 - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.SimCardGroup.create(name="My Test Group",data_enabled=true) - { - "data": { - "consumed_data": { - "amount": 10, - "unit": "B" - }, - "created_at": "2018-02-02T22:25:27.521Z", - "data_enabled": true, - "data_limit": 2048, - "default": true, - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "name": "My Test Group", - "record_type": "sim_card_group", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.SimCardGroup.retrieve("id") - { - "data": { - "consumed_data": { - "amount": 10, - "unit": "B" - }, - "created_at": "2018-02-02T22:25:27.521Z", - "data_enabled": true, - "data_limit": 2048, - "default": true, - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "name": "My Test Group", - "record_type": "sim_card_group", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.SimCardGroup.retrieve("id") -res.data_enabled = true -res.data_limit = 2048 - -res.save() - - { - "data": { - "consumed_data": { - "amount": 10, - "unit": "B" - }, - "created_at": "2018-02-02T22:25:27.521Z", - "data_enabled": true, - "data_limit": 2048, - "default": true, - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "name": "My Test Group", - "record_type": "sim_card_group", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.SimCardGroup.retrieve("id") -res.delete() - { - "data": { - "consumed_data": { - "amount": 10, - "unit": "B" - }, - "created_at": "2018-02-02T22:25:27.521Z", - "data_enabled": true, - "data_limit": 2048, - "default": true, - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "name": "My Test Group", - "record_type": "sim_card_group", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.SIMCard.list(page={"number":1,"size":20}) - - { - "data": [ - { - "created_at": "2018-02-02T22:25:27.521Z", - "iccid": "89310410106543789301", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "imsi": 81932214823362980, - "msisdn": "+13109976224", - "record_type": "sim_card", - "sim_card_group_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "status": "enabled", - "tags": [ - "personal", - "customers", - "active-customers" - ], - "updated_at": "2018-02-02T22:25:27.521Z" - } - ], - "meta": { - "page_number": 2, - "page_size": 25, - "total_pages": 3, - "total_results": 55 - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.SIMCard.retrieve("id",include_sim_card_group=True) - { - "data": { - "created_at": "2018-02-02T22:25:27.521Z", - "iccid": "89310410106543789301", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "imsi": 81932214823362980, - "ipv4": "192.168.0.0", - "ipv6": "2001:cdba:0000:0000:0000:0000:3257:9652", - "msisdn": "+13109976224", - "record_type": "sim_card", - "sim_card_group_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "status": "enabled", - "tags": [ - "personal", - "customers", - "active-customers" - ], - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.SIMCard.retrieve("id") -res.created_at = "2018-02-02T22:25:27.521Z" -res.iccid = "89310410106543789301" - -res.save() - { - "data": { - "created_at": "2018-02-02T22:25:27.521Z", - "iccid": "89310410106543789301", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "imsi": 81932214823362980, - "ipv4": "192.168.0.0", - "ipv6": "2001:cdba:0000:0000:0000:0000:3257:9652", - "msisdn": "+13109976224", - "record_type": "sim_card", - "sim_card_group_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "status": "enabled", - "tags": [ - "personal", - "customers", - "active-customers" - ], - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.SIMCard.retrieve("id") -res.delete() - { - "data": { - "created_at": "2018-02-02T22:25:27.521Z", - "iccid": "89310410106543789301", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "imsi": 81932214823362980, - "ipv4": "192.168.0.0", - "ipv6": "2001:cdba:0000:0000:0000:0000:3257:9652", - "msisdn": "+13109976224", - "record_type": "sim_card", - "sim_card_group_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "status": "enabled", - "tags": [ - "personal", - "customers", - "active-customers" - ], - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - curl -X POST \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --data '{}' \ - https://api.telnyx.com/v2/sim_cards/6a09cdc3-8948-47f0-aa62-74ac943d6c58/actions/enable - { - "data": { - "created_at": "2018-02-02T22:25:27.521Z", - "iccid": "89310410106543789301", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "imsi": 81932214823362980, - "msisdn": "+13109976224", - "record_type": "sim_card", - "sim_card_group_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "status": "enabled", - "tags": [ - "personal", - "customers", - "active-customers" - ], - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - { - "data": { - "created_at": "2018-02-02T22:25:27.521Z", - "iccid": "89310410106543789301", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "imsi": 81932214823362980, - "msisdn": "+13109976224", - "record_type": "sim_card", - "sim_card_group_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "status": "enabled", - "tags": [ - "personal", - "customers", - "active-customers" - ], - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - curl -X POST \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --data '{}' \ - https://api.telnyx.com/v2/sim_cards/6a09cdc3-8948-47f0-aa62-74ac943d6c58/actions/disable - { - "data": { - "created_at": "2018-02-02T22:25:27.521Z", - "iccid": "89310410106543789301", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "imsi": 81932214823362980, - "msisdn": "+13109976224", - "record_type": "sim_card", - "sim_card_group_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "status": "enabled", - "tags": [ - "personal", - "customers", - "active-customers" - ], - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - curl -X POST \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --data '{"registration_codes": ["1234567890, 123456332601"]}' \ - https://api.telnyx.com/v2/actions/register/sim_cards - { - "data": [ - { - "created_at": "2018-02-02T22:25:27.521Z", - "iccid": "89310410106543789301", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "imsi": 81932214823362980, - "msisdn": "+13109976224", - "record_type": "sim_card", - "sim_card_group_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "status": "enabled", - "tags": [ - "personal", - "customers", - "active-customers" - ], - "updated_at": "2018-02-02T22:25:27.521Z" - } - ] -} - - curl -X GET \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --globoff "https://api.telnyx.com/v2/sim_cards/6a09cdc3-8948-47f0-aa62-74ac943d6c58/network_preferences?include_ota_updates=true" - { - "data": { - "created_at": "2018-02-02T22:25:27.521Z", - "mobile_operator_networks_preferences": [ - { - "mobile_operator_network_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "mobile_operator_network_name": "AT&T Mobility (USACG)", - "priority": 0 - } - ], - "ota_updates": [ - { - "created_at": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "record_type": "ota_update", - "settings": { - "mobile_operator_networks_preferences": [ - { - "mobile_operator_network_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "mobile_operator_network_name": "AT&T Mobility (USACG)", - "priority": 0 - } - ] - }, - "sim_card_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "status": "in-progress", - "type": "sim_card_network_preferences", - "updated_at": "2018-02-02T22:25:27.521Z" - } - ], - "record_type": "sim_card_network_preferences", - "sim_card_id": "6b14e151-8493-4fa1-8664-1cc4e6d14158", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - curl -X PUT \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --data '{"mobile_operator_networks_preferences":"array"}' \ - https://api.telnyx.com/v2/sim_cards/6a09cdc3-8948-47f0-aa62-74ac943d6c58/network_preferences - { - "data": { - "created_at": "2018-02-02T22:25:27.521Z", - "mobile_operator_networks_preferences": [ - { - "mobile_operator_network_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "mobile_operator_network_name": "AT&T Mobility (USACG)", - "priority": 0 - } - ], - "ota_updates": [ - { - "created_at": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "record_type": "ota_update", - "settings": { - "mobile_operator_networks_preferences": [ - { - "mobile_operator_network_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "mobile_operator_network_name": "AT&T Mobility (USACG)", - "priority": 0 - } - ] - }, - "sim_card_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "status": "in-progress", - "type": "sim_card_network_preferences", - "updated_at": "2018-02-02T22:25:27.521Z" - } - ], - "record_type": "sim_card_network_preferences", - "sim_card_id": "6b14e151-8493-4fa1-8664-1cc4e6d14158", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - curl -X DELETE \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - "https://api.telnyx.com/v2/sim_cards/6a09cdc3-8948-47f0-aa62-74ac943d6c58/network_preferences" - - { - "data": { - "created_at": "2018-02-02T22:25:27.521Z", - "mobile_operator_networks_preferences": [ - { - "mobile_operator_network_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "mobile_operator_network_name": "AT&T Mobility (USACG)", - "priority": 0 - } - ], - "ota_updates": [ - { - "created_at": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "record_type": "ota_update", - "settings": { - "mobile_operator_networks_preferences": [ - { - "mobile_operator_network_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "mobile_operator_network_name": "AT&T Mobility (USACG)", - "priority": 0 - } - ] - }, - "sim_card_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "status": "in-progress", - "type": "sim_card_network_preferences", - "updated_at": "2018-02-02T22:25:27.521Z" - } - ], - "record_type": "sim_card_network_preferences", - "sim_card_id": "6b14e151-8493-4fa1-8664-1cc4e6d14158", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - - curl -X PUT \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --data '{"mobile_operator_networks_preferences":"array","sim_card_ids":["6b14e151-8493-4fa1-8664-1cc4e6d14158","6b14e151-8493-4fa1-8664-1cc4e6d14158"]}' \ - - { - "data": [ - { - "created_at": "2018-02-02T22:25:27.521Z", - "mobile_operator_networks_preferences": [ - { - "mobile_operator_network_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "mobile_operator_network_name": "AT&T Mobility (USACG)", - "priority": 0 - } - ], - "ota_updates": [ - { - "created_at": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "record_type": "ota_update", - "settings": { - "mobile_operator_networks_preferences": [ - { - "mobile_operator_network_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "mobile_operator_network_name": "AT&T Mobility (USACG)", - "priority": 0 - } - ] - }, - "sim_card_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "status": "in-progress", - "type": "sim_card_network_preferences", - "updated_at": "2018-02-02T22:25:27.521Z" - } - ], - "record_type": "sim_card_network_preferences", - "sim_card_id": "6b14e151-8493-4fa1-8664-1cc4e6d14158", - "updated_at": "2018-02-02T22:25:27.521Z" - } - ] -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.Connection.list(page={"number":1,"size":20}) - - { - "data": [ - { - "active": true, - "anchorsite_override": "Latency", - "connection_name": "string", - "created_at": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "outbound_voice_profile_id": "1293384261075731499", - "record_type": "ip_connection", - "updated_at": "2018-02-02T22:25:27.521Z", - "webhook_api_version": "1", - "webhook_event_failover_url": "https://failover.webtechnicom.net", - "webhook_event_url": "https://webtechnicom.net" - } - ], - "meta": { - "page_number": 2, - "page_size": 25, - "total_pages": 3, - "total_results": 55 - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.Connection.retrieve("id") - - { - "data": { - "active": true, - "anchorsite_override": "Latency", - "connection_name": "string", - "created_at": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "outbound_voice_profile_id": "1293384261075731499", - "record_type": "ip_connection", - "updated_at": "2018-02-02T22:25:27.521Z", - "webhook_api_version": "1", - "webhook_event_failover_url": "https://failover.webtechnicom.net", - "webhook_event_url": "https://webtechnicom.net" - } -} - { - "data": [ - { - "active": true, - "anchorsite_override": "Latency", - "connection_name": "string", - "created_at": "2018-02-02T22:25:27.521Z", - "default_on_hold_comfort_noise_enabled": true, - "dtmf_type": "RFC 2833", - "encode_contact_header_enabled": true, - "encrypted_media": "SRTP", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "inbound": { - "ani_number_format": "+E.164", - "channel_limit": 10, - "codecs": [ - "G722" - ], - "dnis_number_format": "+e164", - "generate_ringback_tone": true, - "isup_headers_enabled": true, - "prack_enabled": true, - "privacy_zone_enabled": true, - "sip_compact_headers_enabled": true, - "timeout_1xx_secs": 10, - "timeout_2xx_secs": "15" - }, - "onnet_t38_passthrough_enabled": true, - "outbound": { - "ani_override": "string", - "ani_override_type": "always", - "call_parking_enabled": true, - "channel_limit": 10, - "generate_ringback_tone": true, - "instant_ringback_enabled": true, - "localization": "string", - "outbound_voice_profile_id": "1293384261075731499", - "t38_reinvite_source": "telnyx" - }, - "password": "my123secure456password789", - "record_type": "credential_connection", - "rtcp_settings": { - "capture_enabled": true, - "port": "rtp+1", - "report_frequency_seconds": 10 - }, - "sip_uri_calling_preference": "disabled", - "updated_at": "2018-02-02T22:25:27.521Z", - "user_name": "myusername123" - } - ], - "meta": { - "page_number": 2, - "page_size": 25, - "total_pages": 3, - "total_results": 55 - } -} - - https://api.telnyx.com/v2/actions/network_preferences/sim_cards - { - "data": { - "active": true, - "anchorsite_override": "Latency", - "connection_name": "string", - "created_at": "2018-02-02T22:25:27.521Z", - "default_on_hold_comfort_noise_enabled": true, - "dtmf_type": "RFC 2833", - "encode_contact_header_enabled": true, - "encrypted_media": "SRTP", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "inbound": { - "ani_number_format": "+E.164", - "channel_limit": 10, - "codecs": [ - "G722" - ], - "dnis_number_format": "+e164", - "generate_ringback_tone": true, - "isup_headers_enabled": true, - "prack_enabled": true, - "privacy_zone_enabled": true, - "sip_compact_headers_enabled": true, - "timeout_1xx_secs": 10, - "timeout_2xx_secs": "15" - }, - "onnet_t38_passthrough_enabled": true, - "outbound": { - "ani_override": "string", - "ani_override_type": "always", - "call_parking_enabled": true, - "channel_limit": 10, - "generate_ringback_tone": true, - "instant_ringback_enabled": true, - "localization": "string", - "outbound_voice_profile_id": "1293384261075731499", - "t38_reinvite_source": "telnyx" - }, - "password": "my123secure456password789", - "record_type": "credential_connection", - "rtcp_settings": { - "capture_enabled": true, - "port": "rtp+1", - "report_frequency_seconds": 10 - }, - "sip_uri_calling_preference": "disabled", - "updated_at": "2018-02-02T22:25:27.521Z", - "user_name": "myusername123" - } -} - - { - "data": { - "active": true, - "anchorsite_override": "Latency", - "connection_name": "string", - "created_at": "2018-02-02T22:25:27.521Z", - "default_on_hold_comfort_noise_enabled": true, - "dtmf_type": "RFC 2833", - "encode_contact_header_enabled": true, - "encrypted_media": "SRTP", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "inbound": { - "ani_number_format": "+E.164", - "channel_limit": 10, - "codecs": [ - "G722" - ], - "dnis_number_format": "+e164", - "generate_ringback_tone": true, - "isup_headers_enabled": true, - "prack_enabled": true, - "privacy_zone_enabled": true, - "sip_compact_headers_enabled": true, - "timeout_1xx_secs": 10, - "timeout_2xx_secs": "15" - }, - "onnet_t38_passthrough_enabled": true, - "outbound": { - "ani_override": "string", - "ani_override_type": "always", - "call_parking_enabled": true, - "channel_limit": 10, - "generate_ringback_tone": true, - "instant_ringback_enabled": true, - "localization": "string", - "outbound_voice_profile_id": "1293384261075731499", - "t38_reinvite_source": "telnyx" - }, - "password": "my123secure456password789", - "record_type": "credential_connection", - "rtcp_settings": { - "capture_enabled": true, - "port": "rtp+1", - "report_frequency_seconds": 10 - }, - "sip_uri_calling_preference": "disabled", - "updated_at": "2018-02-02T22:25:27.521Z", - "user_name": "myusername123" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.FqdnConnection.list(page={"number":1,"size":20}) - - { - "data": [ - { - "active": true, - "anchorsite_override": "Latency", - "connection_name": "string", - "created_at": "2018-02-02T22:25:27.521Z", - "default_on_hold_comfort_noise_enabled": true, - "dtmf_type": "RFC 2833", - "encode_contact_header_enabled": true, - "encrypted_media": "SRTP", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "inbound": { - "ani_number_format": "+E.164", - "channel_limit": 10, - "codecs": [ - "G722" - ], - "default_routing_method": "sequential", - "dnis_number_format": "+e164", - "generate_ringback_tone": true, - "isup_headers_enabled": true, - "prack_enabled": true, - "privacy_zone_enabled": true, - "sip_compact_headers_enabled": true, - "sip_region": "US", - "sip_subdomain": "string", - "sip_subdomain_receive_settings": "only_my_connections", - "timeout_1xx_secs": 10, - "timeout_2xx_secs": 10 - }, - "onnet_t38_passthrough_enabled": true, - "record_type": "fqdn_connection", - "rtcp_settings": { - "capture_enabled": true, - "port": "rtcp-mux", - "report_frequency_secs": 10 - }, - "transport_protocol": "UDP", - "updated_at": "2018-02-02T22:25:27.521Z" - } - ], - "meta": { - "page_number": 2, - "page_size": 25, - "total_pages": 3, - "total_results": 55 - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.FqdnConnection.create(active=true,anchorsite_override="Latency") - { - "data": { - "active": true, - "anchorsite_override": "Latency", - "connection_name": "string", - "created_at": "2018-02-02T22:25:27.521Z", - "default_on_hold_comfort_noise_enabled": true, - "dtmf_type": "RFC 2833", - "encode_contact_header_enabled": true, - "encrypted_media": "SRTP", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "inbound": { - "ani_number_format": "+E.164", - "channel_limit": 10, - "codecs": [ - "G722" - ], - "default_routing_method": "sequential", - "dnis_number_format": "+e164", - "generate_ringback_tone": true, - "isup_headers_enabled": true, - "prack_enabled": true, - "privacy_zone_enabled": true, - "sip_compact_headers_enabled": true, - "sip_region": "US", - "sip_subdomain": "string", - "sip_subdomain_receive_settings": "only_my_connections", - "timeout_1xx_secs": 10, - "timeout_2xx_secs": 10 - }, - "onnet_t38_passthrough_enabled": true, - "record_type": "fqdn_connection", - "rtcp_settings": { - "capture_enabled": true, - "port": "rtcp-mux", - "report_frequency_secs": 10 - }, - "transport_protocol": "UDP", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.FqdnConnection.retrieve("id") - - { - "data": { - "active": true, - "anchorsite_override": "Latency", - "connection_name": "string", - "created_at": "2018-02-02T22:25:27.521Z", - "default_on_hold_comfort_noise_enabled": true, - "dtmf_type": "RFC 2833", - "encode_contact_header_enabled": true, - "encrypted_media": "SRTP", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "inbound": { - "ani_number_format": "+E.164", - "channel_limit": 10, - "codecs": [ - "G722" - ], - "default_routing_method": "sequential", - "dnis_number_format": "+e164", - "generate_ringback_tone": true, - "isup_headers_enabled": true, - "prack_enabled": true, - "privacy_zone_enabled": true, - "sip_compact_headers_enabled": true, - "sip_region": "US", - "sip_subdomain": "string", - "sip_subdomain_receive_settings": "only_my_connections", - "timeout_1xx_secs": 10, - "timeout_2xx_secs": 10 - }, - "onnet_t38_passthrough_enabled": true, - "record_type": "fqdn_connection", - "rtcp_settings": { - "capture_enabled": true, - "port": "rtcp-mux", - "report_frequency_secs": 10 - }, - "transport_protocol": "UDP", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.FqdnConnection.retrieve("id") -res.active = true -res.anchorsite_override = "Latency" - -res.save() - - { - "data": { - "active": true, - "anchorsite_override": "Latency", - "connection_name": "string", - "created_at": "2018-02-02T22:25:27.521Z", - "default_on_hold_comfort_noise_enabled": true, - "dtmf_type": "RFC 2833", - "encode_contact_header_enabled": true, - "encrypted_media": "SRTP", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "inbound": { - "ani_number_format": "+E.164", - "channel_limit": 10, - "codecs": [ - "G722" - ], - "default_routing_method": "sequential", - "dnis_number_format": "+e164", - "generate_ringback_tone": true, - "isup_headers_enabled": true, - "prack_enabled": true, - "privacy_zone_enabled": true, - "sip_compact_headers_enabled": true, - "sip_region": "US", - "sip_subdomain": "string", - "sip_subdomain_receive_settings": "only_my_connections", - "timeout_1xx_secs": 10, - "timeout_2xx_secs": 10 - }, - "onnet_t38_passthrough_enabled": true, - "record_type": "fqdn_connection", - "rtcp_settings": { - "capture_enabled": true, - "port": "rtcp-mux", - "report_frequency_secs": 10 - }, - "transport_protocol": "UDP", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.FqdnConnection.retrieve("id") -res.delete() - { - "data": { - "active": true, - "anchorsite_override": "Latency", - "connection_name": "string", - "created_at": "2018-02-02T22:25:27.521Z", - "default_on_hold_comfort_noise_enabled": true, - "dtmf_type": "RFC 2833", - "encode_contact_header_enabled": true, - "encrypted_media": "SRTP", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "inbound": { - "ani_number_format": "+E.164", - "channel_limit": 10, - "codecs": [ - "G722" - ], - "default_routing_method": "sequential", - "dnis_number_format": "+e164", - "generate_ringback_tone": true, - "isup_headers_enabled": true, - "prack_enabled": true, - "privacy_zone_enabled": true, - "sip_compact_headers_enabled": true, - "sip_region": "US", - "sip_subdomain": "string", - "sip_subdomain_receive_settings": "only_my_connections", - "timeout_1xx_secs": 10, - "timeout_2xx_secs": 10 - }, - "onnet_t38_passthrough_enabled": true, - "record_type": "fqdn_connection", - "rtcp_settings": { - "capture_enabled": true, - "port": "rtcp-mux", - "report_frequency_secs": 10 - }, - "transport_protocol": "UDP", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.Fqdn.list(page={"number":1,"size":20}) - - { - "data": [ - { - "connection_id": "3456789987654", - "created_at": "2018-02-02T22:25:27.521Z", - "dns_record_type": "a", - "fqdn": "example.com", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "port": 5060, - "record_type": "fqdn", - "updated_at": "2018-02-02T22:25:27.521Z" - } - ] -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.Fqdn.create(fqdn="example.com",connection_id="6a09cdc3-8948-47f0-aa62-74ac943d6c58") - - { - "data": { - "connection_id": "3456789987654", - "created_at": "2018-02-02T22:25:27.521Z", - "dns_record_type": "a", - "fqdn": "example.com", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "port": 5060, - "record_type": "fqdn", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.Fqdn.retrieve("id") - - { - "data": { - "connection_id": "3456789987654", - "created_at": "2018-02-02T22:25:27.521Z", - "dns_record_type": "a", - "fqdn": "example.com", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "port": 5060, - "record_type": "fqdn", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.Fqdn.retrieve("id") -res.fqdn = "example.com" -res.connection_id = "6a09cdc3-8948-47f0-aa62-74ac943d6c58" - -res.save() - - { - "data": { - "connection_id": "3456789987654", - "created_at": "2018-02-02T22:25:27.521Z", - "dns_record_type": "a", - "fqdn": "example.com", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "port": 5060, - "record_type": "fqdn", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.Fqdn.retrieve("id") -res.delete() - { - "data": { - "connection_id": "3456789987654", - "created_at": "2018-02-02T22:25:27.521Z", - "dns_record_type": "a", - "fqdn": "example.com", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "port": 5060, - "record_type": "fqdn", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.IpConnection.list(page={"number":1,"size":20}) - - { - "data": [ - { - "active": true, - "anchorsite_override": "Latency", - "connection_name": "string", - "created_at": "2018-02-02T22:25:27.521Z", - "default_on_hold_comfort_noise_enabled": true, - "dtmf_type": "RFC 2833", - "encode_contact_header_enabled": true, - "encrypted_media": "SRTP", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "inbound": { - "ani_number_format": "+E.164", - "channel_limit": 10, - "codecs": [ - "G722" - ], - "default_primary_ip_id": "192.0.2.1", - "default_routing_method": "sequential", - "default_secondary_ip_id": "198.51.100.1", - "default_tertiary_ip_id": "203.0.113.1", - "dnis_number_format": "+e164", - "generate_ringback_tone": true, - "isup_headers_enabled": true, - "prack_enabled": true, - "privacy_zone_enabled": true, - "sip_compact_headers_enabled": true, - "sip_region": "US", - "sip_subdomain": "string", - "sip_subdomain_receive_settings": "only_my_connections", - "timeout_1xx_secs": 10, - "timeout_2xx_secs": 10 - }, - "onnet_t38_passthrough_enabled": true, - "outbound": { - "ani_override": "string", - "ani_override_type": "always", - "call_parking_enabled": true, - "channel_limit": 10, - "generate_ringback_tone": true, - "instant_ringback_enabled": true, - "ip_authentication_method": "token", - "ip_authentication_token": "string", - "localization": "string", - "outbound_voice_profile_id": "1293384261075731499", - "t38_reinvite_source": "telnyx", - "tech_prefix": "string" - }, - "record_type": "ip_connection", - "rtcp_settings": { - "capture_enabled": true, - "port": "rtcp-mux", - "report_frequency_secs": 10 - }, - "transport_protocol": "UDP", - "updated_at": "2018-02-02T22:25:27.521Z" - } - ], - "meta": { - "page_number": 2, - "page_size": 25, - "total_pages": 3, - "total_results": 55 - } -} - - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.IpConnection.create(active=true,anchorsite_override="Latency") - - { - "data": { - "active": true, - "anchorsite_override": "Latency", - "connection_name": "string", - "created_at": "2018-02-02T22:25:27.521Z", - "default_on_hold_comfort_noise_enabled": true, - "dtmf_type": "RFC 2833", - "encode_contact_header_enabled": true, - "encrypted_media": "SRTP", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "inbound": { - "ani_number_format": "+E.164", - "channel_limit": 10, - "codecs": [ - "G722" - ], - "default_primary_ip_id": "192.0.2.1", - "default_routing_method": "sequential", - "default_secondary_ip_id": "198.51.100.1", - "default_tertiary_ip_id": "203.0.113.1", - "dnis_number_format": "+e164", - "generate_ringback_tone": true, - "isup_headers_enabled": true, - "prack_enabled": true, - "privacy_zone_enabled": true, - "sip_compact_headers_enabled": true, - "sip_region": "US", - "sip_subdomain": "string", - "sip_subdomain_receive_settings": "only_my_connections", - "timeout_1xx_secs": 10, - "timeout_2xx_secs": 10 - }, - "onnet_t38_passthrough_enabled": true, - "outbound": { - "ani_override": "string", - "ani_override_type": "always", - "call_parking_enabled": true, - "channel_limit": 10, - "generate_ringback_tone": true, - "instant_ringback_enabled": true, - "ip_authentication_method": "token", - "ip_authentication_token": "string", - "localization": "string", - "outbound_voice_profile_id": "1293384261075731499", - "t38_reinvite_source": "telnyx", - "tech_prefix": "string" - }, - "record_type": "ip_connection", - "rtcp_settings": { - "capture_enabled": true, - "port": "rtcp-mux", - "report_frequency_secs": 10 - }, - "transport_protocol": "UDP", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.IpConnection.retrieve("id") - - { - "data": { - "active": true, - "anchorsite_override": "Latency", - "connection_name": "string", - "created_at": "2018-02-02T22:25:27.521Z", - "default_on_hold_comfort_noise_enabled": true, - "dtmf_type": "RFC 2833", - "encode_contact_header_enabled": true, - "encrypted_media": "SRTP", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "inbound": { - "ani_number_format": "+E.164", - "channel_limit": 10, - "codecs": [ - "G722" - ], - "default_primary_ip_id": "192.0.2.1", - "default_routing_method": "sequential", - "default_secondary_ip_id": "198.51.100.1", - "default_tertiary_ip_id": "203.0.113.1", - "dnis_number_format": "+e164", - "generate_ringback_tone": true, - "isup_headers_enabled": true, - "prack_enabled": true, - "privacy_zone_enabled": true, - "sip_compact_headers_enabled": true, - "sip_region": "US", - "sip_subdomain": "string", - "sip_subdomain_receive_settings": "only_my_connections", - "timeout_1xx_secs": 10, - "timeout_2xx_secs": 10 - }, - "onnet_t38_passthrough_enabled": true, - "outbound": { - "ani_override": "string", - "ani_override_type": "always", - "call_parking_enabled": true, - "channel_limit": 10, - "generate_ringback_tone": true, - "instant_ringback_enabled": true, - "ip_authentication_method": "token", - "ip_authentication_token": "string", - "localization": "string", - "outbound_voice_profile_id": "1293384261075731499", - "t38_reinvite_source": "telnyx", - "tech_prefix": "string" - }, - "record_type": "ip_connection", - "rtcp_settings": { - "capture_enabled": true, - "port": "rtcp-mux", - "report_frequency_secs": 10 - }, - "transport_protocol": "UDP", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.IpConnection.retrieve("id") -res.active = true -res.anchorsite_override = "Latency" - -res.save() - - { - "data": { - "active": true, - "anchorsite_override": "Latency", - "connection_name": "string", - "created_at": "2018-02-02T22:25:27.521Z", - "default_on_hold_comfort_noise_enabled": true, - "dtmf_type": "RFC 2833", - "encode_contact_header_enabled": true, - "encrypted_media": "SRTP", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "inbound": { - "ani_number_format": "+E.164", - "channel_limit": 10, - "codecs": [ - "G722" - ], - "default_primary_ip_id": "192.0.2.1", - "default_routing_method": "sequential", - "default_secondary_ip_id": "198.51.100.1", - "default_tertiary_ip_id": "203.0.113.1", - "dnis_number_format": "+e164", - "generate_ringback_tone": true, - "isup_headers_enabled": true, - "prack_enabled": true, - "privacy_zone_enabled": true, - "sip_compact_headers_enabled": true, - "sip_region": "US", - "sip_subdomain": "string", - "sip_subdomain_receive_settings": "only_my_connections", - "timeout_1xx_secs": 10, - "timeout_2xx_secs": 10 - }, - "onnet_t38_passthrough_enabled": true, - "outbound": { - "ani_override": "string", - "ani_override_type": "always", - "call_parking_enabled": true, - "channel_limit": 10, - "generate_ringback_tone": true, - "instant_ringback_enabled": true, - "ip_authentication_method": "token", - "ip_authentication_token": "string", - "localization": "string", - "outbound_voice_profile_id": "1293384261075731499", - "t38_reinvite_source": "telnyx", - "tech_prefix": "string" - }, - "record_type": "ip_connection", - "rtcp_settings": { - "capture_enabled": true, - "port": "rtcp-mux", - "report_frequency_secs": 10 - }, - "transport_protocol": "UDP", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.Ip.list(page={"number":1,"size":20}) - { - "data": [ - { - "connection_id": "3456789987654", - "created_at": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "ip_address": "192.168.0.0", - "port": 5060, - "record_type": "ip", - "updated_at": "2018-02-02T22:25:27.521Z" - } - ] -} - - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.Ip.create(ip_address="192.168.0.0",connection_id="6a09cdc3-8948-47f0-aa62-74ac943d6c58") - - - { - "data": { - "connection_id": "3456789987654", - "created_at": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "ip_address": "192.168.0.0", - "port": 5060, - "record_type": "ip", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.Ip.retrieve("id") - { - "data": { - "connection_id": "3456789987654", - "created_at": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "ip_address": "192.168.0.0", - "port": 5060, - "record_type": "ip", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.Ip.retrieve("id") -res.ip_address = "192.168.0.0" -res.connection_id = "6a09cdc3-8948-47f0-aa62-74ac943d6c58" - -res.save() - - { - "data": { - "connection_id": "3456789987654", - "created_at": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "ip_address": "192.168.0.0", - "port": 5060, - "record_type": "ip", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.Ip.retrieve("id") -res.delete() - - { - "data": { - "connection_id": "3456789987654", - "created_at": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "ip_address": "192.168.0.0", - "port": 5060, - "record_type": "ip", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - - # Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - url='http://demo.twilio.com/docs/voice.xml', - to='+15558675310', - from_='+15017122661' - ) - -print(call.sid) -{ - "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "annotation": null, - "answered_by": null, - "api_version": "2010-04-01", - "caller_name": null, - "date_created": "Tue, 31 Aug 2010 20:36:28 +0000", - "date_updated": "Tue, 31 Aug 2010 20:36:44 +0000", - "direction": "inbound", - "duration": "15", - "end_time": "Tue, 31 Aug 2010 20:36:44 +0000", - "forwarded_from": "+141586753093", - "from": "+15017122661", - "from_formatted": "(501) 712-2661", - "group_sid": null, - "parent_call_sid": null, - "phone_number_sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "price": "-0.03000", - "price_unit": "USD", - "sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "start_time": "Tue, 31 Aug 2010 20:36:29 +0000", - "status": "completed", - "subresource_uris": { - "notifications": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications.json", - "recordings": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Recordings.json", - "feedback": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Feedback.json", - "feedback_summaries": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/FeedbackSummary.json", - "payments": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Payments.json", - "events": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Events.json" - }, - "to": "+15558675310", - "to_formatted": "(555) 867-5310", - "trunk_sid": null, - "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json", - "queue_time": "1000" -} - from flask import Flask -app = Flask(__name__) - -@app.route("/") -def hello(): - return "Hello World!" - -if __name__ == "__main__": - app.run() -from flask import Flask -from twilio.twiml.voice_response import VoiceResponse - -app = Flask(__name__) - - -@app.route("/answer", methods=['GET', 'POST']) -def answer_call(): - """Respond to incoming phone calls with a brief message.""" - # Start our TwiML response - resp = VoiceResponse() - - # Read a message aloud to the caller - resp.say("Thank you for calling! Have a great day.", voice='alice') - - return str(resp) - -if __name__ == "__main__": - app.run(debug=True) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - twiml='Ahoy, World!', - to='+14155551212', - from_='+15017122661' - ) - -print(call.sid) -{ - "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "annotation": null, - "answered_by": null, - "api_version": "2010-04-01", - "caller_name": null, - "date_created": "Tue, 31 Aug 2010 20:36:28 +0000", - "date_updated": "Tue, 31 Aug 2010 20:36:44 +0000", - "direction": "inbound", - "duration": "15", - "end_time": "Tue, 31 Aug 2010 20:36:44 +0000", - "forwarded_from": "+141586753093", - "from": "+15017122661", - "from_formatted": "(501) 712-2661", - "group_sid": null, - "parent_call_sid": null, - "phone_number_sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "price": "-0.03000", - "price_unit": "USD", - "sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "start_time": "Tue, 31 Aug 2010 20:36:29 +0000", - "status": "completed", - "subresource_uris": { - "notifications": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications.json", - "recordings": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Recordings.json", - "feedback": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Feedback.json", - "feedback_summaries": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/FeedbackSummary.json", - "payments": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Payments.json", - "events": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Events.json" - }, - "to": "+14155551212", - "to_formatted": "(415) 555-1212", - "trunk_sid": null, - "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json", - "queue_time": "1000" -} - - # Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - url='http://demo.twilio.com/docs/classic.mp3', - to='+14155551212', - from_='+14155551212' - ) - -print(call.sid) -{ - "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "annotation": null, - "answered_by": null, - "api_version": "2010-04-01", - "caller_name": null, - "date_created": "Tue, 31 Aug 2010 20:36:28 +0000", - "date_updated": "Tue, 31 Aug 2010 20:36:44 +0000", - "direction": "inbound", - "duration": "15", - "end_time": "Tue, 31 Aug 2010 20:36:44 +0000", - "forwarded_from": "+141586753093", - "from": "+14155551212", - "from_formatted": "(415) 555-1212", - "group_sid": null, - "parent_call_sid": null, - "phone_number_sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "price": "-0.03000", - "price_unit": "USD", - "sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "start_time": "Tue, 31 Aug 2010 20:36:29 +0000", - "status": "completed", - "subresource_uris": { - "notifications": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications.json", - "recordings": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Recordings.json", - "feedback": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Feedback.json", - "feedback_summaries": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/FeedbackSummary.json", - "payments": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Payments.json", - "events": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Events.json" - }, - "to": "+14155551212", - "to_formatted": "(415) 555-1212", - "trunk_sid": null, - "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json", - "queue_time": "1000" -} - - - - Thanks for trying our documentation. Enjoy! - https://demo.twilio.com/docs/classic.mp3 - -from flask import Flask -from twilio.twiml.voice_response import VoiceResponse, Gather - -app = Flask(__name__) - - -@app.route("/voice", methods=['GET', 'POST']) -def voice(): - """Respond to incoming phone calls with a menu of options""" - # Start our TwiML response - resp = VoiceResponse() - - # Start our verb - gather = Gather(num_digits=1) - gather.say('For sales, press 1. For support, press 2.') - resp.append(gather) - - # If the user doesn't select an option, redirect them into a loop - resp.redirect('/voice') - - return str(resp) - -if __name__ == "__main__": - app.run(debug=True) -from flask import Flask, request -from twilio.twiml.voice_response import VoiceResponse, Gather - -app = Flask(__name__) - - -@app.route("/voice", methods=['GET', 'POST']) -def voice(): - """Respond to incoming phone calls with a menu of options""" - # Start our TwiML response - resp = VoiceResponse() - - # If Twilio's request to our app included already gathered digits, - # process them - if 'Digits' in request.values: - # Get which digit the caller chose - choice = request.values['Digits'] - - # a different message depending on the caller's choice - if choice == '1': - resp.say('You selected sales. Good for you!') - return str(resp) - elif choice == '2': - resp.say('You need support. We will help!') - return str(resp) - else: - # If the caller didn't choose 1 or 2, apologize and ask them again - resp.say("Sorry, I don't understand that choice.") - - # Start our verb - gather = Gather(num_digits=1) - gather.say('For sales, press 1. For support, press 2.') - resp.append(gather) - - # If the user doesn't select an option, redirect them into a loop - resp.redirect('/voice') - - return str(resp) - -if __name__ == "__main__": - app.run(debug=True) -from flask import Flask, request -from twilio.twiml.voice_response import VoiceResponse, Gather - -app = Flask(__name__) - - -@app.route("/voice", methods=['GET', 'POST']) -def voice(): - """Respond to incoming phone calls with a menu of options""" - # Start our TwiML response - resp = VoiceResponse() - - # Start our verb - gather = Gather(num_digits=1, action='/gather') - gather.say('For sales, press 1. For support, press 2.') - resp.append(gather) - - # If the user doesn't select an option, redirect them into a loop - resp.redirect('/voice') - - return str(resp) - - -@app.route('/gather', methods=['GET', 'POST']) -def gather(): - """Processes results from the prompt in /voice""" - # Start our TwiML response - resp = VoiceResponse() - - # If Twilio's request to our app included already gathered digits, - # process them - if 'Digits' in request.values: - # Get which digit the caller chose - choice = request.values['Digits'] - - # a different message depending on the caller's choice - if choice == '1': - resp.say('You selected sales. Good for you!') - return str(resp) - elif choice == '2': - resp.say('You need support. We will help!') - return str(resp) - else: - # If the caller didn't choose 1 or 2, apologize and ask them again - resp.say("Sorry, I don't understand that choice.") - - # If the user didn't choose 1 or 2 (or anything), send them back to /voice - resp.redirect('/voice') - - return str(resp) - -if __name__ == "__main__": - app.run(debug=True) - - from flask import ( - flash, - render_template, - redirect, - request, - session, - url_for, -) -from twilio.twiml.voice_response import VoiceResponse - -from ivr_phone_tree_python import app -from ivr_phone_tree_python.view_helpers import twiml - - -@app.route('/') -@app.route('/ivr') -def home(): - return render_template('index.html') - - -@app.route('/ivr/welcome', methods=['POST']) -def welcome(): - response = VoiceResponse() - with response.gather( - num_digits=1, action=url_for('menu'), method="POST" - ) as g: - g.say(message="Thanks for calling the E T Phone Home Service. " + - "Please press 1 for directions." + - "Press 2 for a list of planets to call.", loop=3) - return twiml(response) - - -@app.route('/ivr/menu', methods=['POST']) -def menu(): - selected_option = request.form['Digits'] - option_actions = {'1': _give_instructions, - '2': _list_planets} - - if option_actions.has_key(selected_option): - response = VoiceResponse() - option_actions[selected_option](response) - return twiml(response) - - return _redirect_welcome() - - -@app.route('/ivr/planets', methods=['POST']) -def planets(): - selected_option = request.form['Digits'] - option_actions = {'2': "+12024173378", - '3': "+12027336386", - "4": "+12027336637"} - - if selected_option in option_actions: - response = VoiceResponse() - response.dial(option_actions[selected_option]) - return twiml(response) - - return _redirect_welcome() - - -# private methods - -def _give_instructions(response): - response.say("To get to your extraction point, get on your bike and go " + - "down the street. Then Left down an alley. Avoid the police" + - " cars. Turn left into an unfinished housing development." + - "Fly over the roadblock. Go past the moon. Soon after " + - "you will see your mother ship.", - voice="alice", language="en-GB") - - response.say("Thank you for calling the E T Phone Home Service - the " + - "adventurous alien's first choice in intergalactic travel") - - response.hangup() - return response - - -def _list_planets(response): - with response.gather( - numDigits=1, action=url_for('planets'), method="POST" - ) as g: - g.say("To call the planet Broh doe As O G, press 2. To call the " + - "planet DuhGo bah, press 3. To call an oober asteroid " + - "to your location, press 4. To go back to the main menu " + - " press the star key.", - voice="alice", language="en-GB", loop=3) - - return response - - -def _redirect_welcome(): - response = VoiceResponse() - response.say("Returning to the main menu", voice="alice", language="en-GB") - response.redirect(url_for('welcome')) - - return twiml(response) - from flask import ( - flash, - render_template, - redirect, - request, - session, - url_for, -) -from twilio.twiml.voice_response import VoiceResponse - -from ivr_phone_tree_python import app -from ivr_phone_tree_python.view_helpers import twiml - - -@app.route('/') -@app.route('/ivr') -def home(): - return render_template('index.html') - - -@app.route('/ivr/welcome', methods=['POST']) -def welcome(): - response = VoiceResponse() - with response.gather( - num_digits=1, action=url_for('menu'), method="POST" - ) as g: - g.say(message="Thanks for calling the E T Phone Home Service. " + - "Please press 1 for directions." + - "Press 2 for a list of planets to call.", loop=3) - return twiml(response) - - -@app.route('/ivr/menu', methods=['POST']) -def menu(): - selected_option = request.form['Digits'] - option_actions = {'1': _give_instructions, - '2': _list_planets} - - if option_actions.has_key(selected_option): - response = VoiceResponse() - option_actions[selected_option](response) - return twiml(response) - - return _redirect_welcome() - - -@app.route('/ivr/planets', methods=['POST']) -def planets(): - selected_option = request.form['Digits'] - option_actions = {'2': "+12024173378", - '3': "+12027336386", - "4": "+12027336637"} - - if selected_option in option_actions: - response = VoiceResponse() - response.dial(option_actions[selected_option]) - return twiml(response) - - return _redirect_welcome() - - -# private methods - -def _give_instructions(response): - response.say("To get to your extraction point, get on your bike and go " + - "down the street. Then Left down an alley. Avoid the police" + - " cars. Turn left into an unfinished housing development." + - "Fly over the roadblock. Go past the moon. Soon after " + - "you will see your mother ship.", - voice="alice", language="en-GB") - - response.say("Thank you for calling the E T Phone Home Service - the " + - "adventurous alien's first choice in intergalactic travel") - - response.hangup() - return response - - -def _list_planets(response): - with response.gather( - numDigits=1, action=url_for('planets'), method="POST" - ) as g: - g.say("To call the planet Broh doe As O G, press 2. To call the " + - "planet DuhGo bah, press 3. To call an oober asteroid " + - "to your location, press 4. To go back to the main menu " + - " press the star key.", - voice="alice", language="en-GB", loop=3) - - return response - - -def _redirect_welcome(): - response = VoiceResponse() - response.say("Returning to the main menu", voice="alice", language="en-GB") - response.redirect(url_for('welcome')) - - return twiml(response) -from flask import ( - flash, - render_template, - redirect, - request, - session, - url_for, -) -from twilio.twiml.voice_response import VoiceResponse - -from ivr_phone_tree_python import app -from ivr_phone_tree_python.view_helpers import twiml - - -@app.route('/') -@app.route('/ivr') -def home(): - return render_template('index.html') - - -@app.route('/ivr/welcome', methods=['POST']) -def welcome(): - response = VoiceResponse() - with response.gather( - num_digits=1, action=url_for('menu'), method="POST" - ) as g: - g.say(message="Thanks for calling the E T Phone Home Service. " + - "Please press 1 for directions." + - "Press 2 for a list of planets to call.", loop=3) - return twiml(response) - - -@app.route('/ivr/menu', methods=['POST']) -def menu(): - selected_option = request.form['Digits'] - option_actions = {'1': _give_instructions, - '2': _list_planets} - - if option_actions.has_key(selected_option): - response = VoiceResponse() - option_actions[selected_option](response) - return twiml(response) - - return _redirect_welcome() - - -@app.route('/ivr/planets', methods=['POST']) -def planets(): - selected_option = request.form['Digits'] - option_actions = {'2': "+12024173378", - '3': "+12027336386", - "4": "+12027336637"} - - if selected_option in option_actions: - response = VoiceResponse() - response.dial(option_actions[selected_option]) - return twiml(response) - - return _redirect_welcome() - - -# private methods - -def _give_instructions(response): - response.say("To get to your extraction point, get on your bike and go " + - "down the street. Then Left down an alley. Avoid the police" + - " cars. Turn left into an unfinished housing development." + - "Fly over the roadblock. Go past the moon. Soon after " + - "you will see your mother ship.", - voice="alice", language="en-GB") - - response.say("Thank you for calling the E T Phone Home Service - the " + - "adventurous alien's first choice in intergalactic travel") - - response.hangup() - return response - - -def _list_planets(response): - with response.gather( - numDigits=1, action=url_for('planets'), method="POST" - ) as g: - g.say("To call the planet Broh doe As O G, press 2. To call the " + - "planet DuhGo bah, press 3. To call an oober asteroid " + - "to your location, press 4. To go back to the main menu " + - " press the star key.", - voice="alice", language="en-GB", loop=3) - - return response - - -def _redirect_welcome(): - response = VoiceResponse() - response.say("Returning to the main menu", voice="alice", language="en-GB") - response.redirect(url_for('welcome')) - - return twiml(response) -from flask import ( - flash, - render_template, - redirect, - request, - session, - url_for, -) -from twilio.twiml.voice_response import VoiceResponse - -from ivr_phone_tree_python import app -from ivr_phone_tree_python.view_helpers import twiml - - -@app.route('/') -@app.route('/ivr') -def home(): - return render_template('index.html') - - -@app.route('/ivr/welcome', methods=['POST']) -def welcome(): - response = VoiceResponse() - with response.gather( - num_digits=1, action=url_for('menu'), method="POST" - ) as g: - g.say(message="Thanks for calling the E T Phone Home Service. " + - "Please press 1 for directions." + - "Press 2 for a list of planets to call.", loop=3) - return twiml(response) - - -@app.route('/ivr/menu', methods=['POST']) -def menu(): - selected_option = request.form['Digits'] - option_actions = {'1': _give_instructions, - '2': _list_planets} - - if option_actions.has_key(selected_option): - response = VoiceResponse() - option_actions[selected_option](response) - return twiml(response) - - return _redirect_welcome() - - -@app.route('/ivr/planets', methods=['POST']) -def planets(): - selected_option = request.form['Digits'] - option_actions = {'2': "+12024173378", - '3': "+12027336386", - "4": "+12027336637"} - - if selected_option in option_actions: - response = VoiceResponse() - response.dial(option_actions[selected_option]) - return twiml(response) - - return _redirect_welcome() - - -# private methods - -def _give_instructions(response): - response.say("To get to your extraction point, get on your bike and go " + - "down the street. Then Left down an alley. Avoid the police" + - " cars. Turn left into an unfinished housing development." + - "Fly over the roadblock. Go past the moon. Soon after " + - "you will see your mother ship.", - voice="alice", language="en-GB") - - response.say("Thank you for calling the E T Phone Home Service - the " + - "adventurous alien's first choice in intergalactic travel") - - response.hangup() - return response - - -def _list_planets(response): - with response.gather( - numDigits=1, action=url_for('planets'), method="POST" - ) as g: - g.say("To call the planet Broh doe As O G, press 2. To call the " + - "planet DuhGo bah, press 3. To call an oober asteroid " + - "to your location, press 4. To go back to the main menu " + - " press the star key.", - voice="alice", language="en-GB", loop=3) - - return response - - -def _redirect_welcome(): - response = VoiceResponse() - response.say("Returning to the main menu", voice="alice", language="en-GB") - response.redirect(url_for('welcome')) - - return twiml(response) -from flask import ( - flash, - render_template, - redirect, - request, - session, - url_for, -) -from twilio.twiml.voice_response import VoiceResponse - -from ivr_phone_tree_python import app -from ivr_phone_tree_python.view_helpers import twiml - - -@app.route('/') -@app.route('/ivr') -def home(): - return render_template('index.html') - - -@app.route('/ivr/welcome', methods=['POST']) -def welcome(): - response = VoiceResponse() - with response.gather( - num_digits=1, action=url_for('menu'), method="POST" - ) as g: - g.say(message="Thanks for calling the E T Phone Home Service. " + - "Please press 1 for directions." + - "Press 2 for a list of planets to call.", loop=3) - return twiml(response) - - -@app.route('/ivr/menu', methods=['POST']) -def menu(): - selected_option = request.form['Digits'] - option_actions = {'1': _give_instructions, - '2': _list_planets} - - if option_actions.has_key(selected_option): - response = VoiceResponse() - option_actions[selected_option](response) - return twiml(response) - - return _redirect_welcome() - - -@app.route('/ivr/planets', methods=['POST']) -def planets(): - selected_option = request.form['Digits'] - option_actions = {'2': "+12024173378", - '3': "+12027336386", - "4": "+12027336637"} - - if selected_option in option_actions: - response = VoiceResponse() - response.dial(option_actions[selected_option]) - return twiml(response) - - return _redirect_welcome() - - -# private methods - -def _give_instructions(response): - response.say("To get to your extraction point, get on your bike and go " + - "down the street. Then Left down an alley. Avoid the police" + - " cars. Turn left into an unfinished housing development." + - "Fly over the roadblock. Go past the moon. Soon after " + - "you will see your mother ship.", - voice="alice", language="en-GB") - - response.say("Thank you for calling the E T Phone Home Service - the " + - "adventurous alien's first choice in intergalactic travel") - - response.hangup() - return response - - -def _list_planets(response): - with response.gather( - numDigits=1, action=url_for('planets'), method="POST" - ) as g: - g.say("To call the planet Broh doe As O G, press 2. To call the " + - "planet DuhGo bah, press 3. To call an oober asteroid " + - "to your location, press 4. To go back to the main menu " + - " press the star key.", - voice="alice", language="en-GB", loop=3) - - return response - - -def _redirect_welcome(): - response = VoiceResponse() - response.say("Returning to the main menu", voice="alice", language="en-GB") - response.redirect(url_for('welcome')) - - return twiml(response) -from flask import ( - flash, - render_template, - redirect, - request, - session, - url_for, -) -from twilio.twiml.voice_response import VoiceResponse - -from ivr_phone_tree_python import app -from ivr_phone_tree_python.view_helpers import twiml - - -@app.route('/') -@app.route('/ivr') -def home(): - return render_template('index.html') - - -@app.route('/ivr/welcome', methods=['POST']) -def welcome(): - response = VoiceResponse() - with response.gather( - num_digits=1, action=url_for('menu'), method="POST" - ) as g: - g.say(message="Thanks for calling the E T Phone Home Service. " + - "Please press 1 for directions." + - "Press 2 for a list of planets to call.", loop=3) - return twiml(response) - - -@app.route('/ivr/menu', methods=['POST']) -def menu(): - selected_option = request.form['Digits'] - option_actions = {'1': _give_instructions, - '2': _list_planets} - - if option_actions.has_key(selected_option): - response = VoiceResponse() - option_actions[selected_option](response) - return twiml(response) - - return _redirect_welcome() - - -@app.route('/ivr/planets', methods=['POST']) -def planets(): - selected_option = request.form['Digits'] - option_actions = {'2': "+12024173378", - '3': "+12027336386", - "4": "+12027336637"} - - if selected_option in option_actions: - response = VoiceResponse() - response.dial(option_actions[selected_option]) - return twiml(response) - - return _redirect_welcome() - - -# private methods - -def _give_instructions(response): - response.say("To get to your extraction point, get on your bike and go " + - "down the street. Then Left down an alley. Avoid the police" + - " cars. Turn left into an unfinished housing development." + - "Fly over the roadblock. Go past the moon. Soon after " + - "you will see your mother ship.", - voice="alice", language="en-GB") - - response.say("Thank you for calling the E T Phone Home Service - the " + - "adventurous alien's first choice in intergalactic travel") - - response.hangup() - return response - - -def _list_planets(response): - with response.gather( - numDigits=1, action=url_for('planets'), method="POST" - ) as g: - g.say("To call the planet Broh doe As O G, press 2. To call the " + - "planet DuhGo bah, press 3. To call an oober asteroid " + - "to your location, press 4. To go back to the main menu " + - " press the star key.", - voice="alice", language="en-GB", loop=3) - - return response - - -def _redirect_welcome(): - response = VoiceResponse() - response.say("Returning to the main menu", voice="alice", language="en-GB") - response.redirect(url_for('welcome')) - - return twiml(response) -from flask import ( - flash, - render_template, - redirect, - request, - session, - url_for, -) -from twilio.twiml.voice_response import VoiceResponse - -from ivr_phone_tree_python import app -from ivr_phone_tree_python.view_helpers import twiml - - -@app.route('/') -@app.route('/ivr') -def home(): - return render_template('index.html') - - -@app.route('/ivr/welcome', methods=['POST']) -def welcome(): - response = VoiceResponse() - with response.gather( - num_digits=1, action=url_for('menu'), method="POST" - ) as g: - g.say(message="Thanks for calling the E T Phone Home Service. " + - "Please press 1 for directions." + - "Press 2 for a list of planets to call.", loop=3) - return twiml(response) - - -@app.route('/ivr/menu', methods=['POST']) -def menu(): - selected_option = request.form['Digits'] - option_actions = {'1': _give_instructions, - '2': _list_planets} - - if option_actions.has_key(selected_option): - response = VoiceResponse() - option_actions[selected_option](response) - return twiml(response) - - return _redirect_welcome() - - -@app.route('/ivr/planets', methods=['POST']) -def planets(): - selected_option = request.form['Digits'] - option_actions = {'2': "+12024173378", - '3': "+12027336386", - "4": "+12027336637"} - - if selected_option in option_actions: - response = VoiceResponse() - response.dial(option_actions[selected_option]) - return twiml(response) - - return _redirect_welcome() - - -# private methods - -def _give_instructions(response): - response.say("To get to your extraction point, get on your bike and go " + - "down the street. Then Left down an alley. Avoid the police" + - " cars. Turn left into an unfinished housing development." + - "Fly over the roadblock. Go past the moon. Soon after " + - "you will see your mother ship.", - voice="alice", language="en-GB") - - response.say("Thank you for calling the E T Phone Home Service - the " + - "adventurous alien's first choice in intergalactic travel") - - response.hangup() - return response - - -def _list_planets(response): - with response.gather( - numDigits=1, action=url_for('planets'), method="POST" - ) as g: - g.say("To call the planet Broh doe As O G, press 2. To call the " + - "planet DuhGo bah, press 3. To call an oober asteroid " + - "to your location, press 4. To go back to the main menu " + - " press the star key.", - voice="alice", language="en-GB", loop=3) - - return response - - -def _redirect_welcome(): - response = VoiceResponse() - response.say("Returning to the main menu", voice="alice", language="en-GB") - response.redirect(url_for('welcome')) - - return twiml(response) - - - +print($call->sid); diff --git a/twilio b/twilio index 013f4d0..5cab6b6 100644 --- a/twilio +++ b/twilio @@ -1,16091 +1,426 @@ - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GitHub - webtechnicom/stripe: repository - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Skip to content - - - - - - - - -
- -
- - - - - -
- - - -
- - - - - - - - - -
-
-
- - - - - - - - - - - - -
- -
- -
-

- - - / - - stripe - - Template -

- - -
- -
    -
  • - -
  • - -
  • - - - Watch - - -
  • +// Find your Account Sid and Auth Token at twilio.com/console +// DANGER! This is insecure. See http://twil.io/secure +$sid = "ACcc67c045cffaea7653952cf73b7443a5"; +$token = "4a48ef16988eca378188b06fd8d433e0"; +$twilio = new Client($sid, $token); -
  • - - - Star - - +$message = $twilio->messages + ->create("+15558675310", // to + [ + "body" => "This will be the body of the new message!", + "from" => "+15017122661" + ] + ); -
  • +print($message->sid); +{ + "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", + "api_version": "2010-04-01", + "body": "This will be the body of the new message!", + "date_created": "Thu, 30 Jul 2015 20:12:31 +0000", + "date_sent": "Thu, 30 Jul 2015 20:12:33 +0000", + "date_updated": "Thu, 30 Jul 2015 20:12:33 +0000", + "direction": "outbound-api", + "error_code": null, + "error_message": null, + "from": "+14155552345", + "messaging_service_sid": "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", + "num_media": "0", + "num_segments": "1", + "price": null, + "price_unit": null, + "sid": "SMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", + "status": "sent", + "subresource_uris": { + "media": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/SMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Media.json" + }, + "to": "+14155552345", + "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/SMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json" +} + - - - Fork - - - -
+// Update the path below to your autoload.php, +// see https://getcomposer.org/doc/01-basic-usage.md +require_once '/path/to/vendor/autoload.php'; -
-
-

- repository -

- -
-
- - - Star - +use Twilio\Rest\Client; -
- -
-
+// Find your Account Sid and Auth Token at twilio.com/console +// DANGER! This is insecure. See http://twil.io/secure +$sid = "ACcc67c045cffaea7653952cf73b7443a5"; +$token = "4a48ef16988eca378188b06fd8d433e0"; +$twilio = new Client($sid, $token); - - -
+class TwilioRequestValidator +{ + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle($request, Closure $next) + { + // Be sure TWILIO_AUTH_TOKEN is set in your .env file. + // You can get your authentication token in your twilio console https://www.twilio.com/console + $requestValidator = new RequestValidator(env('TWILIO_AUTH_TOKEN')); + $requestData = $request->toArray(); -
-
+ // Switch to the body content if this is a JSON request. + if (array_key_exists('bodySHA256', $requestData)) { + $requestData = $request->getContent(); + } - - + $isValid = $requestValidator->validate( + $request->header('X-Twilio-Signature'), + $request->fullUrl(), + $requestData + ); -
- -
+ if ($isValid) { + return $next($request); + } else { + return new Response('You are not Twilio :(', 403); + } + } +} + - - +// Your Account SID and Auth Token from twilio.com/console +$account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; +$auth_token = '4a48ef16988eca378188b06fd8d433e0'; +// In production, these should be environment variables. E.g.: +// $auth_token = $_ENV["TWILIO_ACCOUNT_SID"] +// A Twilio number you own with Voice capabilities +$twilio_number = "+15017122661"; +// Where to make a voice call (your cell phone?) +$to_number = "+15558675310"; -
+$client = new Client($account_sid, $auth_token); +$client->account->calls->create( + $to_number, + $twilio_number, + array( + "url" => "http://demo.twilio.com/docs/voice.xml" + ) +); + - +// Start our TwiML response +$response = new VoiceResponse; +// Read a message aloud to the caller +$response->say( + "Thank you for calling! Have a great day.", + array("voice" => "alice") +); +echo $response; +say( + "Thank you for calling! Have a great day.", + array("voice" => "alice") +); -
- -
-
- - - master - - +echo $response; + -
- - - -
- -
+namespace App\Http\Controllers; -
+use App\Http\Requests; +use Illuminate\Http\Request; +use Twilio\Twiml; +class IvrController extends Controller +{ + public function __construct() + { + $this->_thankYouMessage = 'Thank you for calling the ET Phone Home' . + ' Service - the adventurous alien\'s first choice' . + ' in intergalactic travel.'; - + } -
+ /** + * Responds with a welcome message with instructions + * + * @return \Illuminate\Http\Response + */ + public function showWelcome() + { + $response = new Twiml(); + $gather = $response->gather( + [ + 'numDigits' => 1, + 'action' => route('menu-response', [], false) + ] + ); - - Go to file - + $gather->say( + 'Thanks for calling the E T Phone Home Service.' . + 'Please press 1 for directions. Press 2 for a ' . + 'list of planets to call.', + ['loop' => 3] + ); + return $response; + } + /** + * Responds to selection of an option by the caller + * + * @return \Illuminate\Http\Response + */ + public function showMenuResponse(Request $request) + { + $selectedOption = $request->input('Digits'); - - - -
- - - Code - -
- +namespace App\Http\Controllers; - +use Illuminate\Http\Request; +use Illuminate\Database\Eloquent\ModelNotFoundException; +use App\Http\Requests; +use App\Http\Controllers\Controller; +use App\Agent; +use Twilio\Twiml; -
-
- - +class ExtensionController extends Controller +{ + /** + * Responds with a to the caller's planet + * + * @return \Illuminate\Http\Response + */ + public function showExtensionConnection(Request $request) + { + $selectedOption = $request->input('Digits'); + try { + $agent = $this->_getAgentForDigit($selectedOption); + } + catch (ModelNotFoundException $e){ + return redirect()->route('main-menu-redirect'); + } - - -
+ $numberToDial = $agent->phone_number; + $response = new Twiml(); + $response->say( + "You'll be connected shortly to your planet. " . + $this->_thankYouMessage, + ['voice' => 'alice', 'language' => 'en-GB'] + ); - + $dialCommand = $response->dial( + ['action' => route('agent-voicemail', ['agent' => $agent->id], false), + 'method' => 'POST'] + ); + $dialCommand->number( + $numberToDial, + ['url' => route('screen-call', [], false)] + ); -
-
-

Latest commit

-
- -
- -
-
- - @webtechnicom -
-
+ return $response; + } -
-
-
- - webtechnicom + private function _getAgentForDigit($digit) + { + $planetExtensions = [ + '2' => 'Brodo', + '3' => 'Dagobah', + '4' => 'Oober' + ]; + $planetExtensionExists = isset($planetExtensions[$digit]); + if ($planetExtensionExists) { + $agent = Agent::where( + 'extension', '=', $planetExtensions[$digit] + )->firstOrFail(); - + return $agent; + } else { + throw new ModelNotFoundException; + } + } +} + - calls + ->create("sip:UserA@Trunk1.sip.us1.twilio.com", // to + "+15017122661", // from [ - "twiml" => "<Response><Say>Hello and thanks for connecting to your SIP network!</Say></Response>" + "twiml" => "Hello and thanks for connecting to your SIP network!" ] ); -print($call->sid); -{ - "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "annotation": null, - "answered_by": null, - "api_version": "2010-04-01", - "caller_name": null, - "date_created": "Tue, 31 Aug 2010 20:36:28 +0000", - "date_updated": "Tue, 31 Aug 2010 20:36:44 +0000", - "direction": "inbound", - "duration": "15", - "end_time": "Tue, 31 Aug 2010 20:36:44 +0000", - "forwarded_from": "+17708008448", - "from": "+15017122661", - "from_formatted": "(501) 712-2661", - "group_sid": null, - "parent_call_sid": null, - "phone_number_sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "price": "-0.03000", - "price_unit": "USD", - "sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "start_time": "Tue, 31 Aug 2010 20:36:29 +0000", - "status": "completed", - "subresource_uris": { - "notifications": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications.json", - "recordings": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Recordings.json", - "feedback": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Feedback.json", - "feedback_summaries": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/FeedbackSummary.json", - "payments": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Payments.json" - }, - "to": "sip:sip.webtechnicom.net", - "to_formatted": "sip:sip.webtechnicom.net", - "trunk_sid": null, - "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json", - "queue_time": "1000" -} -<?php - -// Update the path below to your autoload.php, -// see https://getcomposer.org/doc/01-basic-usage.md -require_once '/path/to/vendor/autoload.php'; - -use Twilio\Rest\Client; - -// Find your Account Sid and Auth Token at twilio.com/console -// DANGER! This is insecure. See http://twil.io/secure -$sid = "ACcc67c045cffaea7653952cf73b7443a5"; -$token = "4a48ef16988eca378188b06fd8d433e0"; -$twilio = new Client($sid, $token); - -$available_phone_number_country = $twilio->availablePhoneNumbers("US") - ->fetch(); - -print($available_phone_number_country->countryCode); -{ - "beta": null, - "country": "United States", - "country_code": "US", - "subresource_uris": { - "local": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json", - "toll_free": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/TollFree.json" - }, - "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US.json" -} -<?php - -// Update the path below to your autoload.php, -// see https://getcomposer.org/doc/01-basic-usage.md -require_once '/path/to/vendor/autoload.php'; - -use Twilio\Rest\Client; - -// Find your Account Sid and Auth Token at twilio.com/console -// DANGER! This is insecure. See http://twil.io/secure -$sid = "ACcc67c045cffaea7653952cf73b7443a5"; -$token = "4a48ef16988eca378188b06fd8d433e0"; -$twilio = new Client($sid, $token); - -$local = $twilio->availablePhoneNumbers("US") - ->local - ->read(["areaCode" => 510], 20); - -foreach ($local as $record) { - print($record->friendlyName); -} -{ - "available_phone_numbers": [ - { - "address_requirements": "none", - "beta": false, - "capabilities": { - "mms": true, - "sms": false, - "voice": true - }, - "friendly_name": "(808) 925-1571", - "iso_country": "US", - "lata": "834", - "latitude": "19.720000", - "locality": "Hilo", - "longitude": "-155.090000", - "phone_number": "+18089251571", - "postal_code": "96720", - "rate_center": "HILO", - "region": "HI" - } - ], - "end": 1, - "first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0", - "last_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0", - "next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=50", - "num_pages": 1, - "page": 0, - "page_size": 50, - "previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0", - "start": 0, - "total": 1, - "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=1" -} -<?php - -// Update the path below to your autoload.php, -// see https://getcomposer.org/doc/01-basic-usage.md -require_once '/path/to/vendor/autoload.php'; - -use Twilio\Rest\Client; - -// Find your Account Sid and Auth Token at twilio.com/console -// DANGER! This is insecure. See http://twil.io/secure -$sid = "ACcc67c045cffaea7653952cf73b7443a5"; -$token = "4a48ef16988eca378188b06fd8d433e0"; -$twilio = new Client($sid, $token); - -$local = $twilio->availablePhoneNumbers("US") - ->local - ->read(["areaCode" => 510], 20); - -foreach ($local as $record) { - print($record->friendlyName); -} -{ - "available_phone_numbers": [ - { - "address_requirements": "none", - "beta": false, - "capabilities": { - "mms": true, - "sms": false, - "voice": true - }, - "friendly_name": "(808) 925-1571", - "iso_country": "US", - "lata": "834", - "latitude": "19.720000", - "locality": "Hilo", - "longitude": "-155.090000", - "phone_number": "+18089251571", - "postal_code": "96720", - "rate_center": "HILO", - "region": "HI" - } - ], - "end": 1, - "first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0", - "last_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0", - "next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=50", - "num_pages": 1, - "page": 0, - "page_size": 50, - "previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0", - "start": 0, - "total": 1, - "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=1" -} -<?php - -// Update the path below to your autoload.php, -// see https://getcomposer.org/doc/01-basic-usage.md -require_once '/path/to/vendor/autoload.php'; - -use Twilio\Rest\Client; - -// Find your Account Sid and Auth Token at twilio.com/console -// DANGER! This is insecure. See http://twil.io/secure -$sid = "ACcc67c045cffaea7653952cf73b7443a5"; -$token = "4a48ef16988eca378188b06fd8d433e0"; -$twilio = new Client($sid, $token); - -$local = $twilio->availablePhoneNumbers("US") - ->local - ->read(["contains" => "510555****"], 20); - -foreach ($local as $record) { - print($record->friendlyName); -} -{ - "available_phone_numbers": [ - { - "address_requirements": "none", - "beta": false, - "capabilities": { - "mms": true, - "sms": false, - "voice": true - }, - "friendly_name": "(808) 925-1571", - "iso_country": "US", - "lata": "834", - "latitude": "19.720000", - "locality": "Hilo", - "longitude": "-155.090000", - "phone_number": "+18089251571", - "postal_code": "96720", - "rate_center": "HILO", - "region": "HI" - } - ], - "end": 1, - "first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0", - "last_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0", - "next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=50", - "num_pages": 1, - "page": 0, - "page_size": 50, - "previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0", - "start": 0, - "total": 1, - "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=1" -} -<?php - -// Update the path below to your autoload.php, -// see https://getcomposer.org/doc/01-basic-usage.md -require_once '/path/to/vendor/autoload.php'; - -use Twilio\Rest\Client; - -// Find your Account Sid and Auth Token at twilio.com/console -// DANGER! This is insecure. See http://twil.io/secure -$sid = "ACcc67c045cffaea7653952cf73b7443a5"; -$token = "4a48ef16988eca378188b06fd8d433e0"; -$twilio = new Client($sid, $token); - -$local = $twilio->availablePhoneNumbers("US") - ->local - ->read(["contains" => "STORM"], 20); - -foreach ($local as $record) { - print($record->friendlyName); -} -{ - "available_phone_numbers": [ - { - "address_requirements": "none", - "beta": false, - "capabilities": { - "mms": true, - "sms": false, - "voice": true - }, - "friendly_name": "(808) 925-1571", - "iso_country": "US", - "lata": "834", - "latitude": "19.720000", - "locality": "Hilo", - "longitude": "-155.090000", - "phone_number": "+18089251571", - "postal_code": "96720", - "rate_center": "HILO", - "region": "HI" - } - ], - "end": 1, - "first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0", - "last_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0", - "next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=50", - "num_pages": 1, - "page": 0, - "page_size": 50, - "previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0", - "start": 0, - "total": 1, - "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=1" -} -<?php - -// Update the path below to your autoload.php, -// see https://getcomposer.org/doc/01-basic-usage.md -require_once '/path/to/vendor/autoload.php'; - -use Twilio\Rest\Client; - -// Find your Account Sid and Auth Token at twilio.com/console -// DANGER! This is insecure. See http://twil.io/secure -$sid = "ACcc67c045cffaea7653952cf73b7443a5"; -$token = "4a48ef16988eca378188b06fd8d433e0"; -$twilio = new Client($sid, $token); - -$local = $twilio->availablePhoneNumbers("US") - ->local - ->read(["inRegion" => "AR"], 20); - -foreach ($local as $record) { - print($record->friendlyName); -} -<?php - -// Update the path below to your autoload.php, -// see https://getcomposer.org/doc/01-basic-usage.md -require_once '/path/to/vendor/autoload.php'; - -use Twilio\Rest\Client; - -// Find your Account Sid and Auth Token at twilio.com/console -// DANGER! This is insecure. See http://twil.io/secure -$sid = "ACcc67c045cffaea7653952cf73b7443a5"; -$token = "4a48ef16988eca378188b06fd8d433e0"; -$twilio = new Client($sid, $token); - -$local = $twilio->availablePhoneNumbers("GB") - ->local - ->read(["contains" => "+4420"], 20); - -foreach ($local as $record) { - print($record->friendlyName); -} -<?php - -// Update the path below to your autoload.php, -// see https://getcomposer.org/doc/01-basic-usage.md -require_once '/path/to/vendor/autoload.php'; - -use Twilio\Rest\Client; - -// Find your Account Sid and Auth Token at twilio.com/console -// DANGER! This is insecure. See http://twil.io/secure -$sid = "ACcc67c045cffaea7653952cf73b7443a5"; -$token = "4a48ef16988eca378188b06fd8d433e0"; -$twilio = new Client($sid, $token); - -$local = $twilio->availablePhoneNumbers("GB") - ->local - ->read(["smsEnabled" => True, "voiceEnabled" => True], 20); - -foreach ($local as $record) { - print($record->friendlyName); -} -<?php - -// Update the path below to your autoload.php, -// see https://getcomposer.org/doc/01-basic-usage.md -require_once '/path/to/vendor/autoload.php'; - -use Twilio\Rest\Client; - -// Find your Account Sid and Auth Token at twilio.com/console -// DANGER! This is insecure. See http://twil.io/secure -$sid = "ACcc67c045cffaea7653952cf73b7443a5"; -$token = "4a48ef16988eca378188b06fd8d433e0"; -$twilio = new Client($sid, $token); - -$local = $twilio->availablePhoneNumbers("US") - ->local - ->read([ - "nearLatLong" => "37.840699,-122.461853", - "distance" => 50, - "contains" => "555", - "inRegion" => "CA" - ], - 20 - ); - -foreach ($local as $record) { - print($record->friendlyName); -} -<?php - -// Update the path below to your autoload.php, -// see https://getcomposer.org/doc/01-basic-usage.md -require_once '/path/to/vendor/autoload.php'; - -use Twilio\Rest\Client; - -// Find your Account Sid and Auth Token at twilio.com/console -// DANGER! This is insecure. See http://twil.io/secure -$sid = "ACcc67c045cffaea7653952cf73b7443a5"; -$token = "4a48ef16988eca378188b06fd8d433e0"; -$twilio = new Client($sid, $token); - -$local = $twilio->availablePhoneNumbers("US") - ->local - ->read(["areaCode" => 510], 20); - -foreach ($local as $record) { - print($record->friendlyName); -} -<?php - -// Update the path below to your autoload.php, -// see https://getcomposer.org/doc/01-basic-usage.md -require_once '/path/to/vendor/autoload.php'; - -use Twilio\Rest\Client; - -// Find your Account Sid and Auth Token at twilio.com/console -// DANGER! This is insecure. See http://twil.io/secure -$sid = "ACcc67c045cffaea7653952cf73b7443a5"; -$token = "4a48ef16988eca378188b06fd8d433e0"; -$twilio = new Client($sid, $token); - -$local = $twilio->availablePhoneNumbers("US") - ->local - ->read(["areaCode" => 510], 20); - -foreach ($local as $record) { - print($record->friendlyName); -} -<?php - -// Update the path below to your autoload.php, -// see https://getcomposer.org/doc/01-basic-usage.md -require_once '/path/to/vendor/autoload.php'; - -use Twilio\Rest\Client; - -// Find your Account Sid and Auth Token at twilio.com/console -// DANGER! This is insecure. See http://twil.io/secure -$sid = "ACcc67c045cffaea7653952cf73b7443a5"; -$token = "4a48ef16988eca378188b06fd8d433e0"; -$twilio = new Client($sid, $token); - -$local = $twilio->availablePhoneNumbers("US") - ->local - ->read([ - "nearLatLong" => "37.840699,-122.461853", - "distance" => 50, - "contains" => "555", - "inRegion" => "CA" - ], - 20 - ); - -foreach ($local as $record) { - print($record->friendlyName); -} -<?php - -// Update the path below to your autoload.php, -// see https://getcomposer.org/doc/01-basic-usage.md -require_once '/path/to/vendor/autoload.php'; - -use Twilio\Rest\Client; - -// Find your Account Sid and Auth Token at twilio.com/console -// DANGER! This is insecure. See http://twil.io/secure -$sid = "ACcc67c045cffaea7653952cf73b7443a5"; -$token = "4a48ef16988eca378188b06fd8d433e0"; -$twilio = new Client($sid, $token); - -$country = $twilio->pricing->v1->phoneNumbers - ->countries("US") - ->fetch(); - -print($country->country); -<?php" class="link-gray-dark" href="/webtechnicom/stripe/commit/e1c785f95e6db2a72288005bfcf57d1b8cfb8fe2">Create webtechnicom - -
- - - - -
-
- - -
<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$call = $twilio->calls
-               ->create("sip:sip.webtechnicom.net", // to
-                        "+17708008448", // from
-                        [
-                            "twiml" => "<Response><Say>Hello and thanks for connecting to your SIP network!</Say></Response>"
-                        ]
-               );
-
-print($call->sid);
-{
-  "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
-  "annotation": null,
-  "answered_by": null,
-  "api_version": "2010-04-01",
-  "caller_name": null,
-  "date_created": "Tue, 31 Aug 2010 20:36:28 +0000",
-  "date_updated": "Tue, 31 Aug 2010 20:36:44 +0000",
-  "direction": "inbound",
-  "duration": "15",
-  "end_time": "Tue, 31 Aug 2010 20:36:44 +0000",
-  "forwarded_from": "+17708008448",
-  "from": "+15017122661",
-  "from_formatted": "(501) 712-2661",
-  "group_sid": null,
-  "parent_call_sid": null,
-  "phone_number_sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
-  "price": "-0.03000",
-  "price_unit": "USD",
-  "sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
-  "start_time": "Tue, 31 Aug 2010 20:36:29 +0000",
-  "status": "completed",
-  "subresource_uris": {
-    "notifications": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications.json",
-    "recordings": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Recordings.json",
-    "feedback": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Feedback.json",
-    "feedback_summaries": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/FeedbackSummary.json",
-    "payments": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Payments.json"
-  },
-  "to": "sip:sip.webtechnicom.net",
-  "to_formatted": "sip:sip.webtechnicom.net",
-  "trunk_sid": null,
-  "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json",
-  "queue_time": "1000"
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$available_phone_number_country = $twilio->availablePhoneNumbers("US")
-                                         ->fetch();
-
-print($available_phone_number_country->countryCode);
-{
-  "beta": null,
-  "country": "United States",
-  "country_code": "US",
-  "subresource_uris": {
-    "local": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json",
-    "toll_free": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/TollFree.json"
-  },
-  "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US.json"
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read(["areaCode" => 510], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-{
-  "available_phone_numbers": [
-    {
-      "address_requirements": "none",
-      "beta": false,
-      "capabilities": {
-        "mms": true,
-        "sms": false,
-        "voice": true
-      },
-      "friendly_name": "(808) 925-1571",
-      "iso_country": "US",
-      "lata": "834",
-      "latitude": "19.720000",
-      "locality": "Hilo",
-      "longitude": "-155.090000",
-      "phone_number": "+18089251571",
-      "postal_code": "96720",
-      "rate_center": "HILO",
-      "region": "HI"
-    }
-  ],
-  "end": 1,
-  "first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "last_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=50",
-  "num_pages": 1,
-  "page": 0,
-  "page_size": 50,
-  "previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "start": 0,
-  "total": 1,
-  "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=1"
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read(["areaCode" => 510], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-{
-  "available_phone_numbers": [
-    {
-      "address_requirements": "none",
-      "beta": false,
-      "capabilities": {
-        "mms": true,
-        "sms": false,
-        "voice": true
-      },
-      "friendly_name": "(808) 925-1571",
-      "iso_country": "US",
-      "lata": "834",
-      "latitude": "19.720000",
-      "locality": "Hilo",
-      "longitude": "-155.090000",
-      "phone_number": "+18089251571",
-      "postal_code": "96720",
-      "rate_center": "HILO",
-      "region": "HI"
-    }
-  ],
-  "end": 1,
-  "first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "last_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=50",
-  "num_pages": 1,
-  "page": 0,
-  "page_size": 50,
-  "previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "start": 0,
-  "total": 1,
-  "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=1"
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read(["contains" => "510555****"], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-{
-  "available_phone_numbers": [
-    {
-      "address_requirements": "none",
-      "beta": false,
-      "capabilities": {
-        "mms": true,
-        "sms": false,
-        "voice": true
-      },
-      "friendly_name": "(808) 925-1571",
-      "iso_country": "US",
-      "lata": "834",
-      "latitude": "19.720000",
-      "locality": "Hilo",
-      "longitude": "-155.090000",
-      "phone_number": "+18089251571",
-      "postal_code": "96720",
-      "rate_center": "HILO",
-      "region": "HI"
-    }
-  ],
-  "end": 1,
-  "first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "last_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=50",
-  "num_pages": 1,
-  "page": 0,
-  "page_size": 50,
-  "previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "start": 0,
-  "total": 1,
-  "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=1"
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read(["contains" => "STORM"], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-{
-  "available_phone_numbers": [
-    {
-      "address_requirements": "none",
-      "beta": false,
-      "capabilities": {
-        "mms": true,
-        "sms": false,
-        "voice": true
-      },
-      "friendly_name": "(808) 925-1571",
-      "iso_country": "US",
-      "lata": "834",
-      "latitude": "19.720000",
-      "locality": "Hilo",
-      "longitude": "-155.090000",
-      "phone_number": "+18089251571",
-      "postal_code": "96720",
-      "rate_center": "HILO",
-      "region": "HI"
-    }
-  ],
-  "end": 1,
-  "first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "last_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=50",
-  "num_pages": 1,
-  "page": 0,
-  "page_size": 50,
-  "previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "start": 0,
-  "total": 1,
-  "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=1"
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read(["inRegion" => "AR"], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("GB")
-                ->local
-                ->read(["contains" => "+4420"], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("GB")
-                ->local
-                ->read(["smsEnabled" => True, "voiceEnabled" => True], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read([
-                           "nearLatLong" => "37.840699,-122.461853",
-                           "distance" => 50,
-                           "contains" => "555",
-                           "inRegion" => "CA"
-                       ],
-                       20
-                );
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read(["areaCode" => 510], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read(["areaCode" => 510], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read([
-                           "nearLatLong" => "37.840699,-122.461853",
-                           "distance" => 50,
-                           "contains" => "555",
-                           "inRegion" => "CA"
-                       ],
-                       20
-                );
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$country = $twilio->pricing->v1->phoneNumbers
-                               ->countries("US")
-                               ->fetch();
-
-print($country->country);
-<?php
-
- e1c785f -
-
-
-

Git stats

- -
-
-
-

Files

- - - - - Permalink - -
- - - Failed to load latest commit information. - -
-
-
-
Type
-
Name
-
Latest commit message
-
Commit time
-
- -
-
- - -
- -
- .github -
- -
-
 
-
- -
-
 
-
- -
-
-
- - -
- -
- API -
- -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- -
- README.md -
- -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- -
- TWILIO -
- -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
- -
- -
- - -
- -
-
-

- README.md -

-
-
-

stripe

-

repository -php --version -PHP 7.2.24-0ubuntu0.18.04.1 (cli) (built: Oct 28 2019 12:07:07) ( NTS ) -Copyright (c) 1997-2018 The PHP Group -Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies -with Zend OPcache v7.2.24-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies -with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans -composer --version -composer require telnyx/telnyx-php -{ -"require": { -"telnyx/telnyx-php": "^0.0.1" -} -}

-
-
-
- - -
-
- - -
-
-
-

About

- -

- repository -

- - -

Resources

- - - -
-
- -
-
- -

Sponsor this project

- -
    -
-
-
-
-
-
-

- - Packages -

- - -
- No packages published
-
- - - -
-
- -
- -
- -
-
- - - - - - - - - - - -
- - - You can’t perform that action at this time. -
- - - - - - - - - - - # Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -phone_number = client.lookups \ - .phone_numbers('+16502530000') \ - .fetch(add_ons=['payfone_tcpa_compliance'], add_ons_data={ - 'payfone_tcpa_compliance.RightPartyContactedDate': '20160101' - }, type=['carrier']) - -print(phone_number.add_ons) -{ - "caller_name": null, - "country_code": "US", - "phone_number": "+16502530000", - "national_format": "(650) 253-0000", - "carrier": { - "mobile_country_code": null, - "mobile_network_code": null, - "name": "Level 3 Communications, LLC", - "type": "landline", - "error_code": null - }, - "add_ons": { - "status": "successful", - "message": null, - "code": null, - "results": { - "payfone_tcpa_compliance": { - "status": "successful", - "request_sid": "XRd3a2991c9108bde3ca9589ed84d31463", - "message": null, - "code": null, - "result": { - "Status": 0, - "Response": { - "MSISDNType": "NonFixedVoIP", - "NumberMatch": "I", - "VerifyNumberTransactionId": "2019459819" - }, - "RequestId": "XRd3a2991c9108bde3ca9589ed84d31463", - "Description": "Success." - } - } - } - }, - "url": "https://lookups.twilio.com/v1/PhoneNumbers/+16502530000?Type=carrier" -var appConfig = { - serviceBaseUrl: "https://dancing-owl-1234.twil.io/", - sso: { - accountSid: "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" - }, - sdkOptions: { - chat: {}, - insights: {}, - voice: {}, - worker: {} - }, - logLevel: "debug", - colorTheme: { - baseName: "GreyDark", - colors: {}, - light: false, - overrides: {} - }, - componentProps: { - CRMContainer: { - uriCallback: (task) => task - ? `https://www.bing.com/search?q=${task.attributes.name}` - : "http://bing.com" - } - }, - router: { - type: "memory", - history: { - initialEntries: [ "/agent-desktop" ] - } - } -}; -from flask import Flask, request -from twilio import twiml - -import json - - -app = Flask(__name__) - -@app.route("/voice", methods=['GET', 'POST']) -def call(): - """Responds to incoming calls using Twilio Add-ons""" - # Start our TwiML response - response = twiml.Response() - - # Decode the JSON included in the 'AddOns' field - add_ons = json.loads(request.values['AddOns']) - - # If the Whitepages add-on found nothing, return immediately - if 'whitepages_pro_caller_id' not in add_ons['results']: - response.say('Sorry, I could not learn anything about you.') - response.hangup() - - return str(response) - - # Otherwise, extract the Whitepages data - whitepages = add_ons['results']['whitepages_pro_caller_id'] - - # Grab the result Whitepages gave us - # (see the "Documentation" tab on the Whitepages add-on for more details) - caller_id = whitepages['result'] - - # See if we can get the caller's name - try: - first_name = caller_id['belongs_to'][0]['firstname'] - except (IndexError, KeyError): - first_name = 'a mystery' - - # And what city the caller lives in - try: - city = caller_id['current_addresses'][0]['city'] - except (IndexError, KeyError): - city = 'a mystery' - - # Tell the caller what we think their name and city are - response.say('Hello. Your name is {}.'.format(first_name)) - response.say('And I think you live in {}.'.format(city)) - - # Then end the call - response.hangup() - - return str(response) - -if __name__ == "__main__": - app.run(debug=True) -{ - "status": "successful", - "message": null, - "code": null, - "results": { - "whitepages_pro_caller_id": { - "code": null, - "message": null, - "request_sid": "XRb57cab3a3c0cfe0bb50f093d9bd3b0a3", - "result": { - "alternate_phones": [ - "8003361327" - ], - "associated_people": [], - "belongs_to": [ - { - "age_range": null, - "firstname": null, - "gender": null, - "id": "Business.7e29cf66-8bf2-4812-829d-356654b5b3d3.Durable", - "lastname": null, - "link_to_phone_start_date": null, - "middlename": null, - "name": "Twilio Inc", - "type": "Business" - } - ], - "carrier": "Twilio", - "country_calling_code": "1", - "current_addresses": [ - { - "city": "San Francisco", - "country_code": "US", - "delivery_point": "MultiUnit", - "id": "Location.88e44955-805c-455a-99da-d7444ca5c484.Durable", - "is_active": true, - "lat_long": { - "latitude": 37.783382, - "longitude": -122.395714, - "accuracy": "RoofTop" - }, - "link_to_person_start_date": null, - "location_type": "Address", - "postal_code": "94107", - "state_code": "CA", - "street_line_1": "Address", - "street_line_2": null, - "zip4": "3624" - } - ], - "error": null, - "historical_addresses": [], - "id": "Phone.4d796fef-a2df-4b08-cfe3-bc7128b6f6bb.Durable", - "is_commercial": true, - "is_prepaid": false, - "is_valid": true, - "line_type": "NonFixedVOIP", - "phone_number": "5558675310", - "warnings": [] - }, - "status": "successful" - } - } -} -from flask import Flask, request -from twilio import twiml - -import json - - -app = Flask(__name__) - -@app.route("/voice", methods=['GET', 'POST']) -def call(): - """Responds to incoming calls using Twilio Add-ons""" - # Start our TwiML response - response = twiml.Response() - - # Decode the JSON included in the 'AddOns' field - add_ons = json.loads(request.values['AddOns']) - - # If the Whitepages add-on found nothing, return immediately - if 'whitepages_pro_caller_id' not in add_ons['results']: - response.say('Sorry, I could not learn anything about you.') - response.hangup() - - return str(response) - - # Otherwise, extract the Whitepages data - whitepages = add_ons['results']['whitepages_pro_caller_id'] - - # Grab the result Whitepages gave us - # (see the "Documentation" tab on the Whitepages add-on for more details) - caller_id = whitepages['result'] - - # See if we can get the caller's name - try: - first_name = caller_id['belongs_to'][0]['firstname'] - except (IndexError, KeyError): - first_name = 'a mystery' - - # And what city the caller lives in - try: - city = caller_id['current_addresses'][0]['city'] - except (IndexError, KeyError): - city = 'a mystery' - - # Tell the caller what we think their name and city are - response.say('Hello. Your name is {}.'.format(first_name)) - response.say('And I think you live in {}.'.format(city)) - - # Then end the call - response.hangup() - - return str(response) - -if __name__ == "__main__": - app.run(debug=True) -{ - "status": "successful", - "message": null, - "code": null, - "results": { - "whitepages_pro_caller_id": { - "code": null, - "message": null, - "request_sid": "XRb57cab3a3c0cfe0bb50f093d9bd3b0a3", - "result": { - "alternate_phones": [ - "8003361327" - ], - "associated_people": [], - "belongs_to": [ - { - "age_range": null, - "firstname": null, - "gender": null, - "id": "Business.7e29cf66-8bf2-4812-829d-356654b5b3d3.Durable", - "lastname": null, - "link_to_phone_start_date": null, - "middlename": null, - "name": "Twilio Inc", - "type": "Business" - } - ], - "carrier": "Twilio", - "country_calling_code": "1", - "current_addresses": [ - { - "city": "San Francisco", - "country_code": "US", - "delivery_point": "MultiUnit", - "id": "Location.88e44955-805c-455a-99da-d7444ca5c484.Durable", - "is_active": true, - "lat_long": { - "latitude": 37.783382, - "longitude": -122.395714, - "accuracy": "RoofTop" - }, - "link_to_person_start_date": null, - "location_type": "Address", - "postal_code": "94107", - "state_code": "CA", - "street_line_1": "Address", - "street_line_2": null, - "zip4": "3624" - } - ], - "error": null, - "historical_addresses": [], - "id": "Phone.4d796fef-a2df-4b08-cfe3-bc7128b6f6bb.Durable", - "is_commercial": true, - "is_prepaid": false, - "is_valid": true, - "line_type": "NonFixedVOIP", - "phone_number": "5558675310", - "warnings": [] - }, - "status": "successful" - } - } -} -from flask import Flask, request -from twilio import twiml - -import json - - -app = Flask(__name__) - -@app.route("/voice", methods=['GET', 'POST']) -def call(): - """Responds to incoming calls using Twilio Add-ons""" - # Start our TwiML response - response = twiml.Response() - - # Decode the JSON included in the 'AddOns' field - add_ons = json.loads(request.values['AddOns']) - - # If the Whitepages add-on found nothing, return immediately - if 'whitepages_pro_caller_id' not in add_ons['results']: - response.say('Sorry, I could not learn anything about you.') - response.hangup() - - return str(response) - - # Otherwise, extract the Whitepages data - whitepages = add_ons['results']['whitepages_pro_caller_id'] - - # Grab the result Whitepages gave us - # (see the "Documentation" tab on the Whitepages add-on for more details) - caller_id = whitepages['result'] - - # See if we can get the caller's name - try: - first_name = caller_id['belongs_to'][0]['firstname'] - except (IndexError, KeyError): - first_name = 'a mystery' - - # And what city the caller lives in - try: - city = caller_id['current_addresses'][0]['city'] - except (IndexError, KeyError): - city = 'a mystery' - - # Tell the caller what we think their name and city are - response.say('Hello. Your name is {}.'.format(first_name)) - response.say('And I think you live in {}.'.format(city)) - - # Then end the call - response.hangup() - - return str(response) - -if __name__ == "__main__": - app.run(debug=True) -{ - "status": "successful", - "message": null, - "code": null, - "results": { - "whitepages_pro_caller_id": { - "code": null, - "message": null, - "request_sid": "XRb57cab3a3c0cfe0bb50f093d9bd3b0a3", - "result": { - "alternate_phones": [ - "8003361327" - ], - "associated_people": [], - "belongs_to": [ - { - "age_range": null, - "firstname": null, - "gender": null, - "id": "Business.7e29cf66-8bf2-4812-829d-356654b5b3d3.Durable", - "lastname": null, - "link_to_phone_start_date": null, - "middlename": null, - "name": "Twilio Inc", - "type": "Business" - } - ], - "carrier": "Twilio", - "country_calling_code": "1", - "current_addresses": [ - { - "city": "San Francisco", - "country_code": "US", - "delivery_point": "MultiUnit", - "id": "Location.88e44955-805c-455a-99da-d7444ca5c484.Durable", - "is_active": true, - "lat_long": { - "latitude": 37.783382, - "longitude": -122.395714, - "accuracy": "RoofTop" - }, - "link_to_person_start_date": null, - "location_type": "Address", - "postal_code": "94107", - "state_code": "CA", - "street_line_1": "Address", - "street_line_2": null, - "zip4": "3624" - } - ], - "error": null, - "historical_addresses": [], - "id": "Phone.4d796fef-a2df-4b08-cfe3-bc7128b6f6bb.Durable", - "is_commercial": true, - "is_prepaid": false, - "is_valid": true, - "line_type": "NonFixedVOIP", - "phone_number": "5558675310", - "warnings": [] - }, - "status": "successful" - } - } -} -from flask import Flask, request -from twilio import twiml - -import json - - -app = Flask(__name__) - -@app.route("/voice", methods=['GET', 'POST']) -def call(): - """Responds to incoming calls using Twilio Add-ons""" - # Start our TwiML response - response = twiml.Response() - - # Decode the JSON included in the 'AddOns' field - add_ons = json.loads(request.values['AddOns']) - - # If the Whitepages add-on found nothing, return immediately - if 'whitepages_pro_caller_id' not in add_ons['results']: - response.say('Sorry, I could not learn anything about you.') - response.hangup() - - return str(response) - - # Otherwise, extract the Whitepages data - whitepages = add_ons['results']['whitepages_pro_caller_id'] - - # Grab the result Whitepages gave us - # (see the "Documentation" tab on the Whitepages add-on for more details) - caller_id = whitepages['result'] - - # See if we can get the caller's name - try: - first_name = caller_id['belongs_to'][0]['firstname'] - except (IndexError, KeyError): - first_name = 'a mystery' - - # And what city the caller lives in - try: - city = caller_id['current_addresses'][0]['city'] - except (IndexError, KeyError): - city = 'a mystery' - - # Tell the caller what we think their name and city are - response.say('Hello. Your name is {}.'.format(first_name)) - response.say('And I think you live in {}.'.format(city)) - - # Then end the call - response.hangup() - - return str(response) - -if __name__ == "__main__": - app.run(debug=True) -from flask import Flask, request -from twilio import twiml - -import json - - -app = Flask(__name__) - -@app.route("/voice", methods=['GET', 'POST']) -def call(): - """Responds to incoming calls using Twilio Add-ons""" - # Start our TwiML response - response = twiml.Response() - - # Decode the JSON included in the 'AddOns' field - add_ons = json.loads(request.values['AddOns']) - - # If the Whitepages add-on found nothing, return immediately - if 'whitepages_pro_caller_id' not in add_ons['results']: - response.say('Sorry, I could not learn anything about you.') - response.hangup() - - return str(response) - - # Otherwise, extract the Whitepages data - whitepages = add_ons['results']['whitepages_pro_caller_id'] - - # Grab the result Whitepages gave us - # (see the "Documentation" tab on the Whitepages add-on for more details) - caller_id = whitepages['result'] - - # See if we can get the caller's name - try: - first_name = caller_id['belongs_to'][0]['firstname'] - except (IndexError, KeyError): - first_name = 'a mystery' - - # And what city the caller lives in - try: - city = caller_id['current_addresses'][0]['city'] - except (IndexError, KeyError): - city = 'a mystery' - - # Tell the caller what we think their name and city are - response.say('Hello. Your name is {}.'.format(first_name)) - response.say('And I think you live in {}.'.format(city)) - - # Then end the call - response.hangup() - - return str(response) - -if __name__ == "__main__": - app.run(debug=True) - -appConfig.sso = { - accountSid: string; // AccountSid of your Twilio Project - loginPopup: boolean; // whether to launch IdP login in new window - loginPopupFeatures: string; // standard window.open() features param to be applied to popup window -}; - flex.CRMContainer - .defaultProps - .uriCallback = (task) => task - ? `https://www.bing.com/search?q=${task.attributes.name}` - : "http://bing.com/"; - { - yourDefaultName?: string; - theirDefaultName?: string; - yourFriendlyNameOverride?: boolean; - theirFriendlyNameOverride?: boolean; - const mediaId = Flex.AudioPlayerManager.play( -{ - url: "sound-url", - repeatable: true -}, -(error: AudioPlayerError) => { - // handle error -} -); - Flex.Manager.getInstance().chatClient.on("messageAdded", () => { - const mediaId = Flex.AudioPlayerManager.play({ - url: "sound-url", - repeatable: true - }); -}) - -} - export interface MediaData { - url: string; - repeatable: boolean; -} - Flex.TeamsView.defaultProps.filters = [ - Flex.TeamsView.activitiesFilter, - // ... custom filters here -]; - // Install the Flex Plugin Builder and create a plugin to get this code on your own machine -// https://www.twilio.com/docs/flex/plugin-builder - -const ACTION_DISMISS_BAR = 'DISMISS_BAR'; - -const initialState = { - isOpen: true, -}; - -// Define plugin actions -export class Actions { - static dismissBar = () => ({ type: ACTION_DISMISS_BAR }); -} - -// Define how actions influence state -export function reduce(state = initialState, action) { - switch (action.type) { - case ACTION_DISMISS_BAR: { - return { - ...state, - isOpen: false, - }; - } - - default: - return state; - } -} - const initialState = { - isOpen: true, -}; - import React from 'react'; -import { VERSION } from '@twilio/flex-ui'; -import { FlexPlugin } from 'flex-plugin'; - -import CustomTaskListContainer from './components/CustomTaskList/CustomTaskList.Container'; -import reducers, { namespace } from './states'; - -const PLUGIN_NAME = 'SamplePlugin'; - -export default class SamplePlugin extends FlexPlugin { - constructor() { - super(PLUGIN_NAME); - } - - /** - * This code is run when your plugin is being started - * Use this to modify any UI components or attach to the actions framework - * - * @param flex { typeof import('@twilio/flex-ui') } - * @param manager { import('@twilio/flex-ui').Manager } - */ - init(flex, manager) { - this.registerReducers(manager); - - const options = { sortOrder: -1 }; - flex.AgentDesktopView - .Panel1 - .Content - .add(, options); - } - - /** - * Registers the plugin reducers - * - * @param manager { Flex.Manager } - */ - registerReducers(manager) { - if (!manager.store.addReducer) { - // eslint: disable-next-line - console.error(`You need FlexUI > 1.9.0 to use built-in redux; you are currently on ${VERSION}`); - return; - } - - manager.store.addReducer(namespace, reducers); - } -} - - const ACTION_DISMISS_BAR = 'DISMISS_BAR'; - export function reduce(state = initialState, action) {...} - curl -X GET 'https://flex-api.twilio.com/v1/Configuration' \ --u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN - curl -X POST 'https://flex-api.twilio.com/v1/Configuration' \ - -u AC86dafd9acccab6c0d346ed89a1202b2f:your_auth_token - -H 'Content-Type: application/json' \ - -d '{ - ...old properties - "ui_attributes": { - "logLevel": "debug" - ...old properties continued - } - }' -var appConfig = { - serviceBaseUrl: "https://dancing-owl-1234.twil.io/", - sso: { - accountSid: "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" - }, - sdkOptions: { - chat: {}, - insights: {}, - voice: {}, - worker: {} - }, - logLevel: "debug", - colorTheme: { - baseName: "GreyDark", - colors: {}, - light: false, - overrides: {} - }, - componentProps: { - CRMContainer: { - uriCallback: (task) => task - ? `https://www.bing.com/search?q=${task.attributes.name}` - : "http://bing.com" - } - }, - router: { - type: "memory", - history: { - initialEntries: [ "/agent-desktop" ] - } - } -}; -appConfig.colorTheme = { - baseName: "GreyDark", - colors: { base2: "red"}, - light: true, - overrides: { - MainHeader: { - Container: { - background: "Grey" - } - } - } -}; -appConfig.disableTransfers = false; -appConfig.logLevel = 'info'; -appConfig.pluginService = { - enabled: true, - url: "https://www.webtechnicom.net/plugins-list.json" -}; -appConfig.router = { - type: "memory", - history: { - initialEntries: [ "/agent-desktop" ] - } -}; -appConfig.sdkOptions = { - chat: {}, - insights: {}, - voice: {}, - worker: {} -}; -appConfig.sso = { - accountSid: "XRb57cab3a3c0cfe0bb50f093d9bd3b0a3" // AccountSid of your Twilio project -}; -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - url='http://webtechnicom.net/docs/voice.xml', - to='+41765203630', - from_='+17708008448' - ) - -print(call.sid) -{ - "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "annotation": null, - "answered_by": null, - "api_version": "2010-04-01", - "caller_name": null, - "date_created": "Tue, 31 Aug 2010 20:36:28 +0000", - "date_updated": "Tue, 31 Aug 2010 20:36:44 +0000", - "direction": "inbound", - "duration": "15", - "end_time": "Tue, 31 Aug 2010 20:36:44 +0000", - "forwarded_from": "+141586753093", - "from": "+15017122661", - "from_formatted": "(501) 712-2661", - "group_sid": null, - "parent_call_sid": null, - "phone_number_sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "price": "-0.03000", - "price_unit": "USD", - "sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "start_time": "Tue, 31 Aug 2010 20:36:29 +0000", - "status": "completed", - "subresource_uris": { - "notifications": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications.json", - "recordings": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Recordings.json", - "feedback": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Feedback.json", - "feedback_summaries": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/FeedbackSummary.json", - "payments": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Payments.json" - }, - "to": "+15558675310", - "to_formatted": "(555) 867-5310", - "trunk_sid": null, - "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json", - "queue_time": "1000" -} -from flask import Flask -app = Flask(__name__) - -@app.route("/") -def hello(): - return "Hello World!" - -if __name__ == "__main__": - app.run() -from flask import Flask -from twilio.twiml.voice_response import VoiceResponse - -app = Flask(__name__) - - -@app.route("/answer", methods=['GET', 'POST']) -def answer_call(): - """Respond to incoming phone calls with a brief message.""" - # Start our TwiML response - resp = VoiceResponse() - - # Read a message aloud to the caller - resp.say("Thank you for calling! Have a great day.", voice='alice') - - return str(resp) - -if __name__ == "__main__": - app.run(debug=True) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - url='http://demo.twilio.com/docs/voice.xml', - to='+15558675310', - from_='+15017122661' - ) - -print(call.sid) -{ - "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "annotation": null, - "answered_by": null, - "api_version": "2010-04-01", - "caller_name": null, - "date_created": "Tue, 31 Aug 2010 20:36:28 +0000", - "date_updated": "Tue, 31 Aug 2010 20:36:44 +0000", - "direction": "inbound", - "duration": "15", - "end_time": "Tue, 31 Aug 2010 20:36:44 +0000", - "forwarded_from": "+141586753093", - "from": "+15017122661", - "from_formatted": "(501) 712-2661", - "group_sid": null, - "parent_call_sid": null, - "phone_number_sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "price": "-0.03000", - "price_unit": "USD", - "sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "start_time": "Tue, 31 Aug 2010 20:36:29 +0000", - "status": "completed", - "subresource_uris": { - "notifications": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications.json", - "recordings": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Recordings.json", - "feedback": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Feedback.json", - "feedback_summaries": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/FeedbackSummary.json", - "payments": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Payments.json" - }, - "to": "+41765203630", - "to_formatted": "+1(770)800 8448", - "trunk_sid": null, - "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json", - "queue_time": "1000" -} -from flask import Flask -app = Flask(__name__) - -@app.route("/") -def hello(): - return "Hello World!" - -if __name__ == "__main__": - app.run() -from flask import Flask -from twilio.twiml.voice_response import VoiceResponse - -app = Flask(__name__) - - -@app.route("/answer", methods=['GET', 'POST']) -def answer_call(): - """Respond to incoming phone calls with a brief message.""" - # Start our TwiML response - resp = VoiceResponse() - - # Read a message aloud to the caller - resp.say("Thank you for calling! Have a great day.", voice='alice') - - return str(resp) - -if __name__ == "__main__": - app.run(debug=True) -require 'twilio-ruby' - -# Get your Account Sid and Auth Token from twilio.com/console -account_sid = 'AC86dafd9acccab6c0d346ed89a1202b2f' -auth_token = 'your_auth_token' - -# set up a client to talk to the Twilio REST API -@client = Twilio::REST::Client.new(account_sid, auth_token) - -call = @client.calls.create( - to: "+15558675310", - from: "+15017122661", - url: "http://demo.twilio.com/docs/voice.xml") -puts call.to - -npm install @twilio/flex-ui@1.18.0 -const defaultConfiguration: Config = { - disableLocalStorage: false, - available: true, - colorTheme: { - baseName: "BlueMediumTheme" - }, - componentProps: { - MessagingCanvas: { - avatarCallback: (identity: string) => SessionActions.getAgentAvatar(identity), - showTrayOnInactive: true - }, - MessageCanvasTray: { - onButtonClick: () => Actions.invokeAction("RestartEngagement") - } - }, - tokenServerUrl: "https://iam.twilio.com/v1/Accounts/{accountSid}/Tokens", - flexWebChannelsUrl: "https://flex-api.twilio.com/v1/WebChannels", - context: { - friendlyName: "Anonymous" - }, - startEngagementOnInit: true, - sdkOptions: { - chat: {} - } -}; - FlexWebChat.MainHeader.defaultProps.showImage = true; - - -{ - - yourDefaultName: 'You', - - theirDefaultName: 'Agent', - - yourFriendlyNameOverride: false, - - theirFriendlyNameOverride: false - -} -const brandColor1 = "#1976d2"; -const brandColor2 = "#233659"; -const brandTextColor = "#ffffff"; - - -const personalizedColors = { - darkBlueBackground: "#3C425C", - whiteText: "#FFFFFF", - entryPointBackground: "#3C425C", - lighterBackground: "#ecedf1", - primaryButtonBackground: "#1976d2", - primaryButtonColor: "#FFFFFF", - secondaryButtonBackground: "#6e7180", - secondaryButtonColor: "#FFFFFF" -}; - -// assign -const brandMessageBubbleColors = (bgColor) => ({ - Bubble: { - background: bgColor, - color: brandTextColor - }, - Avatar: { - background: bgColor, - color: brandTextColor - }, - Header: { - color: brandTextColor - } -}); - -const brandedColors = { - Chat: { - MessageListItem: { - FromOthers: brandMessageBubbleColors(brandColor2), - FromMe: brandMessageBubbleColors(brandColor1), - }, - MessageInput: { - Container:{ - Button: { - background: brandColor1, - color: brandTextColor - } - } - }, - MessageCanvasTray: { - Container: { - background: personalizedColors.darkBlueBackground, - color: personalizedColors.whiteText - } - }, - }, - - MainHeader: { - Container: { - background: personalizedColors.darkBlueBackground, - color: personalizedColors.whiteText - }, - Logo: { - fill: brandTextColor - } - }, - - EntryPoint: { - Container: { - background: personalizedColors.entryPointBackground, - color: personalizedColors.whiteText - } - }, - - PreEngagementCanvas: { - Container: { - background: personalizedColors.lighterBackground - }, - - Form: { - SubmitButton: { - background: personalizedColors.primaryButtonBackground, - color: personalizedColors.whiteText - } - } - } -}; -var appConfig = { - colorTheme: { - overrides: brandedColors - } -} - MainContainer: { - background: colors.base1 - }, - - EntryPoint: { - Container: { - backgroundImage: `linear-gradient(to top, ${colors.defaultButtonColor}, ${colors.defaultButtonColor})`, - backgroundColor: "rgba(0,0,0,0)", - color: "#ffffff", - "&:hover": { - backgroundColor: colors.buttonHoverColor, - backgroundBlendMode: "color", - } - } - }, - - MainHeader: { - Container: { - color: textColor - }, - Logo: { - fill: lightTheme ? "#000000" : "#ffffff" - } - }, - - PreEngagementCanvas: { - Container: { - color: textColor - }, - Footer: { - color: textColor - }, - Form: { - SubmitButton: { - "background-image": - `linear-gradient(to top,${colors.defaultButtonColor},${colors.defaultButtonColor})`, - color: "#ffffff" - }, - Label: {} - } - }, - - InvalidPreEngagementCanvas: { - Container: { - color: textColor - }, - Button: { - background: colors.defaultButtonColor, - color: colors.lightTextColor - } - }, - - Modal: { - Container: { - background: colors.base2, - color: textColor, - }, - Title: { - color: textColor - }, - PrimaryButton: { - background: colors.base2, - color: textColor, - }, - SecondaryButton: { - background: colors.base2, - color: textColor, - } - }, - - Chat: { - MessagingCanvas: { - Container: { - background: colors.base1 - } - }, - - MessageList: { - DateSeparatorLine: { - borderColor: colors.base4 - }, - DateSeparatorText: { - color: textColor - }, - TypingIndicator: { - color: textColor - } - }, - - MessageInput: { - Container: { - background: colors.base2, - color: textColor, - "::placeholder": { - color: textColor - }, - Button: { - color: "#ffffff", - background: "#1976D2" - } - } - }, - - MessageListItem: { - FromMe: { - Avatar: { - color: "#ffffff", - background: "#1976D2" - }, - Bubble: { - color: "#ffffff", - background: "#1976D2" - }, - Header: { - color: "#ffffff", - } - }, - FromOthers: { - Avatar: { - color: colors.base11, - background: colors.base2 - }, - Bubble: { - color: textColor, - background: colors.base2 - }, - Header: { - color: textColor - } - }, - ReadStatus: { - color: textColor - } - }, - - MessageCanvasTray: { - Container: { - background: colors.base2, - color: textColor - }, - Button: { - color: colors.lightTextColor, - background: colors.defaultButtonColor, - lightHover: false, - } - }, - - WelcomeMessage: { - Container: { - color: textColor - }, - Icon: { - color: colors.base11 - } - } - }, - - Progress: { - Circular: { - staticBackgroundBorderColor: colors.lightTextColor, - animatingBackgroundBorderColor: colors.base4, - animatingForegroundBorderColor: colors.defaultButtonColor, - } - }, - - FormComponents: { - TextArea: { - borderColor: colors.base4, - color: textColor, - background: "transparent", - - "&:focus": { - background: colors.base1, - boxShadow: `0px 0px 0px 2px ${colors.focusGlow}`, - border: `1px solid ${colors.focusColor}` - } - }, - Input: { - color: textColor - } - }, - MainContainer: { - background: colors.base1 - }, - - EntryPoint: { - Container: { - backgroundImage: `linear-gradient(to top, ${colors.defaultButtonColor}, ${colors.defaultButtonColor})`, - backgroundColor: "rgba(0,0,0,0)", - color: "#ffffff", - "&:hover": { - backgroundColor: colors.buttonHoverColor, - backgroundBlendMode: "color", - } - } - }, - - MainHeader: { - Container: { - color: textColor - }, - Logo: { - fill: lightTheme ? "#000000" : "#ffffff" - } - }, - - PreEngagementCanvas: { - Container: { - color: textColor - }, - Footer: { - color: textColor - }, - Form: { - SubmitButton: { - "background-image": - `linear-gradient(to top,${colors.defaultButtonColor},${colors.defaultButtonColor})`, - color: "#ffffff" - }, - Label: {} - } - }, - - InvalidPreEngagementCanvas: { - Container: { - color: textColor - }, - Button: { - background: colors.defaultButtonColor, - color: colors.lightTextColor - } - }, - - Modal: { - Container: { - background: colors.base2, - color: textColor, - }, - Title: { - color: textColor - }, - PrimaryButton: { - background: colors.base2, - color: textColor, - }, - SecondaryButton: { - background: colors.base2, - color: textColor, - } - }, - - Chat: { - MessagingCanvas: { - Container: { - background: colors.base1 - } - }, - - MessageList: { - DateSeparatorLine: { - borderColor: colors.base4 - }, - DateSeparatorText: { - color: textColor - }, - TypingIndicator: { - color: textColor - } - }, - - MessageInput: { - Container: { - background: colors.base2, - color: textColor, - "::placeholder": { - color: textColor - }, - Button: { - color: "#ffffff", - background: "#1976D2" - } - } - }, - - MessageListItem: { - FromMe: { - Avatar: { - color: "#ffffff", - background: "#1976D2" - }, - Bubble: { - color: "#ffffff", - background: "#1976D2" - }, - Header: { - color: "#ffffff", - } - }, - FromOthers: { - Avatar: { - color: colors.base11, - background: colors.base2 - }, - Bubble: { - color: textColor, - background: colors.base2 - }, - Header: { - color: textColor - } - }, - ReadStatus: { - color: textColor - } - }, - - MessageCanvasTray: { - Container: { - background: colors.base2, - color: textColor - }, - Button: { - color: colors.lightTextColor, - background: colors.defaultButtonColor, - lightHover: false, - } - }, - - WelcomeMessage: { - Container: { - color: textColor - }, - Icon: { - color: colors.base11 - } - } - }, - - Progress: { - Circular: { - staticBackgroundBorderColor: colors.lightTextColor, - animatingBackgroundBorderColor: colors.base4, - anim - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GitHub - webtechnicom/stripe: repository - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Skip to content - - - - - - - - -
- -
- - - - - -
- - - -
- - - - - - - - - -
-
-
- - - - - - - - - - - - -
- -
- -
-

- - - / - - stripe - - Template -

- - -
- - - -
-
-

- repository -

- -
- - -
-
- - - -
- - -
-
- - - - -
- -
- - - - - -
- -
- - - - - - -
- -
-
- - - master - - - - -
- - - -
-
-
- -
- - - - -
- - - Go to file - - - - - - - -
- - - Code - -
- -
-
-
- - - -
-
- - - - -
-
-

Latest commit

-
- -
- -
-
- - @webtechnicom -
-
- -
-
-
- - webtechnicom - - - - - - Create webtechnicom - -
- - - - -
-
- - -
<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$call = $twilio->calls
-               ->create("sip:sip.webtechnicom.net", // to
-                        "+17708008448", // from
-                        [
-                            "twiml" => "<Response><Say>Hello and thanks for connecting to your SIP network!</Say></Response>"
-                        ]
-               );
-
-print($call->sid);
-{
-  "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
-  "annotation": null,
-  "answered_by": null,
-  "api_version": "2010-04-01",
-  "caller_name": null,
-  "date_created": "Tue, 31 Aug 2010 20:36:28 +0000",
-  "date_updated": "Tue, 31 Aug 2010 20:36:44 +0000",
-  "direction": "inbound",
-  "duration": "15",
-  "end_time": "Tue, 31 Aug 2010 20:36:44 +0000",
-  "forwarded_from": "+17708008448",
-  "from": "+15017122661",
-  "from_formatted": "(501) 712-2661",
-  "group_sid": null,
-  "parent_call_sid": null,
-  "phone_number_sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
-  "price": "-0.03000",
-  "price_unit": "USD",
-  "sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
-  "start_time": "Tue, 31 Aug 2010 20:36:29 +0000",
-  "status": "completed",
-  "subresource_uris": {
-    "notifications": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications.json",
-    "recordings": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Recordings.json",
-    "feedback": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Feedback.json",
-    "feedback_summaries": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/FeedbackSummary.json",
-    "payments": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Payments.json"
-  },
-  "to": "sip:sip.webtechnicom.net",
-  "to_formatted": "sip:sip.webtechnicom.net",
-  "trunk_sid": null,
-  "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json",
-  "queue_time": "1000"
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$available_phone_number_country = $twilio->availablePhoneNumbers("US")
-                                         ->fetch();
-
-print($available_phone_number_country->countryCode);
-{
-  "beta": null,
-  "country": "United States",
-  "country_code": "US",
-  "subresource_uris": {
-    "local": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json",
-    "toll_free": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/TollFree.json"
-  },
-  "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US.json"
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read(["areaCode" => 510], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-{
-  "available_phone_numbers": [
-    {
-      "address_requirements": "none",
-      "beta": false,
-      "capabilities": {
-        "mms": true,
-        "sms": false,
-        "voice": true
-      },
-      "friendly_name": "(808) 925-1571",
-      "iso_country": "US",
-      "lata": "834",
-      "latitude": "19.720000",
-      "locality": "Hilo",
-      "longitude": "-155.090000",
-      "phone_number": "+18089251571",
-      "postal_code": "96720",
-      "rate_center": "HILO",
-      "region": "HI"
-    }
-  ],
-  "end": 1,
-  "first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "last_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=50",
-  "num_pages": 1,
-  "page": 0,
-  "page_size": 50,
-  "previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "start": 0,
-  "total": 1,
-  "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=1"
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read(["areaCode" => 510], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-{
-  "available_phone_numbers": [
-    {
-      "address_requirements": "none",
-      "beta": false,
-      "capabilities": {
-        "mms": true,
-        "sms": false,
-        "voice": true
-      },
-      "friendly_name": "(808) 925-1571",
-      "iso_country": "US",
-      "lata": "834",
-      "latitude": "19.720000",
-      "locality": "Hilo",
-      "longitude": "-155.090000",
-      "phone_number": "+18089251571",
-      "postal_code": "96720",
-      "rate_center": "HILO",
-      "region": "HI"
-    }
-  ],
-  "end": 1,
-  "first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "last_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=50",
-  "num_pages": 1,
-  "page": 0,
-  "page_size": 50,
-  "previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "start": 0,
-  "total": 1,
-  "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=1"
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read(["contains" => "510555****"], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-{
-  "available_phone_numbers": [
-    {
-      "address_requirements": "none",
-      "beta": false,
-      "capabilities": {
-        "mms": true,
-        "sms": false,
-        "voice": true
-      },
-      "friendly_name": "(808) 925-1571",
-      "iso_country": "US",
-      "lata": "834",
-      "latitude": "19.720000",
-      "locality": "Hilo",
-      "longitude": "-155.090000",
-      "phone_number": "+18089251571",
-      "postal_code": "96720",
-      "rate_center": "HILO",
-      "region": "HI"
-    }
-  ],
-  "end": 1,
-  "first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "last_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=50",
-  "num_pages": 1,
-  "page": 0,
-  "page_size": 50,
-  "previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "start": 0,
-  "total": 1,
-  "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=1"
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read(["contains" => "STORM"], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-{
-  "available_phone_numbers": [
-    {
-      "address_requirements": "none",
-      "beta": false,
-      "capabilities": {
-        "mms": true,
-        "sms": false,
-        "voice": true
-      },
-      "friendly_name": "(808) 925-1571",
-      "iso_country": "US",
-      "lata": "834",
-      "latitude": "19.720000",
-      "locality": "Hilo",
-      "longitude": "-155.090000",
-      "phone_number": "+18089251571",
-      "postal_code": "96720",
-      "rate_center": "HILO",
-      "region": "HI"
-    }
-  ],
-  "end": 1,
-  "first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "last_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=50",
-  "num_pages": 1,
-  "page": 0,
-  "page_size": 50,
-  "previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=50&Page=0",
-  "start": 0,
-  "total": 1,
-  "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json?PageSize=1"
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read(["inRegion" => "AR"], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("GB")
-                ->local
-                ->read(["contains" => "+4420"], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("GB")
-                ->local
-                ->read(["smsEnabled" => True, "voiceEnabled" => True], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read([
-                           "nearLatLong" => "37.840699,-122.461853",
-                           "distance" => 50,
-                           "contains" => "555",
-                           "inRegion" => "CA"
-                       ],
-                       20
-                );
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read(["areaCode" => 510], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read(["areaCode" => 510], 20);
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$local = $twilio->availablePhoneNumbers("US")
-                ->local
-                ->read([
-                           "nearLatLong" => "37.840699,-122.461853",
-                           "distance" => 50,
-                           "contains" => "555",
-                           "inRegion" => "CA"
-                       ],
-                       20
-                );
-
-foreach ($local as $record) {
-    print($record->friendlyName);
-}
-<?php
-
-// Update the path below to your autoload.php,
-// see https://getcomposer.org/doc/01-basic-usage.md
-require_once '/path/to/vendor/autoload.php';
-
-use Twilio\Rest\Client;
-
-// Find your Account Sid and Auth Token at twilio.com/console
-// DANGER! This is insecure. See http://twil.io/secure
-$sid    = "ACcc67c045cffaea7653952cf73b7443a5";
-$token  = "4a48ef16988eca378188b06fd8d433e0";
-$twilio = new Client($sid, $token);
-
-$country = $twilio->pricing->v1->phoneNumbers
-                               ->countries("US")
-                               ->fetch();
-
-print($country->country);
-<?php
-
- e1c785f -
-
-
-

Git stats

- -
-
-
-

Files

- - - - - Permalink - -
- - - Failed to load latest commit information. - -
-
-
-
Type
-
Name
-
Latest commit message
-
Commit time
-
- -
-
- - -
- -
- .github -
- -
-
 
-
- -
-
 
-
- -
-
-
- - -
- -
- API -
- -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- -
- README.md -
- -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- -
- TWILIO -
- -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
-
- - -
- - - -
-
 
-
- -
-
 
-
- -
-
- -
- -
- - -
- -
-
-

- README.md -

-
-
-

stripe

-

repository -php --version -PHP 7.2.24-0ubuntu0.18.04.1 (cli) (built: Oct 28 2019 12:07:07) ( NTS ) -Copyright (c) 1997-2018 The PHP Group -Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies -with Zend OPcache v7.2.24-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies -with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans -composer --version -composer require telnyx/telnyx-php -{ -"require": { -"telnyx/telnyx-php": "^0.0.1" -} -}

-
-
-
- - -
-
- - -
-
-
-

About

- -

- repository -

- - -

Resources

- - - -
-
- -
-
- -

Sponsor this project

- -
    -
-
-
-
-
-
-

- - Packages -

- - -
- No packages published
-
- - - -
-
- -
- -
- -
-
- -
-
- -
- - - - - - -
- - - You can’t perform that action at this time. -
- - - - - - - - - - - # Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -phone_number = client.lookups \ - .phone_numbers('+16502530000') \ - .fetch(add_ons=['payfone_tcpa_compliance'], add_ons_data={ - 'payfone_tcpa_compliance.RightPartyContactedDate': '20160101' - }, type=['carrier']) - -print(phone_number.add_ons) -{ - "caller_name": null, - "country_code": "US", - "phone_number": "+16502530000", - "national_format": "(650) 253-0000", - "carrier": { - "mobile_country_code": null, - "mobile_network_code": null, - "name": "Level 3 Communications, LLC", - "type": "landline", - "error_code": null - }, - "add_ons": { - "status": "successful", - "message": null, - "code": null, - "results": { - "payfone_tcpa_compliance": { - "status": "successful", - "request_sid": "XRd3a2991c9108bde3ca9589ed84d31463", - "message": null, - "code": null, - "result": { - "Status": 0, - "Response": { - "MSISDNType": "NonFixedVoIP", - "NumberMatch": "I", - "VerifyNumberTransactionId": "2019459819" - }, - "RequestId": "XRd3a2991c9108bde3ca9589ed84d31463", - "Description": "Success." - } - } - } - }, - "url": "https://lookups.twilio.com/v1/PhoneNumbers/+16502530000?Type=carrier" -var appConfig = { - serviceBaseUrl: "https://dancing-owl-1234.twil.io/", - sso: { - accountSid: "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" - }, - sdkOptions: { - chat: {}, - insights: {}, - voice: {}, - worker: {} - }, - logLevel: "debug", - colorTheme: { - baseName: "GreyDark", - colors: {}, - light: false, - overrides: {} - }, - componentProps: { - CRMContainer: { - uriCallback: (task) => task - ? `https://www.bing.com/search?q=${task.attributes.name}` - : "http://bing.com" - } - }, - router: { - type: "memory", - history: { - initialEntries: [ "/agent-desktop" ] - } - } -}; -from flask import Flask, request -from twilio import twiml - -import json - - -app = Flask(__name__) - -@app.route("/voice", methods=['GET', 'POST']) -def call(): - """Responds to incoming calls using Twilio Add-ons""" - # Start our TwiML response - response = twiml.Response() - - # Decode the JSON included in the 'AddOns' field - add_ons = json.loads(request.values['AddOns']) - - # If the Whitepages add-on found nothing, return immediately - if 'whitepages_pro_caller_id' not in add_ons['results']: - response.say('Sorry, I could not learn anything about you.') - response.hangup() - - return str(response) - - # Otherwise, extract the Whitepages data - whitepages = add_ons['results']['whitepages_pro_caller_id'] - - # Grab the result Whitepages gave us - # (see the "Documentation" tab on the Whitepages add-on for more details) - caller_id = whitepages['result'] - - # See if we can get the caller's name - try: - first_name = caller_id['belongs_to'][0]['firstname'] - except (IndexError, KeyError): - first_name = 'a mystery' - - # And what city the caller lives in - try: - city = caller_id['current_addresses'][0]['city'] - except (IndexError, KeyError): - city = 'a mystery' - - # Tell the caller what we think their name and city are - response.say('Hello. Your name is {}.'.format(first_name)) - response.say('And I think you live in {}.'.format(city)) - - # Then end the call - response.hangup() - - return str(response) - -if __name__ == "__main__": - app.run(debug=True) -{ - "status": "successful", - "message": null, - "code": null, - "results": { - "whitepages_pro_caller_id": { - "code": null, - "message": null, - "request_sid": "XRb57cab3a3c0cfe0bb50f093d9bd3b0a3", - "result": { - "alternate_phones": [ - "8003361327" - ], - "associated_people": [], - "belongs_to": [ - { - "age_range": null, - "firstname": null, - "gender": null, - "id": "Business.7e29cf66-8bf2-4812-829d-356654b5b3d3.Durable", - "lastname": null, - "link_to_phone_start_date": null, - "middlename": null, - "name": "Twilio Inc", - "type": "Business" - } - ], - "carrier": "Twilio", - "country_calling_code": "1", - "current_addresses": [ - { - "city": "San Francisco", - "country_code": "US", - "delivery_point": "MultiUnit", - "id": "Location.88e44955-805c-455a-99da-d7444ca5c484.Durable", - "is_active": true, - "lat_long": { - "latitude": 37.783382, - "longitude": -122.395714, - "accuracy": "RoofTop" - }, - "link_to_person_start_date": null, - "location_type": "Address", - "postal_code": "94107", - "state_code": "CA", - "street_line_1": "Address", - "street_line_2": null, - "zip4": "3624" - } - ], - "error": null, - "historical_addresses": [], - "id": "Phone.4d796fef-a2df-4b08-cfe3-bc7128b6f6bb.Durable", - "is_commercial": true, - "is_prepaid": false, - "is_valid": true, - "line_type": "NonFixedVOIP", - "phone_number": "5558675310", - "warnings": [] - }, - "status": "successful" - } - } -} -from flask import Flask, request -from twilio import twiml - -import json - - -app = Flask(__name__) - -@app.route("/voice", methods=['GET', 'POST']) -def call(): - """Responds to incoming calls using Twilio Add-ons""" - # Start our TwiML response - response = twiml.Response() - - # Decode the JSON included in the 'AddOns' field - add_ons = json.loads(request.values['AddOns']) - - # If the Whitepages add-on found nothing, return immediately - if 'whitepages_pro_caller_id' not in add_ons['results']: - response.say('Sorry, I could not learn anything about you.') - response.hangup() - - return str(response) - - # Otherwise, extract the Whitepages data - whitepages = add_ons['results']['whitepages_pro_caller_id'] - - # Grab the result Whitepages gave us - # (see the "Documentation" tab on the Whitepages add-on for more details) - caller_id = whitepages['result'] - - # See if we can get the caller's name - try: - first_name = caller_id['belongs_to'][0]['firstname'] - except (IndexError, KeyError): - first_name = 'a mystery' - - # And what city the caller lives in - try: - city = caller_id['current_addresses'][0]['city'] - except (IndexError, KeyError): - city = 'a mystery' - - # Tell the caller what we think their name and city are - response.say('Hello. Your name is {}.'.format(first_name)) - response.say('And I think you live in {}.'.format(city)) - - # Then end the call - response.hangup() - - return str(response) - -if __name__ == "__main__": - app.run(debug=True) -{ - "status": "successful", - "message": null, - "code": null, - "results": { - "whitepages_pro_caller_id": { - "code": null, - "message": null, - "request_sid": "XRb57cab3a3c0cfe0bb50f093d9bd3b0a3", - "result": { - "alternate_phones": [ - "8003361327" - ], - "associated_people": [], - "belongs_to": [ - { - "age_range": null, - "firstname": null, - "gender": null, - "id": "Business.7e29cf66-8bf2-4812-829d-356654b5b3d3.Durable", - "lastname": null, - "link_to_phone_start_date": null, - "middlename": null, - "name": "Twilio Inc", - "type": "Business" - } - ], - "carrier": "Twilio", - "country_calling_code": "1", - "current_addresses": [ - { - "city": "San Francisco", - "country_code": "US", - "delivery_point": "MultiUnit", - "id": "Location.88e44955-805c-455a-99da-d7444ca5c484.Durable", - "is_active": true, - "lat_long": { - "latitude": 37.783382, - "longitude": -122.395714, - "accuracy": "RoofTop" - }, - "link_to_person_start_date": null, - "location_type": "Address", - "postal_code": "94107", - "state_code": "CA", - "street_line_1": "Address", - "street_line_2": null, - "zip4": "3624" - } - ], - "error": null, - "historical_addresses": [], - "id": "Phone.4d796fef-a2df-4b08-cfe3-bc7128b6f6bb.Durable", - "is_commercial": true, - "is_prepaid": false, - "is_valid": true, - "line_type": "NonFixedVOIP", - "phone_number": "5558675310", - "warnings": [] - }, - "status": "successful" - } - } -} -from flask import Flask, request -from twilio import twiml - -import json - - -app = Flask(__name__) - -@app.route("/voice", methods=['GET', 'POST']) -def call(): - """Responds to incoming calls using Twilio Add-ons""" - # Start our TwiML response - response = twiml.Response() - - # Decode the JSON included in the 'AddOns' field - add_ons = json.loads(request.values['AddOns']) - - # If the Whitepages add-on found nothing, return immediately - if 'whitepages_pro_caller_id' not in add_ons['results']: - response.say('Sorry, I could not learn anything about you.') - response.hangup() - - return str(response) - - # Otherwise, extract the Whitepages data - whitepages = add_ons['results']['whitepages_pro_caller_id'] - - # Grab the result Whitepages gave us - # (see the "Documentation" tab on the Whitepages add-on for more details) - caller_id = whitepages['result'] - - # See if we can get the caller's name - try: - first_name = caller_id['belongs_to'][0]['firstname'] - except (IndexError, KeyError): - first_name = 'a mystery' - - # And what city the caller lives in - try: - city = caller_id['current_addresses'][0]['city'] - except (IndexError, KeyError): - city = 'a mystery' - - # Tell the caller what we think their name and city are - response.say('Hello. Your name is {}.'.format(first_name)) - response.say('And I think you live in {}.'.format(city)) - - # Then end the call - response.hangup() - - return str(response) - -if __name__ == "__main__": - app.run(debug=True) -{ - "status": "successful", - "message": null, - "code": null, - "results": { - "whitepages_pro_caller_id": { - "code": null, - "message": null, - "request_sid": "XRb57cab3a3c0cfe0bb50f093d9bd3b0a3", - "result": { - "alternate_phones": [ - "8003361327" - ], - "associated_people": [], - "belongs_to": [ - { - "age_range": null, - "firstname": null, - "gender": null, - "id": "Business.7e29cf66-8bf2-4812-829d-356654b5b3d3.Durable", - "lastname": null, - "link_to_phone_start_date": null, - "middlename": null, - "name": "Twilio Inc", - "type": "Business" - } - ], - "carrier": "Twilio", - "country_calling_code": "1", - "current_addresses": [ - { - "city": "San Francisco", - "country_code": "US", - "delivery_point": "MultiUnit", - "id": "Location.88e44955-805c-455a-99da-d7444ca5c484.Durable", - "is_active": true, - "lat_long": { - "latitude": 37.783382, - "longitude": -122.395714, - "accuracy": "RoofTop" - }, - "link_to_person_start_date": null, - "location_type": "Address", - "postal_code": "94107", - "state_code": "CA", - "street_line_1": "Address", - "street_line_2": null, - "zip4": "3624" - } - ], - "error": null, - "historical_addresses": [], - "id": "Phone.4d796fef-a2df-4b08-cfe3-bc7128b6f6bb.Durable", - "is_commercial": true, - "is_prepaid": false, - "is_valid": true, - "line_type": "NonFixedVOIP", - "phone_number": "5558675310", - "warnings": [] - }, - "status": "successful" - } - } -} -from flask import Flask, request -from twilio import twiml - -import json - - -app = Flask(__name__) - -@app.route("/voice", methods=['GET', 'POST']) -def call(): - """Responds to incoming calls using Twilio Add-ons""" - # Start our TwiML response - response = twiml.Response() - - # Decode the JSON included in the 'AddOns' field - add_ons = json.loads(request.values['AddOns']) - - # If the Whitepages add-on found nothing, return immediately - if 'whitepages_pro_caller_id' not in add_ons['results']: - response.say('Sorry, I could not learn anything about you.') - response.hangup() - - return str(response) - - # Otherwise, extract the Whitepages data - whitepages = add_ons['results']['whitepages_pro_caller_id'] - - # Grab the result Whitepages gave us - # (see the "Documentation" tab on the Whitepages add-on for more details) - caller_id = whitepages['result'] - - # See if we can get the caller's name - try: - first_name = caller_id['belongs_to'][0]['firstname'] - except (IndexError, KeyError): - first_name = 'a mystery' - - # And what city the caller lives in - try: - city = caller_id['current_addresses'][0]['city'] - except (IndexError, KeyError): - city = 'a mystery' - - # Tell the caller what we think their name and city are - response.say('Hello. Your name is {}.'.format(first_name)) - response.say('And I think you live in {}.'.format(city)) - - # Then end the call - response.hangup() - - return str(response) - -if __name__ == "__main__": - app.run(debug=True) -from flask import Flask, request -from twilio import twiml - -import json - - -app = Flask(__name__) - -@app.route("/voice", methods=['GET', 'POST']) -def call(): - """Responds to incoming calls using Twilio Add-ons""" - # Start our TwiML response - response = twiml.Response() - - # Decode the JSON included in the 'AddOns' field - add_ons = json.loads(request.values['AddOns']) - - # If the Whitepages add-on found nothing, return immediately - if 'whitepages_pro_caller_id' not in add_ons['results']: - response.say('Sorry, I could not learn anything about you.') - response.hangup() - - return str(response) - - # Otherwise, extract the Whitepages data - whitepages = add_ons['results']['whitepages_pro_caller_id'] - - # Grab the result Whitepages gave us - # (see the "Documentation" tab on the Whitepages add-on for more details) - caller_id = whitepages['result'] - - # See if we can get the caller's name - try: - first_name = caller_id['belongs_to'][0]['firstname'] - except (IndexError, KeyError): - first_name = 'a mystery' - - # And what city the caller lives in - try: - city = caller_id['current_addresses'][0]['city'] - except (IndexError, KeyError): - city = 'a mystery' - - # Tell the caller what we think their name and city are - response.say('Hello. Your name is {}.'.format(first_name)) - response.say('And I think you live in {}.'.format(city)) - - # Then end the call - response.hangup() - - return str(response) - -if __name__ == "__main__": - app.run(debug=True) - -appConfig.sso = { - accountSid: string; // AccountSid of your Twilio Project - loginPopup: boolean; // whether to launch IdP login in new window - loginPopupFeatures: string; // standard window.open() features param to be applied to popup window -}; - flex.CRMContainer - .defaultProps - .uriCallback = (task) => task - ? `https://www.bing.com/search?q=${task.attributes.name}` - : "http://bing.com/"; - { - yourDefaultName?: string; - theirDefaultName?: string; - yourFriendlyNameOverride?: boolean; - theirFriendlyNameOverride?: boolean; - const mediaId = Flex.AudioPlayerManager.play( -{ - url: "sound-url", - repeatable: true -}, -(error: AudioPlayerError) => { - // handle error -} -); - Flex.Manager.getInstance().chatClient.on("messageAdded", () => { - const mediaId = Flex.AudioPlayerManager.play({ - url: "sound-url", - repeatable: true - }); -}) - -} - export interface MediaData { - url: string; - repeatable: boolean; -} - Flex.TeamsView.defaultProps.filters = [ - Flex.TeamsView.activitiesFilter, - // ... custom filters here -]; - // Install the Flex Plugin Builder and create a plugin to get this code on your own machine -// https://www.twilio.com/docs/flex/plugin-builder - -const ACTION_DISMISS_BAR = 'DISMISS_BAR'; - -const initialState = { - isOpen: true, -}; - -// Define plugin actions -export class Actions { - static dismissBar = () => ({ type: ACTION_DISMISS_BAR }); -} - -// Define how actions influence state -export function reduce(state = initialState, action) { - switch (action.type) { - case ACTION_DISMISS_BAR: { - return { - ...state, - isOpen: false, - }; - } - - default: - return state; - } -} - const initialState = { - isOpen: true, -}; - import React from 'react'; -import { VERSION } from '@twilio/flex-ui'; -import { FlexPlugin } from 'flex-plugin'; - -import CustomTaskListContainer from './components/CustomTaskList/CustomTaskList.Container'; -import reducers, { namespace } from './states'; - -const PLUGIN_NAME = 'SamplePlugin'; - -export default class SamplePlugin extends FlexPlugin { - constructor() { - super(PLUGIN_NAME); - } - - /** - * This code is run when your plugin is being started - * Use this to modify any UI components or attach to the actions framework - * - * @param flex { typeof import('@twilio/flex-ui') } - * @param manager { import('@twilio/flex-ui').Manager } - */ - init(flex, manager) { - this.registerReducers(manager); - - const options = { sortOrder: -1 }; - flex.AgentDesktopView - .Panel1 - .Content - .add(, options); - } - - /** - * Registers the plugin reducers - * - * @param manager { Flex.Manager } - */ - registerReducers(manager) { - if (!manager.store.addReducer) { - // eslint: disable-next-line - console.error(`You need FlexUI > 1.9.0 to use built-in redux; you are currently on ${VERSION}`); - return; - } - - manager.store.addReducer(namespace, reducers); - } -} - - const ACTION_DISMISS_BAR = 'DISMISS_BAR'; - export function reduce(state = initialState, action) {...} - curl -X GET 'https://flex-api.twilio.com/v1/Configuration' \ --u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN - curl -X POST 'https://flex-api.twilio.com/v1/Configuration' \ - -u AC86dafd9acccab6c0d346ed89a1202b2f:your_auth_token - -H 'Content-Type: application/json' \ - -d '{ - ...old properties - "ui_attributes": { - "logLevel": "debug" - ...old properties continued - } - }' -var appConfig = { - serviceBaseUrl: "https://dancing-owl-1234.twil.io/", - sso: { - accountSid: "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" - }, - sdkOptions: { - chat: {}, - insights: {}, - voice: {}, - worker: {} - }, - logLevel: "debug", - colorTheme: { - baseName: "GreyDark", - colors: {}, - light: false, - overrides: {} - }, - componentProps: { - CRMContainer: { - uriCallback: (task) => task - ? `https://www.bing.com/search?q=${task.attributes.name}` - : "http://bing.com" - } - }, - router: { - type: "memory", - history: { - initialEntries: [ "/agent-desktop" ] - } - } -}; -appConfig.colorTheme = { - baseName: "GreyDark", - colors: { base2: "red"}, - light: true, - overrides: { - MainHeader: { - Container: { - background: "Grey" - } - } - } -}; -appConfig.disableTransfers = false; -appConfig.logLevel = 'info'; -appConfig.pluginService = { - enabled: true, - url: "https://www.webtechnicom.net/plugins-list.json" -}; -appConfig.router = { - type: "memory", - history: { - initialEntries: [ "/agent-desktop" ] - } -}; -appConfig.sdkOptions = { - chat: {}, - insights: {}, - voice: {}, - worker: {} -}; -appConfig.sso = { - accountSid: "XRb57cab3a3c0cfe0bb50f093d9bd3b0a3" // AccountSid of your Twilio project -}; -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - url='http://webtechnicom.net/docs/voice.xml', - to='+41765203630', - from_='+17708008448' - ) - -print(call.sid) -{ - "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "annotation": null, - "answered_by": null, - "api_version": "2010-04-01", - "caller_name": null, - "date_created": "Tue, 31 Aug 2010 20:36:28 +0000", - "date_updated": "Tue, 31 Aug 2010 20:36:44 +0000", - "direction": "inbound", - "duration": "15", - "end_time": "Tue, 31 Aug 2010 20:36:44 +0000", - "forwarded_from": "+141586753093", - "from": "+15017122661", - "from_formatted": "(501) 712-2661", - "group_sid": null, - "parent_call_sid": null, - "phone_number_sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "price": "-0.03000", - "price_unit": "USD", - "sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "start_time": "Tue, 31 Aug 2010 20:36:29 +0000", - "status": "completed", - "subresource_uris": { - "notifications": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications.json", - "recordings": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Recordings.json", - "feedback": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Feedback.json", - "feedback_summaries": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/FeedbackSummary.json", - "payments": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Payments.json" - }, - "to": "+15558675310", - "to_formatted": "(555) 867-5310", - "trunk_sid": null, - "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json", - "queue_time": "1000" -} -from flask import Flask -app = Flask(__name__) - -@app.route("/") -def hello(): - return "Hello World!" - -if __name__ == "__main__": - app.run() -from flask import Flask -from twilio.twiml.voice_response import VoiceResponse - -app = Flask(__name__) - - -@app.route("/answer", methods=['GET', 'POST']) -def answer_call(): - """Respond to incoming phone calls with a brief message.""" - # Start our TwiML response - resp = VoiceResponse() - - # Read a message aloud to the caller - resp.say("Thank you for calling! Have a great day.", voice='alice') - - return str(resp) - -if __name__ == "__main__": - app.run(debug=True) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - url='http://demo.twilio.com/docs/voice.xml', - to='+15558675310', - from_='+15017122661' - ) - -print(call.sid) -{ - "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "annotation": null, - "answered_by": null, - "api_version": "2010-04-01", - "caller_name": null, - "date_created": "Tue, 31 Aug 2010 20:36:28 +0000", - "date_updated": "Tue, 31 Aug 2010 20:36:44 +0000", - "direction": "inbound", - "duration": "15", - "end_time": "Tue, 31 Aug 2010 20:36:44 +0000", - "forwarded_from": "+141586753093", - "from": "+15017122661", - "from_formatted": "(501) 712-2661", - "group_sid": null, - "parent_call_sid": null, - "phone_number_sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "price": "-0.03000", - "price_unit": "USD", - "sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "start_time": "Tue, 31 Aug 2010 20:36:29 +0000", - "status": "completed", - "subresource_uris": { - "notifications": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications.json", - "recordings": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Recordings.json", - "feedback": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Feedback.json", - "feedback_summaries": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/FeedbackSummary.json", - "payments": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Payments.json" - }, - "to": "+41765203630", - "to_formatted": "+1(770)800 8448", - "trunk_sid": null, - "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json", - "queue_time": "1000" -} -from flask import Flask -app = Flask(__name__) - -@app.route("/") -def hello(): - return "Hello World!" - -if __name__ == "__main__": - app.run() -from flask import Flask -from twilio.twiml.voice_response import VoiceResponse - -app = Flask(__name__) - - -@app.route("/answer", methods=['GET', 'POST']) -def answer_call(): - """Respond to incoming phone calls with a brief message.""" - # Start our TwiML response - resp = VoiceResponse() - - # Read a message aloud to the caller - resp.say("Thank you for calling! Have a great day.", voice='alice') - - return str(resp) - -if __name__ == "__main__": - app.run(debug=True) -require 'twilio-ruby' - -# Get your Account Sid and Auth Token from twilio.com/console -account_sid = 'AC86dafd9acccab6c0d346ed89a1202b2f' -auth_token = 'your_auth_token' - -# set up a client to talk to the Twilio REST API -@client = Twilio::REST::Client.new(account_sid, auth_token) - -call = @client.calls.create( - to: "+15558675310", - from: "+15017122661", - url: "http://demo.twilio.com/docs/voice.xml") -puts call.to - -npm install @twilio/flex-ui@1.18.0 -const defaultConfiguration: Config = { - disableLocalStorage: false, - available: true, - colorTheme: { - baseName: "BlueMediumTheme" - }, - componentProps: { - MessagingCanvas: { - avatarCallback: (identity: string) => SessionActions.getAgentAvatar(identity), - showTrayOnInactive: true - }, - MessageCanvasTray: { - onButtonClick: () => Actions.invokeAction("RestartEngagement") - } - }, - tokenServerUrl: "https://iam.twilio.com/v1/Accounts/{accountSid}/Tokens", - flexWebChannelsUrl: "https://flex-api.twilio.com/v1/WebChannels", - context: { - friendlyName: "Anonymous" - }, - startEngagementOnInit: true, - sdkOptions: { - chat: {} - } -}; - FlexWebChat.MainHeader.defaultProps.showImage = true; - - -{ - - yourDefaultName: 'You', - - theirDefaultName: 'Agent', - - yourFriendlyNameOverride: false, - - theirFriendlyNameOverride: false - -} -const brandColor1 = "#1976d2"; -const brandColor2 = "#233659"; -const brandTextColor = "#ffffff"; - - -const personalizedColors = { - darkBlueBackground: "#3C425C", - whiteText: "#FFFFFF", - entryPointBackground: "#3C425C", - lighterBackground: "#ecedf1", - primaryButtonBackground: "#1976d2", - primaryButtonColor: "#FFFFFF", - secondaryButtonBackground: "#6e7180", - secondaryButtonColor: "#FFFFFF" -}; - -// assign -const brandMessageBubbleColors = (bgColor) => ({ - Bubble: { - background: bgColor, - color: brandTextColor - }, - Avatar: { - background: bgColor, - color: brandTextColor - }, - Header: { - color: brandTextColor - } -}); - -const brandedColors = { - Chat: { - MessageListItem: { - FromOthers: brandMessageBubbleColors(brandColor2), - FromMe: brandMessageBubbleColors(brandColor1), - }, - MessageInput: { - Container:{ - Button: { - background: brandColor1, - color: brandTextColor - } - } - }, - MessageCanvasTray: { - Container: { - background: personalizedColors.darkBlueBackground, - color: personalizedColors.whiteText - } - }, - }, - - MainHeader: { - Container: { - background: personalizedColors.darkBlueBackground, - color: personalizedColors.whiteText - }, - Logo: { - fill: brandTextColor - } - }, - - EntryPoint: { - Container: { - background: personalizedColors.entryPointBackground, - color: personalizedColors.whiteText - } - }, - - PreEngagementCanvas: { - Container: { - background: personalizedColors.lighterBackground - }, - - Form: { - SubmitButton: { - background: personalizedColors.primaryButtonBackground, - color: personalizedColors.whiteText - } - } - } -}; -var appConfig = { - colorTheme: { - overrides: brandedColors - } -} - MainContainer: { - background: colors.base1 - }, - - EntryPoint: { - Container: { - backgroundImage: `linear-gradient(to top, ${colors.defaultButtonColor}, ${colors.defaultButtonColor})`, - backgroundColor: "rgba(0,0,0,0)", - color: "#ffffff", - "&:hover": { - backgroundColor: colors.buttonHoverColor, - backgroundBlendMode: "color", - } - } - }, - - MainHeader: { - Container: { - color: textColor - }, - Logo: { - fill: lightTheme ? "#000000" : "#ffffff" - } - }, - - PreEngagementCanvas: { - Container: { - color: textColor - }, - Footer: { - color: textColor - }, - Form: { - SubmitButton: { - "background-image": - `linear-gradient(to top,${colors.defaultButtonColor},${colors.defaultButtonColor})`, - color: "#ffffff" - }, - Label: {} - } - }, - - InvalidPreEngagementCanvas: { - Container: { - color: textColor - }, - Button: { - background: colors.defaultButtonColor, - color: colors.lightTextColor - } - }, - - Modal: { - Container: { - background: colors.base2, - color: textColor, - }, - Title: { - color: textColor - }, - PrimaryButton: { - background: colors.base2, - color: textColor, - }, - SecondaryButton: { - background: colors.base2, - color: textColor, - } - }, - - Chat: { - MessagingCanvas: { - Container: { - background: colors.base1 - } - }, - - MessageList: { - DateSeparatorLine: { - borderColor: colors.base4 - }, - DateSeparatorText: { - color: textColor - }, - TypingIndicator: { - color: textColor - } - }, - - MessageInput: { - Container: { - background: colors.base2, - color: textColor, - "::placeholder": { - color: textColor - }, - Button: { - color: "#ffffff", - background: "#1976D2" - } - } - }, - - MessageListItem: { - FromMe: { - Avatar: { - color: "#ffffff", - background: "#1976D2" - }, - Bubble: { - color: "#ffffff", - background: "#1976D2" - }, - Header: { - color: "#ffffff", - } - }, - FromOthers: { - Avatar: { - color: colors.base11, - background: colors.base2 - }, - Bubble: { - color: textColor, - background: colors.base2 - }, - Header: { - color: textColor - } - }, - ReadStatus: { - color: textColor - } - }, - - MessageCanvasTray: { - Container: { - background: colors.base2, - color: textColor - }, - Button: { - color: colors.lightTextColor, - background: colors.defaultButtonColor, - lightHover: false, - } - }, - - WelcomeMessage: { - Container: { - color: textColor - }, - Icon: { - color: colors.base11 - } - } - }, - - Progress: { - Circular: { - staticBackgroundBorderColor: colors.lightTextColor, - animatingBackgroundBorderColor: colors.base4, - animatingForegroundBorderColor: colors.defaultButtonColor, - } - }, - - FormComponents: { - TextArea: { - borderColor: colors.base4, - color: textColor, - background: "transparent", - - "&:focus": { - background: colors.base1, - boxShadow: `0px 0px 0px 2px ${colors.focusGlow}`, - border: `1px solid ${colors.focusColor}` - } - }, - Input: { - color: textColor - } - }, - MainContainer: { - background: colors.base1 - }, - - EntryPoint: { - Container: { - backgroundImage: `linear-gradient(to top, ${colors.defaultButtonColor}, ${colors.defaultButtonColor})`, - backgroundColor: "rgba(0,0,0,0)", - color: "#ffffff", - "&:hover": { - backgroundColor: colors.buttonHoverColor, - backgroundBlendMode: "color", - } - } - }, - - MainHeader: { - Container: { - color: textColor - }, - Logo: { - fill: lightTheme ? "#000000" : "#ffffff" - } - }, - - PreEngagementCanvas: { - Container: { - color: textColor - }, - Footer: { - color: textColor - }, - Form: { - SubmitButton: { - "background-image": - `linear-gradient(to top,${colors.defaultButtonColor},${colors.defaultButtonColor})`, - color: "#ffffff" - }, - Label: {} - } - }, - - InvalidPreEngagementCanvas: { - Container: { - color: textColor - }, - Button: { - background: colors.defaultButtonColor, - color: colors.lightTextColor - } - }, - - Modal: { - Container: { - background: colors.base2, - color: textColor, - }, - Title: { - color: textColor - }, - PrimaryButton: { - background: colors.base2, - color: textColor, - }, - SecondaryButton: { - background: colors.base2, - color: textColor, - } - }, - - Chat: { - MessagingCanvas: { - Container: { - background: colors.base1 - } - }, - - MessageList: { - DateSeparatorLine: { - borderColor: colors.base4 - }, - DateSeparatorText: { - color: textColor - }, - TypingIndicator: { - color: textColor - } - }, - - MessageInput: { - Container: { - background: colors.base2, - color: textColor, - "::placeholder": { - color: textColor - }, - Button: { - color: "#ffffff", - background: "#1976D2" - } - } - }, - - MessageListItem: { - FromMe: { - Avatar: { - color: "#ffffff", - background: "#1976D2" - }, - Bubble: { - color: "#ffffff", - background: "#1976D2" - }, - Header: { - color: "#ffffff", - } - }, - FromOthers: { - Avatar: { - color: colors.base11, - background: colors.base2 - }, - Bubble: { - color: textColor, - background: colors.base2 - }, - Header: { - color: textColor - } - }, - ReadStatus: { - color: textColor - } - }, - - MessageCanvasTray: { - Container: { - background: colors.base2, - color: textColor - }, - Button: { - color: colors.lightTextColor, - background: colors.defaultButtonColor, - lightHover: false, - } - }, - - WelcomeMessage: { - Container: { - color: textColor - }, - Icon: { - color: colors.base11 - } - } - }, - - Progress: { - Circular: { - staticBackgroundBorderColor: colors.lightTextColor, - animatingBackgroundBorderColor: colors.base4, - animatingFoatingForegroundBorderColor: colors.defaultButtonColor, - } - }, - - FormComponents: { - TextArea: { - borderColor: colors.base4, - color: textColor, - background: "transparent", - - "&:focus": { - background: colors.base1, - boxShadow: `0px 0px 0px 2px ${colors.focusGlow}`, - border: `1px solid ${colors.focusColor}` - } - }, - Input: { - color: textColor - } - }, - FlexWebChat.Manager.create(configuration) - .then(manager => { - - manager.strings.WelcomeMessage = "I am a new Welcome Message"; - - ReactDOM.render( - - - , - document.getElementById("root") - ); - }); - EntryPointTagline: "Chat with us", - MessageCanvasTrayContent: ` -
Thanks for chatting with us!
-

If you have any more questions please reach out to us again.

`, - MessageCanvasTrayButton: "START NEW CHAT", - InvalidPreEngagementMessage: "Pre-engagement forms have not been set and are required to initiate the web-chat. " + "Please configure these now in setup.", - InvalidPreEngagementButton: "Learn more", - PredefinedChatMessageAuthorName: "Bot", - PredefinedChatMessageBody: "Hi there! How can we help you today?", - InputPlaceHolder: "Type message", - TypingIndicator: "{{name}} is typing ... ", - Read: "Read", - MessageSendingDisabled: "Message sending has been disabled", - Today: "TODAY", - Yesterday: "YESTERDAY", - MessageCanvasTrayButton: "START NEW CHAT", - WelcomeMessage: "Welcome to customer service", - Save: "SAVE", - Reset: "RESET", - MessageCharacterCountStatus: "{{currentCharCount}} / {{maxCharCount}}", - SendMessageTooltip: "Send Message", - FieldValidationRequiredField: "Field required", - FieldValidationInvalidEmail: "Please provide a valid email address" - FlexWebChat.Actions.on("afterStartEngagement", (payload) => { - - const { channelSid } = manager.store.getState().flex.session; - manager.chatClient.getChannelBySid(channelSid) - .then(channel => { - channel.sendMessage("My awesome message"); - }); - }); - // WebchatConfig.js - -const defaultConfiguration: Config = { - disableLocalStorage: false, - available: true, - colorTheme: { - baseName: "BlueMediumTheme" - }, - componentProps: { - MessagingCanvas: { - avatarCallback: (identity: string) => SessionActions.getAgentAvatar(identity), - showTrayOnInactive: true - }, - MessageCanvasTray: { - onButtonClick: () => Actions.invokeAction("RestartEngagement") - } - PreEngagementCanvas: { - .... - }, - - tokenServerUrl: "https://iam.twilio.com/v1/Accounts/{accountSid}/Tokens", - flexWebChannelsUrl: "https://flex-api.twilio.com/v1/WebChannels", - context: { - friendlyName: "Anonymous" - }, - startEngagementOnInit: false, - preEngagementConfig: { - ... - } -}; -const defaultConfiguration: Config = { -... -preEngagementConfig: { - - description: "Please provide some information", - fields: [ - { - label: "What is your name?", - type: "InputItem", - attributes: { - name: "friendlyName", - type: "text", - required: true - } - }, - { - label: "What is your question?", - type: "TextareaItem", - attributes: { - name: "question", - type: "text", - placeholder: "Type your question here", - required: false, - rows: 5 - } - }, - ], - submitLabel: "Ok Let's Go!" -} -}; -preEngagementConfig: { - - description: "Please provide some information", - fields: [ - { - label: "What is your name?", - type: "InputItem", - attributes: { - name: "friendlyName", - type: "text", - placeholder: "Enter your name", - required: true, - value: "Bob", - readOnly: false - } - }, - { - label: "What is your email?", - type: "InputItem", - attributes: { - name: "email", - type: "email", - placeholder: "Enter yout email", - required: true, - value: "Bob@bobson.com", - readOnly: false - } - }, - { - label: "My awesome dropdown", - type: "SelectItem", - attributes: { - name: "My awesome dropdown", - required: true, - readOnly: false - - }, - options: [ - { - value: "value1", - label: "label1", - selected: false - }, - { - value: "value2", - label: "label2", - selected: true - } - ] - }, - { - label: "What is your question?", - type: "TextareaItem", - attributes: { - name: "question", - type: "text", - placeholder: "Type your question here", - required: false, - rows: 5, - value: "My awesome question", - readOnly: false - } - } - ], - footerLabel: "I am a footer", - submitLabel: "Ok Let's Go!", -} -// post question from pre-engagement into chat - - FlexWebChat.Actions.on("afterStartEngagement", (payload) => { - const { question } = payload.formData; - if (!question) return; - - const { channelSid } = manager.store.getState().flex.session; - manager.chatClient.getChannelBySid(channelSid) - .then(channel => { - channel.sendMessage(question); - }); - }); - FlexWebChat.MessagingCanvas.defaultProps.predefinedMessage = false; - const defaultConfiguration: Config = { - ... - context: { - locationOrigin: window.location.origin, - someContextProp: "ContextProp1", - } -} - // context set in the WebChat - - context: { - friendlyName: "Anonymous", - locationOrigin: "http://someOriginUrl.com", - someContextProp: "ContextProp1", - }, - -// pre-engagement config set in WebChat - -preEngagementConfig: { - - description: "Please provide some information", - fields: [ - { - label: "What is your name?", - type: "InputItem", - attributes: { - name: "friendlyName", - type: "text", - required: true - } - }, - { - label: "What is your question?", - type: "TextareaItem", - attributes: { - name: "question", - type: "text", - placeholder: "Type your question here", - required: false, - rows: 5 - } - }, - ], - submitLabel: "Ok Let's Go!" -} - -// Chat channel attributes saved on chat initiation - -"attributes": "{\"status\":\"ACTIVE\",\"long_lived\":false,\"pre_engagement_data\":{\"friendlyName\":\"Anonymous\",\"question\":\"Can you help me with my invoice?\",\"location\":\"http://localhost:8081/\",\"locationOrigin\":\"http://someOriginUrl.com\",\"someContextProp\":\"ContextProp1\"},\"from\":\"Bob\",\"channel_type\":\"web\"}" - "{{trigger.message.ChannelAttributes.pre_engagement_data.question}}" - {"initial_question": "{{trigger.message.ChannelAttributes.pre_engagement_data.question}}"} - fileAttachment: { - enabled: true - } - fileAttachment: { -readOnly: true -} - // Max file size = 10 mb = 10 x 1024 x 1024 = 10,485,760 - -interface Config { - fileAttachment?: { - enabled?: boolean; - maxFileSize?: number; - }; -} - // Accepted extensions = .png, .txt, .pdf = ["png", "txt", "pdf"] - -interface Config { - fileAttachment?: { - enabled?: boolean; - acceptedExtensions?: Array; - }; -} - fileAttachment: { - enabled: true, - maxFileSize: 26214400, - acceptedExtensions: ["png", "txt", "pdf"] -} - Actions.invokeAction("SendMediaMessage", { file: file, channelSid: "unique_channel_identifier" }); - Actions.invokeAction("AttachFile", { file: File, channelSid: "unique_channel_identifier" }); - Actions.invokeAction("DetachFile", { file: File, channelSid: "unique_channel_identifier" }); - Actions.invokeAction("DownloadMedia", { message: message, channelSid: "unique_channel_identifier" }); - // Add a delete button. to every MessageListItem - -const DeleteMessage = ({ message }) => ( - // message is the default prop passed through by the MessageListItem - -); - -Flex.MessageListItem.Content.add(, { sortOrder: -1 }); - // Implement personal storage - -const uploadFileToMyStorage = async (file) => { - const formData = new FormData(); - formData.append("image", file); - - // Upload the file to private storage - const res = await fetch("https://api.imgur.com/3/image", { - method: "POST", - headers: new Headers({ - Authorization: "Client-ID 546c25a59c58ad7" - }), - body: formData - }); - return res.json(); -}; - -// Replace the action -Flex.Actions.replaceAction("SendMediaMessage", async (payload: Flex.ActionPayload) => { - const { file, messageAttributes, channelSid } = payload; - - // Retrieve the uploaded file location - const res = await uploadFileToMyStorage(file); - - // Include the new media file when sending the message - return Flex.Actions.invokeAction("SendMessage", { - messageAttributes: { - ...messageAttributes, - media: { - url: res.data.link, - filename: file.name, - contentType: file.type, - size: file.size - } - }, - body: file.name, - channelSid - }); -}); - -// Now you need to render your uploaded file. First, delete the body of the MessageBubble. Then, add a new body, including appropriate HTML that points to your uploaded file (in this example, an image tag is sufficient for rendering the image. Don’t forget your alt text!) - -// Create new message bubble content -const PersonalStorageContent = ({ message }) => ( -
- ”file -
-); - -Flex.MessageBubble.Content.remove("body", { - if: (props) => !!props.message.source.attributes.media -}); - -Flex.MessageBubble.Content.add(, { - if: (props) => !!props.message.source.attributes.media -});// Implement personal storage - -const uploadFileToMyStorage = async (file) => { - const formData = new FormData(); - formData.append("image", file); - - // Upload the file to private storage - const res = await fetch("https://api.imgur.com/3/image", { - method: "POST", - headers: new Headers({ - Authorization: "Client-ID 546c25a59c58ad7" - }), - body: formData - }); - return res.json(); -}; - -// Replace the action -Flex.Actions.replaceAction("SendMediaMessage", async (payload: Flex.ActionPayload) => { - const { file, messageAttributes, channelSid } = payload; - - // Retrieve the uploaded file location - const res = await uploadFileToMyStorage(file); - - // Include the new media file when sending the message - return Flex.Actions.invokeAction("SendMessage", { - messageAttributes: { - ...messageAttributes, - media: { - url: res.data.link, - filename: file.name, - contentType: file.type, - size: file.size - } - }, - body: file.name, - channelSid - }); -}); - -// Now you need to render your uploaded file. First, delete the body of the MessageBubble. Then, add a new body, including appropriate HTML that points to your uploaded file (in this example, an image tag is sufficient for rendering the image. Don’t forget your alt text!) - -// Create new message bubble content -const PersonalStorageContent = ({ message }) => ( -
- ”file -
-); - -Flex.MessageBubble.Content.remove("body", { - if: (props) => !!props.message.source.attributes.media -}); - -Flex.MessageBubble.Content.add(, { - if: (props) => !!props.message.source.attributes.media -}); - // Check file content - -Flex.Actions.addListener("beforeDownloadMedia", async (payload, cancelAction) => { - - const { message } = payload; - - const url = await message.media.getContentUrl(); - - // Validate file before download (note that checkFileContent method needs to be written) - - const result = await checkFileContent(url); - - if (!result.pass) { - - // Failed to validate content of the file - - cancelAction(); - - } - -}); - -Flex.Actions.addListener("beforeSendMediaMessage", async (payload, cancelAction) => { - const { file } = payload; - - // Validate file before sending - const result = await checkFileContent(file); - - if (!result.pass) { - // Failed to validate content of the file - cancelAction(); - } -}); - -Flex.Actions.addListener("beforeAttachFile", async (payload, cancelAction) => { - - const { file } = payload; - - // Validate file before attaching - const result = await checkFileContent(file); - - if (!result.pass) { - // Failed to validate content of the file - cancelAction(); - } -}); - // Check file content - -Flex.Actions.addListener("beforeDownloadMedia", async (payload, cancelAction) => { - - const { message } = payload; - - const url = await message.media.getContentUrl(); - - // Validate file before download (note that checkFileContent method needs to be written) - - const result = await checkFileContent(url); - - if (!result.pass) { - - // Failed to validate content of the file - - cancelAction(); - - } - -}); - -Flex.Actions.addListener("beforeSendMediaMessage", async (payload, cancelAction) => { - const { file } = payload; - - // Validate file before sending - const result = await checkFileContent(file); - - if (!result.pass) { - // Failed to validate content of the file - cancelAction(); - } -}); - -Flex.Actions.addListener("beforeAttachFile", async (payload, cancelAction) => { - - const { file } = payload; - - // Validate file before attaching - const result = await checkFileContent(file); - - if (!result.pass) { - // Failed to validate content of the file - cancelAction(); - } -}); - exports.handler = function(context, event, callback) { - // Use context parameter to initialize Twilio client and retrieve stored environment variables - const twilioClient = context.getTwilioClient(); - const chatServiceSid = context.CHAT_SERVICE_SID; // // Get Chat service sid from https://www.twilio.com/console/chat/dashboard - const blockedUserSid = context.BLOCKED_USER_SID - - - // Use the event parameter to retrieve dynamic information, like the current chat channel and the member to blockedUserSid - const {chatChannelSid, memberSid} = event - - console.log(event) - - twilioClient.chat.services(chatServiceSid) - .channels(chatChannelSid) - .members(memberSid) - .update({roleSid: blockedUserSid}) - .then(member => callback(null, member.sid)) - .catch(err => callback(err, null)) -}; - // Create function to block user -const blockUser = (chatChannelSid, memberSid) => { - const body = { chatChannelSid, memberSid }; - - // Set up the HTTP options for your request - const options = { - method: 'POST', - body: new URLSearchParams(body), - headers: { - 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' - } - }; - - // Make the network request using the Fetch API - fetch('https://YOUR_DOMAIN.twil.io/block-user', options) - .then(resp => resp.json()) - .then(data => console.log(data)); - } -} - -// Create a button component to block users -const BlockUserButton = (props) => ( - -); - -// Insert Block User Button into the Flex UI -Flex.MessageBubble.Content.add(, { - if: (props) => !props.message.isFromMe -}); - import 'react-app-polyfill/ie11'; -import 'react-app-polyfill/stable'; - FlexWebChat.MessageInput.defaultProps.sendButtonAriaProps = { - ariaLabel: "Send Message", - ariaLive: FlexWebChat.AriaLive.Polite -}; - -FlexWebChat.MessageInput.defaultProps.textAreaAriaProps = { - ariaLabel: "Enter your message here to get help", - ariaLive: FlexWebChat.AriaLive.Assertive -};appConfig = { - <...> - Chat: { - MessageInput: { - Button: { - borderRadius: "5px", - width: "100px", - fontSize: "18px", - svg: { - display: "none" - }, - ":after": { - content: '"Send Button text"' - } - } - } - }, - <...> - appConfig = { - <...> - Chat: { - MessageInput: { - Button: { - borderRadius: "5px", - width: "100px", - fontSize: "18px", - svg: { - display: "none" - }, - ":after": { - content: '"Send Button text"' - } - } - } - }, - <...> - const reducers = combineReducers({ - flex: WebchatReducer, - app: appReducer -}); - -const store = createStore( - reducers, - compose( - applyWebchatMiddleware() - ) -); - -FlexWebChat.Manager.create(config, store) - .then(manager => { - ReactDOM.render( - - - - - , - document.getElementById("container") - ); - }); - const reducers = combineReducers({ - flex: WebchatReducer, - app: appReducer -}); - -const store = createStore( - reducers, - compose( - applyWebchatMiddleware() - ) -); - -FlexWebChat.Manager.create(config, store) - .then(manager => { - ReactDOM.render( - - - - - , - document.getElementById("container") - ); - }); - base1, base2, base3, base4, base5, base6, base7, base8, base9, base10, base11, defaultButtonColor, lightTextColor, darkTextColor, buttonHoverColor, tabSelectedColor, connectingColor, disconnectedColor, notificationBackgroundColorInformation, notificationBackgroundColorSuccess, notificationBackgroundColorError, notificationBackgroundColorWarning, notificationIconColorError, notificationIconColorWarning, userAvailableColor, userUnavailableColor, errorColor,​ - // Picks the default blue dark theme -config.colorTheme = "BlueDarkTheme"; -// Picks dark theme, changes all of its base colors to new ones and tells the system that we still expect it to take the theme as dark (light parameter) -config.colorTheme = { - name: "DarkTheme", - colors: { - base1: "blue", - base2: "orange", - base3: "yellow", - base4: "black", - base5: "white", - base6: "pink", - base7: "red", - base8: "blue", - base9: "brown", - base10: "black", - base11: "white" - }, - light: false; -}// Picks the default blue dark theme -config.colorTheme = "BlueDarkTheme"; -// Picks dark theme, changes all of its base colors to new ones and tells the system that we still expect it to take the theme as dark (light parameter) -config.colorTheme = { - name: "DarkTheme", - colors: { - base1: "blue", - base2: "orange", - base3: "yellow", - base4: "black", - base5: "white", - base6: "pink", - base7: "red", - base8: "blue", - base9: "brown", - base10: "black", - base11: "white" - }, - light: false; -} - # Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -phone_call = client.preview \ - .trusted_comms \ - .phone_calls \ - .create( - reason='Security notice about your account.', - url='https://amber-ox-6503.twil.io/verified', - from_='+13133951154', - to='+15017122661' - ) - -print(phone_call.sid) - - - { - "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "api_version": "2010-04-01", - "body": "This will be the body of the new message!", - "date_created": "Thu, 30 Jul 2015 20:12:31 +0000", - "date_sent": "Thu, 30 Jul 2015 20:12:33 +0000", - "date_updated": "Thu, 30 Jul 2015 20:12:33 +0000", - "direction": "outbound-api", - "error_code": null, - "error_message": null, - "from": "+14155552345", - "messaging_service_sid": "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "num_media": "0", - "num_segments": "1", - "price": null, - "price_unit": null, - "sid": "SMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "status": "sent", - "subresource_uris": { - "media": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/SMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Media.json" - }, - "to": "+14155552345", - "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/SMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json" -} - # Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -phone_call = client.preview \ - .trusted_comms \ - .phone_calls \ - .create( - reason='Security notice about your account.', - url='https://amber-ox-6503.twil.io/verified', - from_='+13133951154', - to='+15017122661' - ) - -print(phone_call.sid) -{ - "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "bg_color": "#fff", - "brand_sid": "BZXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "branded_channel_sid": "BWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "business_sid": "BXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "call_sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "caller": "Owl Bank", - "created_at": "2019-05-01T20:00:00Z", - "font_color": "#000", - "from": "+13133951154", - "logo": "https://webtechnicom.net/wp-content/uploads/2020/08/webtechnicom.png", - "phone_number_sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "reason": "Security notice about your account.", - "sid": "CQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "status": "unknown", - "to": "+15017122661", - "url": "https://amber-ox-6503.twil.io/verified", - "use_case": "conversational" -} - from flask import Flask -from twilio import twiml - -app = Flask(__name__) - - -@app.route("/voice", methods=['GET', 'POST']) -def voice(): - """Respond to incoming phone calls with a menu of options""" - # Start our TwiML response - resp = twiml.Response() - - # Start our verb - with resp.gather(numDigits=1) as gather: - gather.say('For sales, press 1. For support, press 2.') - - # If the user doesn't select an option, redirect them into a loop - resp.redirect('/voice') - - return str(resp) - -if __name__ == "__main__": - app.run(debug=True) - # Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - twiml='Ahoy there!', - to='+15558675310', - from_='+15552223214' - ) - -print(call.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - method='GET', - status_callback='https://www.myapp.com/events', - status_callback_event=['initiated', 'answered'], - status_callback_method='POST', - url='http://demo.twilio.com/docs/voice.xml', - to='+14155551212', - from_='+18668675310' - ) - -print(call.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls('CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch() - -print(call.to) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -calls = client.calls.list(limit=20) - -for record in calls: - print(record.sid) - -# Download the helper library from https://www.twilio.com/docs/python/install -from datetime import datetime -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -calls = client.calls.list( - start_time=datetime(2009, 7, 6, 0, 0, 0), - status='completed', - limit=20 - ) - -for record in calls: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -from datetime import datetime -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -calls = client.calls.list( - start_time_after=datetime(2009, 7, 6, 0, 0, 0), - status='completed', - limit=20 - ) - -for record in calls: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -calls = client.calls.list(status='busy', to='+15558675310', limit=20) - -for record in calls: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -calls = client.calls.list(status='busy', to='+15558675310', limit=20) - -for record in calls: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.calls('CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -feedback = client.messages('MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .feedback \ - .create() - -print(feedback.message_sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -feedback = client.calls('CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').feedback() \ - .fetch() - -print(feedback.date_created) -# Download the helper library from https://www.twilio.com/docs/python/install -from datetime import date -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -feedback_summary = client.calls \ - .feedback_summaries \ - .create( - start_date=date(2008, 1, 2), - end_date=date(2008, 1, 2) - ) - -print(feedback_summary.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -feedback_summary = client.calls \ - .feedback_summaries('FSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(feedback_summary.call_count) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -conference = client.conferences('CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch() - -print(conference.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -conferences = client.conferences.list(limit=20) - -for record in conferences: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -conferences = client.conferences.list( - friendly_name='MyRoom', - status='in-progress', - limit=20 - ) - -for record in conferences: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -from datetime import date -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -conferences = client.conferences.list( - date_created=date(2009, 7, 6), - status='completed', - limit=20 - ) - -for record in conferences: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -from datetime import date -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -conferences = client.conferences.list( - date_created_after=date(2009, 7, 6), - status='in-progress', - limit=20 - ) - -for record in conferences: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -conference = client.conferences('CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(status='completed') - -print(conference.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -conference = client.conferences('CFbbe46ff1274e283f7e3ac1df0072ab39') \ - .update(announce_url='http://www.myapp.com/announce') - -print(conference.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -conference = client.conferences('CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch() - -print(conference.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -conference = client.conferences('CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(status='completed') - -print(conference.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -conference = client.conferences('CFbbe46ff1274e283f7e3ac1df0072ab39') \ - .update(announce_url='http://www.myapp.com/announce') - -print(conference.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -conference = client.conferences('CFbbe46ff1274e283f7e3ac1df0072ab39') \ - .update(announce_url='http://www.myapp.com/announce') - -print(conference.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -bulk_country_update = client.voice \ - .dialing_permissions \ - .bulk_country_updates \ - .create( - update_request='[{"iso_code":"GB","low_risk_numbers_enabled":true,"high_risk_special_numbers_enabled":true,"high_risk_tollfraud_numbers_enabled":false}]' - ) - -print(bulk_country_update.update_count) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -bulk_country_update = client.voice \ - .dialing_permissions \ - .bulk_country_updates \ - .create( - update_request='[{"iso_code":"GB","low_risk_numbers_enabled":true,"high_risk_special_numbers_enabled":true,"high_risk_tollfraud_numbers_enabled":false}]' - ) - -print(bulk_country_update.update_count) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -bulk_country_update = client.voice \ - .dialing_permissions \ - .bulk_country_updates \ - .create( - update_request='[{"iso_code":"GB","low_risk_numbers_enabled":true,"high_risk_special_numbers_enabled":true,"high_risk_tollfraud_numbers_enabled":false}]' - ) - -print(bulk_country_update.update_count) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -highrisk_special_prefixes = client.voice \ - .dialing_permissions \ - .countries('LV') \ - .highrisk_special_prefixes \ - .list(limit=20) - -for record in highrisk_special_prefixes: - print(record.prefix) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -highrisk_special_prefixes = client.voice \ - .dialing_permissions \ - .countries('LV') \ - .highrisk_special_prefixes \ - .list(limit=20) - -for record in highrisk_special_prefixes: - print(record.prefix) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -highrisk_special_prefixes = client.voice \ - .dialing_permissions \ - .countries('LV') \ - .highrisk_special_prefixes \ - .list(limit=20) - -for record in highrisk_special_prefixes: - print(record.prefix) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -outgoing_caller_id = client \ - .outgoing_caller_ids('PNe905d7e6b410746a0fb08c57e5a186f3') \ - .fetch() - -print(outgoing_caller_id.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -outgoing_caller_id = client \ - .outgoing_caller_ids('PNe536d32a3c49700934481addd5ce1659') \ - .update(friendly_name='My Second Line') - -print(outgoing_caller_id.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.outgoing_caller_ids('PNe536d32a3c49700934481addd5ce1659').delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -outgoing_caller_ids = client.outgoing_caller_ids.list(limit=20) - -for record in outgoing_caller_ids: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -outgoing_caller_ids = client.outgoing_caller_ids \ - .list(phone_number='+14158675310', limit=20) - -for record in outgoing_caller_ids: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -validation_request = client.validation_requests \ - .create( - friendly_name='My Home Phone Number', - phone_number='+14158675310' - ) - -print(validation_request.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.outgoing_caller_ids('PNe536d32a3c49700934481addd5ce1659').delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -payment = client.calls('CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .payments \ - .create( - idempotency_key='idempotency_key', - status_callback='https://example.com' - ) - -print(payment.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -payment = client.calls('CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .payments('PKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update( - capture='payment-card-number', - idempotency_key='request-4', - status_callback='https://www.webtechnicom.net' - ) - -print(payment.call_sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -payment = client.calls('CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .payments('PKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update( - status='complete', - idempotency_key='idempotency_key', - status_callback='https://www.webtechnicom.net' - ) - -print(payment.call_sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -payment = client.calls('CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .payments('PKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update( - status='cancel', - idempotency_key='idempotency_key', - status_callback='https://www.webtechnicom.net' - ) - -print(payment.call_sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -queue = client.queues.create(friendly_name='friendly_name') - -print(queue.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -queue = client.queues('QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch() - -print(queue.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -queues = client.queues.list(limit=20) - -for record in queues: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -queue = client.queues('QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(friendly_name='friendly_name') - -print(queue.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.queues('QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() -from twilio.twiml.voice_response import Pay, VoiceResponse, Say - -response = VoiceResponse() -response.say('Calling Twilio Pay') -response.pay(charge_amount='20.45') - -print(response) -from twilio.twiml.voice_response import Pay, VoiceResponse, Say - -response = VoiceResponse() -response.say('Calling Twilio Pay') -response.pay( - charge_amount='20.45', - action='https://enter-your-callback-function-url.twil.io/pay' -) - -print(response) -from twilio.twiml.voice_response import Pay, VoiceResponse, Say - -response = VoiceResponse() -response.say('Calling Twilio Pay') -response.pay(charge_amount='20.45') - -print(response) -from twilio.twiml.voice_response import Pay, VoiceResponse, Say - -response = VoiceResponse() -response.say('Calling Twilio Pay') -response.pay( - charge_amount='20.45', - action='https://enter-your-callback-function-url.twil.io/pay' -) - -print(response) -from twilio.twiml.voice_response import Pay, VoiceResponse - -response = VoiceResponse() -response.pay() - -print(response) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_record = client.voice.ip_records.create(ip_address='ip_address') - -print(ip_record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_record = client.voice.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(ip_record.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_records = client.voice.ip_records.list(limit=20) - -for record in ip_records: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_record = client.voice.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(friendly_name='friendly_name') - -print(ip_record.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.voice.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -credential = client.sip.credential_lists('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .credentials \ - .create(username='username', password='password') - -print(credential.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -credential = client.sip.credential_lists('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .credentials('CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(credential.username) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -credentials = client.sip.credential_lists('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .credentials \ - .list(limit=20) - -for record in credentials: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -credential = client.sip.credential_lists('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .credentials('CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(password='password') - -print(credential.username) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.sip.credential_lists('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .credentials('CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -credential_list = client.sip \ - .credential_lists('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(credential_list.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -credential = client.sip.credential_lists('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .credentials \ - .create(username='username', password='password') - -print(credential.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -credentials = client.sip.credential_lists('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .credentials \ - .list(limit=20) - -for record in credentials: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -credential = client.sip.credential_lists('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .credentials('CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(password='password') - -print(credential.username) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.sip.credential_lists('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .credentials('CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -credential_list = client.sip.credential_lists.create( - friendly_name='friendly_name' - ) - -print(credential_list.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -credential_list = client.sip \ - .credential_lists('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(credential_list.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -credential_lists = client.sip.credential_lists.list(limit=20) - -for record in credential_lists: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -credential_list = client.sip \ - .credential_lists('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(friendly_name='friendly_name') - -print(credential_list.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.sip.credential_lists('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -auth_calls_credential_list_mapping = client.sip \ - .domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .auth \ - .calls \ - .credential_list_mappings \ - .create(credential_list_sid='CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') - -print(auth_calls_credential_list_mapping.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -auth_calls_credential_list_mapping = client.sip \ - .domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .auth \ - .calls \ - .credential_list_mappings('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(auth_calls_credential_list_mapping.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -credential_list_mappings = client.sip \ - .domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .auth \ - .calls \ - .credential_list_mappings \ - .list(limit=20) - -for record in credential_list_mappings: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.sip.domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .auth \ - .calls \ - .credential_list_mappings('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -domain = client.sip.domains.create(domain_name='domain_name') - -print(domain.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -domain = client.sip.domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch() - -print(domain.domain_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -domains = client.sip.domains.list(limit=20) - -for record in domains: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -domain = client.sip.domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(friendly_name='friendly_name') - -print(domain.domain_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.sip.domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -auth_registrations_credential_list_mapping = client.sip \ - .domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .auth \ - .registrations \ - .credential_list_mappings \ - .create(credential_list_sid='CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') - -print(auth_registrations_credential_list_mapping.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -auth_registrations_credential_list_mapping = client.sip \ - .domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .auth \ - .registrations \ - .credential_list_mappings('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(auth_registrations_credential_list_mapping.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -credential_list_mappings = client.sip \ - .domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .auth \ - .registrations \ - .credential_list_mappings \ - .list(limit=20) - -for record in credential_list_mappings: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.sip.domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .auth \ - .registrations \ - .credential_list_mappings('CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_access_control_list = client.sip \ - .ip_access_control_lists \ - .create(friendly_name='friendly_name') - -print(ip_access_control_list.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_access_control_list = client.sip \ - .ip_access_control_lists('ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(ip_access_control_list.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_access_control_lists = client.sip.ip_access_control_lists.list(limit=20) - -for record in ip_access_control_lists: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_access_control_list = client.sip \ - .ip_access_control_lists('ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(friendly_name='friendly_name') - -print(ip_access_control_list.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.sip.ip_access_control_lists('ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -auth_calls_ip_access_control_list_mapping = client.sip \ - .domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .auth \ - .calls \ - .ip_access_control_list_mappings \ - .create(ip_access_control_list_sid='ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') - -print(auth_calls_ip_access_control_list_mapping.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -auth_calls_ip_access_control_list_mapping = client.sip \ - .domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .auth \ - .calls \ - .ip_access_control_list_mappings('ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(auth_calls_ip_access_control_list_mapping.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_access_control_list_mappings = client.sip \ - .domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .auth \ - .calls \ - .ip_access_control_list_mappings \ - .list(limit=20) - -for record in ip_access_control_list_mappings: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.sip.domains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .auth \ - .calls \ - .ip_access_control_list_mappings('ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_address = client.sip \ - .ip_access_control_lists('ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .ip_addresses \ - .create(friendly_name='friendly_name', ip_address='ip_address') - -print(ip_address.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_address = client.sip \ - .ip_access_control_lists('ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .ip_addresses('IPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(ip_address.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_addresses = client.sip \ - .ip_access_control_lists('ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .ip_addresses \ - .list(limit=20) - -for record in ip_addresses: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_address = client.sip \ - .ip_access_control_lists('ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .ip_addresses('IPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(ip_address='ip_address') - -print(ip_address.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.sip.ip_access_control_lists('ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .ip_addresses('IPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -address = client.addresses.create( - friendly_name='Twilio', - emergency_enabled=True, - customer_name='Twilio', - street='645 Harrison St.', - city='San Francisco', - region='CA', - postal_code='94105', - iso_country='US' - ) - -print(address.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -incoming_phone_number = client \ - .incoming_phone_numbers('PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(emergency_address_sid='ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') - -print(incoming_phone_number.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -incoming_phone_number = client \ - .incoming_phone_numbers('PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(emergency_status='Active') - -print(incoming_phone_number.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -incoming_phone_number = client \ - .incoming_phone_numbers('PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(emergency_status='Inactive') - -print(incoming_phone_number.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -incoming_phone_number = client.incoming_phone_numbers('PNXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(incoming_phone_number.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.incoming_phone_numbers('ADXXXXXXXXXXXXXXXXXX').delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -byoc_trunk = client.voice.byoc_trunks.create() - -print(byoc_trunk.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -byoc_trunk = client.voice \ - .byoc_trunks('BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(byoc_trunk.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -byoc_trunks = client.voice.byoc_trunks.list(limit=20) - -for record in byoc_trunks: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -byoc_trunk = client.voice \ - .byoc_trunks('BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(friendly_name='friendly_name') - -print(byoc_trunk.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.voice.byoc_trunks('BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -connection_policy = client.voice.connection_policies.create() - -print(connection_policy.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -connection_policy = client.voice.connection_policies.create() - -print(connection_policy.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -connection_policy = client.voice \ - .connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(connection_policy.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.voice.connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -connection_policy_target = client.voice \ - .connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .targets \ - .create(target='https://example.com') - -print(connection_policy_target.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -connection_policy_target = client.voice \ - .connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .targets('NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(connection_policy_target.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -targets = client.voice \ - .connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .targets \ - .list(limit=20) - -for record in targets: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -connection_policy_target = client.voice \ - .connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .targets('NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(friendly_name='friendly_name') - -print(connection_policy_target.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.voice.connection_policies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .targets('NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -source_ip_mapping = client.voice \ - .source_ip_mappings \ - .create( - ip_record_sid='ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', - sip_domain_sid='SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' - ) - -print(source_ip_mapping.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -source_ip_mapping = client.voice \ - .source_ip_mappings('IBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(source_ip_mapping.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -source_ip_mappings = client.voice.source_ip_mappings.list(limit=20) - -for record in source_ip_mappings: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -source_ip_mapping = client.voice \ - .source_ip_mappings('IBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(sip_domain_sid='SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') - -print(source_ip_mapping.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.voice.source_ip_mappings('IBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_record = client.voice.ip_records.create(ip_address='ip_address') - -print(ip_record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_record = client.voice.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(ip_record.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_records = client.voice.ip_records.list(limit=20) - -for record in ip_records: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_record = client.voice.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(friendly_name='friendly_name') - -print(ip_record.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.voice.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_record = client.voice.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(ip_record.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_records = client.voice.ip_records.list(limit=20) - -for record in ip_records: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_record = client.voice.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(friendly_name='friendly_name') - -print(ip_record.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.voice.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_record = client.voice.ip_records.create(ip_address='ip_address') - -print(ip_record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_record = client.voice.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(ip_record.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_records = client.voice.ip_records.list(limit=20) - -for record in ip_records: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -ip_record = client.voice.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(friendly_name='friendly_name') - -print(ip_record.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.voice.ip_records('ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - url='http://demo.twilio.com/docs/voice.xml', - to='+15558675310', - from_='+15017122661' - ) - -print(call.sid) -from flask import Flask -app = Flask(__name__) - -@app.route("/") -def hello(): - return "Hello World!" - -if __name__ == "__main__": - app.run() -from flask import Flask -from twilio.twiml.voice_response import VoiceResponse - -app = Flask(__name__) - - -@app.route("/answer", methods=['GET', 'POST']) -def answer_call(): - """Respond to incoming phone calls with a brief message.""" - # Start our TwiML response - resp = VoiceResponse() - - # Read a message aloud to the caller - resp.say("Thank you for calling! Have a great day.", voice='alice') - - return str(resp) - -if __name__ == "__main__": - app.run(debug=True) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - url='http://demo.twilio.com/docs/voice.xml', - to='+15558675310', - from_='+15017122661' - ) - -print(call.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - url='http://demo.twilio.com/docs/voice.xml', - to='+15558675310', - from_='+15017122661' - ) - -print(call.sid) -from flask import Flask -from twilio.twiml.voice_response import VoiceResponse - -app = Flask(__name__) - - -@app.route("/answer", methods=['GET', 'POST']) -def answer_call(): - """Respond to incoming phone calls with a brief message.""" - # Start our TwiML response - resp = VoiceResponse() - - # Read a message aloud to the caller - resp.say("Thank you for calling! Have a great day.", voice='alice') - - return str(resp) - -if __name__ == "__main__": - app.run(debug=True) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - url='http://demo.twilio.com/docs/voice.xml', - to='+15558675310', - from_='+15017122661' - ) - -print(call.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - url='http://demo.twilio.com/docs/voice.xml', - to='+15558675310', - from_='+15017122661' - ) - -print(call.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - url='http://demo.twilio.com/docs/voice.xml', - to='+14155551212', - from_='+15017122661' - ) - -print(call.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - url='http://www.example.com/sipdial.xml', - to='sip:kate@example.com?hatchkey=4815162342', - from_='Jack' - ) - -print(call.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - method='GET', - send_digits='1234#', - url='http://demo.twilio.com/docs/voice.xml', - to='+14155551212', - from_='+18668675310' - ) - -print(call.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - record=True, - url='http://demo.twilio.com/docs/voice.xml', - to='+14155551212', - from_='+15017122661' - ) - -print(call.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - method='GET', - status_callback='https://www.myapp.com/events', - status_callback_method='POST', - url='http://demo.twilio.com/docs/voice.xml', - to='+14155551212', - from_='+18668675310' - ) - -print(call.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - method='GET', - status_callback='https://www.myapp.com/events', - status_callback_event=['initiated', 'answered'], - status_callback_method='POST', - url='http://demo.twilio.com/docs/voice.xml', - to='+14155551212', - from_='+18668675310' - ) - -print(call.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -function = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .functions \ - .create(friendly_name='friendly_name') - -print(function.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -function = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .functions('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(function.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -functions = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .functions \ - .list(limit=20) - -for record in functions: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -function = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .functions('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(friendly_name='friendly_name') - -print(function.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.serverless.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .functions('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -function_version = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .functions('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .function_versions('ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(function_version.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -function_versions = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .functions('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .function_versions \ - .list(limit=20) - -for record in function_versions: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -function_version = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .functions('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .function_versions('ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(function_version.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -function_versions = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .functions('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .function_versions \ - .list(limit=20) - -for record in function_versions: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -function_version = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .functions('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .function_versions('ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(function_version.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -function_versions = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .functions('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .function_versions \ - .list(limit=20) - -for record in function_versions: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -asset = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .assets \ - .create(friendly_name='friendly_name') - -print(asset.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -asset = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .assets('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(asset.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -assets = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .assets \ - .list(limit=20) - -for record in assets: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -asset = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .assets('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(friendly_name='friendly_name') - -print(asset.friendly_name) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.serverless.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .assets('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -asset_version = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .assets('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .asset_versions('ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(asset_version.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -asset_versions = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .assets('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .asset_versions \ - .list(limit=20) - -for record in asset_versions: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -variable = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .variables \ - .create(key='key', value='value') - -print(variable.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -variable = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .variables('ZVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(variable.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -variables = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .variables \ - .list(limit=20) - -for record in variables: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -variable = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .variables('ZVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .update(key='key') - -print(variable.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.serverless.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .variables('ZVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -build = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .builds \ - .create() - -print(build.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -build = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .builds('ZBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(build.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -builds = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .builds \ - .list(limit=20) - -for record in builds: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -client.serverless.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .builds('ZBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .delete() -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -deployment = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .deployments \ - .create() - -print(deployment.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -deployment = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .deployments('ZDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(deployment.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -deployments = client.serverless \ - .services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .deployments \ - .list(limit=20) - -for record in deployments: - print(record.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -log = client.serverless.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .logs('NOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .fetch() - -print(log.sid) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -logs = client.serverless.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ - .logs \ - .list(limit=20) - -for record in logs: - print(record.sid) -// Description -// Send a single SMS - -exports.handler = function (context, event, callback) { - // Make sure under Functions Settings tab: - // "Add my Twilio Credentials (ACCOUNT_SID) and (AUTH_TOKEN) to ENV" is CHECKED - - const twilioClient = context.getTwilioClient(); - - // Pass in From, To, and Body as query parameters - // Example: https://x.x.x.x/?From=%2b15095550100&To=%2b15105550100&Body=Hello%20World - // Note URL encoding above - let from = event.From || '+15095550100'; - // If passing in To, make sure to validate, to avoid sending SMS to unexpected locations - let to = event.To || '+15105550100'; - let body = event.Body || 'Hello World!'; - - twilioClient.messages - .create({ - body: body, - to: to, - from: from, - }) - .then((message) => { - console.log('SMS successfully sent'); - console.log(message.sid); - return callback(null, 'success'); - }) - .catch((error) => { - console.log(error); - return callback(error); - }); -}; - // Description -// Send multiple SMS - -exports.handler = function (context, event, callback) { - // Make sure under Functions Settings tab: - // "Add my Twilio Credentials (ACCOUNT_SID) and (AUTH_TOKEN) to ENV" is CHECKED - - const twilioClient = context.getTwilioClient(); - - let groupMembers = [ - { - name: 'Person1', - to: '+15105550100', - body: 'Hello Alan', - from: '+15095550100', - }, - { - name: 'Person2', - to: '+15105550101', - body: 'Hello Winston', - from: '+15095550100', - }, - { - name: 'Person3', - to: '+15105550102', - body: 'Hello Deepa', - from: '+15095550100', - }, - ]; - - Promise.all( - groupMembers.map((individual) => { - return twilioClient.messages.create(individual); - }) - ) - .then((results) => { - console.log('success'); - callback(null, 'success'); - }) - .catch((err) => { - console.log(err); - callback(error); - }); -}; - // Description -// Make a call - -exports.handler = function (context, event, callback) { - // Make sure under Functions Settings tab: - // "Add my Twilio Credentials (ACCOUNT_SID) and (AUTH_TOKEN) to ENV" is CHECKED - - const twilioClient = context.getTwilioClient(); - - // Pass in From, To, and Url as query parameters - // Example: https://x.x.x.x/?From=%2b15108675310&To=%2b15108675310&Url=http%3A%2F%2Fdemo.twilio.com%2Fdocs%2Fvoice.xml - // Note URL encoding above - let from = event.From || '+15095550100'; - // If passing in To, make sure to validate, to avoid placing calls to unexpected locations - let to = event.To || '+15105550100'; - let url = event.Url || 'http://demo.twilio.com/docs/voice.xml'; - - twilioClient.calls - .create({ - url: url, - from: from, - to: to, - }) - .then((result) => { - console.log('Call successfully placed'); - console.log(result.sid); - return callback(null, 'success'); - }) - .catch((error) => { - console.log(error); - return callback(error); - }); -}; - exports.handler = function(context, event, callback) { - let twiml = new Twilio.twiml.VoiceResponse(); - twiml.say("Hello World"); - return callback(null, twiml); -}; - // Description -// This Function showcases how you can send information into your Twilio Function -// From Twilio Studio's Run Function Widget and respond back with JSON. -// Twilio Studio will parse the returned JSON and incorporate it into your flow. - -// Note: The Studio Run Function Widget provides additional flexability over the HTTP Request -// Widget but either can be used to communicate with external API's. - -exports.handler = function (context, event, callback) { - // Function Parameters Sent in from Studio Run Function Widget are accessible from the - // Function event object, for example event.key would provide the value you sent in for - // the key called key. In our example, our Run Function widget is sending in the From - // Key: From, Value: {{trigger.message.From}} (which sends in the From Telephone Number) - - let from = event.From; - - let randomQuotes = ['Good', 'Day', 'Dachshund', 'Winston']; - console.log(randomQuotes.length); - let randomArrayIndex = Math.floor(Math.random() * randomQuotes.length); - console.log(randomArrayIndex); - - // We send the results back into our Studio flow as an object so the respective - // Studio Send Message or Say/Play widget can respond with the results. - - return callback(null, { - quote: randomQuotes[randomArrayIndex], - from: from, - }); -}; - exports.handler = function(context, event, callback) { - let twiml = new Twilio.twiml.MessagingResponse() - twiml.message("Hello World") - return callback(null, twiml) -} - - // Description -// Normalize Telephone Number -// Useful for Studio to read out telephone numbers as telephone number rather then large numbers - -exports.handler = async function (context, event, callback) { - // Make sure under Functions Global Config tab: - // "Add my Twilio Credentials (ACCOUNT_SID) and (AUTH_TOKEN) to ENV" is CHECKED - const twilioClient = context.getTwilioClient(); - - // Pass in From as a URL query parameter - // Example: https://x.x.x.x/?From=%2b15108675310 - let from = event.From || '+15095550100'; - - let result = await twilioClient.lookups - .phoneNumbers(from) - .fetch({ countryCode: 'US' }); - - result = { - normalizedNum: result.nationalFormat, - }; - - return callback(null, result); -}; -© 2020 GitHub, Inc. -// Description -// Prevent blocked numbers from calling your application -// Host blocklist.json as a private Twilio asset - -const fs = require('fs'); - -exports.handler = function (context, event, callback) { - let twiml = new Twilio.twiml.VoiceResponse(); - - // Phone numbers in blocklist.json file are rejected - // blocklist.json is uploaded to Twilio Assets as a private asset - // Format of blocklist.json is plain text: - // ["+14075550100", "+18025550100"] - - let fileName = '/blocklist.json'; - let file = Runtime.getAssets()[fileName].path; - let text = fs.readFileSync(file); - let blocklist = JSON.parse(text); - let blocked = true; - - if (blocklist.length > 0) { - if (blocklist.indexOf(event.From) === -1) { - blocked = false; - } - } - - if (blocked) { - twiml.reject(); - } else { - // if the caller's number is not blocked, redirect to your existing webhook - twiml.redirect('https://demo.twilio.com/welcome/voice/'); - } - - return callback(null, twiml); -}; - // Description -// Add a delay, useful for using with Twilio Studio Run Function Widget - -exports.handler = function (context, event, callback) { - // Function can run up to 10 seconds (value of delay is milliseconds) - - // Pass in delay as a URL query parameter - // Example: https://x.x.x.x/?delay=5000 - let delayInMs = event.delay || 5000; - - let timerUp = () => { - return callback(null, `Timer Up: ${delayInMs}ms`); - }; - - // Description -// Make a read request to an external API - -// Add axios 0.20.0 as a dependency under Functions Settings, Dependencies -const axios = require('axios'); - -exports.handler = function (context, event, callback) { - let twiml = new Twilio.twiml.VoiceResponse(); - - // Open APIs From Space: http://open-notify.org/ - // Number of People in Space - axios - .get(`http://api.open-notify.org/astros.json`) - .then((response) => { - let { number, people } = response.data; - - let names = people.map((astronaut) => astronaut.name); - - twiml.say(`There are ${number} people in space.`); - twiml.say(`They are ${names.join()}`); - return callback(null, twiml); - }) - .catch((error) => { - console.log(error); - return callback(error); - }); -}; - - // Make a write request to an external API using JSON (application/json) - -// Add axios 0.20.0 as a dependency under Functions Global Config, Dependencies -const axios = require('axios'); - -exports.handler = function (context, event, callback) { - // JSONPlaceholder: https://jsonplaceholder.typicode.com/ - // Fake Online REST API for Testing and Prototyping - const instance = axios.create({ - baseURL: 'https://aklein.ngrok.io/', - timeout: 1000, - headers: { 'X-Custom-Header': 'Twilo' }, - }); - - instance - .post('/posts', { - id: 1, - title: 'Twilio', - body: 'Owl', - userId: 1, - }) - .then((response) => { - console.log(JSON.stringify(response.data)); - return callback(null, response.data); - }) - .catch((error) => { - console.log(error); - return callback(error); - }); -}; - // Make a write request to an external API using urlencoded data (application/x-www-form-urlencoded) - -// Add axios 0.20.0 as a dependency under Functions Global Config, Dependencies -const axios = require('axios'); - -// Add qs 6.9.4 as a dependency under Functions Global Config, Dependencies -const qs = require('qs'); - -exports.handler = function (context, event, callback) { - // JSONPlaceholder: https://jsonplaceholder.typicode.com/ - // Fake Online REST API for Testing and Prototyping - - const instance = axios.create({ - baseURL: 'https://jsonplaceholder.typicode.com/', - timeout: 1000, - headers: { - 'X-Custom-Header': 'Twilo', - 'Content-Type': 'application/x-www-form-urlencoded', - }, - }); - - let data = qs.stringify({ - id: 1, - title: 'Twilio', - body: 'Owl', - userId: 1, - }); - - instance - .post('/posts', data) - .then((response) => { - console.log(JSON.stringify(response.data)); - return callback(null, response.data); - }) - .catch((error) => { - console.log(error); - return callback(error); - }); -}; - // Description -// Make a write request to an external API - -// Add axios 0.20.0 as a dependency under Functions Global Config, Dependencies -const axios = require('axios'); - -exports.handler = function (context, event, callback) { - // JSONPlaceholder: https://jsonplaceholder.typicode.com/ - // Fake Online REST API for Testing and Prototyping - const instance = axios.create({ - baseURL: 'https://jsonplaceholder.typicode.com', - timeout: 1000, - headers: { 'X-Custom-Header': 'Twilo' }, - }); - - instance - .post('/posts', { - id: 1, - title: 'Twilio', - body: 'Owl', - userId: 1, - }) - .then((response) => { - console.log(JSON.stringify(response.data)); - return callback(null, response.data); - }) - .catch((error) => { - console.log(error); - return callback(error); - }); -}; - // Description -// Use Twilio Lookup to determine carrier and phone number type (mobile, landline, voip) - -exports.handler = function (context, event, callback) { - // Make sure under Functions Global Config tab: - // "Add my Twilio Credentials (ACCOUNT_SID) and (AUTH_TOKEN) to ENV" is CHECKED - const client = context.getTwilioClient(); - - // Pass in phoneNumber as a URL query parameter - // Example: https://x.x.x.x/?phoneNumber=%2b15105550100 - const phoneNumber = event.phoneNumber || '+15105550100'; - - client.lookups - .phoneNumbers(phoneNumber) - .fetch({ type: 'carrier' }) - .then((phone_number) => { - console.log(phone_number.carrier); - return callback(null, phone_number); - }) - .catch((error) => { - console.log(error); - return callback(error, null); - }); -}; - - - setTimeout(timerUp, delayInMs); -}; - // Description -// Use Twilio Sync to create, read, update, delete peristent data - -exports.handler = function (context, event, callback) { - // Make sure under Functions Global Config tab: - // "Add my Twilio Credentials (ACCOUNT_SID) and (AUTH_TOKEN) to ENV" is CHECKED - const client = context.getTwilioClient(); - - // View Sync Services - https://www.twilio.com/console/sync/services - // Set to a specific Sync Service SID - // Set to your own sync document name to create, I use dynamicMsg - - let syncServiceSid = 'IS.....'; - let syncDocumentName = 'dynamicMsg'; - - // Pass in Function to Run via URL query parameter - // Example: https:/x.x.x.x/?Function=createSyncDocument - let functionToRun = event.Function || ''; - - function createSyncDocument() { - client.sync - .services(syncServiceSid) - .documents.create({ - data: { - msg: 'Sorry we are closed.', - }, - uniqueName: syncDocumentName, - }) - .then((document) => { - console.log(JSON.stringify(document.sid)); - return callback(null, 'success'); - }) - .catch((error) => { - console.log(error); - return callback(error); - }); - } - - function readSyncDocument() { - client.sync - .services(syncServiceSid) - .documents(syncDocumentName) - .fetch() - .then((document) => { - console.log(JSON.stringify(document.data)); - return callback(null, document.data); - }) - .catch((error) => { - console.log(error); - return callback(error); - }); - } - - function updateSyncDocument() { - client.sync - .services(syncServiceSid) - .documents(syncDocumentName) - .update({ - data: { - msg: 'We are open.', - }, - }) - .then((document) => { - console.log(`Documented Updated, Document SID: ${document.sid}`); - return callback( - null, - `Documented Updated, Document SID: ${document.sid}` - ); - }) - .catch((error) => { - console.log(error); - return callback(error); - }); - } - - function deleteSyncDocument() { - client.sync - .services(syncServiceSid) - .documents(syncDocumentName) - .fetch() - .then((document) => { - client.sync.services(syncServiceSid).documents(document.sid).remove(); - return callback(null, `Document ${document.sid} Deleted`); - }) - .catch((error) => { - console.log(error); - return callback(error); - }); - } - - // Test run function via passed in parameter - switch (functionToRun) { - case 'createSyncDocument': - { - createSyncDocument(); - } - break; - case 'readSyncDocument': - { - readSyncDocument(); - } - break; - case 'updateSyncDocument': - { - updateSyncDocument(); - } - break; - case 'deleteSyncDocument': - { - deleteSyncDocument(); - } - break; - default: - console.log('Please pass in the function name to execute'); - console.log('Example: https:/x.x.x.x/?Function=createSyncDocument'); - return callback( - 'missing URL query parameter - Example: https:/x.x.x.x?Function=createSyncDocument' - ); - } -}; - // Description -// Time of Day Routing -// Useful for IVR logic, for Example in Studio, to determine which path to route to -// Add moment-timezone 0.5.31 as a dependency under Functions Settings, Dependencies - -const moment = require('moment-timezone'); - -exports.handler = function (context, event, callback) { - let twiml = new Twilio.twiml.VoiceResponse(); - - function businessHours() { - // My timezone East Coast (other choices: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) - const now = moment().tz('America/New_York'); - - // Weekday Check using moment().isoWeekday() - // Monday = 1, Tuesday = 2 ... Sunday = 7 - if ( - now.isoWeekday() <= 5 /* Check for Normal Work Week Monday - Friday */ - ) { - //Work Hours Check, 9 am to 5pm (17:00 24 hour Time) - if (now.hour() >= 9 && now.hour() < 17 /* 24h basis */) { - return true; - } - } - - // Outside of business hours, return false - return false; - } - - const isOpen = businessHours(); - if (isOpen) { - twiml.say('Business is Open'); - } else { - twiml.say('Business is Closed'); - } - return callback(null, twiml); -}; - // Description -// Time of Day Routing -// Useful for IVR logic, for Example in Studio, to determine which path to route to -// Add moment-timezone 0.5.31 as a dependency under Functions Settings, Dependencies - -const moment = require('moment-timezone'); - -exports.handler = function (context, event, callback) { - let twiml = new Twilio.twiml.VoiceResponse(); - - function businessHours() { - // My timezone East Coast (other choices: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) - const now = moment().tz('America/New_York'); - - // Weekday Check using moment().isoWeekday() - // Monday = 1, Tuesday = 2 ... Sunday = 7 - if ( - now.isoWeekday() <= 5 /* Check for Normal Work Week Monday - Friday */ - ) { - //Work Hours Check, 9 am to 5pm (17:00 24 hour Time) - if (now.hour() >= 9 && now.hour() < 17 /* 24h basis */) { - return true; - } - } - - // Outside of business hours, return false - return false; - } - - const isOpen = businessHours(); - if (isOpen) { - twiml.say('Business is Open'); - } else { - twiml.say('Business is Closed'); - } - return callback(null, twiml); -}; - // Description -// Twilio Autopilot Stub Response -// Parse Remember Action and Returns Say Action -// Additional Autopilot Actions - https://www.twilio.com/docs/autopilot/actions - -exports.handler = function (context, event, callback) { - let memory = JSON.parse(event.Memory); - console.log('User Identifier: ' + event.UserIdentifier); - console.log('Task: ' + event.CurrentTask); - console.log(memory); - let message = '😸 Hello from Winston 😸'; - let responseObject = { - actions: [ - { - say: message, - }, - ], - }; - callback(null, responseObject); -}; - // Description -// Displays Node Version and Twilio Helper Library Version in console log -// To discover a more recent version of the Twilio helper library, visit the URL -// https://github.com/twilio/twilio-node/blob/main/CHANGES.md - -const twilio_version = require('twilio/package.json').version; - -exports.handler = function (context, event, callback) { - console.log(`Entered ${context.PATH}`); - console.log(`node version ${process.version}`); - console.log(`Twilio helper library version ${twilio_version}`); - - return callback(null, { status: `complete` }); -}; - // Description -// Twilio Notify API to send bulk SMS with the same message (body) as one API request -// Upload notifyList.txt as a private Twilio asset -// notifyList.txt format (comma separated numbers w/wo spaces): +15105550100, +15105550101, +15105550102, +15105550103 -// Execute Syntax: https://x.x.x.x/?queryParamPasscode=8675309 -// (change passcode below, replace this method with a secure auth method in production) -// Make sure under Functions Global Config tab: -// "Add my Twilio Credentials (ACCOUNT_SID) and (AUTH_TOKEN) to ENV" is CHECKED - -const fs = require('fs'); - -// Add node-fetch 2.6.0 as a dependency under Settings, Dependencies -const fetch = require('node-fetch'); - -// ** START NECESSARY CONFIGURATION ** -// You must define your unique Twilio Notify SID - https://www.twilio.com/console/notify/services below -// Notify will make use of a Twilio Messaging Service which you also need to define with a Twilio number(s) -// https://www.twilio.com/console/sms/services -const notifySid = 'IS076575.....'; -const passCode = '8675309'; // CHANGE THIS -// Notify Bulk Message Body to Send -const bulkMsgBody = '😸 Hello from Winston 😸'; -// ** END NECESSARY CONFIGURATION ** - -exports.handler = function (context, event, callback) { - const params = new URLSearchParams(); - const queryParamPasscode = event.queryParamPasscode; - - let fileName = '/notifyList.txt'; - let file = Runtime.getAssets()[fileName].path; - let numbers = fs.readFileSync(file, 'utf8').trim(); - - // Must pass a URL query parameter of queryParamPasscode with value of passCode to execute - if (queryParamPasscode != passCode) return callback('invalid operation'); // You can change the error message - - params.append('Body', bulkMsgBody); - - numbers.split(',').forEach((number) => { - number.trim(); - params.append( - `ToBinding`, - `{ "binding_type": "sms", "address": "${number}" }` - ); - }); - - let headers = { - Authorization: - 'Basic ' + - new Buffer.from(context.ACCOUNT_SID + ':' + context.AUTH_TOKEN).toString( - 'base64' - ), - }; - - fetch(`https://notify.twilio.com/v1/Services/${notifySid}/Notifications`, { - method: 'POST', - headers: headers, - body: params, - }) - .then((res) => res.json()) - .then((json) => { - console.log(json); - return callback(null, { result: 'success' }); - }) - .catch((err) => { - console.log(err); - return callback({ result: 'error' }); - }); -}; - exports.handler = function(context, event, callback) { - // Providing neither error or response will result in a 200 OK - return callback(); -} - - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.AvailablePhoneNumber.list(filter={"rate_center": "CHICAGO HEIGHTS"}) - { - "data": [ - { - "best_effort": false, - "cost_information": { - "currency": "USD", - "monthly_cost": "6.54", - "upfront_cost": "3.21" - }, - "phone_number": "+19705555098", - "quickship": true, - "record_type": "available_phone_number", - "region_information": [ - { - "region_name": "US", - "region_type": "country_code" - } - ], - "regulatory_requirements": [ - { - "description": "Requirement for providing Proof of Address.", - "field_type": "address", - "label": "Proof of Address", - "requirement_type": "end user proof of address" - } - ], - "reservable": true, - "vanity_format": "" - } - ], - "meta": { - "best_effort_results": 50, - "total_results": 100 - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.NumberReservation.list(filter={"phone_numbers.phone_number": ["+18665552368"]}) - { - "data": [ - { - "created_at": "2018-01-01T00:00:00.000000Z", - "customer_reference": "MY REF 001", - "id": "12ade33a-21c0-473b-b055-b3c836e1c292", - "phone_numbers": [ - { - "created_at": "2018-01-01T00:00:00.000000Z", - "errors": "", - "expired_at": "2018-01-01T00:00:00.000000Z", - "id": "12ade33a-21c0-473b-b055-b3c836e1c292", - "phone_number": "+19705555098", - "record_type": "reserved_phone_number", - "status": "pending", - "updated_at": "2018-01-01T00:00:00.000000Z" - } - ], - "record_type": "number_reservation", - "status": "pending", - "updated_at": "2018-01-01T00:00:00.000000Z" - } - ], - "meta": { - "page_number": 2, - "page_size": 25, - "total_pages": 3, - "total_results": 55 - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.NumberReservation.create( - phone_numbers=[{"phone_number": "+18665552368"}] -) - { - "data": { - "created_at": "2018-01-01T00:00:00.000000Z", - "customer_reference": "MY REF 001", - "id": "12ade33a-21c0-473b-b055-b3c836e1c292", - "phone_numbers": [ - { - "created_at": "2018-01-01T00:00:00.000000Z", - "errors": "", - "expired_at": "2018-01-01T00:00:00.000000Z", - "id": "12ade33a-21c0-473b-b055-b3c836e1c292", - "phone_number": "+19705555098", - "record_type": "reserved_phone_number", - "status": "pending", - "updated_at": "2018-01-01T00:00:00.000000Z" - } - ], - "record_type": "number_reservation", - "status": "pending", - "updated_at": "2018-01-01T00:00:00.000000Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.NumberReservation.retrieve("uuid") - { - "data": { - "created_at": "2018-01-01T00:00:00.000000Z", - "customer_reference": "MY REF 001", - "id": "12ade33a-21c0-473b-b055-b3c836e1c292", - "phone_numbers": [ - { - "created_at": "2018-01-01T00:00:00.000000Z", - "errors": "", - "expired_at": "2018-01-01T00:00:00.000000Z", - "id": "12ade33a-21c0-473b-b055-b3c836e1c292", - "phone_number": "+19705555098", - "record_type": "reserved_phone_number", - "status": "pending", - "updated_at": "2018-01-01T00:00:00.000000Z" - } - ], - "record_type": "number_reservation", - "status": "pending", - "updated_at": "2018-01-01T00:00:00.000000Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -number_reservation = telnyx.NumberReservation.retrieve("uuid") -number_reservation.extend() - { - "data": { - "created_at": "2018-01-01T00:00:00.000000Z", - "customer_reference": "MY REF 001", - "id": "12ade33a-21c0-473b-b055-b3c836e1c292", - "phone_numbers": [ - { - "created_at": "2018-01-01T00:00:00.000000Z", - "errors": "", - "expired_at": "2018-01-01T00:00:00.000000Z", - "id": "12ade33a-21c0-473b-b055-b3c836e1c292", - "phone_number": "+19705555098", - "record_type": "reserved_phone_number", - "status": "pending", - "updated_at": "2018-01-01T00:00:00.000000Z" - } - ], - "record_type": "number_reservation", - "status": "pending", - "updated_at": "2018-01-01T00:00:00.000000Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.OutboundVoiceProfile.list(page={"number":1,"size":20}) - { - "data": [ - { - "billing_group_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "call_recording": { - "call_recording_caller_phone_numbers": [ - "+19705555098" - ], - "call_recording_channels": "dual", - "call_recording_format": "mp3", - "call_recording_type": "by_call_phone_number" - }, - "concurrent_call_limit": 10, - "connections_count": 12, - "created_at": "2018-02-02T22:25:27.521Z", - "daily_spend_limit": "100.00", - "daily_spend_limit_enabled": true, - "enabled": true, - "id": "1293384261075731499", - "max_destination_rate": 10, - "name": "office", - "record_type": "outbound_voice_profile", - "service_plan": "global", - "tags": [ - "office-profile" - ], - "traffic_type": "conversational", - "updated_at": "2018-02-02T22:25:27.521Z", - "usage_payment_method": "rate-deck", - "whitelisted_destinations": [ - "US", - "BR", - "AU" - ] - } - ], - "meta": { - "page_number": 2, - "page_size": 25, - "total_pages": 3, - "total_results": 55 - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.OutboundVoiceProfile.create(billing_group_id="6a09cdc3-8948-47f0-aa62-74ac943d6c58",concurrent_call_limit=10) - { - "data": { - "billing_group_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "call_recording": { - "call_recording_caller_phone_numbers": [ - "+19705555098" - ], - "call_recording_channels": "dual", - "call_recording_format": "mp3", - "call_recording_type": "by_call_phone_number" - }, - "concurrent_call_limit": 10, - "connections_count": 12, - "created_at": "2018-02-02T22:25:27.521Z", - "daily_spend_limit": "100.00", - "daily_spend_limit_enabled": true, - "enabled": true, - "id": "1293384261075731499", - "max_destination_rate": 10, - "name": "office", - "record_type": "outbound_voice_profile", - "service_plan": "global", - "tags": [ - "office-profile" - ], - "traffic_type": "conversational", - "updated_at": "2018-02-02T22:25:27.521Z", - "usage_payment_method": "rate-deck", - "whitelisted_destinations": [ - "US", - "BR", - "AU" - ] - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.OutboundVoiceProfile.retrieve("id") -res.billing_group_id = "6a09cdc3-8948-47f0-aa62-74ac943d6c58" -res.concurrent_call_limit = 10 - -res.save() - { - "data": { - "billing_group_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "call_recording": { - "call_recording_caller_phone_numbers": [ - "+19705555098" - ], - "call_recording_channels": "dual", - "call_recording_format": "mp3", - "call_recording_type": "by_call_phone_number" - }, - "concurrent_call_limit": 10, - "connections_count": 12, - "created_at": "2018-02-02T22:25:27.521Z", - "daily_spend_limit": "100.00", - "daily_spend_limit_enabled": true, - "enabled": true, - "id": "1293384261075731499", - "max_destination_rate": 10, - "name": "office", - "record_type": "outbound_voice_profile", - "service_plan": "global", - "tags": [ - "office-profile" - ], - "traffic_type": "conversational", - "updated_at": "2018-02-02T22:25:27.521Z", - "usage_payment_method": "rate-deck", - "whitelisted_destinations": [ - "US", - "BR", - "AU" - ] - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.OutboundVoiceProfile.retrieve("id") -res.delete() - { - "data": { - "billing_group_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "call_recording": { - "call_recording_caller_phone_numbers": [ - "+19705555098" - ], - "call_recording_channels": "dual", - "call_recording_format": "mp3", - "call_recording_type": "by_call_phone_number" - }, - "concurrent_call_limit": 10, - "connections_count": 12, - "created_at": "2018-02-02T22:25:27.521Z", - "daily_spend_limit": "100.00", - "daily_spend_limit_enabled": true, - "enabled": true, - "id": "1293384261075731499", - "max_destination_rate": 10, - "name": "office", - "record_type": "outbound_voice_profile", - "service_plan": "global", - "tags": [ - "office-profile" - ], - "traffic_type": "conversational", - "updated_at": "2018-02-02T22:25:27.521Z", - "usage_payment_method": "rate-deck", - "whitelisted_destinations": [ - "US", - "BR", - "AU" - ] - } -} - curl -X POST \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --data '{}' \ - https://api.telnyx.com/v2/telephony_credentials/{id}/token - eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJ0ZWxueXhfdGVsZXBob255IiwiZXhwIjoxNTkwMDEwMTQzLCJpYXQiOjE1ODc1OTA5NDMsImlzcyI6InRlbG55eF90ZWxlcGhvbnkiLCJqdGkiOiJiOGM3NDgzNy1kODllLTRhNjUtOWNmMi0zNGM3YTZmYTYwYzgiLCJuYmYiOjE1ODc1OTA5NDIsInN1YiI6IjVjN2FjN2QwLWRiNjUtNGYxMS05OGUxLWVlYzBkMWQ1YzZhZSIsInRlbF90b2tlbiI6InJqX1pra1pVT1pNeFpPZk9tTHBFVUIzc2lVN3U2UmpaRmVNOXMtZ2JfeENSNTZXRktGQUppTXlGMlQ2Q0JSbWxoX1N5MGlfbGZ5VDlBSThzRWlmOE1USUlzenl6U2xfYURuRzQ4YU81MHlhSEd1UlNZYlViU1ltOVdJaVEwZz09IiwidHlwIjoiYWNjZXNzIn0.gNEwzTow5MLLPLQENytca7pUN79PmPj6FyqZWW06ZeEmesxYpwKh0xRtA0TzLh6CDYIRHrI8seofOO0YFGDhpQ - curl -X GET \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --globoff "https://api.telnyx.com/v2/telephony_credentials?page[number]=1&page[size]=20" - { - "data": [ - { - "created_at": "2020-06-18T21:32:38", - "expired": "false", - "expires_at": "2042-06-18T21:32:38", - "id": "c215ade3-0d39-418e-94be-c5f780760199", - "name": "2020-06-18 21:32:38.917732Z", - "record_type": "credential", - "resource_id": "connection:804252963366242252", - "sip_password": "a92dbcfb60184a8cb330b0acb2f7617b", - "sip_username": "gencrednCvHU5IYpSBPPsXI2iQsDX", - "updated_at": "2020-06-18T21:32:38.000Z", - "user_id": "user-id" - } - ], - "meta": { - "page_number": 2, - "page_size": 25, - "total_pages": 3, - "total_results": 55 - } -} - curl -X POST \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --data '{"connection_id":"1234567890","name":"My-new-credential"}' \ - https://api.telnyx.com/v2/telephony_credentials - { - "data": { - "created_at": "2020-06-18T21:32:38", - "expired": "false", - "expires_at": "2042-06-18T21:32:38", - "id": "c215ade3-0d39-418e-94be-c5f780760199", - "name": "2020-06-18 21:32:38.917732Z", - "record_type": "credential", - "resource_id": "connection:804252963366242252", - "sip_password": "a92dbcfb60184a8cb330b0acb2f7617b", - "sip_username": "gencrednCvHU5IYpSBPPsXI2iQsDX", - "updated_at": "2020-06-18T21:32:38.000Z", - "user_id": "user-id" - } -} - curl -X GET \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --globoff "https://api.telnyx.com/v2/telephony_credentials/{id}" - { - "data": { - "created_at": "2020-06-18T21:32:38", - "expired": "false", - "expires_at": "2042-06-18T21:32:38", - "id": "c215ade3-0d39-418e-94be-c5f780760199", - "name": "2020-06-18 21:32:38.917732Z", - "record_type": "credential", - "resource_id": "connection:804252963366242252", - "sip_password": "a92dbcfb60184a8cb330b0acb2f7617b", - "sip_username": "gencrednCvHU5IYpSBPPsXI2iQsDX", - "updated_at": "2020-06-18T21:32:38.000Z", - "user_id": "user-id" - } -} - curl -X PATCH \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --data '{"connection_id":"987654321","name":"My-new-updated-credential"}' \ - https://api.telnyx.com/v2/telephony_credentials/{id} - { - "data": { - "created_at": "2020-06-18T21:32:38", - "expired": "false", - "expires_at": "2042-06-18T21:32:38", - "id": "c215ade3-0d39-418e-94be-c5f780760199", - "name": "2020-06-18 21:32:38.917732Z", - "record_type": "credential", - "resource_id": "connection:804252963366242252", - "sip_password": "a92dbcfb60184a8cb330b0acb2f7617b", - "sip_username": "gencrednCvHU5IYpSBPPsXI2iQsDX", - "updated_at": "2020-06-18T21:32:38.000Z", - "user_id": "user-id" - } -} - curl -X DELETE \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - "https://api.telnyx.com/v2/telephony_credentials/{id}" - { - "data": { - "created_at": "2020-06-18T21:32:38", - "expired": "false", - "expires_at": "2042-06-18T21:32:38", - "id": "c215ade3-0d39-418e-94be-c5f780760199", - "name": "2020-06-18 21:32:38.917732Z", - "record_type": "credential", - "resource_id": "connection:804252963366242252", - "sip_password": "a92dbcfb60184a8cb330b0acb2f7617b", - "sip_username": "gencrednCvHU5IYpSBPPsXI2iQsDX", - "updated_at": "2020-06-18T21:32:38.000Z", - "user_id": "user-id" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.BillingGroup.list(page={"number":1,"size":20}) - { - "data": [ - { - "created_at": "2019-10-15T10:07:15.527Z", - "deleted_at": null, - "id": "f5586561-8ff0-4291-a0ac-84fe544797bd", - "name": "My billing group name", - "organization_id": "f1486bae-f067-460c-ad43-73a92848f902", - "record_type": "billing_group", - "updated_at": "2019-10-15T10:07:15.527Z" - } - ], - "meta": { - "page_number": 2, - "page_size": 25, - "total_pages": 3, - "total_results": 55 - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.BillingGroup.create(name="string") - { - "data": { - "created_at": "2019-10-15T10:07:15.527Z", - "deleted_at": null, - "id": "f5586561-8ff0-4291-a0ac-84fe544797bd", - "name": "My billing group name", - "organization_id": "f1486bae-f067-460c-ad43-73a92848f902", - "record_type": "billing_group", - "updated_at": "2019-10-15T10:07:15.527Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.BillingGroup.retrieve("id") - { - "data": { - "created_at": "2019-10-15T10:07:15.527Z", - "deleted_at": null, - "id": "f5586561-8ff0-4291-a0ac-84fe544797bd", - "name": "My billing group name", - "organization_id": "f1486bae-f067-460c-ad43-73a92848f902", - "record_type": "billing_group", - "updated_at": "2019-10-15T10:07:15.527Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.BillingGroup.retrieve("id") -res.name = "string" - -res.save() - { - "data": { - "created_at": "2019-10-15T10:07:15.527Z", - "deleted_at": null, - "id": "f5586561-8ff0-4291-a0ac-84fe544797bd", - "name": "My billing group name", - "organization_id": "f1486bae-f067-460c-ad43-73a92848f902", - "record_type": "billing_group", - "updated_at": "2019-10-15T10:07:15.527Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.BillingGroup.retrieve("id") -res.delete() - { - "data": { - "created_at": "2019-10-15T10:07:15.527Z", - "deleted_at": null, - "id": "f5586561-8ff0-4291-a0ac-84fe544797bd", - "name": "My billing group name", - "organization_id": "f1486bae-f067-460c-ad43-73a92848f902", - "record_type": "billing_group", - "updated_at": "2019-10-15T10:07:15.527Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.Address.list(page={"number":1,"size":20}) - { - "data": [ - { - "address_book": false, - "administrative_area": "IL", - "borough": "Guadalajara", - "business_name": "Toy-O'Kon", - "country_code": "US", - "created_at": "2018-02-02T22:25:27.521Z", - "customer_reference": "MY REF 001", - "extended_address": "#504", - "first_name": "Alfred", - "id": "1293384261075731499", - "last_name": "Foster", - "locality": "Chicago", - "neighborhood": "Ciudad de los deportes", - "phone_number": "+12125559000", - "postal_code": "60654", - "record_type": "address", - "street_address": "311 W Superior Street", - "updated_at": "2018-02-02T22:25:27.521Z" - } - ], - "meta": { - "page_number": 2, - "page_size": 25, - "total_pages": 3, - "total_results": 55 - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.Address.create(address_book=True,administrative_area="IL") - { - "data": { - "address_book": false, - "administrative_area": "IL", - "borough": "Guadalajara", - "business_name": "Toy-O'Kon", - "country_code": "US", - "created_at": "2018-02-02T22:25:27.521Z", - "customer_reference": "MY REF 001", - "extended_address": "#504", - "first_name": "Alfred", - "id": "1293384261075731499", - "last_name": "Foster", - "locality": "Chicago", - "neighborhood": "Ciudad de los deportes", - "phone_number": "+12125559000", - "postal_code": "60654", - "record_type": "address", - "street_address": "311 W Superior Street", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.Address.retrieve("id") - { - "data": { - "address_book": false, - "administrative_area": "IL", - "borough": "Guadalajara", - "business_name": "Toy-O'Kon", - "country_code": "US", - "created_at": "2018-02-02T22:25:27.521Z", - "customer_reference": "MY REF 001", - "extended_address": "#504", - "first_name": "Alfred", - "id": "1293384261075731499", - "last_name": "Foster", - "locality": "Chicago", - "neighborhood": "Ciudad de los deportes", - "phone_number": "+12125559000", - "postal_code": "60654", - "record_type": "address", - "street_address": "311 W Superior Street", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.Address.retrieve("id") -res.delete() - { - "data": { - "address_book": false, - "administrative_area": "IL", - "borough": "Guadalajara", - "business_name": "Toy-O'Kon", - "country_code": "US", - "created_at": "2018-02-02T22:25:27.521Z", - "customer_reference": "MY REF 001", - "extended_address": "#504", - "first_name": "Alfred", - "id": "1293384261075731499", - "last_name": "Foster", - "locality": "Chicago", - "neighborhood": "Ciudad de los deportes", - "phone_number": "+12125559000", - "postal_code": "60654", - "record_type": "address", - "street_address": "311 W Superior Street", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - curl -X POST \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --data '{ - "administrative_area":"IL", - "country_code":"US", - "locality":"Chicago", - "postal_code":"60654", - "street_address":"311 W Superior Street" - }' \ - https://api.telnyx.com/v2/addresses/actions/validate - { - "data": { - "record_type": "address_validation", - "result": "valid", - "suggested": { - "administrative_area": "IL", - "country_code": "US", - "extended_address": "#504", - "locality": "Chicago", - "postal_code": "60654", - "street_address": "311 W Superior Street" - } - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.Balance.retrieve() - { - "data": { - "available_credit": "400.00", - "balance": "300.00", - "credit_limit": "100.00", - "currency": "USD", - "record_type": "balance" - } -} - curl -X GET \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --globoff "https://api.telnyx.com/v2/portouts?filter[carrier_name]=&filter[spid]=" - { - "data": [ - { - "carrier_name": "test", - "created_at": "2018-02-02T22:25:27.521Z", - "foc_date": "2018-02-02T22:25:27.521Z", - "id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0", - "phone_numbers": [ - "+35312345678" - ], - "record_type": "portout", - "requested_foc_date": "2018-02-02T22:25:27.521Z", - "spid": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0", - "status": "pending", - "updated_at": "2018-02-02T22:25:27.521Z" - } - ], - "meta": { - "page_number": 3, - "page_size": 1, - "total_pages": 13, - "total_results": 13 - } -} - - curl -X GET \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --globoff "https://api.telnyx.com/v2/portouts/{id}" - - { - "data": { - "carrier_name": "test", - "created_at": "2018-02-02T22:25:27.521Z", - "foc_date": "2018-02-02T22:25:27.521Z", - "id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0", - "phone_numbers": [ - "+35312345678" - ], - "record_type": "portout", - "requested_foc_date": "2018-02-02T22:25:27.521Z", - "spid": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0", - "status": "pending", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - curl -X PATCH \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --data '{}' \ - https://api.telnyx.com/v2/portouts/{id} - { - "data": { - "carrier_name": "test", - "created_at": "2018-02-02T22:25:27.521Z", - "foc_date": "2018-02-02T22:25:27.521Z", - "id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0", - "phone_numbers": [ - "+35312345678" - ], - "record_type": "portout", - "requested_foc_date": "2018-02-02T22:25:27.521Z", - "spid": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0", - "status": "pending", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - curl -X GET \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --globoff "https://api.telnyx.com/v2/portouts/{id}/comments" - { - "data": [ - { - "body": "This is a comment", - "created_at": "2018-02-02T22:25:27.521Z", - "id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0", - "portout_id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0", - "record_type": "portout", - "user_id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0" - } - ], - "meta": { - "page_number": 3, - "page_size": 1, - "total_pages": 13, - "total_results": 13 - } -} - curl -X POST \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --data '{"body": "Comment to post on this portout request"}' \ - https://api.telnyx.com/v2/portouts/{id}/comments - { - "data": { - "body": "This is a comment", - "created_at": "2018-02-02T22:25:27.521Z", - "id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0", - "portout_id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0", - "record_type": "portout", - "user_id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0" - } -} - curl -X POST \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --data '{"phone_numbers":["+13035550000","+13035550001","+13035550002"]}' \ - https://api.telnyx.com/v2/portability_checks - { - "data": [ - { - "fast_portable": true, - "not_portable_reason": "No coverage", - "phone_number": "+13125550123", - "portable": true, - "record_type": "portability_check_result" - } - ] -} - curl -X GET \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --globoff "https://api.telnyx.com/v2/mobile_operator_networks?page[number]=1&page[size]=20" - { - "data": [ - { - "country_code": "US", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "mcc": "310", - "mnc": "410", - "name": "AT&T Mobility (USACG)", - "record_type": "mobile_operator_network", - "tadig": "USACG" - } - ], - "meta": { - "page_number": 2, - "page_size": 25, - "total_pages": 3, - "total_results": 55 - } -} - { - "data": [ - { - "country_code": "US", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "mcc": "310", - "mnc": "410", - "name": "AT&T Mobility (USACG)", - "record_type": "mobile_operator_network", - "tadig": "USACG" - } - ], - "meta": { - "page_number": 2, - "page_size": 25, - "total_pages": 3, - "total_results": 55 - } -} - curl -X GET \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --globoff "https://api.telnyx.com/v2/ota_updates?page[number]=1&page[size]=20" - - { - "data": [ - { - "created_at": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "record_type": "ota_update", - "sim_card_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "status": "in-progress", - "type": "sim_card_network_preferences", - "updated_at": "2018-02-02T22:25:27.521Z" - } - ], - "meta": { - "page_number": 2, - "page_size": 25, - "total_pages": 3, - "total_results": 55 - } -} - curl -X GET \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --globoff "https://api.telnyx.com/v2/ota_updates/6a09cdc3-8948-47f0-aa62-74ac943d6c58" - - { - "data": { - "created_at": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "record_type": "ota_update", - "settings": { - "mobile_operator_networks_preferences": [ - { - "mobile_operator_network_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "mobile_operator_network_name": "AT&T Mobility (USACG)", - "priority": 0 - } - ] - }, - "sim_card_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "status": "in-progress", - "type": "sim_card_network_preferences", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.Wireless.list_detail_records_report.list(page={"number":1,"size":20}) - { - "data": [ - { - "created_at": "2018-02-02T22:25:27.521Z", - "end_time": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "record_type": "detail_records_report", - "report_url": "https://webtechnicom.net", - "start_time": "2018-02-02T22:25:27.521Z", - "status": "pending", - "updated_at": "2018-02-02T22:25:27.521Z" - } - ] -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.Wireless._detail_records_report.create(end_time="2018-02-02T22:25:27.521Z",start_time="2018-02-02T22:25:27.521Z") - - { - "data": { - "created_at": "2018-02-02T22:25:27.521Z", - "end_time": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "record_type": "detail_records_report", - "report_url": "http://webtechnicom.net", - "start_time": "2018-02-02T22:25:27.521Z", - "status": "pending", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - curl -X GET \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --globoff "https://api.telnyx.com/v2/wireless/detail_records_reports/6a09cdc3-8948-47f0-aa62-74ac943d6c58" - - { - "data": { - "created_at": "2018-02-02T22:25:27.521Z", - "end_time": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "record_type": "detail_records_report", - "report_url": "https://webtechnicom.net", - "start_time": "2018-02-02T22:25:27.521Z", - "status": "pending", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - curl -X DELETE \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - "https://api.telnyx.com/v2/wireless/detail_records_reports/6a09cdc3-8948-47f0-aa62-74ac943d6c58" - { - "data": { - "created_at": "2018-02-02T22:25:27.521Z", - "end_time": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "record_type": "detail_records_report", - "report_url": "http://webtechnicom.net", - "start_time": "2018-02-02T22:25:27.521Z", - "status": "pending", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.SimCardGroup.list(page={"number":1,"size":20}) - - { - "data": [ - { - "consumed_data": { - "amount": 10, - "unit": "B" - }, - "created_at": "2018-02-02T22:25:27.521Z", - "data_enabled": true, - "data_limit": 2048, - "default": true, - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "name": "My Test Group", - "record_type": "sim_card_group", - "updated_at": "2018-02-02T22:25:27.521Z" - } - ], - "meta": { - "page_number": 2, - "page_size": 25, - "total_pages": 3, - "total_results": 55 - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.SimCardGroup.create(name="My Test Group",data_enabled=true) - { - "data": { - "consumed_data": { - "amount": 10, - "unit": "B" - }, - "created_at": "2018-02-02T22:25:27.521Z", - "data_enabled": true, - "data_limit": 2048, - "default": true, - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "name": "My Test Group", - "record_type": "sim_card_group", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.SimCardGroup.retrieve("id") - { - "data": { - "consumed_data": { - "amount": 10, - "unit": "B" - }, - "created_at": "2018-02-02T22:25:27.521Z", - "data_enabled": true, - "data_limit": 2048, - "default": true, - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "name": "My Test Group", - "record_type": "sim_card_group", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.SimCardGroup.retrieve("id") -res.data_enabled = true -res.data_limit = 2048 - -res.save() - - { - "data": { - "consumed_data": { - "amount": 10, - "unit": "B" - }, - "created_at": "2018-02-02T22:25:27.521Z", - "data_enabled": true, - "data_limit": 2048, - "default": true, - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "name": "My Test Group", - "record_type": "sim_card_group", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.SimCardGroup.retrieve("id") -res.delete() - { - "data": { - "consumed_data": { - "amount": 10, - "unit": "B" - }, - "created_at": "2018-02-02T22:25:27.521Z", - "data_enabled": true, - "data_limit": 2048, - "default": true, - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "name": "My Test Group", - "record_type": "sim_card_group", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.SIMCard.list(page={"number":1,"size":20}) - - { - "data": [ - { - "created_at": "2018-02-02T22:25:27.521Z", - "iccid": "89310410106543789301", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "imsi": 81932214823362980, - "msisdn": "+13109976224", - "record_type": "sim_card", - "sim_card_group_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "status": "enabled", - "tags": [ - "personal", - "customers", - "active-customers" - ], - "updated_at": "2018-02-02T22:25:27.521Z" - } - ], - "meta": { - "page_number": 2, - "page_size": 25, - "total_pages": 3, - "total_results": 55 - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.SIMCard.retrieve("id",include_sim_card_group=True) - { - "data": { - "created_at": "2018-02-02T22:25:27.521Z", - "iccid": "89310410106543789301", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "imsi": 81932214823362980, - "ipv4": "192.168.0.0", - "ipv6": "2001:cdba:0000:0000:0000:0000:3257:9652", - "msisdn": "+13109976224", - "record_type": "sim_card", - "sim_card_group_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "status": "enabled", - "tags": [ - "personal", - "customers", - "active-customers" - ], - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.SIMCard.retrieve("id") -res.created_at = "2018-02-02T22:25:27.521Z" -res.iccid = "89310410106543789301" - -res.save() - { - "data": { - "created_at": "2018-02-02T22:25:27.521Z", - "iccid": "89310410106543789301", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "imsi": 81932214823362980, - "ipv4": "192.168.0.0", - "ipv6": "2001:cdba:0000:0000:0000:0000:3257:9652", - "msisdn": "+13109976224", - "record_type": "sim_card", - "sim_card_group_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "status": "enabled", - "tags": [ - "personal", - "customers", - "active-customers" - ], - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.SIMCard.retrieve("id") -res.delete() - { - "data": { - "created_at": "2018-02-02T22:25:27.521Z", - "iccid": "89310410106543789301", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "imsi": 81932214823362980, - "ipv4": "192.168.0.0", - "ipv6": "2001:cdba:0000:0000:0000:0000:3257:9652", - "msisdn": "+13109976224", - "record_type": "sim_card", - "sim_card_group_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "status": "enabled", - "tags": [ - "personal", - "customers", - "active-customers" - ], - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - curl -X POST \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --data '{}' \ - https://api.telnyx.com/v2/sim_cards/6a09cdc3-8948-47f0-aa62-74ac943d6c58/actions/enable - { - "data": { - "created_at": "2018-02-02T22:25:27.521Z", - "iccid": "89310410106543789301", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "imsi": 81932214823362980, - "msisdn": "+13109976224", - "record_type": "sim_card", - "sim_card_group_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "status": "enabled", - "tags": [ - "personal", - "customers", - "active-customers" - ], - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - { - "data": { - "created_at": "2018-02-02T22:25:27.521Z", - "iccid": "89310410106543789301", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "imsi": 81932214823362980, - "msisdn": "+13109976224", - "record_type": "sim_card", - "sim_card_group_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "status": "enabled", - "tags": [ - "personal", - "customers", - "active-customers" - ], - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - curl -X POST \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --data '{}' \ - https://api.telnyx.com/v2/sim_cards/6a09cdc3-8948-47f0-aa62-74ac943d6c58/actions/disable - { - "data": { - "created_at": "2018-02-02T22:25:27.521Z", - "iccid": "89310410106543789301", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "imsi": 81932214823362980, - "msisdn": "+13109976224", - "record_type": "sim_card", - "sim_card_group_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "status": "enabled", - "tags": [ - "personal", - "customers", - "active-customers" - ], - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - curl -X POST \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --data '{"registration_codes": ["1234567890, 123456332601"]}' \ - https://api.telnyx.com/v2/actions/register/sim_cards - { - "data": [ - { - "created_at": "2018-02-02T22:25:27.521Z", - "iccid": "89310410106543789301", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "imsi": 81932214823362980, - "msisdn": "+13109976224", - "record_type": "sim_card", - "sim_card_group_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "status": "enabled", - "tags": [ - "personal", - "customers", - "active-customers" - ], - "updated_at": "2018-02-02T22:25:27.521Z" - } - ] -} - - curl -X GET \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --globoff "https://api.telnyx.com/v2/sim_cards/6a09cdc3-8948-47f0-aa62-74ac943d6c58/network_preferences?include_ota_updates=true" - { - "data": { - "created_at": "2018-02-02T22:25:27.521Z", - "mobile_operator_networks_preferences": [ - { - "mobile_operator_network_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "mobile_operator_network_name": "AT&T Mobility (USACG)", - "priority": 0 - } - ], - "ota_updates": [ - { - "created_at": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "record_type": "ota_update", - "settings": { - "mobile_operator_networks_preferences": [ - { - "mobile_operator_network_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "mobile_operator_network_name": "AT&T Mobility (USACG)", - "priority": 0 - } - ] - }, - "sim_card_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "status": "in-progress", - "type": "sim_card_network_preferences", - "updated_at": "2018-02-02T22:25:27.521Z" - } - ], - "record_type": "sim_card_network_preferences", - "sim_card_id": "6b14e151-8493-4fa1-8664-1cc4e6d14158", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - curl -X PUT \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --data '{"mobile_operator_networks_preferences":"array"}' \ - https://api.telnyx.com/v2/sim_cards/6a09cdc3-8948-47f0-aa62-74ac943d6c58/network_preferences - { - "data": { - "created_at": "2018-02-02T22:25:27.521Z", - "mobile_operator_networks_preferences": [ - { - "mobile_operator_network_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "mobile_operator_network_name": "AT&T Mobility (USACG)", - "priority": 0 - } - ], - "ota_updates": [ - { - "created_at": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "record_type": "ota_update", - "settings": { - "mobile_operator_networks_preferences": [ - { - "mobile_operator_network_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "mobile_operator_network_name": "AT&T Mobility (USACG)", - "priority": 0 - } - ] - }, - "sim_card_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "status": "in-progress", - "type": "sim_card_network_preferences", - "updated_at": "2018-02-02T22:25:27.521Z" - } - ], - "record_type": "sim_card_network_preferences", - "sim_card_id": "6b14e151-8493-4fa1-8664-1cc4e6d14158", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - curl -X DELETE \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - "https://api.telnyx.com/v2/sim_cards/6a09cdc3-8948-47f0-aa62-74ac943d6c58/network_preferences" - - { - "data": { - "created_at": "2018-02-02T22:25:27.521Z", - "mobile_operator_networks_preferences": [ - { - "mobile_operator_network_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "mobile_operator_network_name": "AT&T Mobility (USACG)", - "priority": 0 - } - ], - "ota_updates": [ - { - "created_at": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "record_type": "ota_update", - "settings": { - "mobile_operator_networks_preferences": [ - { - "mobile_operator_network_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "mobile_operator_network_name": "AT&T Mobility (USACG)", - "priority": 0 - } - ] - }, - "sim_card_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "status": "in-progress", - "type": "sim_card_network_preferences", - "updated_at": "2018-02-02T22:25:27.521Z" - } - ], - "record_type": "sim_card_network_preferences", - "sim_card_id": "6b14e151-8493-4fa1-8664-1cc4e6d14158", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - - curl -X PUT \ - --header "Content-Type: application/json" \ - --header "Accept: application/json" \ - --header "Authorization: Bearer YOUR_API_KEY" \ - --data '{"mobile_operator_networks_preferences":"array","sim_card_ids":["6b14e151-8493-4fa1-8664-1cc4e6d14158","6b14e151-8493-4fa1-8664-1cc4e6d14158"]}' \ - - { - "data": [ - { - "created_at": "2018-02-02T22:25:27.521Z", - "mobile_operator_networks_preferences": [ - { - "mobile_operator_network_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "mobile_operator_network_name": "AT&T Mobility (USACG)", - "priority": 0 - } - ], - "ota_updates": [ - { - "created_at": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "record_type": "ota_update", - "settings": { - "mobile_operator_networks_preferences": [ - { - "mobile_operator_network_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "mobile_operator_network_name": "AT&T Mobility (USACG)", - "priority": 0 - } - ] - }, - "sim_card_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "status": "in-progress", - "type": "sim_card_network_preferences", - "updated_at": "2018-02-02T22:25:27.521Z" - } - ], - "record_type": "sim_card_network_preferences", - "sim_card_id": "6b14e151-8493-4fa1-8664-1cc4e6d14158", - "updated_at": "2018-02-02T22:25:27.521Z" - } - ] -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.Connection.list(page={"number":1,"size":20}) - - { - "data": [ - { - "active": true, - "anchorsite_override": "Latency", - "connection_name": "string", - "created_at": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "outbound_voice_profile_id": "1293384261075731499", - "record_type": "ip_connection", - "updated_at": "2018-02-02T22:25:27.521Z", - "webhook_api_version": "1", - "webhook_event_failover_url": "https://failover.webtechnicom.net", - "webhook_event_url": "https://webtechnicom.net" - } - ], - "meta": { - "page_number": 2, - "page_size": 25, - "total_pages": 3, - "total_results": 55 - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.Connection.retrieve("id") - - { - "data": { - "active": true, - "anchorsite_override": "Latency", - "connection_name": "string", - "created_at": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "outbound_voice_profile_id": "1293384261075731499", - "record_type": "ip_connection", - "updated_at": "2018-02-02T22:25:27.521Z", - "webhook_api_version": "1", - "webhook_event_failover_url": "https://failover.webtechnicom.net", - "webhook_event_url": "https://webtechnicom.net" - } -} - { - "data": [ - { - "active": true, - "anchorsite_override": "Latency", - "connection_name": "string", - "created_at": "2018-02-02T22:25:27.521Z", - "default_on_hold_comfort_noise_enabled": true, - "dtmf_type": "RFC 2833", - "encode_contact_header_enabled": true, - "encrypted_media": "SRTP", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "inbound": { - "ani_number_format": "+E.164", - "channel_limit": 10, - "codecs": [ - "G722" - ], - "dnis_number_format": "+e164", - "generate_ringback_tone": true, - "isup_headers_enabled": true, - "prack_enabled": true, - "privacy_zone_enabled": true, - "sip_compact_headers_enabled": true, - "timeout_1xx_secs": 10, - "timeout_2xx_secs": "15" - }, - "onnet_t38_passthrough_enabled": true, - "outbound": { - "ani_override": "string", - "ani_override_type": "always", - "call_parking_enabled": true, - "channel_limit": 10, - "generate_ringback_tone": true, - "instant_ringback_enabled": true, - "localization": "string", - "outbound_voice_profile_id": "1293384261075731499", - "t38_reinvite_source": "telnyx" - }, - "password": "my123secure456password789", - "record_type": "credential_connection", - "rtcp_settings": { - "capture_enabled": true, - "port": "rtp+1", - "report_frequency_seconds": 10 - }, - "sip_uri_calling_preference": "disabled", - "updated_at": "2018-02-02T22:25:27.521Z", - "user_name": "myusername123" - } - ], - "meta": { - "page_number": 2, - "page_size": 25, - "total_pages": 3, - "total_results": 55 - } -} - - https://api.telnyx.com/v2/actions/network_preferences/sim_cards - { - "data": { - "active": true, - "anchorsite_override": "Latency", - "connection_name": "string", - "created_at": "2018-02-02T22:25:27.521Z", - "default_on_hold_comfort_noise_enabled": true, - "dtmf_type": "RFC 2833", - "encode_contact_header_enabled": true, - "encrypted_media": "SRTP", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "inbound": { - "ani_number_format": "+E.164", - "channel_limit": 10, - "codecs": [ - "G722" - ], - "dnis_number_format": "+e164", - "generate_ringback_tone": true, - "isup_headers_enabled": true, - "prack_enabled": true, - "privacy_zone_enabled": true, - "sip_compact_headers_enabled": true, - "timeout_1xx_secs": 10, - "timeout_2xx_secs": "15" - }, - "onnet_t38_passthrough_enabled": true, - "outbound": { - "ani_override": "string", - "ani_override_type": "always", - "call_parking_enabled": true, - "channel_limit": 10, - "generate_ringback_tone": true, - "instant_ringback_enabled": true, - "localization": "string", - "outbound_voice_profile_id": "1293384261075731499", - "t38_reinvite_source": "telnyx" - }, - "password": "my123secure456password789", - "record_type": "credential_connection", - "rtcp_settings": { - "capture_enabled": true, - "port": "rtp+1", - "report_frequency_seconds": 10 - }, - "sip_uri_calling_preference": "disabled", - "updated_at": "2018-02-02T22:25:27.521Z", - "user_name": "myusername123" - } -} - - { - "data": { - "active": true, - "anchorsite_override": "Latency", - "connection_name": "string", - "created_at": "2018-02-02T22:25:27.521Z", - "default_on_hold_comfort_noise_enabled": true, - "dtmf_type": "RFC 2833", - "encode_contact_header_enabled": true, - "encrypted_media": "SRTP", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "inbound": { - "ani_number_format": "+E.164", - "channel_limit": 10, - "codecs": [ - "G722" - ], - "dnis_number_format": "+e164", - "generate_ringback_tone": true, - "isup_headers_enabled": true, - "prack_enabled": true, - "privacy_zone_enabled": true, - "sip_compact_headers_enabled": true, - "timeout_1xx_secs": 10, - "timeout_2xx_secs": "15" - }, - "onnet_t38_passthrough_enabled": true, - "outbound": { - "ani_override": "string", - "ani_override_type": "always", - "call_parking_enabled": true, - "channel_limit": 10, - "generate_ringback_tone": true, - "instant_ringback_enabled": true, - "localization": "string", - "outbound_voice_profile_id": "1293384261075731499", - "t38_reinvite_source": "telnyx" - }, - "password": "my123secure456password789", - "record_type": "credential_connection", - "rtcp_settings": { - "capture_enabled": true, - "port": "rtp+1", - "report_frequency_seconds": 10 - }, - "sip_uri_calling_preference": "disabled", - "updated_at": "2018-02-02T22:25:27.521Z", - "user_name": "myusername123" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.FqdnConnection.list(page={"number":1,"size":20}) - - { - "data": [ - { - "active": true, - "anchorsite_override": "Latency", - "connection_name": "string", - "created_at": "2018-02-02T22:25:27.521Z", - "default_on_hold_comfort_noise_enabled": true, - "dtmf_type": "RFC 2833", - "encode_contact_header_enabled": true, - "encrypted_media": "SRTP", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "inbound": { - "ani_number_format": "+E.164", - "channel_limit": 10, - "codecs": [ - "G722" - ], - "default_routing_method": "sequential", - "dnis_number_format": "+e164", - "generate_ringback_tone": true, - "isup_headers_enabled": true, - "prack_enabled": true, - "privacy_zone_enabled": true, - "sip_compact_headers_enabled": true, - "sip_region": "US", - "sip_subdomain": "string", - "sip_subdomain_receive_settings": "only_my_connections", - "timeout_1xx_secs": 10, - "timeout_2xx_secs": 10 - }, - "onnet_t38_passthrough_enabled": true, - "record_type": "fqdn_connection", - "rtcp_settings": { - "capture_enabled": true, - "port": "rtcp-mux", - "report_frequency_secs": 10 - }, - "transport_protocol": "UDP", - "updated_at": "2018-02-02T22:25:27.521Z" - } - ], - "meta": { - "page_number": 2, - "page_size": 25, - "total_pages": 3, - "total_results": 55 - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.FqdnConnection.create(active=true,anchorsite_override="Latency") - { - "data": { - "active": true, - "anchorsite_override": "Latency", - "connection_name": "string", - "created_at": "2018-02-02T22:25:27.521Z", - "default_on_hold_comfort_noise_enabled": true, - "dtmf_type": "RFC 2833", - "encode_contact_header_enabled": true, - "encrypted_media": "SRTP", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "inbound": { - "ani_number_format": "+E.164", - "channel_limit": 10, - "codecs": [ - "G722" - ], - "default_routing_method": "sequential", - "dnis_number_format": "+e164", - "generate_ringback_tone": true, - "isup_headers_enabled": true, - "prack_enabled": true, - "privacy_zone_enabled": true, - "sip_compact_headers_enabled": true, - "sip_region": "US", - "sip_subdomain": "string", - "sip_subdomain_receive_settings": "only_my_connections", - "timeout_1xx_secs": 10, - "timeout_2xx_secs": 10 - }, - "onnet_t38_passthrough_enabled": true, - "record_type": "fqdn_connection", - "rtcp_settings": { - "capture_enabled": true, - "port": "rtcp-mux", - "report_frequency_secs": 10 - }, - "transport_protocol": "UDP", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.FqdnConnection.retrieve("id") - - { - "data": { - "active": true, - "anchorsite_override": "Latency", - "connection_name": "string", - "created_at": "2018-02-02T22:25:27.521Z", - "default_on_hold_comfort_noise_enabled": true, - "dtmf_type": "RFC 2833", - "encode_contact_header_enabled": true, - "encrypted_media": "SRTP", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "inbound": { - "ani_number_format": "+E.164", - "channel_limit": 10, - "codecs": [ - "G722" - ], - "default_routing_method": "sequential", - "dnis_number_format": "+e164", - "generate_ringback_tone": true, - "isup_headers_enabled": true, - "prack_enabled": true, - "privacy_zone_enabled": true, - "sip_compact_headers_enabled": true, - "sip_region": "US", - "sip_subdomain": "string", - "sip_subdomain_receive_settings": "only_my_connections", - "timeout_1xx_secs": 10, - "timeout_2xx_secs": 10 - }, - "onnet_t38_passthrough_enabled": true, - "record_type": "fqdn_connection", - "rtcp_settings": { - "capture_enabled": true, - "port": "rtcp-mux", - "report_frequency_secs": 10 - }, - "transport_protocol": "UDP", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.FqdnConnection.retrieve("id") -res.active = true -res.anchorsite_override = "Latency" - -res.save() - - { - "data": { - "active": true, - "anchorsite_override": "Latency", - "connection_name": "string", - "created_at": "2018-02-02T22:25:27.521Z", - "default_on_hold_comfort_noise_enabled": true, - "dtmf_type": "RFC 2833", - "encode_contact_header_enabled": true, - "encrypted_media": "SRTP", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "inbound": { - "ani_number_format": "+E.164", - "channel_limit": 10, - "codecs": [ - "G722" - ], - "default_routing_method": "sequential", - "dnis_number_format": "+e164", - "generate_ringback_tone": true, - "isup_headers_enabled": true, - "prack_enabled": true, - "privacy_zone_enabled": true, - "sip_compact_headers_enabled": true, - "sip_region": "US", - "sip_subdomain": "string", - "sip_subdomain_receive_settings": "only_my_connections", - "timeout_1xx_secs": 10, - "timeout_2xx_secs": 10 - }, - "onnet_t38_passthrough_enabled": true, - "record_type": "fqdn_connection", - "rtcp_settings": { - "capture_enabled": true, - "port": "rtcp-mux", - "report_frequency_secs": 10 - }, - "transport_protocol": "UDP", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.FqdnConnection.retrieve("id") -res.delete() - { - "data": { - "active": true, - "anchorsite_override": "Latency", - "connection_name": "string", - "created_at": "2018-02-02T22:25:27.521Z", - "default_on_hold_comfort_noise_enabled": true, - "dtmf_type": "RFC 2833", - "encode_contact_header_enabled": true, - "encrypted_media": "SRTP", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "inbound": { - "ani_number_format": "+E.164", - "channel_limit": 10, - "codecs": [ - "G722" - ], - "default_routing_method": "sequential", - "dnis_number_format": "+e164", - "generate_ringback_tone": true, - "isup_headers_enabled": true, - "prack_enabled": true, - "privacy_zone_enabled": true, - "sip_compact_headers_enabled": true, - "sip_region": "US", - "sip_subdomain": "string", - "sip_subdomain_receive_settings": "only_my_connections", - "timeout_1xx_secs": 10, - "timeout_2xx_secs": 10 - }, - "onnet_t38_passthrough_enabled": true, - "record_type": "fqdn_connection", - "rtcp_settings": { - "capture_enabled": true, - "port": "rtcp-mux", - "report_frequency_secs": 10 - }, - "transport_protocol": "UDP", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.Fqdn.list(page={"number":1,"size":20}) - - { - "data": [ - { - "connection_id": "3456789987654", - "created_at": "2018-02-02T22:25:27.521Z", - "dns_record_type": "a", - "fqdn": "example.com", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "port": 5060, - "record_type": "fqdn", - "updated_at": "2018-02-02T22:25:27.521Z" - } - ] -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.Fqdn.create(fqdn="example.com",connection_id="6a09cdc3-8948-47f0-aa62-74ac943d6c58") - - { - "data": { - "connection_id": "3456789987654", - "created_at": "2018-02-02T22:25:27.521Z", - "dns_record_type": "a", - "fqdn": "example.com", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "port": 5060, - "record_type": "fqdn", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.Fqdn.retrieve("id") - - { - "data": { - "connection_id": "3456789987654", - "created_at": "2018-02-02T22:25:27.521Z", - "dns_record_type": "a", - "fqdn": "example.com", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "port": 5060, - "record_type": "fqdn", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.Fqdn.retrieve("id") -res.fqdn = "example.com" -res.connection_id = "6a09cdc3-8948-47f0-aa62-74ac943d6c58" - -res.save() - - { - "data": { - "connection_id": "3456789987654", - "created_at": "2018-02-02T22:25:27.521Z", - "dns_record_type": "a", - "fqdn": "example.com", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "port": 5060, - "record_type": "fqdn", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.Fqdn.retrieve("id") -res.delete() - { - "data": { - "connection_id": "3456789987654", - "created_at": "2018-02-02T22:25:27.521Z", - "dns_record_type": "a", - "fqdn": "example.com", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "port": 5060, - "record_type": "fqdn", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.IpConnection.list(page={"number":1,"size":20}) - - { - "data": [ - { - "active": true, - "anchorsite_override": "Latency", - "connection_name": "string", - "created_at": "2018-02-02T22:25:27.521Z", - "default_on_hold_comfort_noise_enabled": true, - "dtmf_type": "RFC 2833", - "encode_contact_header_enabled": true, - "encrypted_media": "SRTP", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "inbound": { - "ani_number_format": "+E.164", - "channel_limit": 10, - "codecs": [ - "G722" - ], - "default_primary_ip_id": "192.0.2.1", - "default_routing_method": "sequential", - "default_secondary_ip_id": "198.51.100.1", - "default_tertiary_ip_id": "203.0.113.1", - "dnis_number_format": "+e164", - "generate_ringback_tone": true, - "isup_headers_enabled": true, - "prack_enabled": true, - "privacy_zone_enabled": true, - "sip_compact_headers_enabled": true, - "sip_region": "US", - "sip_subdomain": "string", - "sip_subdomain_receive_settings": "only_my_connections", - "timeout_1xx_secs": 10, - "timeout_2xx_secs": 10 - }, - "onnet_t38_passthrough_enabled": true, - "outbound": { - "ani_override": "string", - "ani_override_type": "always", - "call_parking_enabled": true, - "channel_limit": 10, - "generate_ringback_tone": true, - "instant_ringback_enabled": true, - "ip_authentication_method": "token", - "ip_authentication_token": "string", - "localization": "string", - "outbound_voice_profile_id": "1293384261075731499", - "t38_reinvite_source": "telnyx", - "tech_prefix": "string" - }, - "record_type": "ip_connection", - "rtcp_settings": { - "capture_enabled": true, - "port": "rtcp-mux", - "report_frequency_secs": 10 - }, - "transport_protocol": "UDP", - "updated_at": "2018-02-02T22:25:27.521Z" - } - ], - "meta": { - "page_number": 2, - "page_size": 25, - "total_pages": 3, - "total_results": 55 - } -} - - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.IpConnection.create(active=true,anchorsite_override="Latency") - - { - "data": { - "active": true, - "anchorsite_override": "Latency", - "connection_name": "string", - "created_at": "2018-02-02T22:25:27.521Z", - "default_on_hold_comfort_noise_enabled": true, - "dtmf_type": "RFC 2833", - "encode_contact_header_enabled": true, - "encrypted_media": "SRTP", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "inbound": { - "ani_number_format": "+E.164", - "channel_limit": 10, - "codecs": [ - "G722" - ], - "default_primary_ip_id": "192.0.2.1", - "default_routing_method": "sequential", - "default_secondary_ip_id": "198.51.100.1", - "default_tertiary_ip_id": "203.0.113.1", - "dnis_number_format": "+e164", - "generate_ringback_tone": true, - "isup_headers_enabled": true, - "prack_enabled": true, - "privacy_zone_enabled": true, - "sip_compact_headers_enabled": true, - "sip_region": "US", - "sip_subdomain": "string", - "sip_subdomain_receive_settings": "only_my_connections", - "timeout_1xx_secs": 10, - "timeout_2xx_secs": 10 - }, - "onnet_t38_passthrough_enabled": true, - "outbound": { - "ani_override": "string", - "ani_override_type": "always", - "call_parking_enabled": true, - "channel_limit": 10, - "generate_ringback_tone": true, - "instant_ringback_enabled": true, - "ip_authentication_method": "token", - "ip_authentication_token": "string", - "localization": "string", - "outbound_voice_profile_id": "1293384261075731499", - "t38_reinvite_source": "telnyx", - "tech_prefix": "string" - }, - "record_type": "ip_connection", - "rtcp_settings": { - "capture_enabled": true, - "port": "rtcp-mux", - "report_frequency_secs": 10 - }, - "transport_protocol": "UDP", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.IpConnection.retrieve("id") - - { - "data": { - "active": true, - "anchorsite_override": "Latency", - "connection_name": "string", - "created_at": "2018-02-02T22:25:27.521Z", - "default_on_hold_comfort_noise_enabled": true, - "dtmf_type": "RFC 2833", - "encode_contact_header_enabled": true, - "encrypted_media": "SRTP", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "inbound": { - "ani_number_format": "+E.164", - "channel_limit": 10, - "codecs": [ - "G722" - ], - "default_primary_ip_id": "192.0.2.1", - "default_routing_method": "sequential", - "default_secondary_ip_id": "198.51.100.1", - "default_tertiary_ip_id": "203.0.113.1", - "dnis_number_format": "+e164", - "generate_ringback_tone": true, - "isup_headers_enabled": true, - "prack_enabled": true, - "privacy_zone_enabled": true, - "sip_compact_headers_enabled": true, - "sip_region": "US", - "sip_subdomain": "string", - "sip_subdomain_receive_settings": "only_my_connections", - "timeout_1xx_secs": 10, - "timeout_2xx_secs": 10 - }, - "onnet_t38_passthrough_enabled": true, - "outbound": { - "ani_override": "string", - "ani_override_type": "always", - "call_parking_enabled": true, - "channel_limit": 10, - "generate_ringback_tone": true, - "instant_ringback_enabled": true, - "ip_authentication_method": "token", - "ip_authentication_token": "string", - "localization": "string", - "outbound_voice_profile_id": "1293384261075731499", - "t38_reinvite_source": "telnyx", - "tech_prefix": "string" - }, - "record_type": "ip_connection", - "rtcp_settings": { - "capture_enabled": true, - "port": "rtcp-mux", - "report_frequency_secs": 10 - }, - "transport_protocol": "UDP", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.IpConnection.retrieve("id") -res.active = true -res.anchorsite_override = "Latency" - -res.save() - - { - "data": { - "active": true, - "anchorsite_override": "Latency", - "connection_name": "string", - "created_at": "2018-02-02T22:25:27.521Z", - "default_on_hold_comfort_noise_enabled": true, - "dtmf_type": "RFC 2833", - "encode_contact_header_enabled": true, - "encrypted_media": "SRTP", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "inbound": { - "ani_number_format": "+E.164", - "channel_limit": 10, - "codecs": [ - "G722" - ], - "default_primary_ip_id": "192.0.2.1", - "default_routing_method": "sequential", - "default_secondary_ip_id": "198.51.100.1", - "default_tertiary_ip_id": "203.0.113.1", - "dnis_number_format": "+e164", - "generate_ringback_tone": true, - "isup_headers_enabled": true, - "prack_enabled": true, - "privacy_zone_enabled": true, - "sip_compact_headers_enabled": true, - "sip_region": "US", - "sip_subdomain": "string", - "sip_subdomain_receive_settings": "only_my_connections", - "timeout_1xx_secs": 10, - "timeout_2xx_secs": 10 - }, - "onnet_t38_passthrough_enabled": true, - "outbound": { - "ani_override": "string", - "ani_override_type": "always", - "call_parking_enabled": true, - "channel_limit": 10, - "generate_ringback_tone": true, - "instant_ringback_enabled": true, - "ip_authentication_method": "token", - "ip_authentication_token": "string", - "localization": "string", - "outbound_voice_profile_id": "1293384261075731499", - "t38_reinvite_source": "telnyx", - "tech_prefix": "string" - }, - "record_type": "ip_connection", - "rtcp_settings": { - "capture_enabled": true, - "port": "rtcp-mux", - "report_frequency_secs": 10 - }, - "transport_protocol": "UDP", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.Ip.list(page={"number":1,"size":20}) - { - "data": [ - { - "connection_id": "3456789987654", - "created_at": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "ip_address": "192.168.0.0", - "port": 5060, - "record_type": "ip", - "updated_at": "2018-02-02T22:25:27.521Z" - } - ] -} - - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.Ip.create(ip_address="192.168.0.0",connection_id="6a09cdc3-8948-47f0-aa62-74ac943d6c58") - - - { - "data": { - "connection_id": "3456789987654", - "created_at": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "ip_address": "192.168.0.0", - "port": 5060, - "record_type": "ip", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -telnyx.Ip.retrieve("id") - { - "data": { - "connection_id": "3456789987654", - "created_at": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "ip_address": "192.168.0.0", - "port": 5060, - "record_type": "ip", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.Ip.retrieve("id") -res.ip_address = "192.168.0.0" -res.connection_id = "6a09cdc3-8948-47f0-aa62-74ac943d6c58" - -res.save() - - { - "data": { - "connection_id": "3456789987654", - "created_at": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "ip_address": "192.168.0.0", - "port": 5060, - "record_type": "ip", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - import telnyx -telnyx.api_key = "YOUR_API_KEY" - -res = telnyx.Ip.retrieve("id") -res.delete() - - { - "data": { - "connection_id": "3456789987654", - "created_at": "2018-02-02T22:25:27.521Z", - "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58", - "ip_address": "192.168.0.0", - "port": 5060, - "record_type": "ip", - "updated_at": "2018-02-02T22:25:27.521Z" - } -} - - # Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - url='http://demo.twilio.com/docs/voice.xml', - to='+15558675310', - from_='+15017122661' - ) - -print(call.sid) -{ - "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "annotation": null, - "answered_by": null, - "api_version": "2010-04-01", - "caller_name": null, - "date_created": "Tue, 31 Aug 2010 20:36:28 +0000", - "date_updated": "Tue, 31 Aug 2010 20:36:44 +0000", - "direction": "inbound", - "duration": "15", - "end_time": "Tue, 31 Aug 2010 20:36:44 +0000", - "forwarded_from": "+141586753093", - "from": "+15017122661", - "from_formatted": "(501) 712-2661", - "group_sid": null, - "parent_call_sid": null, - "phone_number_sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "price": "-0.03000", - "price_unit": "USD", - "sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "start_time": "Tue, 31 Aug 2010 20:36:29 +0000", - "status": "completed", - "subresource_uris": { - "notifications": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications.json", - "recordings": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Recordings.json", - "feedback": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Feedback.json", - "feedback_summaries": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/FeedbackSummary.json", - "payments": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Payments.json", - "events": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Events.json" - }, - "to": "+15558675310", - "to_formatted": "(555) 867-5310", - "trunk_sid": null, - "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json", - "queue_time": "1000" -} - from flask import Flask -app = Flask(__name__) - -@app.route("/") -def hello(): - return "Hello World!" - -if __name__ == "__main__": - app.run() -from flask import Flask -from twilio.twiml.voice_response import VoiceResponse - -app = Flask(__name__) - - -@app.route("/answer", methods=['GET', 'POST']) -def answer_call(): - """Respond to incoming phone calls with a brief message.""" - # Start our TwiML response - resp = VoiceResponse() - - # Read a message aloud to the caller - resp.say("Thank you for calling! Have a great day.", voice='alice') - - return str(resp) - -if __name__ == "__main__": - app.run(debug=True) -# Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - twiml='Ahoy, World!', - to='+14155551212', - from_='+15017122661' - ) - -print(call.sid) -{ - "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "annotation": null, - "answered_by": null, - "api_version": "2010-04-01", - "caller_name": null, - "date_created": "Tue, 31 Aug 2010 20:36:28 +0000", - "date_updated": "Tue, 31 Aug 2010 20:36:44 +0000", - "direction": "inbound", - "duration": "15", - "end_time": "Tue, 31 Aug 2010 20:36:44 +0000", - "forwarded_from": "+141586753093", - "from": "+15017122661", - "from_formatted": "(501) 712-2661", - "group_sid": null, - "parent_call_sid": null, - "phone_number_sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "price": "-0.03000", - "price_unit": "USD", - "sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "start_time": "Tue, 31 Aug 2010 20:36:29 +0000", - "status": "completed", - "subresource_uris": { - "notifications": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications.json", - "recordings": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Recordings.json", - "feedback": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Feedback.json", - "feedback_summaries": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/FeedbackSummary.json", - "payments": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Payments.json", - "events": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Events.json" - }, - "to": "+14155551212", - "to_formatted": "(415) 555-1212", - "trunk_sid": null, - "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json", - "queue_time": "1000" -} - - # Download the helper library from https://www.twilio.com/docs/python/install -import os -from twilio.rest import Client - - -# Your Account Sid and Auth Token from twilio.com/console -# and set the environment variables. See http://twil.io/secure -account_sid = os.environ['TWILIO_ACCOUNT_SID'] -auth_token = os.environ['TWILIO_AUTH_TOKEN'] -client = Client(account_sid, auth_token) - -call = client.calls.create( - url='http://demo.twilio.com/docs/classic.mp3', - to='+14155551212', - from_='+14155551212' - ) - -print(call.sid) -{ - "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "annotation": null, - "answered_by": null, - "api_version": "2010-04-01", - "caller_name": null, - "date_created": "Tue, 31 Aug 2010 20:36:28 +0000", - "date_updated": "Tue, 31 Aug 2010 20:36:44 +0000", - "direction": "inbound", - "duration": "15", - "end_time": "Tue, 31 Aug 2010 20:36:44 +0000", - "forwarded_from": "+141586753093", - "from": "+14155551212", - "from_formatted": "(415) 555-1212", - "group_sid": null, - "parent_call_sid": null, - "phone_number_sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "price": "-0.03000", - "price_unit": "USD", - "sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", - "start_time": "Tue, 31 Aug 2010 20:36:29 +0000", - "status": "completed", - "subresource_uris": { - "notifications": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications.json", - "recordings": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Recordings.json", - "feedback": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Feedback.json", - "feedback_summaries": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/FeedbackSummary.json", - "payments": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Payments.json", - "events": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Events.json" - }, - "to": "+14155551212", - "to_formatted": "(415) 555-1212", - "trunk_sid": null, - "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json", - "queue_time": "1000" -} - - - - Thanks for trying our documentation. Enjoy! - https://demo.twilio.com/docs/classic.mp3 - -from flask import Flask -from twilio.twiml.voice_response import VoiceResponse, Gather - -app = Flask(__name__) - - -@app.route("/voice", methods=['GET', 'POST']) -def voice(): - """Respond to incoming phone calls with a menu of options""" - # Start our TwiML response - resp = VoiceResponse() - - # Start our verb - gather = Gather(num_digits=1) - gather.say('For sales, press 1. For support, press 2.') - resp.append(gather) - - # If the user doesn't select an option, redirect them into a loop - resp.redirect('/voice') - - return str(resp) - -if __name__ == "__main__": - app.run(debug=True) -from flask import Flask, request -from twilio.twiml.voice_response import VoiceResponse, Gather - -app = Flask(__name__) - - -@app.route("/voice", methods=['GET', 'POST']) -def voice(): - """Respond to incoming phone calls with a menu of options""" - # Start our TwiML response - resp = VoiceResponse() - - # If Twilio's request to our app included already gathered digits, - # process them - if 'Digits' in request.values: - # Get which digit the caller chose - choice = request.values['Digits'] - - # a different message depending on the caller's choice - if choice == '1': - resp.say('You selected sales. Good for you!') - return str(resp) - elif choice == '2': - resp.say('You need support. We will help!') - return str(resp) - else: - # If the caller didn't choose 1 or 2, apologize and ask them again - resp.say("Sorry, I don't understand that choice.") - - # Start our verb - gather = Gather(num_digits=1) - gather.say('For sales, press 1. For support, press 2.') - resp.append(gather) - - # If the user doesn't select an option, redirect them into a loop - resp.redirect('/voice') - - return str(resp) - -if __name__ == "__main__": - app.run(debug=True) -from flask import Flask, request -from twilio.twiml.voice_response import VoiceResponse, Gather - -app = Flask(__name__) - - -@app.route("/voice", methods=['GET', 'POST']) -def voice(): - """Respond to incoming phone calls with a menu of options""" - # Start our TwiML response - resp = VoiceResponse() - - # Start our verb - gather = Gather(num_digits=1, action='/gather') - gather.say('For sales, press 1. For support, press 2.') - resp.append(gather) - - # If the user doesn't select an option, redirect them into a loop - resp.redirect('/voice') - - return str(resp) - - -@app.route('/gather', methods=['GET', 'POST']) -def gather(): - """Processes results from the prompt in /voice""" - # Start our TwiML response - resp = VoiceResponse() - - # If Twilio's request to our app included already gathered digits, - # process them - if 'Digits' in request.values: - # Get which digit the caller chose - choice = request.values['Digits'] - - # a different message depending on the caller's choice - if choice == '1': - resp.say('You selected sales. Good for you!') - return str(resp) - elif choice == '2': - resp.say('You need support. We will help!') - return str(resp) - else: - # If the caller didn't choose 1 or 2, apologize and ask them again - resp.say("Sorry, I don't understand that choice.") - - # If the user didn't choose 1 or 2 (or anything), send them back to /voice - resp.redirect('/voice') - - return str(resp) - -if __name__ == "__main__": - app.run(debug=True) - - from flask import ( - flash, - render_template, - redirect, - request, - session, - url_for, -) -from twilio.twiml.voice_response import VoiceResponse - -from ivr_phone_tree_python import app -from ivr_phone_tree_python.view_helpers import twiml - - -@app.route('/') -@app.route('/ivr') -def home(): - return render_template('index.html') - - -@app.route('/ivr/welcome', methods=['POST']) -def welcome(): - response = VoiceResponse() - with response.gather( - num_digits=1, action=url_for('menu'), method="POST" - ) as g: - g.say(message="Thanks for calling the E T Phone Home Service. " + - "Please press 1 for directions." + - "Press 2 for a list of planets to call.", loop=3) - return twiml(response) - - -@app.route('/ivr/menu', methods=['POST']) -def menu(): - selected_option = request.form['Digits'] - option_actions = {'1': _give_instructions, - '2': _list_planets} - - if option_actions.has_key(selected_option): - response = VoiceResponse() - option_actions[selected_option](response) - return twiml(response) - - return _redirect_welcome() - - -@app.route('/ivr/planets', methods=['POST']) -def planets(): - selected_option = request.form['Digits'] - option_actions = {'2': "+12024173378", - '3': "+12027336386", - "4": "+12027336637"} - - if selected_option in option_actions: - response = VoiceResponse() - response.dial(option_actions[selected_option]) - return twiml(response) - - return _redirect_welcome() - - -# private methods - -def _give_instructions(response): - response.say("To get to your extraction point, get on your bike and go " + - "down the street. Then Left down an alley. Avoid the police" + - " cars. Turn left into an unfinished housing development." + - "Fly over the roadblock. Go past the moon. Soon after " + - "you will see your mother ship.", - voice="alice", language="en-GB") - - response.say("Thank you for calling the E T Phone Home Service - the " + - "adventurous alien's first choice in intergalactic travel") - - response.hangup() - return response - - -def _list_planets(response): - with response.gather( - numDigits=1, action=url_for('planets'), method="POST" - ) as g: - g.say("To call the planet Broh doe As O G, press 2. To call the " + - "planet DuhGo bah, press 3. To call an oober asteroid " + - "to your location, press 4. To go back to the main menu " + - " press the star key.", - voice="alice", language="en-GB", loop=3) - - return response - - -def _redirect_welcome(): - response = VoiceResponse() - response.say("Returning to the main menu", voice="alice", language="en-GB") - response.redirect(url_for('welcome')) - - return twiml(response) - from flask import ( - flash, - render_template, - redirect, - request, - session, - url_for, -) -from twilio.twiml.voice_response import VoiceResponse - -from ivr_phone_tree_python import app -from ivr_phone_tree_python.view_helpers import twiml - - -@app.route('/') -@app.route('/ivr') -def home(): - return render_template('index.html') - - -@app.route('/ivr/welcome', methods=['POST']) -def welcome(): - response = VoiceResponse() - with response.gather( - num_digits=1, action=url_for('menu'), method="POST" - ) as g: - g.say(message="Thanks for calling the E T Phone Home Service. " + - "Please press 1 for directions." + - "Press 2 for a list of planets to call.", loop=3) - return twiml(response) - - -@app.route('/ivr/menu', methods=['POST']) -def menu(): - selected_option = request.form['Digits'] - option_actions = {'1': _give_instructions, - '2': _list_planets} - - if option_actions.has_key(selected_option): - response = VoiceResponse() - option_actions[selected_option](response) - return twiml(response) - - return _redirect_welcome() - - -@app.route('/ivr/planets', methods=['POST']) -def planets(): - selected_option = request.form['Digits'] - option_actions = {'2': "+12024173378", - '3': "+12027336386", - "4": "+12027336637"} - - if selected_option in option_actions: - response = VoiceResponse() - response.dial(option_actions[selected_option]) - return twiml(response) - - return _redirect_welcome() - - -# private methods - -def _give_instructions(response): - response.say("To get to your extraction point, get on your bike and go " + - "down the street. Then Left down an alley. Avoid the police" + - " cars. Turn left into an unfinished housing development." + - "Fly over the roadblock. Go past the moon. Soon after " + - "you will see your mother ship.", - voice="alice", language="en-GB") - - response.say("Thank you for calling the E T Phone Home Service - the " + - "adventurous alien's first choice in intergalactic travel") - - response.hangup() - return response - - -def _list_planets(response): - with response.gather( - numDigits=1, action=url_for('planets'), method="POST" - ) as g: - g.say("To call the planet Broh doe As O G, press 2. To call the " + - "planet DuhGo bah, press 3. To call an oober asteroid " + - "to your location, press 4. To go back to the main menu " + - " press the star key.", - voice="alice", language="en-GB", loop=3) - - return response - - -def _redirect_welcome(): - response = VoiceResponse() - response.say("Returning to the main menu", voice="alice", language="en-GB") - response.redirect(url_for('welcome')) - - return twiml(response) -from flask import ( - flash, - render_template, - redirect, - request, - session, - url_for, -) -from twilio.twiml.voice_response import VoiceResponse - -from ivr_phone_tree_python import app -from ivr_phone_tree_python.view_helpers import twiml - - -@app.route('/') -@app.route('/ivr') -def home(): - return render_template('index.html') - - -@app.route('/ivr/welcome', methods=['POST']) -def welcome(): - response = VoiceResponse() - with response.gather( - num_digits=1, action=url_for('menu'), method="POST" - ) as g: - g.say(message="Thanks for calling the E T Phone Home Service. " + - "Please press 1 for directions." + - "Press 2 for a list of planets to call.", loop=3) - return twiml(response) - - -@app.route('/ivr/menu', methods=['POST']) -def menu(): - selected_option = request.form['Digits'] - option_actions = {'1': _give_instructions, - '2': _list_planets} - - if option_actions.has_key(selected_option): - response = VoiceResponse() - option_actions[selected_option](response) - return twiml(response) - - return _redirect_welcome() - - -@app.route('/ivr/planets', methods=['POST']) -def planets(): - selected_option = request.form['Digits'] - option_actions = {'2': "+12024173378", - '3': "+12027336386", - "4": "+12027336637"} - - if selected_option in option_actions: - response = VoiceResponse() - response.dial(option_actions[selected_option]) - return twiml(response) - - return _redirect_welcome() - - -# private methods - -def _give_instructions(response): - response.say("To get to your extraction point, get on your bike and go " + - "down the street. Then Left down an alley. Avoid the police" + - " cars. Turn left into an unfinished housing development." + - "Fly over the roadblock. Go past the moon. Soon after " + - "you will see your mother ship.", - voice="alice", language="en-GB") - - response.say("Thank you for calling the E T Phone Home Service - the " + - "adventurous alien's first choice in intergalactic travel") - - response.hangup() - return response - - -def _list_planets(response): - with response.gather( - numDigits=1, action=url_for('planets'), method="POST" - ) as g: - g.say("To call the planet Broh doe As O G, press 2. To call the " + - "planet DuhGo bah, press 3. To call an oober asteroid " + - "to your location, press 4. To go back to the main menu " + - " press the star key.", - voice="alice", language="en-GB", loop=3) - - return response - - -def _redirect_welcome(): - response = VoiceResponse() - response.say("Returning to the main menu", voice="alice", language="en-GB") - response.redirect(url_for('welcome')) - - return twiml(response) -from flask import ( - flash, - render_template, - redirect, - request, - session, - url_for, -) -from twilio.twiml.voice_response import VoiceResponse - -from ivr_phone_tree_python import app -from ivr_phone_tree_python.view_helpers import twiml - - -@app.route('/') -@app.route('/ivr') -def home(): - return render_template('index.html') - - -@app.route('/ivr/welcome', methods=['POST']) -def welcome(): - response = VoiceResponse() - with response.gather( - num_digits=1, action=url_for('menu'), method="POST" - ) as g: - g.say(message="Thanks for calling the E T Phone Home Service. " + - "Please press 1 for directions." + - "Press 2 for a list of planets to call.", loop=3) - return twiml(response) - - -@app.route('/ivr/menu', methods=['POST']) -def menu(): - selected_option = request.form['Digits'] - option_actions = {'1': _give_instructions, - '2': _list_planets} - - if option_actions.has_key(selected_option): - response = VoiceResponse() - option_actions[selected_option](response) - return twiml(response) - - return _redirect_welcome() - - -@app.route('/ivr/planets', methods=['POST']) -def planets(): - selected_option = request.form['Digits'] - option_actions = {'2': "+12024173378", - '3': "+12027336386", - "4": "+12027336637"} - - if selected_option in option_actions: - response = VoiceResponse() - response.dial(option_actions[selected_option]) - return twiml(response) - - return _redirect_welcome() - - -# private methods - -def _give_instructions(response): - response.say("To get to your extraction point, get on your bike and go " + - "down the street. Then Left down an alley. Avoid the police" + - " cars. Turn left into an unfinished housing development." + - "Fly over the roadblock. Go past the moon. Soon after " + - "you will see your mother ship.", - voice="alice", language="en-GB") - - response.say("Thank you for calling the E T Phone Home Service - the " + - "adventurous alien's first choice in intergalactic travel") - - response.hangup() - return response - - -def _list_planets(response): - with response.gather( - numDigits=1, action=url_for('planets'), method="POST" - ) as g: - g.say("To call the planet Broh doe As O G, press 2. To call the " + - "planet DuhGo bah, press 3. To call an oober asteroid " + - "to your location, press 4. To go back to the main menu " + - " press the star key.", - voice="alice", language="en-GB", loop=3) - - return response - - -def _redirect_welcome(): - response = VoiceResponse() - response.say("Returning to the main menu", voice="alice", language="en-GB") - response.redirect(url_for('welcome')) - - return twiml(response) -from flask import ( - flash, - render_template, - redirect, - request, - session, - url_for, -) -from twilio.twiml.voice_response import VoiceResponse - -from ivr_phone_tree_python import app -from ivr_phone_tree_python.view_helpers import twiml - - -@app.route('/') -@app.route('/ivr') -def home(): - return render_template('index.html') - - -@app.route('/ivr/welcome', methods=['POST']) -def welcome(): - response = VoiceResponse() - with response.gather( - num_digits=1, action=url_for('menu'), method="POST" - ) as g: - g.say(message="Thanks for calling the E T Phone Home Service. " + - "Please press 1 for directions." + - "Press 2 for a list of planets to call.", loop=3) - return twiml(response) - - -@app.route('/ivr/menu', methods=['POST']) -def menu(): - selected_option = request.form['Digits'] - option_actions = {'1': _give_instructions, - '2': _list_planets} - - if option_actions.has_key(selected_option): - response = VoiceResponse() - option_actions[selected_option](response) - return twiml(response) - - return _redirect_welcome() - - -@app.route('/ivr/planets', methods=['POST']) -def planets(): - selected_option = request.form['Digits'] - option_actions = {'2': "+12024173378", - '3': "+12027336386", - "4": "+12027336637"} - - if selected_option in option_actions: - response = VoiceResponse() - response.dial(option_actions[selected_option]) - return twiml(response) - - return _redirect_welcome() - - -# private methods - -def _give_instructions(response): - response.say("To get to your extraction point, get on your bike and go " + - "down the street. Then Left down an alley. Avoid the police" + - " cars. Turn left into an unfinished housing development." + - "Fly over the roadblock. Go past the moon. Soon after " + - "you will see your mother ship.", - voice="alice", language="en-GB") - - response.say("Thank you for calling the E T Phone Home Service - the " + - "adventurous alien's first choice in intergalactic travel") - - response.hangup() - return response - - -def _list_planets(response): - with response.gather( - numDigits=1, action=url_for('planets'), method="POST" - ) as g: - g.say("To call the planet Broh doe As O G, press 2. To call the " + - "planet DuhGo bah, press 3. To call an oober asteroid " + - "to your location, press 4. To go back to the main menu " + - " press the star key.", - voice="alice", language="en-GB", loop=3) - - return response - - -def _redirect_welcome(): - response = VoiceResponse() - response.say("Returning to the main menu", voice="alice", language="en-GB") - response.redirect(url_for('welcome')) - - return twiml(response) -from flask import ( - flash, - render_template, - redirect, - request, - session, - url_for, -) -from twilio.twiml.voice_response import VoiceResponse - -from ivr_phone_tree_python import app -from ivr_phone_tree_python.view_helpers import twiml - - -@app.route('/') -@app.route('/ivr') -def home(): - return render_template('index.html') - - -@app.route('/ivr/welcome', methods=['POST']) -def welcome(): - response = VoiceResponse() - with response.gather( - num_digits=1, action=url_for('menu'), method="POST" - ) as g: - g.say(message="Thanks for calling the E T Phone Home Service. " + - "Please press 1 for directions." + - "Press 2 for a list of planets to call.", loop=3) - return twiml(response) - - -@app.route('/ivr/menu', methods=['POST']) -def menu(): - selected_option = request.form['Digits'] - option_actions = {'1': _give_instructions, - '2': _list_planets} - - if option_actions.has_key(selected_option): - response = VoiceResponse() - option_actions[selected_option](response) - return twiml(response) - - return _redirect_welcome() - - -@app.route('/ivr/planets', methods=['POST']) -def planets(): - selected_option = request.form['Digits'] - option_actions = {'2': "+12024173378", - '3': "+12027336386", - "4": "+12027336637"} - - if selected_option in option_actions: - response = VoiceResponse() - response.dial(option_actions[selected_option]) - return twiml(response) - - return _redirect_welcome() - - -# private methods - -def _give_instructions(response): - response.say("To get to your extraction point, get on your bike and go " + - "down the street. Then Left down an alley. Avoid the police" + - " cars. Turn left into an unfinished housing development." + - "Fly over the roadblock. Go past the moon. Soon after " + - "you will see your mother ship.", - voice="alice", language="en-GB") - - response.say("Thank you for calling the E T Phone Home Service - the " + - "adventurous alien's first choice in intergalactic travel") - - response.hangup() - return response - - -def _list_planets(response): - with response.gather( - numDigits=1, action=url_for('planets'), method="POST" - ) as g: - g.say("To call the planet Broh doe As O G, press 2. To call the " + - "planet DuhGo bah, press 3. To call an oober asteroid " + - "to your location, press 4. To go back to the main menu " + - " press the star key.", - voice="alice", language="en-GB", loop=3) - - return response - - -def _redirect_welcome(): - response = VoiceResponse() - response.say("Returning to the main menu", voice="alice", language="en-GB") - response.redirect(url_for('welcome')) - - return twiml(response) -from flask import ( - flash, - render_template, - redirect, - request, - session, - url_for, -) -from twilio.twiml.voice_response import VoiceResponse - -from ivr_phone_tree_python import app -from ivr_phone_tree_python.view_helpers import twiml - - -@app.route('/') -@app.route('/ivr') -def home(): - return render_template('index.html') - - -@app.route('/ivr/welcome', methods=['POST']) -def welcome(): - response = VoiceResponse() - with response.gather( - num_digits=1, action=url_for('menu'), method="POST" - ) as g: - g.say(message="Thanks for calling the E T Phone Home Service. " + - "Please press 1 for directions." + - "Press 2 for a list of planets to call.", loop=3) - return twiml(response) - - -@app.route('/ivr/menu', methods=['POST']) -def menu(): - selected_option = request.form['Digits'] - option_actions = {'1': _give_instructions, - '2': _list_planets} - - if option_actions.has_key(selected_option): - response = VoiceResponse() - option_actions[selected_option](response) - return twiml(response) - - return _redirect_welcome() - - -@app.route('/ivr/planets', methods=['POST']) -def planets(): - selected_option = request.form['Digits'] - option_actions = {'2': "+12024173378", - '3': "+12027336386", - "4": "+12027336637"} - - if selected_option in option_actions: - response = VoiceResponse() - response.dial(option_actions[selected_option]) - return twiml(response) - - return _redirect_welcome() - - -# private methods - -def _give_instructions(response): - response.say("To get to your extraction point, get on your bike and go " + - "down the street. Then Left down an alley. Avoid the police" + - " cars. Turn left into an unfinished housing development." + - "Fly over the roadblock. Go past the moon. Soon after " + - "you will see your mother ship.", - voice="alice", language="en-GB") - - response.say("Thank you for calling the E T Phone Home Service - the " + - "adventurous alien's first choice in intergalactic travel") - - response.hangup() - return response - - -def _list_planets(response): - with response.gather( - numDigits=1, action=url_for('planets'), method="POST" - ) as g: - g.say("To call the planet Broh doe As O G, press 2. To call the " + - "planet DuhGo bah, press 3. To call an oober asteroid " + - "to your location, press 4. To go back to the main menu " + - " press the star key.", - voice="alice", language="en-GB", loop=3) - - return response - - -def _redirect_welcome(): - response = VoiceResponse() - response.say("Returning to the main menu", voice="alice", language="en-GB") - response.redirect(url_for('welcome')) - - return twiml(response) - - - +print($call->sid);