├── .gitignore ├── bootstrap └── bootstrap.php ├── classes ├── erlhcoreclassmodeltwiliochat.php ├── erlhcoreclassmodeltwiliophone.php ├── erlhcoreclasstwiliovalidator.php └── filter.php ├── design └── twiliotheme │ └── tpl │ ├── lhchat │ └── chat_tabs │ │ └── after_phone_extension_multiinclude.tpl.php │ ├── lhtwilio │ ├── edit.tpl.php │ ├── index.tpl.php │ ├── list.tpl.php │ ├── new.tpl.php │ ├── notification.tpl.php │ ├── parts │ │ └── form.tpl.php │ └── sendmessage.tpl.php │ └── pagelayouts │ └── parts │ ├── modules_menu │ └── extension_module_multiinclude.tpl.php │ └── top_menu_multiinclude.tpl.php ├── doc ├── install.sql ├── phonenumber.png └── structure.json ├── modules ├── lhcron │ └── update_structure.php ├── lhrestapi │ ├── module.php │ ├── twilio_create_sms.php │ └── twilio_phones.php └── lhtwilio │ ├── callbacks.php │ ├── delete.php │ ├── edit.php │ ├── index.php │ ├── list.php │ ├── module.php │ ├── new.php │ ├── notification.php │ └── sendmessage.php ├── pos ├── erlhcoreclassmodeltwiliochat.php └── erlhcoreclassmodeltwiliophone.php ├── readme.md ├── settings └── settings.ini.default.php └── vendor └── twilio-php-master ├── .gitignore ├── .travis.yml ├── AUTHORS.md ├── CHANGES.md ├── LICENSE ├── Makefile ├── README.md ├── Services ├── Twilio.php └── Twilio │ ├── AutoPagingIterator.php │ ├── Capability.php │ ├── CapabilityAPI.php │ ├── CapabilityTaskRouter.php │ ├── HttpException.php │ ├── HttpStream.php │ ├── InstanceResource.php │ ├── JWT.php │ ├── ListResource.php │ ├── LookupsInstanceResource.php │ ├── LookupsListResource.php │ ├── MonitorInstanceResource.php │ ├── MonitorListResource.php │ ├── NextGenInstanceResource.php │ ├── NextGenListResource.php │ ├── NumberType.php │ ├── Page.php │ ├── PartialApplicationHelper.php │ ├── PricingInstanceResource.php │ ├── PricingListResource.php │ ├── RequestValidator.php │ ├── Resource.php │ ├── Rest │ ├── Account.php │ ├── Accounts.php │ ├── Address.php │ ├── Addresses.php │ ├── Application.php │ ├── Applications.php │ ├── AuthorizedConnectApp.php │ ├── AuthorizedConnectApps.php │ ├── AvailablePhoneNumber.php │ ├── AvailablePhoneNumbers.php │ ├── Call.php │ ├── Calls.php │ ├── Conference.php │ ├── Conferences.php │ ├── ConnectApp.php │ ├── ConnectApps.php │ ├── Credential.php │ ├── CredentialList.php │ ├── CredentialListMapping.php │ ├── CredentialListMappings.php │ ├── CredentialLists.php │ ├── Credentials.php │ ├── DependentPhoneNumber.php │ ├── DependentPhoneNumbers.php │ ├── Domain.php │ ├── Domains.php │ ├── Feedback.php │ ├── FeedbackSummary.php │ ├── IncomingPhoneNumber.php │ ├── IncomingPhoneNumbers.php │ ├── IpAccessControlList.php │ ├── IpAccessControlListMapping.php │ ├── IpAccessControlListMappings.php │ ├── IpAccessControlLists.php │ ├── IpAddress.php │ ├── IpAddresses.php │ ├── Key.php │ ├── Keys.php │ ├── Lookups │ │ ├── PhoneNumber.php │ │ └── PhoneNumbers.php │ ├── Media.php │ ├── MediaInstance.php │ ├── Member.php │ ├── Members.php │ ├── Message.php │ ├── Messages.php │ ├── Monitor │ │ ├── Alert.php │ │ ├── Alerts.php │ │ ├── Event.php │ │ └── Events.php │ ├── Notification.php │ ├── Notifications.php │ ├── OutgoingCallerId.php │ ├── OutgoingCallerIds.php │ ├── Participant.php │ ├── Participants.php │ ├── Pricing │ │ ├── MessagingCountries.php │ │ ├── MessagingCountry.php │ │ ├── PhoneNumberCountries.php │ │ ├── PhoneNumberCountry.php │ │ ├── VoiceCountries.php │ │ ├── VoiceCountry.php │ │ ├── VoiceNumber.php │ │ └── VoiceNumbers.php │ ├── Queue.php │ ├── Queues.php │ ├── Recording.php │ ├── Recordings.php │ ├── Sandbox.php │ ├── ShortCode.php │ ├── ShortCodes.php │ ├── Sip.php │ ├── SmsMessage.php │ ├── SmsMessages.php │ ├── TaskRouter │ │ ├── Activities.php │ │ ├── Activity.php │ │ ├── Event.php │ │ ├── Events.php │ │ ├── Reservation.php │ │ ├── Reservations.php │ │ ├── Statistics.php │ │ ├── Task.php │ │ ├── TaskQueue.php │ │ ├── TaskQueueStatistics.php │ │ ├── TaskQueues.php │ │ ├── TaskQueuesStatistics.php │ │ ├── Tasks.php │ │ ├── Worker.php │ │ ├── WorkerStatistics.php │ │ ├── Workers.php │ │ ├── WorkersStatistics.php │ │ ├── Workflow.php │ │ ├── WorkflowStatistics.php │ │ ├── Workflows.php │ │ ├── Workspace.php │ │ ├── WorkspaceStatistics.php │ │ └── Workspaces.php │ ├── Token.php │ ├── Tokens.php │ ├── Transcription.php │ ├── Transcriptions.php │ ├── Trunking │ │ ├── CredentialList.php │ │ ├── CredentialLists.php │ │ ├── IpAccessControlList.php │ │ ├── IpAccessControlLists.php │ │ ├── OriginationUrl.php │ │ ├── OriginationUrls.php │ │ ├── PhoneNumber.php │ │ ├── PhoneNumbers.php │ │ ├── Trunk.php │ │ └── Trunks.php │ ├── UsageRecord.php │ ├── UsageRecords.php │ ├── UsageTrigger.php │ └── UsageTriggers.php │ ├── RestException.php │ ├── SIPListResource.php │ ├── TaskRouterInstanceResource.php │ ├── TaskRouterListResource.php │ ├── TimeRangeResource.php │ ├── TinyHttp.php │ ├── TrunkingInstanceResource.php │ ├── TrunkingListResource.php │ ├── Twiml.php │ ├── UsageResource.php │ └── WorkflowConfiguration.php ├── composer.json ├── composer.lock ├── docs ├── Makefile ├── _themes │ ├── .gitignore │ ├── LICENSE │ ├── README.rst │ ├── flask_theme_support.py │ ├── kr │ │ ├── layout.html │ │ ├── relations.html │ │ ├── static │ │ │ ├── flasky.css_t │ │ │ └── small_flask.css │ │ └── theme.conf │ └── kr_small │ │ ├── layout.html │ │ ├── static │ │ └── flasky.css_t │ │ └── theme.conf ├── api │ ├── rest.rst │ ├── services.rst │ ├── taskrouter.rst │ └── twiml.rst ├── conf.py ├── faq.rst ├── index.rst ├── quickstart.rst ├── requirements.txt └── usage │ ├── rest.rst │ ├── rest │ ├── accounts.rst │ ├── applications.rst │ ├── callerids.rst │ ├── calls.rst │ ├── conferences.rst │ ├── members.rst │ ├── messages.rst │ ├── notifications.rst │ ├── phonenumbers.rst │ ├── pricing.rst │ ├── queues.rst │ ├── recordings.rst │ ├── sip.rst │ ├── sms-messages.rst │ ├── transcriptions.rst │ ├── usage-records.rst │ └── usage-triggers.rst │ ├── taskrouter.rst │ ├── taskrouter │ ├── activities.rst │ ├── events.rst │ ├── reservations.rst │ ├── statistics.rst │ ├── task-queues.rst │ ├── tasks.rst │ ├── workers.rst │ ├── workflows.rst │ └── workspaces.rst │ ├── token-generation.rst │ ├── twiml.rst │ └── validation.rst ├── package.php └── tests ├── Bootstrap.php ├── BuildQueryTest.php ├── CapabilityTest.php ├── NextGenListResourceTest.php ├── README ├── RequestValidatorTest.php ├── TwilioTest.php ├── TwimlTest.php ├── phpunit.xml └── resources ├── AccountsTest.php ├── ApplicationsTest.php ├── AvailablePhoneNumbersTest.php ├── CallsTest.php ├── ConnectAppsTest.php ├── FeedbackSummaryTest.php ├── FeedbackTest.php ├── IncomingPhoneNumbersTest.php ├── KeysTest.php ├── MediaTest.php ├── MembersTest.php ├── MessagesTest.php ├── NotificationTest.php ├── OutgoingCallerIdsTest.php ├── QueuesTest.php ├── SMSMessagesTest.php ├── SandboxTest.php ├── ShortCodesTest.php ├── TokensTest.php ├── UsageRecordsTest.php ├── UsageTriggersTest.php ├── lookups └── PhoneNumbersTest.php ├── monitor ├── AlertsTest.php └── EventsTest.php ├── pricing ├── MessagingTest.php ├── PhoneNumbersTest.php └── VoiceTest.php ├── task_router ├── ActivitiesTest.php ├── EventsTest.php ├── ReservationsTest.php ├── TaskQueueStatisticsTest.php ├── TaskQueuesStatisticsTest.php ├── TaskQueuesTest.php ├── TasksTest.php ├── WorkerStatisticsTest.php ├── WorkersStatisticsTest.php ├── WorkersTest.php ├── WorkflowStatisticsTest.php ├── WorkflowsTest.php ├── WorkspaceStatisticsTest.php └── WorkspacesTest.php └── trunking ├── CredentialListsTest.php ├── IpAccessControlLists.php ├── OriginationUrls.php ├── PhoneNumbers.php └── TrunksTest.php /.gitignore: -------------------------------------------------------------------------------- 1 | settings/settings.ini.php -------------------------------------------------------------------------------- /classes/erlhcoreclassmodeltwiliochat.php: -------------------------------------------------------------------------------- 1 | $this->id, 19 | 'phone' => $this->phone, 20 | 'chat_id' => $this->chat_id, 21 | 'ctime' => $this->ctime, 22 | 'utime' => $this->utime, 23 | 'tphone_id' => $this->tphone_id 24 | ); 25 | } 26 | 27 | public function __toString() 28 | { 29 | return $this->phone; 30 | } 31 | 32 | public function __get($var) 33 | { 34 | switch ($var) { 35 | 36 | case 'chat': 37 | $this->chat = erLhcoreClassModelChat::fetch($this->chat_id); 38 | return $this->chat; 39 | break; 40 | 41 | default: 42 | ; 43 | break; 44 | } 45 | } 46 | 47 | /** 48 | * Delete page chat's 49 | */ 50 | public function beforeRemove() 51 | { 52 | $q = ezcDbInstance::get()->createDeleteQuery(); 53 | $q->deleteFrom('lhc_twilio_chat')->where($q->expr->eq('phone', $this->phone)); 54 | $stmt = $q->prepare(); 55 | $stmt->execute(); 56 | } 57 | 58 | public $id = null; 59 | 60 | public $phone = null; 61 | 62 | public $chat_id = null; 63 | 64 | public $tphone_id = null; 65 | 66 | public $ctime = null; 67 | 68 | public $utime = null; 69 | 70 | } 71 | 72 | ?> -------------------------------------------------------------------------------- /classes/erlhcoreclassmodeltwiliophone.php: -------------------------------------------------------------------------------- 1 | $this->id, 19 | 'phone' => $this->phone, 20 | 'base_phone' => $this->base_phone, 21 | 'account_sid' => $this->account_sid, 22 | 'auth_token' => $this->auth_token, 23 | 'dep_id' => $this->dep_id, 24 | 'chat_timeout' => $this->chat_timeout, 25 | 'originator' => $this->originator, 26 | 'responder_timeout' => $this->responder_timeout, 27 | 'ah_provided' => $this->ah_provided 28 | ); 29 | } 30 | 31 | public function __toString() 32 | { 33 | return $this->phone; 34 | } 35 | 36 | public function __get($var) 37 | { 38 | switch ($var) { 39 | 40 | case 'callback_url': 41 | $this->callback_url = erLhcoreClassXMP::getBaseHost() . $_SERVER['HTTP_HOST'] . erLhcoreClassDesign::baseurldirect('twilio/callbacks'); 42 | return $this->callback_url; 43 | break; 44 | 45 | default: 46 | ; 47 | break; 48 | } 49 | } 50 | 51 | /** 52 | * Delete page chat's 53 | */ 54 | public function beforeRemove() 55 | { 56 | $q = ezcDbInstance::get()->createDeleteQuery(); 57 | $q->deleteFrom('lhc_twilio_chat')->where($q->expr->eq('phone', ezcDbInstance::get()->quote($this->phone))); 58 | $stmt = $q->prepare(); 59 | $stmt->execute(); 60 | } 61 | 62 | public $id = null; 63 | 64 | public $phone = null; 65 | 66 | public $account_sid = null; 67 | 68 | public $auth_token = null; 69 | 70 | public $dep_id = null; 71 | 72 | public $base_phone = ''; 73 | 74 | public $chat_timeout = 3600*72; 75 | 76 | public $responder_timeout = 12*3600; 77 | 78 | public $originator = ''; 79 | 80 | public $ah_provided = 0; 81 | } 82 | 83 | ?> -------------------------------------------------------------------------------- /classes/filter.php: -------------------------------------------------------------------------------- 1 | 'text', 7 | 'trans' => 'Name', 8 | 'required' => false, 9 | 'valid_if_filled' => false, 10 | 'filter_type' => 'like', 11 | 'filter_table_field' => 'name', 12 | 'validation_definition' => new ezcInputFormDefinitionElement ( 13 | ezcInputFormDefinitionElement::OPTIONAL, 'string' 14 | ) 15 | ); 16 | 17 | $fieldSortAttr = array ( 18 | 'field' => false, 19 | 'default' => false, 20 | 'serialised' => true, 21 | 'disabled' => true, 22 | 'options' => array() 23 | ); 24 | 25 | return array( 26 | 'filterAttributes' => $fieldsSearch, 27 | 'sortAttributes' => $fieldSortAttr 28 | ); -------------------------------------------------------------------------------- /design/twiliotheme/tpl/lhchat/chat_tabs/after_phone_extension_multiinclude.tpl.php: -------------------------------------------------------------------------------- 1 | chat_variables_array; 3 | if (isset($chatVariables['twilio_sms_chat'])) : ?> 4 | 5 | getTranslation('chat/adminchat','SMS')?> 6 | getTranslation('chat/adminchat','YES')?> ( getTranslation('chat/adminchat','SMS were send')?>) 7 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /design/twiliotheme/tpl/lhtwilio/edit.tpl.php: -------------------------------------------------------------------------------- 1 |

getTranslation('module/fbmessenger','Edit phone');?>

2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 |
12 | 13 | 14 |
15 | 16 |
-------------------------------------------------------------------------------- /design/twiliotheme/tpl/lhtwilio/index.tpl.php: -------------------------------------------------------------------------------- 1 |

getTranslation('module/twilio','Twilio');?>

2 | 3 | -------------------------------------------------------------------------------- /design/twiliotheme/tpl/lhtwilio/list.tpl.php: -------------------------------------------------------------------------------- 1 |

getTranslation('module/fbmessenger','Twilio phones');?>

2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 25 | 26 | 27 |
IDgetTranslation('module/fbmessenger','Phone');?>getTranslation('module/fbmessenger','Callback URL');?>
id?>phone?>callback_url?> 20 |
21 | 22 | 23 |
24 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 |
37 | getTranslation('module/fbmessenger','New');?> 38 |
-------------------------------------------------------------------------------- /design/twiliotheme/tpl/lhtwilio/new.tpl.php: -------------------------------------------------------------------------------- 1 |

getTranslation('module/fbmessenger','New phone');?>

2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 |
12 | 13 | 14 |
15 | 16 |
-------------------------------------------------------------------------------- /design/twiliotheme/tpl/lhtwilio/notification.tpl.php: -------------------------------------------------------------------------------- 1 |

getTranslation('module/osticket','Twilio notification settings')?>

2 | 3 | 4 | 5 | 6 | 7 | getTranslation('user/account','Settings updated'); ?> 8 | 9 | 10 | 11 |
12 | 13 |
14 | 15 | 16 |

Supported variables - {chat_duration}, {waited}, {created}, {user_left}, {chat_id}, {phone}, {name}, {email}, {url_request}, {ip}, {department}, {country}, {city}

17 |
18 | 19 |
20 | 21 |
22 | 23 |
-------------------------------------------------------------------------------- /design/twiliotheme/tpl/pagelayouts/parts/modules_menu/extension_module_multiinclude.tpl.php: -------------------------------------------------------------------------------- 1 |
  • textsmsgetTranslation('pagelayout/pagelayout','Twilio settings');?>
  • -------------------------------------------------------------------------------- /design/twiliotheme/tpl/pagelayouts/parts/top_menu_multiinclude.tpl.php: -------------------------------------------------------------------------------- 1 | hasAccessTo('lhtwilio','use')) : ?> 2 | 3 | -------------------------------------------------------------------------------- /doc/install.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE `lhc_twilio_chat` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `chat_id` bigint(20) unsigned NOT NULL, `phone` varchar(35) NOT NULL, `ctime` int(11) NOT NULL, `utime` int(11) NOT NULL, `tphone_id` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `phone_utime` (`phone`,`utime`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 2 | CREATE TABLE `lhc_twilio_phone` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `phone` varchar(35) NOT NULL, `base_phone` varchar(35) NOT NULL, `originator` varchar(35) NOT NULL, `account_sid` varchar(35), `auth_token` varchar(35),`ah_provided` tinyint(1) unsigned NOT NULL DEFAULT 0, `dep_id` int(11) unsigned NOT NULL, `chat_timeout` int(11) unsigned NOT NULL, `responder_timeout` int(11) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `phone` (`phone`)) ENGINE=InnoDB DEFAULT CHARSET=utf8; 3 | -------------------------------------------------------------------------------- /doc/phonenumber.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiveHelperChat/twilio/2624b25df5dbedb01379fe96579d07141b409842/doc/phonenumber.png -------------------------------------------------------------------------------- /modules/lhcron/update_structure.php: -------------------------------------------------------------------------------- 1 | $status) { 12 | $queries = array_merge($queries,$status['queries']); 13 | } 14 | 15 | if (empty($queries)){ 16 | echo "No queries to execute found\n"; 17 | } else { 18 | echo "The following queries will be executed\nYou have 10 seconds to stop executing these quries\n"; 19 | echo implode("\n", $queries)."\n"; 20 | sleep(10); 21 | 22 | erLhcoreClassUpdate::doTablesUpdate(json_decode($contentData,true)); 23 | echo "Tables were updated"; 24 | } 25 | 26 | 27 | ?> -------------------------------------------------------------------------------- /modules/lhrestapi/module.php: -------------------------------------------------------------------------------- 1 | "Twilio Rest API"); 4 | 5 | $ViewList = array(); 6 | 7 | $ViewList['twilio_create_sms'] = array( 8 | 'params' => array(), 9 | 'functions' => array() 10 | ); 11 | 12 | $ViewList['twilio_phones'] = array( 13 | 'params' => array(), 14 | 'functions' => array() 15 | ); 16 | 17 | $FunctionList = array(); 18 | 19 | ?> -------------------------------------------------------------------------------- /modules/lhrestapi/twilio_create_sms.php: -------------------------------------------------------------------------------- 1 | hasAccessTo('lhtwilio','use')) { 9 | throw new Exception('You do not have permission to use twilio! "lhtwilio","use" permission is missing'); 10 | } 11 | 12 | $params = json_decode(file_get_contents('php://input'),true); 13 | 14 | // Twilio phone number 15 | if (!isset($params['phone_number']) || empty($params['phone_number'])) { 16 | $Errors['phone_number'] = erTranslationClassLhTranslation::getInstance()->getTranslation('twilio/sendmessage','Please enter phone number!'); 17 | } 18 | 19 | // Twilio message 20 | if (!isset($params['msg']) || empty($params['msg'])) { 21 | $Errors['msg'] = erTranslationClassLhTranslation::getInstance()->getTranslation('twilio/sendmessage','Please enter message!'); 22 | } 23 | 24 | // Should we create a chat or just send an SMS 25 | if (!isset($params['create_chat'])) { 26 | $params['create_chat'] = false; 27 | } else { 28 | $params['create_chat'] = true; 29 | } 30 | 31 | if (!isset($params['twilio_id']) || !is_numeric($params['twilio_id'])) { 32 | $Errors['twilio_id'] = erTranslationClassLhTranslation::getInstance()->getTranslation('twilio/sendmessage','Please enter twilio phone!'); 33 | } 34 | 35 | if (!empty($Errors)) { 36 | throw new Exception(json_encode($Errors)); 37 | } 38 | 39 | $twilio = erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionTwilio'); 40 | 41 | 42 | $params['operator_id'] = $user->id; 43 | $params['name_support'] = $user->name_support; 44 | 45 | $chat = $twilio->sendManualMessage($params); 46 | 47 | echo erLhcoreClassRestAPIHandler::outputResponse(array( 48 | 'error' => false, 49 | 'result' => 'ok' 50 | )); 51 | 52 | } catch (Exception $e) { 53 | http_response_code(400); 54 | echo erLhcoreClassRestAPIHandler::outputResponse(array( 55 | 'error' => true, 56 | 'result' => $e->getMessage() 57 | )); 58 | } 59 | exit; 60 | 61 | ?> -------------------------------------------------------------------------------- /modules/lhrestapi/twilio_phones.php: -------------------------------------------------------------------------------- 1 | hasAccessTo('lhtwilio','use')) { 9 | throw new Exception('You do not have permission to use twilio! "lhtwilio","use" permission is missing'); 10 | } 11 | 12 | echo erLhcoreClassRestAPIHandler::outputResponse(array( 13 | 'error' => false, 14 | 'result' => array_values(erLhcoreClassModelTwilioPhone::getList(array('limit' => false,'ignore_fields' => array('account_sid','auth_token')))) 15 | )); 16 | 17 | } catch (Exception $e) { 18 | http_response_code(400); 19 | echo erLhcoreClassRestAPIHandler::outputResponse(array( 20 | 'error' => true, 21 | 'result' => $e->getMessage() 22 | )); 23 | } 24 | exit; 25 | 26 | ?> -------------------------------------------------------------------------------- /modules/lhtwilio/callbacks.php: -------------------------------------------------------------------------------- 1 | processCallback($dumpArray); 30 | } catch (Exception $e) { 31 | erLhcoreClassLog::write(print_r($_POST,true)); 32 | erLhcoreClassLog::write(print_r($e,true)); 33 | throw $e; 34 | } 35 | 36 | header("content-type: text/xml"); 37 | 38 | echo "\n 39 | 40 | "; 41 | 42 | exit; 43 | ?> -------------------------------------------------------------------------------- /modules/lhtwilio/delete.php: -------------------------------------------------------------------------------- 1 | validateCSFRToken($Params['user_parameters_unordered']['csfr'])) { 4 | die('Invalid CSFR Token'); 5 | exit; 6 | } 7 | 8 | try { 9 | $item = erLhcoreClassModelTwilioPhone::fetch( $Params['user_parameters']['id']); 10 | $item->removeThis(); 11 | 12 | erLhcoreClassModule::redirect('twilio/list'); 13 | exit; 14 | 15 | } catch (Exception $e) { 16 | 17 | print_r( $e); 18 | 19 | $tpl = erLhcoreClassTemplate::getInstance('lhkernel/validation_error.tpl.php'); 20 | $tpl->set('errors',array($e->getMessage())); 21 | $Result['content'] = $tpl->fetch(); 22 | } 23 | 24 | ?> -------------------------------------------------------------------------------- /modules/lhtwilio/edit.php: -------------------------------------------------------------------------------- 1 | saveThis(); 19 | 20 | erLhcoreClassModule::redirect('twilio/list'); 21 | exit; 22 | 23 | } catch (Exception $e) { 24 | $tpl->set('errors',array($e->getMessage())); 25 | } 26 | 27 | } else { 28 | $tpl->set('errors',$Errors); 29 | } 30 | } 31 | 32 | $tpl->setArray(array( 33 | 'item' => $item, 34 | )); 35 | 36 | $Result['content'] = $tpl->fetch(); 37 | 38 | $Result['path'] = array( 39 | array( 40 | 'url' => erLhcoreClassDesign::baseurl('twilio/index'), 41 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger', 'Twilio') 42 | ), 43 | array ( 44 | 'url' =>erLhcoreClassDesign::baseurl('twilio/list'), 45 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Twilio phones') 46 | ), 47 | array ( 48 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger', 'Edit phone') 49 | ) 50 | ); 51 | 52 | ?> -------------------------------------------------------------------------------- /modules/lhtwilio/index.php: -------------------------------------------------------------------------------- 1 | fetch(); 5 | 6 | $Result['path'] = array( 7 | array( 8 | 'url' => erLhcoreClassDesign::baseurl('twilio/index'), 9 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger', 'Twilio') 10 | ) 11 | ); 12 | 13 | ?> -------------------------------------------------------------------------------- /modules/lhtwilio/list.php: -------------------------------------------------------------------------------- 1 | 'extension/twilio/classes/filter.php','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered'])); 7 | $filterParams['is_search'] = true; 8 | } else { 9 | $filterParams = erLhcoreClassSearchHandler::getParams(array('customfilterfile' => 'extension/twilio/classes/filter.php','format_filter' => true, 'uparams' => $Params['user_parameters_unordered'])); 10 | $filterParams['is_search'] = false; 11 | } 12 | 13 | $append = erLhcoreClassSearchHandler::getURLAppendFromInput($filterParams['input_form']); 14 | 15 | $pages = new lhPaginator(); 16 | $pages->items_total = erLhcoreClassModelTwilioPhone::getCount($filterParams['filter']); 17 | $pages->translationContext = 'chat/activechats'; 18 | $pages->serverURL = erLhcoreClassDesign::baseurl('twilio/list').$append; 19 | $pages->paginate(); 20 | $tpl->set('pages',$pages); 21 | 22 | if ($pages->items_total > 0) { 23 | $items = erLhcoreClassModelTwilioPhone::getList(array_merge(array('limit' => $pages->items_per_page, 'offset' => $pages->low),$filterParams['filter'])); 24 | $tpl->set('items',$items); 25 | } 26 | 27 | $filterParams['input_form']->form_action = erLhcoreClassDesign::baseurl('twilio/list'); 28 | $tpl->set('input',$filterParams['input_form']); 29 | $tpl->set('inputAppend',$append); 30 | 31 | $Result['content'] = $tpl->fetch(); 32 | 33 | $Result['path'] = array( 34 | array( 35 | 'url' => erLhcoreClassDesign::baseurl('twilio/index'), 36 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger', 'Twilio') 37 | ), 38 | array('url' =>erLhcoreClassDesign::baseurl('twilio/list'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Twilio phones')) 39 | ); 40 | 41 | ?> -------------------------------------------------------------------------------- /modules/lhtwilio/module.php: -------------------------------------------------------------------------------- 1 | "iText SMS", 4 | 'variable_params' => true ); 5 | 6 | $ViewList = array(); 7 | 8 | $ViewList['callbacks'] = array( 9 | 'params' => array(), 10 | 'uparams' => array() 11 | ); 12 | 13 | $ViewList['sendmessage'] = array( 14 | 'params' => array(), 15 | 'uparams' => array(), 16 | 'functions' => array('use') 17 | ); 18 | 19 | $ViewList['list'] = array( 20 | 'params' => array(), 21 | 'uparams' => array(), 22 | 'functions' => array('use_admin'), 23 | ); 24 | 25 | $ViewList['notification'] = array( 26 | 'params' => array(), 27 | 'uparams' => array(), 28 | 'functions' => array('use_admin'), 29 | ); 30 | 31 | $ViewList['new'] = array( 32 | 'params' => array(), 33 | 'uparams' => array(), 34 | 'functions' => array('use_admin'), 35 | ); 36 | 37 | $ViewList['edit'] = array( 38 | 'params' => array('id'), 39 | 'uparams' => array(), 40 | 'functions' => array('use_admin'), 41 | ); 42 | 43 | $ViewList['delete'] = array( 44 | 'params' => array('id'), 45 | 'uparams' => array('csfr'), 46 | 'functions' => array('use_admin'), 47 | ); 48 | 49 | $ViewList['index'] = array( 50 | 'params' => array(), 51 | 'functions' => array('use_admin'), 52 | ); 53 | 54 | $FunctionList['use'] = array('explain' => 'Allow operator to send SMS directly'); 55 | $FunctionList['use_admin'] = array('explain' => 'Allow operator to add phone number to department'); 56 | -------------------------------------------------------------------------------- /modules/lhtwilio/new.php: -------------------------------------------------------------------------------- 1 | set('item',$item); 7 | 8 | if (ezcInputForm::hasPostData()) { 9 | 10 | $Errors = erLhcoreClassTwilioValidator::validatePhone($item); 11 | 12 | if (count($Errors) == 0) { 13 | try { 14 | $item->saveThis(); 15 | 16 | erLhcoreClassModule::redirect('twilio/list'); 17 | exit ; 18 | 19 | } catch (Exception $e) { 20 | $tpl->set('errors',array($e->getMessage())); 21 | } 22 | 23 | } else { 24 | $tpl->set('errors',$Errors); 25 | } 26 | } 27 | 28 | $Result['content'] = $tpl->fetch(); 29 | $Result['path'] = array( 30 | array( 31 | 'url' => erLhcoreClassDesign::baseurl('twilio/index'), 32 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger', 'Twilio') 33 | ), 34 | array ( 35 | 'url' =>erLhcoreClassDesign::baseurl('twilio/list'), 36 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Twilio phones') 37 | ), 38 | array( 39 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger', 'New') 40 | ) 41 | ); 42 | 43 | ?> -------------------------------------------------------------------------------- /modules/lhtwilio/notification.php: -------------------------------------------------------------------------------- 1 | data; 6 | 7 | if (ezcInputForm::hasPostData()) { 8 | 9 | $Errors = erLhcoreClassTwilioValidator::validateNotification($data); 10 | 11 | if (count($Errors) == 0) { 12 | try { 13 | $twilioOptions->explain = ''; 14 | $twilioOptions->type = 0; 15 | $twilioOptions->hidden = 1; 16 | $twilioOptions->identifier = 'twilio_notification'; 17 | $twilioOptions->value = serialize($data); 18 | $twilioOptions->saveThis(); 19 | 20 | $tpl->set('updated', true); 21 | } catch (Exception $e) { 22 | $tpl->set('errors', array( 23 | $e->getMessage() 24 | )); 25 | } 26 | 27 | } else { 28 | $tpl->set('errors', $Errors); 29 | } 30 | } 31 | 32 | $tpl->set('data',$data); 33 | 34 | $Result['content'] = $tpl->fetch(); 35 | 36 | $Result['path'] = array( 37 | array( 38 | 'url' => erLhcoreClassDesign::baseurl('twilio/index'), 39 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger', 'Twilio') 40 | ), 41 | array( 42 | 'url' => erLhcoreClassDesign::baseurl('twilio/index'), 43 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/groovehq', 'Twilio returning visitor template') 44 | ) 45 | ); 46 | 47 | ?> -------------------------------------------------------------------------------- /pos/erlhcoreclassmodeltwiliochat.php: -------------------------------------------------------------------------------- 1 | table = "lhc_twilio_chat"; 5 | $def->class = "erLhcoreClassModelTwilioChat"; 6 | 7 | $def->idProperty = new ezcPersistentObjectIdProperty(); 8 | $def->idProperty->columnName = 'id'; 9 | $def->idProperty->propertyName = 'id'; 10 | $def->idProperty->generator = new ezcPersistentGeneratorDefinition( 'ezcPersistentNativeGenerator' ); 11 | 12 | $def->properties['phone'] = new ezcPersistentObjectProperty(); 13 | $def->properties['phone']->columnName = 'phone'; 14 | $def->properties['phone']->propertyName = 'phone'; 15 | $def->properties['phone']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING; 16 | 17 | $def->properties['chat_id'] = new ezcPersistentObjectProperty(); 18 | $def->properties['chat_id']->columnName = 'chat_id'; 19 | $def->properties['chat_id']->propertyName = 'chat_id'; 20 | $def->properties['chat_id']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; 21 | 22 | $def->properties['tphone_id'] = new ezcPersistentObjectProperty(); 23 | $def->properties['tphone_id']->columnName = 'tphone_id'; 24 | $def->properties['tphone_id']->propertyName = 'tphone_id'; 25 | $def->properties['tphone_id']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; 26 | 27 | $def->properties['ctime'] = new ezcPersistentObjectProperty(); 28 | $def->properties['ctime']->columnName = 'ctime'; 29 | $def->properties['ctime']->propertyName = 'ctime'; 30 | $def->properties['ctime']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; 31 | 32 | $def->properties['utime'] = new ezcPersistentObjectProperty(); 33 | $def->properties['utime']->columnName = 'utime'; 34 | $def->properties['utime']->propertyName = 'utime'; 35 | $def->properties['utime']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; 36 | 37 | return $def; 38 | 39 | ?> -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | 1. Just put in extensions folder twilio folder 2 | 2. Copy `extension/twilio/settings.ini.default.php` to extension/twilio/settings.ini.php 3 | 3. Execute 4 | ``` 5 | php cron.php -s site_admin -e twilio -c cron/update_structure 6 | ``` 7 | or 8 | `https://github.com/LiveHelperChat/twilio/blob/master/doc/install.sql` 9 | 10 | 4. Enable extension in `settings/settings.ini.php` 11 | ``` 12 | 'extensions' => 13 | array ( 14 | 'twilio' 15 | ), 16 | ``` 17 | 5. Clear cache from back office. 18 | 6. Twilio module you will find in left menu under Modules. 19 | 7. Register phone from Live Helper Chat back office. 20 | 21 | Settings should look similar to this. P.s I have changed phone number and `Account SID` with `Auth Token` 22 | 23 | ![See image](https://raw.githubusercontent.com/LiveHelperChat/twilio/master/doc/phonenumber.png) 24 | 25 | If you are using `WhatsApp` phone number should look like `whatsapp:+14155234444` 26 | 27 | 6. Send SMS to registered phone number 28 | 7. Enjoy :) 29 | 30 | Callback URL you will find once your register phone in back office. 31 | -------------------------------------------------------------------------------- /settings/settings.ini.default.php: -------------------------------------------------------------------------------- 1 | false, // Is it automated hosting enviroment 5 | 'account_sid' => '', // Account SID, set it only in automated hosting environment 6 | 'auth_token' => '', // Auth Token, set it only in automated hosting environment 7 | 'debug' => true, // If debug enabled you can find details in default.log 8 | ); 9 | 10 | ?> 11 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/.gitignore: -------------------------------------------------------------------------------- 1 | docs/_build/ 2 | vendor/* 3 | composer.phar 4 | coverage 5 | package.xml 6 | *.tgz 7 | 8 | # You should be keeping these in a global gitignore, see for example 9 | # https://help.github.com/articles/ignoring-files#global-gitignore 10 | .DS_Store 11 | .idea 12 | 13 | nbproject 14 | 15 | # This is used by the documentation generator 16 | venv 17 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | php: 3 | - 5.3 4 | - 5.4 5 | - 5.5 6 | - 5.6 7 | - 7.0 8 | - hhvm 9 | matrix: 10 | allow_failures: 11 | - 7.0 12 | - hhvm 13 | script: "make test" 14 | before_install: "composer install --dev" 15 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/AUTHORS.md: -------------------------------------------------------------------------------- 1 | Authors 2 | ======= 3 | 4 | A huge thanks to all of our contributors: 5 | 6 | 7 | - =noloh 8 | - Adam Ballai 9 | - Alex Chan 10 | - Alex Rowley 11 | - Alexandre Payment 12 | - Andrew Nicols 13 | - Brett Gerry 14 | - Bulat Shakirzyanov 15 | - Carlos Diaz-Padron 16 | - Chris Barr 17 | - D. Keith Casey, Jr. 18 | - Doug Black 19 | - Elliot Lings 20 | - Jingming Niu 21 | - John Britton 22 | - John Wolthuis 23 | - Jordi Boggiano 24 | - Justin Witz 25 | - Keith Casey 26 | - Kevin Burke 27 | - Kyle Conroy 28 | - Luke Waite 29 | - Matt Nowack 30 | - Maxime Horcholle 31 | - Neuman Vong 32 | - Patrick Labbett 33 | - Peter Meth 34 | - Ryan Brideau 35 | - Sam Kimbrel 36 | - Shawn Parker 37 | - Stuart Langley 38 | - Taichiro Yoshida 39 | - Trenton McManus 40 | - aaronfoss 41 | - alexw23 42 | - gramanathaiah 43 | - sashalaundy 44 | - tacman 45 | - till 46 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (C) 2011, Twilio, Inc. 4 | Copyright (C) 2011, Neuman Vong 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | this software and associated documentation files (the "Software"), to deal in 8 | the Software without restriction, including without limitation the rights to 9 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 10 | of the Software, and to permit persons to whom the Software is furnished to do 11 | so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Makefile: -------------------------------------------------------------------------------- 1 | # Twilio API helper library. 2 | # See LICENSE file for copyright and license details. 3 | 4 | define LICENSE 5 | 13 | * @license http://creativecommons.org/licenses/MIT/ MIT 14 | * @link http://pear.php.net/package/Services_Twilio 15 | */ 16 | endef 17 | export LICENSE 18 | 19 | COMPOSER = $(shell which composer) 20 | ifeq ($(strip $(COMPOSER)),) 21 | COMPOSER = php composer.phar 22 | endif 23 | 24 | all: test 25 | 26 | clean: 27 | @rm -rf dist venv 28 | 29 | PHP_FILES = `find dist -name \*.php` 30 | dist: clean 31 | @mkdir dist 32 | @git archive master | (cd dist; tar xf -) 33 | @for php in $(PHP_FILES); do\ 34 | echo "$$LICENSE" > $$php.new; \ 35 | tail -n+2 $$php >> $$php.new; \ 36 | mv $$php.new $$php; \ 37 | done 38 | 39 | test-install: 40 | # Composer: http://getcomposer.org/download/ 41 | $(COMPOSER) install 42 | 43 | install: 44 | pear channel-discover twilio.github.com/pear 45 | pear install twilio/Services_Twilio 46 | 47 | # if these fail, you may need to install the helper library - run "make 48 | # test-install" 49 | test: 50 | @PATH=vendor/bin:$(PATH) phpunit --report-useless-tests --strict-coverage --disallow-test-output --colors --configuration tests/phpunit.xml; 51 | 52 | venv: 53 | virtualenv venv 54 | 55 | docs-install: venv 56 | . venv/bin/activate; pip install -r docs/requirements.txt 57 | 58 | docs: 59 | . venv/bin/activate; cd docs && make html 60 | 61 | release-install: 62 | pear channel-discover twilio.github.com/pear || true 63 | pear channel-discover pear.pirum-project.org || true 64 | pear install pirum/Pirum || true 65 | pear install XML_Serializer-0.20.2 || true 66 | pear install PEAR_PackageFileManager2 || true 67 | 68 | authors: 69 | echo "Authors\n=======\n\nA huge thanks to all of our contributors:\n\n" > AUTHORS.md 70 | git log --raw | grep "^Author: " | cut -d ' ' -f2- | cut -d '<' -f1 | sed 's/^/- /' | sort | uniq >> AUTHORS.md 71 | 72 | .PHONY: all clean dist test docs docs-install test-install authors 73 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/HttpException.php: -------------------------------------------------------------------------------- 1 | subresources[$name] = new $type( 10 | $this->client, $this->uri . "/$constantized" 11 | ); 12 | } 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/LookupsListResource.php: -------------------------------------------------------------------------------- 1 | getResourceName(true); 7 | /* 8 | * By default trim the 's' from the end of the list name to get the 9 | * instance name (ex Accounts -> Account). This behavior can be 10 | * overridden by child classes if the rule doesn't work. 11 | */ 12 | if (!isset($this->instance_name)) { 13 | $this->instance_name = "Services_Twilio_Rest_Lookups_" . rtrim($name, 's'); 14 | } 15 | 16 | parent::__construct($client, $uri); 17 | } 18 | 19 | /** 20 | * Gets a resource from this list. Overridden to add 21 | * filter parameters. 22 | * 23 | * :param string $number: The phone number 24 | * :return: The resource 25 | * :rtype: :php:class:`InstanceResource ` 26 | */ 27 | public function get($number, $filters = array()) { 28 | $number = rawurlencode($number); 29 | $full_path = $this->uri . "/$number"; 30 | if (!empty($filters)) { 31 | $full_path .= '?' . http_build_query($filters, '', '&'); 32 | } 33 | 34 | $instance = new $this->instance_name( 35 | $this->client, $full_path 36 | ); 37 | return $instance; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/MonitorInstanceResource.php: -------------------------------------------------------------------------------- 1 | subresources[$name] = new $type( 10 | $this->client, $this->uri . "/$constantized" 11 | ); 12 | } 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/MonitorListResource.php: -------------------------------------------------------------------------------- 1 | getResourceName(true); 7 | /* 8 | * By default trim the 's' from the end of the list name to get the 9 | * instance name (ex Accounts -> Account). This behavior can be 10 | * overridden by child classes if the rule doesn't work. 11 | */ 12 | if (!isset($this->instance_name)) { 13 | $this->instance_name = "Services_Twilio_Rest_Monitor_" . rtrim($name, 's'); 14 | } 15 | 16 | parent::__construct($client, $uri); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/NextGenInstanceResource.php: -------------------------------------------------------------------------------- 1 | ` if 13 | * the update fails. 14 | */ 15 | public function update($params, $value = null) 16 | { 17 | if (!is_array($params)) { 18 | $params = array($params => $value); 19 | } 20 | $decamelizedParams = $this->client->createData($this->uri, $params, true); 21 | $this->updateAttributes($decamelizedParams); 22 | } 23 | } -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/NextGenListResource.php: -------------------------------------------------------------------------------- 1 | client->retrieveData($deep_paging_uri, array(), true); 9 | } else if ($page == 0) { 10 | $page = $this->client->retrieveData($this->uri, array('Page' => $page, 'PageSize' => $size) + $filters); 11 | } else { 12 | return $this->emptyPage(); 13 | } 14 | 15 | $list_name = $page->meta->key; 16 | if (!isset($list_name) || $list_name === '') { 17 | throw new Services_Twilio_HttpException("Couldn't find list key in response"); 18 | } 19 | 20 | $page->$list_name = array_map( 21 | array($this, 'getObjectFromJson'), 22 | $page->$list_name 23 | ); 24 | $page->next_page_uri = $page->meta->next_page_url; 25 | 26 | return new Services_Twilio_Page($page, $list_name, $page->meta->next_page_url); 27 | } 28 | 29 | private function emptyPage() { 30 | $page = new stdClass(); 31 | $page->empty = array(); 32 | return new Services_Twilio_Page($page, 'empty'); 33 | } 34 | 35 | /** 36 | * Create a resource on the list and then return its representation as an 37 | * InstanceResource. 38 | * 39 | * :param array $params: The parameters with which to create the resource 40 | * 41 | * :return: The created resource 42 | * :rtype: :php:class:`InstanceResource ` 43 | */ 44 | protected function _create($params) 45 | { 46 | $params = $this->client->createData($this->uri, $params, true); 47 | /* Some methods like verified caller ID don't return sids. */ 48 | if (isset($params->sid)) { 49 | $resource_uri = $this->uri . '/' . $params->sid; 50 | } else { 51 | $resource_uri = $this->uri; 52 | } 53 | return new $this->instance_name($this->client, $resource_uri, $params); 54 | } 55 | 56 | public function count() { 57 | throw new BadMethodCallException("Counting is not supported by this resource"); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/NumberType.php: -------------------------------------------------------------------------------- 1 | instance_name = 'Services_Twilio_Rest_IncomingPhoneNumber'; 7 | return $camelized ? 'IncomingPhoneNumbers' : 'incoming_phone_numbers'; 8 | } 9 | 10 | /** 11 | * Purchase a new phone number. 12 | * 13 | * Example usage: 14 | * 15 | * .. code-block:: php 16 | * 17 | * $marlosBurner = '+14105551234'; 18 | * $client->account->incoming_phone_numbers->local->purchase($marlosBurner); 19 | * 20 | * :param string $phone_number: The phone number to purchase 21 | * :param array $params: An optional array of parameters to pass along with 22 | * the request (to configure the phone number) 23 | */ 24 | public function purchase($phone_number, array $params = array()) { 25 | $postParams = array( 26 | 'PhoneNumber' => $phone_number 27 | ); 28 | return $this->create($postParams + $params); 29 | } 30 | 31 | public function create(array $params = array()) { 32 | return parent::_create($params); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Page.php: -------------------------------------------------------------------------------- 1 | 9 | * @license http://creativecommons.org/licenses/MIT/ MIT 10 | * @link http://pear.php.net/package/Services_Twilio 11 | */ 12 | class Services_Twilio_Page 13 | implements IteratorAggregate 14 | { 15 | 16 | /** 17 | * The item list. 18 | * 19 | * @var array $items 20 | */ 21 | protected $items; 22 | 23 | /** 24 | * Constructs a page. 25 | * 26 | * @param object $page The page object 27 | * @param string $name The key of the item list 28 | */ 29 | public function __construct($page, $name, $next_page_uri = null) 30 | { 31 | $this->page = $page; 32 | $this->items = $page->{$name}; 33 | $this->next_page_uri = $next_page_uri; 34 | } 35 | 36 | /** 37 | * The item list of the page. 38 | * 39 | * @return array A list of instance resources 40 | */ 41 | public function getItems() 42 | { 43 | return $this->items; 44 | } 45 | 46 | /** 47 | * Magic method to allow retrieving the properties of the wrapped page. 48 | * 49 | * @param string $prop The property name 50 | * 51 | * @return mixed Could be anything 52 | */ 53 | public function __get($prop) 54 | { 55 | return $this->page->$prop; 56 | } 57 | 58 | /** 59 | * Implementation of IteratorAggregate::getIterator(). 60 | * 61 | * @return Traversable 62 | */ 63 | public function getIterator() 64 | { 65 | return $this->getItems(); 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/PartialApplicationHelper.php: -------------------------------------------------------------------------------- 1 | 10 | * @license http://creativecommons.org/licenses/MIT/ MIT 11 | * @link http://pear.php.net/package/Services_Twilio 12 | */ 13 | class Services_Twilio_PartialApplicationHelper 14 | { 15 | private $callbacks; 16 | 17 | public function __construct() 18 | { 19 | $this->callbacks = array(); 20 | } 21 | 22 | public function set($method, $callback, array $args) 23 | { 24 | if (!is_callable($callback)) { 25 | return FALSE; 26 | } 27 | $this->callbacks[$method] = array($callback, $args); 28 | } 29 | 30 | public function __call($method, $args) 31 | { 32 | if (!isset($this->callbacks[$method])) { 33 | throw new Exception("Method not found: $method"); 34 | } 35 | list($callback, $cb_args) = $this->callbacks[$method]; 36 | return call_user_func_array( 37 | $callback, 38 | array_merge($cb_args, $args) 39 | ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/PricingInstanceResource.php: -------------------------------------------------------------------------------- 1 | subresources[$name] = new $type( 10 | $this->client, $this->uri . "/$constantized" 11 | ); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/PricingListResource.php: -------------------------------------------------------------------------------- 1 | getResourceName(true); 6 | 7 | if (!isset($this->instance_name)) { 8 | $this->instance_name = 'Services_Twilio_Rest_Pricing_'. rtrim($name, 's'); 9 | } 10 | 11 | parent::__construct($client, $uri); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/RequestValidator.php: -------------------------------------------------------------------------------- 1 | AuthToken = $token; 11 | } 12 | 13 | public function computeSignature($url, $data = array()) 14 | { 15 | // sort the array by keys 16 | ksort($data); 17 | 18 | // append them to the data string in order 19 | // with no delimiters 20 | foreach($data as $key => $value) 21 | $url .= "$key$value"; 22 | 23 | // This function calculates the HMAC hash of the data with the key 24 | // passed in 25 | // Note: hash_hmac requires PHP 5 >= 5.1.2 or PECL hash:1.1-1.5 26 | // Or http://pear.php.net/package/Crypt_HMAC/ 27 | return base64_encode(hash_hmac("sha1", $url, $this->AuthToken, true)); 28 | } 29 | 30 | public function validate($expectedSignature, $url, $data = array()) 31 | { 32 | return $this->computeSignature($url, $data) 33 | == $expectedSignature; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Account.php: -------------------------------------------------------------------------------- 1 | setupSubresources( 7 | 'applications', 8 | 'available_phone_numbers', 9 | 'outgoing_caller_ids', 10 | 'calls', 11 | 'conferences', 12 | 'incoming_phone_numbers', 13 | 'keys', 14 | 'media', 15 | 'messages', 16 | 'notifications', 17 | 'outgoing_callerids', 18 | 'recordings', 19 | 'sms_messages', 20 | 'short_codes', 21 | 'tokens', 22 | 'transcriptions', 23 | 'connect_apps', 24 | 'authorized_connect_apps', 25 | 'usage_records', 26 | 'usage_triggers', 27 | 'queues', 28 | 'sip', 29 | 'addresses' 30 | ); 31 | 32 | $this->sandbox = new Services_Twilio_Rest_Sandbox( 33 | $client, $uri . '/Sandbox' 34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Accounts.php: -------------------------------------------------------------------------------- 1 | `_ documentation. 6 | */ 7 | class Services_Twilio_Rest_Accounts extends Services_Twilio_ListResource { 8 | 9 | /** 10 | * Create a new subaccount. 11 | * 12 | * :param array $params: An array of parameters describing the new 13 | * subaccount. The ``$params`` array can contain the following keys: 14 | * 15 | * *FriendlyName* 16 | * A description of this account, up to 64 characters long 17 | * 18 | * :returns: The new subaccount 19 | * :rtype: :php:class:`Services_Twilio_Rest_Account` 20 | * 21 | */ 22 | public function create($params = array()) { 23 | return parent::_create($params); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Address.php: -------------------------------------------------------------------------------- 1 | setupSubresources( 9 | 'dependent_phone_numbers' 10 | ); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Addresses.php: -------------------------------------------------------------------------------- 1 | $name 10 | ) + $params); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/AuthorizedConnectApp.php: -------------------------------------------------------------------------------- 1 | set( 9 | 'getList', 10 | array($this, 'getList'), 11 | array($country, 'Local') 12 | ); 13 | return $curried; 14 | } 15 | public function getTollFree($country) { 16 | $curried = new Services_Twilio_PartialApplicationHelper(); 17 | $curried->set( 18 | 'getList', 19 | array($this, 'getList'), 20 | array($country, 'TollFree') 21 | ); 22 | return $curried; 23 | } 24 | 25 | public function getMobile($country) 26 | { 27 | $curried = new Services_Twilio_PartialApplicationHelper(); 28 | $curried->set( 29 | 'getList', 30 | array($this, 'getList'), 31 | array($country, 'Mobile') 32 | ); 33 | return $curried; 34 | } 35 | 36 | /** 37 | * Get a list of available phone numbers. 38 | * 39 | * @param string $country The 2-digit country code you'd like to search for 40 | * numbers e.g. ('US', 'CA', 'GB') 41 | * @param string $type The type of number ('Local', 'TollFree', or 'Mobile') 42 | * @return object The object representation of the resource 43 | */ 44 | public function getList($country, $type, array $params = array()) 45 | { 46 | return $this->client->retrieveData($this->uri . "/$country/$type", $params); 47 | } 48 | 49 | public function getResourceName($camelized = false) { 50 | // You can't page through the list of available phone numbers. 51 | $this->instance_name = 'Services_Twilio_Rest_AvailablePhoneNumber'; 52 | return $camelized ? 'Countries' : 'countries'; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Calls.php: -------------------------------------------------------------------------------- 1 | setupSubresources( 10 | 'feedback_summary' 11 | ); 12 | } 13 | 14 | public static function isApplicationSid($value) 15 | { 16 | return strlen($value) == 34 17 | && !(strpos($value, "AP") === false); 18 | } 19 | 20 | public function create($from, $to, $url, array $params = array()) 21 | { 22 | 23 | $params["To"] = $to; 24 | $params["From"] = $from; 25 | 26 | if (self::isApplicationSid($url)) { 27 | $params["ApplicationSid"] = $url; 28 | } else { 29 | $params["Url"] = $url; 30 | } 31 | 32 | return parent::_create($params); 33 | } 34 | 35 | /** 36 | * Create a feedback for a call. 37 | * 38 | * @param $callSid 39 | * @param $qualityScore 40 | * @param array $issue 41 | * @return Services_Twilio_Rest_Feedback 42 | */ 43 | public function createFeedback($callSid, $qualityScore, array $issue = array()) 44 | { 45 | $params["QualityScore"] = $qualityScore; 46 | $params["Issue"] = $issue; 47 | 48 | $feedbackUri = $this->uri . '/' . $callSid . '/Feedback'; 49 | 50 | $response = $this->client->createData($feedbackUri, $params); 51 | return new Services_Twilio_Rest_Feedback($this->client, $feedbackUri, $response); 52 | } 53 | 54 | /** 55 | * Delete a feedback for a call. 56 | * 57 | * @param $callSid 58 | */ 59 | public function deleteFeedback($callSid) 60 | { 61 | $feedbackUri = $this->uri . '/' . $callSid . '/Feedback'; 62 | $this->client->deleteData($feedbackUri); 63 | } 64 | 65 | /** 66 | * Get a feedback for a call. 67 | * 68 | * @param $callSid 69 | * @return Services_Twilio_Rest_Feedback 70 | */ 71 | public function getFeedback($callSid) 72 | { 73 | $feedbackUri = $this->uri . '/' . $callSid . '/Feedback'; 74 | $response = $this->client->retrieveData($feedbackUri); 75 | return new Services_Twilio_Rest_Feedback($this->client, $feedbackUri, $response); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Conference.php: -------------------------------------------------------------------------------- 1 | setupSubresources( 9 | 'participants' 10 | ); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Conferences.php: -------------------------------------------------------------------------------- 1 | setupSubresources( 38 | 'credentials' 39 | ); 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/CredentialListMapping.php: -------------------------------------------------------------------------------- 1 | setupSubresources( 34 | 'credentials' 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/CredentialListMappings.php: -------------------------------------------------------------------------------- 1 | account->sip->domains->get('SDXXX')->credential_list_mappings->create("CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); 13 | * 14 | * :param string $credential_list_sid: the sid of the CredentialList you're adding to this domain. 15 | * :param array $params: a single array of parameters which is serialized and 16 | * sent directly to the Twilio API. 17 | */ 18 | public function create($credential_list_sid, $params = array()) { 19 | return parent::_create(array( 20 | 'CredentialListSid' => $credential_list_sid, 21 | ) + $params); 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/CredentialLists.php: -------------------------------------------------------------------------------- 1 | account->sip->credential_lists->create("MyFriendlyName"); 13 | * 14 | * :param string $friendly_name: the friendly name of this credential list 15 | * :param array $params: a single array of parameters which is serialized and 16 | * sent directly to the Twilio API. 17 | */ 18 | public function create($friendly_name, $params = array()) { 19 | return parent::_create(array( 20 | 'FriendlyName' => $friendly_name, 21 | ) + $params); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Credentials.php: -------------------------------------------------------------------------------- 1 | account->sip->credential_lists->get('CLXXX')->credentials->create( 13 | * "AwesomeUsername", "SuperSecretPassword", 14 | * ); 15 | * 16 | * :param string $username: the username for the new Credential object 17 | * :param string $password: the password for the new Credential object 18 | * :param array $params: a single array of parameters which is serialized and 19 | * sent directly to the Twilio API. 20 | */ 21 | public function create($username, $password, $params = array()) { 22 | return parent::_create(array( 23 | 'Username' => $username, 24 | 'Password' => $password, 25 | ) + $params); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/DependentPhoneNumber.php: -------------------------------------------------------------------------------- 1 | setupSubresources( 66 | 'ip_access_control_list_mappings', 67 | 'credential_list_mappings' 68 | ); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Domains.php: -------------------------------------------------------------------------------- 1 | account->sip->domains->create( 13 | * "MyFriendlyName", "MyDomainName" 14 | * ); 15 | * 16 | * :param string $friendly_name: the friendly name of this domain 17 | * :param string $domain_name: the domain name for this domain 18 | * :param array $params: a single array of parameters which is serialized and 19 | * sent directly to the Twilio API. 20 | */ 21 | public function create($friendly_name, $domain_name, $params = array()) { 22 | return parent::_create(array( 23 | 'FriendlyName' => $friendly_name, 24 | 'DomainName' => $domain_name, 25 | ) + $params); 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Feedback.php: -------------------------------------------------------------------------------- 1 | instance_name = "Services_Twilio_Rest_Feedback"; 7 | return parent::__construct($client, $uri, $params); 8 | } 9 | 10 | /** 11 | * Create feedback for the parent call 12 | */ 13 | public function create(array $params = array()) { 14 | $params = $this->client->createData($this->uri, $params); 15 | return new $this->instance_name($this->client, $this->uri, $params); 16 | } 17 | 18 | /** 19 | * Delete feedback for the parent call 20 | */ 21 | public function delete() { 22 | $this->client->deleteData($this->uri); 23 | } 24 | 25 | /** 26 | * Fetch the feedback for the parent call 27 | */ 28 | public function get() { 29 | return new $this->instance_name( 30 | $this->client, $this->uri 31 | ); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/FeedbackSummary.php: -------------------------------------------------------------------------------- 1 | instance_name = "Services_Twilio_Rest_FeedbackSummary"; 7 | return parent::__construct($client, $uri, $params); 8 | } 9 | 10 | /** 11 | * Create feedback summary for calls 12 | */ 13 | public function create(array $params = array()) { 14 | $params = $this->client->createData($this->uri, $params); 15 | return new $this->instance_name($this->client, $this->uri, $params); 16 | } 17 | 18 | /** 19 | * Delete a feedback summary 20 | */ 21 | public function delete($sid) { 22 | $this->client->deleteData($this->uri . '/' . $sid); 23 | } 24 | 25 | /** 26 | * Get a feedback summary 27 | */ 28 | public function get($sid) { 29 | return new $this->instance_name( 30 | $this->client, $this->uri . '/' . $sid 31 | ); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/IncomingPhoneNumbers.php: -------------------------------------------------------------------------------- 1 | `_ 7 | * documentation at twilio.com. 8 | */ 9 | class Services_Twilio_Rest_IncomingPhoneNumbers extends Services_Twilio_ListResource { 10 | function init($client, $uri) { 11 | $this->setupSubresources( 12 | 'local', 13 | 'toll_free', 14 | 'mobile' 15 | ); 16 | } 17 | 18 | function create(array $params = array()) { 19 | return parent::_create($params); 20 | } 21 | 22 | function getList($type, array $params = array()) 23 | { 24 | return $this->client->retrieveData($this->uri . "/$type", $params); 25 | } 26 | 27 | /** 28 | * Return a phone number instance from its E.164 representation. If more 29 | * than one number matches the search string, returns the first one. 30 | * 31 | * Example usage: 32 | * 33 | * .. code-block:: php 34 | * 35 | * $number = $client->account->incoming_phone_numbers->getNumber('+14105551234'); 36 | * echo $number->sid; 37 | * 38 | * :param string $number: The number in E.164 format, eg "+684105551234" 39 | * :return: A :php:class:`Services_Twilio_Rest_IncomingPhoneNumber` object, or null 40 | * :raises: a A :php:class:`Services_Twilio_RestException` if the number is 41 | * invalid, not provided in E.164 format or for any other API exception. 42 | */ 43 | public function getNumber($number) { 44 | $page = $this->getPage(0, 1, array( 45 | 'PhoneNumber' => $number 46 | )); 47 | $items = $page->getItems(); 48 | if (is_null($items) || empty($items)) { 49 | return null; 50 | } 51 | return $items[0]; 52 | } 53 | } 54 | 55 | class Services_Twilio_Rest_Local extends Services_Twilio_NumberType { } 56 | 57 | class Services_Twilio_Rest_Mobile extends Services_Twilio_NumberType { } 58 | 59 | class Services_Twilio_Rest_TollFree extends Services_Twilio_NumberType { } 60 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/IpAccessControlList.php: -------------------------------------------------------------------------------- 1 | setupSubresources( 37 | 'ip_addresses' 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/IpAccessControlListMapping.php: -------------------------------------------------------------------------------- 1 | setupSubresources( 33 | 'ip_addresses' 34 | ); 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/IpAccessControlListMappings.php: -------------------------------------------------------------------------------- 1 | account->sip->domains->get('SDXXX')->ip_access_control_list_mappings->create("ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); 13 | * 14 | * :param string $ip_access_control_list_sid: the sid of the IpAccessControList 15 | * you're adding to this domain. 16 | * :param array $params: a single array of parameters which is serialized and 17 | * sent directly to the Twilio API. 18 | */ 19 | public function create($ip_access_control_list_sid, $params = array()) { 20 | return parent::_create(array( 21 | 'IpAccessControlListSid' => $ip_access_control_list_sid, 22 | ) + $params); 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/IpAccessControlLists.php: -------------------------------------------------------------------------------- 1 | account->sip->ip_access_control_lists->create("MyFriendlyName"); 13 | * 14 | * :param string $friendly_name: the friendly name of this ip access control list 15 | * :param array $params: a single array of parameters which is serialized and 16 | * sent directly to the Twilio API. 17 | * :return: the created list 18 | * :rtype: :class:`Services_Twilio_Rest_IpAccessControlList` 19 | * 20 | */ 21 | public function create($friendly_name, $params = array()) { 22 | return parent::_create(array( 23 | 'FriendlyName' => $friendly_name, 24 | ) + $params); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/IpAddress.php: -------------------------------------------------------------------------------- 1 | instance_name = "Services_Twilio_Rest_IpAddress"; 7 | parent::__construct($client, $uri); 8 | } 9 | 10 | /** 11 | * Creates a new IpAddress instance 12 | * 13 | * Example usage: 14 | * 15 | * .. code-block:: php 16 | * 17 | * $client->account->sip->ip_access_control_lists->get('ALXXX')->ip_addresses->create( 18 | * "FriendlyName", "127.0.0.1" 19 | * ); 20 | * 21 | * :param string $friendly_name: the friendly name for the new IpAddress object 22 | * :param string $ip_address: the ip address for the new IpAddress object 23 | * :param array $params: a single array of parameters which is serialized and 24 | * sent directly to the Twilio API. 25 | */ 26 | public function create($friendly_name, $ip_address, $params = array()) { 27 | return parent::_create(array( 28 | 'FriendlyName' => $friendly_name, 29 | 'IpAddress' => $ip_address, 30 | ) + $params); 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Key.php: -------------------------------------------------------------------------------- 1 | ` objects. 5 | * For the definitive reference, see the `Twilio Media List Documentation 6 | * `_. 7 | */ 8 | class Services_Twilio_Rest_Media extends Services_Twilio_ListResource { 9 | 10 | 11 | // This is overridden because the list key in the Twilio response 12 | // is "media_list", not "media". 13 | public function getResourceName($camelized = false) 14 | { 15 | if ($camelized) { 16 | return "MediaList"; 17 | } else { 18 | return "media_list"; 19 | } 20 | } 21 | 22 | // We manually set the instance name here so that the parent 23 | // constructor doesn't attempt to figure out it. It would do it 24 | // incorrectly because we override getResourceName above. 25 | public function __construct($client, $uri) { 26 | $this->instance_name = "Services_Twilio_Rest_MediaInstance"; 27 | parent::__construct($client, $uri); 28 | } 29 | 30 | } 31 | 32 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/MediaInstance.php: -------------------------------------------------------------------------------- 1 | `_. 6 | * 7 | * .. php:attr:: sid 8 | * 9 | * A 34 character string that identifies this object 10 | * 11 | * .. php:attr:: account_sid 12 | * 13 | * A 34 character string representing the account that sent the message 14 | * 15 | * .. php:attr:: parent_sid 16 | * 17 | * The sid of the message that created this media. 18 | * 19 | * .. php:attr:: date_created 20 | * 21 | * The date the message was created 22 | * 23 | * .. php:attr:: date_updated 24 | * 25 | * The date the message was updated 26 | * 27 | * .. php:attr:: content_type 28 | * 29 | * The content-type of the media. 30 | */ 31 | class Services_Twilio_Rest_MediaInstance extends Services_Twilio_InstanceResource { 32 | public function __construct($client, $uri) { 33 | $uri = str_replace('MediaInstance', 'Media', $uri); 34 | parent::__construct($client, $uri); 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Member.php: -------------------------------------------------------------------------------- 1 | $url, 19 | 'Method' => $method, 20 | )); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Members.php: -------------------------------------------------------------------------------- 1 | instance_name($this->client, $this->uri . '/Front'); 15 | } 16 | 17 | /* Participants are identified by CallSid, not like ME123 */ 18 | public function getObjectFromJson($params, $idParam = 'sid') { 19 | return parent::getObjectFromJson($params, 'call_sid'); 20 | } 21 | 22 | public function getResourceName($camelized = false) 23 | { 24 | // The JSON property name is atypical. 25 | return $camelized ? 'Members' : 'queue_members'; 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Message.php: -------------------------------------------------------------------------------- 1 | setupSubresources( 49 | 'media' 50 | ); 51 | } 52 | 53 | public function redact() { 54 | $postParams = array('Body' => ''); 55 | self::update($postParams); 56 | } 57 | 58 | /** 59 | * Make a request to delete the specified resource. 60 | * 61 | * :rtype: boolean 62 | */ 63 | public function delete() 64 | { 65 | return $this->client->deleteData($this->uri); 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Monitor/Alert.php: -------------------------------------------------------------------------------- 1 | $phoneNumber, 10 | ) + $params); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Participant.php: -------------------------------------------------------------------------------- 1 | update('Muted', 'true'); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Participants.php: -------------------------------------------------------------------------------- 1 | instance_name = "Services_Twilio_Rest_Pricing_MessagingCountry"; 16 | parent::__construct($client, $uri); 17 | } 18 | 19 | public function get($isoCountry) { 20 | $instance = new $this->instance_name($this->client, $this->uri . "/$isoCountry"); 21 | $instance->iso_country = $isoCountry; 22 | return $instance; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Pricing/MessagingCountry.php: -------------------------------------------------------------------------------- 1 | instance_name = 'Services_Twilio_Rest_Pricing_PhoneNumberCountry'; 8 | parent::__construct($client, $uri); 9 | } 10 | 11 | public function getResourceName($camelized = false) { 12 | if ($camelized) { 13 | return 'Countries'; 14 | } 15 | return 'countries'; 16 | } 17 | 18 | public function get($isoCountry) { 19 | $instance = new $this->instance_name($this->client, $this->uri . "/$isoCountry"); 20 | $instance->iso_country = $isoCountry; 21 | return $instance; 22 | } 23 | } -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Pricing/PhoneNumberCountry.php: -------------------------------------------------------------------------------- 1 | instance_name = "Services_Twilio_Rest_Pricing_VoiceCountry"; 16 | parent::__construct($client, $uri); 17 | } 18 | 19 | public function get($isoCountry) { 20 | $instance = new $this->instance_name($this->client, $this->uri . "/$isoCountry"); 21 | $instance->iso_country = $isoCountry; 22 | return $instance; 23 | } 24 | } -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Pricing/VoiceCountry.php: -------------------------------------------------------------------------------- 1 | instance_name($this->client, $this->uri . "/$number"); 8 | $instance->number = $number; 9 | return $instance; 10 | } 11 | } -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Queue.php: -------------------------------------------------------------------------------- 1 | setupSubresources('members'); 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Queues.php: -------------------------------------------------------------------------------- 1 | $friendly_name, 16 | ) + $params); 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Recording.php: -------------------------------------------------------------------------------- 1 | setupSubresources('transcriptions'); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Recordings.php: -------------------------------------------------------------------------------- 1 | setupSubresources( 10 | 'domains', 11 | 'ip_access_control_lists', 12 | 'credential_lists' 13 | ); 14 | } 15 | 16 | public function getResourceName($camelized = false) { 17 | return "SIP"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/SmsMessage.php: -------------------------------------------------------------------------------- 1 | $from, 14 | 'To' => $to, 15 | 'Body' => $body 16 | ) + $params); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/TaskRouter/Activities.php: -------------------------------------------------------------------------------- 1 | instance_name = "Services_Twilio_Rest_TaskRouter_Activity"; 7 | parent::__construct($client, $uri); 8 | } 9 | 10 | public function create($friendlyName, $available) { 11 | $params['FriendlyName'] = $friendlyName; 12 | $params['Available'] = $available; 13 | return parent::_create($params); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/TaskRouter/Activity.php: -------------------------------------------------------------------------------- 1 | client->retrieveData($this->uri, $filters); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/TaskRouter/Task.php: -------------------------------------------------------------------------------- 1 | setupSubresources('reservations'); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/TaskRouter/TaskQueue.php: -------------------------------------------------------------------------------- 1 | setupSubresource('statistics'); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/TaskRouter/TaskQueueStatistics.php: -------------------------------------------------------------------------------- 1 | setupSubresource('statistics'); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/TaskRouter/TaskQueuesStatistics.php: -------------------------------------------------------------------------------- 1 | instance_name = "Services_Twilio_Rest_TaskRouter_TaskQueueStatistics"; 7 | parent::__construct($client, $uri); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/TaskRouter/Tasks.php: -------------------------------------------------------------------------------- 1 | setupSubresource('statistics'); 7 | $this->setupSubresources('reservations'); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/TaskRouter/WorkerStatistics.php: -------------------------------------------------------------------------------- 1 | setupSubresource('statistics'); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/TaskRouter/WorkersStatistics.php: -------------------------------------------------------------------------------- 1 | setupSubresource('statistics'); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/TaskRouter/WorkflowStatistics.php: -------------------------------------------------------------------------------- 1 | setupSubresources( 8 | 'activities', 9 | 'events', 10 | 'tasks', 11 | 'task_queues', 12 | 'workers', 13 | 'workflows' 14 | ); 15 | $this->setupSubresource('statistics'); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/TaskRouter/WorkspaceStatistics.php: -------------------------------------------------------------------------------- 1 | account->tokens->create(array( 13 | * "Ttl" => 100, 14 | * )); 15 | * 16 | * :param array $params: a single array of parameters which is serialized and 17 | * sent directly to the Twilio API. 18 | * 19 | */ 20 | public function create($params = array()) { 21 | return parent::_create($params); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Transcription.php: -------------------------------------------------------------------------------- 1 | trunks->get('TK123')->credential_lists->create(array( 13 | * "CredentialListSid" => "CL1234xxxxx", 14 | * .... 15 | * )); 16 | * 17 | * :param array $params: a single array of parameters which is serialized and 18 | * sent directly to the Twilio API. 19 | * 20 | */ 21 | public function create($params = array()) { 22 | return parent::_create($params); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Trunking/IpAccessControlList.php: -------------------------------------------------------------------------------- 1 | trunks->get('TK123')->ip_access_control_lists->create(array( 13 | * "IpAccessControlListSid" => "AL1234xxxx", 14 | * .... 15 | * )); 16 | * 17 | * :param array $params: a single array of parameters which is serialized and 18 | * sent directly to the Twilio API. 19 | * 20 | */ 21 | public function create($params = array()) { 22 | return parent::_create($params); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Trunking/OriginationUrl.php: -------------------------------------------------------------------------------- 1 | trunks->get('TK123')->origination_urls->create(array( 13 | * "FriendlyName" => "TestUrl", 14 | * .... 15 | * )); 16 | * 17 | * :param array $params: a single array of parameters which is serialized and 18 | * sent directly to the Twilio API. 19 | * 20 | */ 21 | public function create($params = array()) { 22 | return parent::_create($params); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Trunking/PhoneNumber.php: -------------------------------------------------------------------------------- 1 | trunks->get('TK123')->phone_numbers->create(array( 13 | * "PhoneNumberSid" => "PN1234xxxx" 14 | * )); 15 | * 16 | * :param array $params: a single array of parameters which is serialized and 17 | * sent directly to the Twilio API. 18 | * 19 | */ 20 | public function create($params = array()) { 21 | return parent::_create($params); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Trunking/Trunk.php: -------------------------------------------------------------------------------- 1 | setupSubresources( 7 | 'credential_lists', 8 | 'ip_access_control_lists', 9 | 'origination_urls', 10 | 'phone_numbers' 11 | ); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/Trunking/Trunks.php: -------------------------------------------------------------------------------- 1 | setupSubresources( 7 | 'today', 8 | 'yesterday', 9 | 'all_time', 10 | 'this_month', 11 | 'last_month', 12 | 'daily', 13 | 'monthly', 14 | 'yearly' 15 | ); 16 | } 17 | } 18 | 19 | class Services_Twilio_Rest_Today extends Services_Twilio_TimeRangeResource { } 20 | 21 | class Services_Twilio_Rest_Yesterday extends Services_Twilio_TimeRangeResource { } 22 | 23 | class Services_Twilio_Rest_LastMonth extends Services_Twilio_TimeRangeResource { } 24 | 25 | class Services_Twilio_Rest_ThisMonth extends Services_Twilio_TimeRangeResource { } 26 | 27 | class Services_Twilio_Rest_AllTime extends Services_Twilio_TimeRangeResource { } 28 | 29 | class Services_Twilio_Rest_Daily extends Services_Twilio_UsageResource { } 30 | 31 | class Services_Twilio_Rest_Monthly extends Services_Twilio_UsageResource { } 32 | 33 | class Services_Twilio_Rest_Yearly extends Services_Twilio_UsageResource { } 34 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/Rest/UsageTrigger.php: -------------------------------------------------------------------------------- 1 | `_. 13 | * @param string $value Fire the trigger when usage crosses this value. 14 | * @param string $url The URL to request when the trigger fires. 15 | * @param array $params Optional parameters for this trigger. A full list of parameters can be found in the `Usage Trigger documentation `_. 16 | * @return Services_Twilio_Rest_UsageTrigger The created trigger 17 | */ 18 | function create($category, $value, $url, array $params = array()) { 19 | return parent::_create(array( 20 | 'UsageCategory' => $category, 21 | 'TriggerValue' => $value, 22 | 'CallbackUrl' => $url, 23 | ) + $params); 24 | } 25 | 26 | } 27 | 28 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/RestException.php: -------------------------------------------------------------------------------- 1 | status = $status; 27 | $this->info = $info; 28 | parent::__construct($message, $code); 29 | } 30 | 31 | /** 32 | * Get the HTTP status code 33 | */ 34 | public function getStatus() { 35 | return $this->status; 36 | } 37 | 38 | /** 39 | * Get a link to more information 40 | */ 41 | public function getInfo() { 42 | return $this->info; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/SIPListResource.php: -------------------------------------------------------------------------------- 1 | subresources[$name] = new $type( 10 | $this->client, $this->uri . "/$constantized" 11 | ); 12 | } 13 | } 14 | 15 | protected function setupSubresource($name) { 16 | $constantized = ucfirst(self::camelize($name)); 17 | $type = get_class($this) . $constantized; 18 | $this->subresources[$name] = new $type( 19 | $this->client, $this->uri . "/". $constantized 20 | ); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/TaskRouterListResource.php: -------------------------------------------------------------------------------- 1 | getResourceName(true); 7 | /* 8 | * By default trim the 's' from the end of the list name to get the 9 | * instance name (ex Accounts -> Account). This behavior can be 10 | * overridden by child classes if the rule doesn't work. 11 | */ 12 | if (!isset($this->instance_name)) { 13 | $this->instance_name = "Services_Twilio_Rest_TaskRouter_" . rtrim($name, 's'); 14 | } 15 | 16 | parent::__construct($client, $uri); 17 | } 18 | 19 | protected function setupSubresource($name) { 20 | $constantized = ucfirst(self::camelize($name)); 21 | $type = get_class($this) . $constantized; 22 | $this->subresources[$name] = new $type( 23 | $this->client, $this->uri . "/". $constantized 24 | ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/TimeRangeResource.php: -------------------------------------------------------------------------------- 1 | 6 | * @license http://creativecommons.org/licenses/MIT/ MIT 7 | * @link http://pear.php.net/package/Services_Twilio 8 | */ 9 | class Services_Twilio_TimeRangeResource extends Services_Twilio_UsageResource { 10 | 11 | /** 12 | * Return a UsageRecord corresponding to the given category. 13 | * 14 | * @param string $category The category of usage to retrieve. For a full 15 | * list of valid categories, please see the documentation at 16 | * http://www.twilio.com/docs/api/rest/usage-records#usage-all-categories 17 | * @return Services_Twilio_Rest_UsageRecord 18 | * @throws Services_Twilio_RestException 19 | */ 20 | public function getCategory($category) { 21 | $page = $this->getPage(0, 1, array( 22 | 'Category' => $category, 23 | )); 24 | $items = $page->getItems(); 25 | if (!is_array($items) || count($items) === 0) { 26 | throw new Services_Twilio_RestException( 27 | 400, "Usage record data is unformattable."); 28 | } 29 | return $items[0]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/TrunkingInstanceResource.php: -------------------------------------------------------------------------------- 1 | subresources[$name] = new $type( 10 | $this->client, $this->uri . "/$constantized" 11 | ); 12 | } 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/TrunkingListResource.php: -------------------------------------------------------------------------------- 1 | getResourceName(true); 7 | /* 8 | * By default trim the 's' from the end of the list name to get the 9 | * instance name (ex Accounts -> Account). This behavior can be 10 | * overridden by child classes if the rule doesn't work. 11 | */ 12 | if (!isset($this->instance_name)) { 13 | $this->instance_name = "Services_Twilio_Rest_Trunking_" . rtrim($name, 's'); 14 | } 15 | 16 | parent::__construct($client, $uri); 17 | } 18 | 19 | /** 20 | * Create a new Trunk instance 21 | * 22 | * Example usage: 23 | * 24 | * .. code-block:: php 25 | * 26 | * $trunkingClient->trunks->create(array( 27 | * "FriendlyName" => "TestTrunk", 28 | * "DomainName" => "test.pstn.twilio.com" 29 | * )); 30 | * 31 | * :param array $params: a single array of parameters which is serialized and 32 | * sent directly to the Twilio API. 33 | * 34 | */ 35 | public function create($params = array()) { 36 | return parent::_create($params); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/Services/Twilio/UsageResource.php: -------------------------------------------------------------------------------- 1 | 6 | * @license http://creativecommons.org/licenses/MIT/ MIT 7 | * @link http://pear.php.net/package/Services_Twilio 8 | */ 9 | class Services_Twilio_UsageResource extends Services_Twilio_ListResource { 10 | public function getResourceName($camelized = false) { 11 | $this->instance_name = 'Services_Twilio_Rest_UsageRecord'; 12 | return $camelized ? 'UsageRecords' : 'usage_records'; 13 | } 14 | 15 | public function __construct($client, $uri) { 16 | $uri = preg_replace("#UsageRecords#", "Usage/Records", $uri); 17 | parent::__construct($client, $uri); 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "twilio/sdk", 3 | "type": "library", 4 | "description": "A PHP wrapper for Twilio's API", 5 | "keywords": ["twilio", "sms", "api"], 6 | "homepage": "http://github.com/twilio/twilio-php", 7 | "license": "MIT", 8 | "authors": [ 9 | { 10 | "name": "Kevin Burke", 11 | "email": "kevin@twilio.com" 12 | }, 13 | { 14 | "name": "Kyle Conroy", 15 | "email": "kyle+pear@twilio.com" 16 | } 17 | ], 18 | "require": { 19 | "php": ">=5.2.1" 20 | }, 21 | "require-dev": { 22 | "mockery/mockery": ">=0.7.2", 23 | "phpunit/phpunit": "4.5.*" 24 | }, 25 | "autoload": { 26 | "files": ["Services/Twilio.php"] 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/_themes/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.pyo 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/_themes/LICENSE: -------------------------------------------------------------------------------- 1 | Modifications: 2 | 3 | Copyright (c) 2011 Kenneth Reitz. 4 | 5 | 6 | Original Project: 7 | 8 | Copyright (c) 2010 by Armin Ronacher. 9 | 10 | 11 | Some rights reserved. 12 | 13 | Redistribution and use in source and binary forms of the theme, with or 14 | without modification, are permitted provided that the following conditions 15 | are met: 16 | 17 | * Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | 20 | * Redistributions in binary form must reproduce the above 21 | copyright notice, this list of conditions and the following 22 | disclaimer in the documentation and/or other materials provided 23 | with the distribution. 24 | 25 | * The names of the contributors may not be used to endorse or 26 | promote products derived from this software without specific 27 | prior written permission. 28 | 29 | We kindly ask you to only use these themes in an unmodified manner just 30 | for Flask and Flask-related products, not for unrelated projects. If you 31 | like the visual style and want to use it for your own projects, please 32 | consider making some larger changes to the themes (such as changing 33 | font faces, sizes, colors or margins). 34 | 35 | THIS THEME IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 36 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 37 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 38 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 39 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 40 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 41 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 42 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 43 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 44 | ARISING IN ANY WAY OUT OF THE USE OF THIS THEME, EVEN IF ADVISED OF THE 45 | POSSIBILITY OF SUCH DAMAGE. 46 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/_themes/README.rst: -------------------------------------------------------------------------------- 1 | krTheme Sphinx Style 2 | ==================== 3 | 4 | This repository contains sphinx styles Kenneth Reitz uses in most of 5 | his projects. It is a drivative of Mitsuhiko's themes for Flask and Flask related 6 | projects. To use this style in your Sphinx documentation, follow 7 | this guide: 8 | 9 | 1. put this folder as _themes into your docs folder. Alternatively 10 | you can also use git submodules to check out the contents there. 11 | 12 | 2. add this to your conf.py: :: 13 | 14 | sys.path.append(os.path.abspath('_themes')) 15 | html_theme_path = ['_themes'] 16 | html_theme = 'flask' 17 | 18 | The following themes exist: 19 | 20 | **kr** 21 | the standard flask documentation theme for large projects 22 | 23 | **kr_small** 24 | small one-page theme. Intended to be used by very small addon libraries. 25 | 26 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/_themes/kr/layout.html: -------------------------------------------------------------------------------- 1 | {%- extends "basic/layout.html" %} 2 | {%- block extrahead %} 3 | {{ super() }} 4 | {% if theme_touch_icon %} 5 | 6 | {% endif %} 7 | 9 | {% endblock %} 10 | {%- block relbar2 %}{% endblock %} 11 | {%- block footer %} 12 | 15 | 28 | 29 | Fork me on GitHub 30 | 31 | 32 | {%- endblock %} 33 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/_themes/kr/relations.html: -------------------------------------------------------------------------------- 1 |

    Related Topics

    2 | 20 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/_themes/kr/static/small_flask.css: -------------------------------------------------------------------------------- 1 | /* 2 | * small_flask.css_t 3 | * ~~~~~~~~~~~~~~~~~ 4 | * 5 | * :copyright: Copyright 2010 by Armin Ronacher. 6 | * :license: Flask Design License, see LICENSE for details. 7 | */ 8 | 9 | body { 10 | margin: 0; 11 | padding: 20px 30px; 12 | } 13 | 14 | div.documentwrapper { 15 | float: none; 16 | background: white; 17 | } 18 | 19 | div.sphinxsidebar { 20 | display: block; 21 | float: none; 22 | width: 102.5%; 23 | margin: 50px -30px -20px -30px; 24 | padding: 10px 20px; 25 | background: #333; 26 | color: white; 27 | } 28 | 29 | div.sphinxsidebar h3, div.sphinxsidebar h4, div.sphinxsidebar p, 30 | div.sphinxsidebar h3 a { 31 | color: white; 32 | } 33 | 34 | div.sphinxsidebar a { 35 | color: #aaa; 36 | } 37 | 38 | div.sphinxsidebar p.logo { 39 | display: none; 40 | } 41 | 42 | div.document { 43 | width: 100%; 44 | margin: 0; 45 | } 46 | 47 | div.related { 48 | display: block; 49 | margin: 0; 50 | padding: 10px 0 20px 0; 51 | } 52 | 53 | div.related ul, 54 | div.related ul li { 55 | margin: 0; 56 | padding: 0; 57 | } 58 | 59 | div.footer { 60 | display: none; 61 | } 62 | 63 | div.bodywrapper { 64 | margin: 0; 65 | } 66 | 67 | div.body { 68 | min-height: 0; 69 | padding: 0; 70 | } 71 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/_themes/kr/theme.conf: -------------------------------------------------------------------------------- 1 | [theme] 2 | inherit = basic 3 | stylesheet = flasky.css 4 | pygments_style = flask_theme_support.FlaskyStyle 5 | 6 | [options] 7 | touch_icon = 8 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/_themes/kr_small/layout.html: -------------------------------------------------------------------------------- 1 | {% extends "basic/layout.html" %} 2 | {% block header %} 3 | {{ super() }} 4 | {% if pagename == 'index' %} 5 |
    6 | {% endif %} 7 | {% endblock %} 8 | {% block footer %} 9 | {% if pagename == 'index' %} 10 |
    11 | {% endif %} 12 | {% endblock %} 13 | {# do not display relbars #} 14 | {% block relbar1 %}{% endblock %} 15 | {% block relbar2 %} 16 | {% if theme_github_fork %} 17 | Fork me on GitHub 19 | {% endif %} 20 | {% endblock %} 21 | {% block sidebar1 %}{% endblock %} 22 | {% block sidebar2 %}{% endblock %} 23 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/_themes/kr_small/theme.conf: -------------------------------------------------------------------------------- 1 | [theme] 2 | inherit = basic 3 | stylesheet = flasky.css 4 | nosidebar = true 5 | pygments_style = flask_theme_support.FlaskyStyle 6 | 7 | [options] 8 | index_logo = '' 9 | index_logo_height = 120px 10 | github_fork = '' 11 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/api/services.rst: -------------------------------------------------------------------------------- 1 | ############################### 2 | HTTP Helper Classes 3 | ############################### 4 | 5 | ********************** 6 | The Twilio Rest Client 7 | ********************** 8 | 9 | .. phpautoclass:: Services_Twilio 10 | :filename: ../Services/Twilio.php 11 | :members: 12 | 13 | *************************** 14 | Twilio's Custom HTTP Client 15 | *************************** 16 | 17 | .. phpautoclass:: Services_Twilio_TinyHttp 18 | :filename: ../Services/Twilio/TinyHttp.php 19 | :members: 20 | 21 | *********************** 22 | Twilio Rest Exceptions 23 | *********************** 24 | .. phpautoclass:: Services_Twilio_RestException 25 | :filename: ../Services/Twilio/RestException.php 26 | :members: 27 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/api/twiml.rst: -------------------------------------------------------------------------------- 1 | ########################################### 2 | API for TwiML Generation 3 | ########################################### 4 | 5 | .. phpautoclass:: Services_Twilio_Twiml 6 | :filename: ../Services/Twilio/Twiml.php 7 | :members: 8 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/quickstart.rst: -------------------------------------------------------------------------------- 1 | ============= 2 | Quickstart 3 | ============= 4 | 5 | Making a Call 6 | ============== 7 | 8 | .. code-block:: php 9 | 10 | $sid = "ACXXXXXX"; // Your Twilio account sid 11 | $token = "YYYYYY"; // Your Twilio auth token 12 | 13 | $client = new Services_Twilio($sid, $token); 14 | $call = $client->account->calls->create( 15 | '9991231234', // From this number 16 | '8881231234', // Call this number 17 | 'http://foo.com/call.xml' 18 | ); 19 | 20 | Generating TwiML 21 | ================== 22 | 23 | To control phone calls, your application need to output TwiML. Use :class:`Services_Twilio_Twiml` to easily create such responses. 24 | 25 | .. code-block:: php 26 | 27 | $response = new Services_Twilio_Twiml(); 28 | $response->say('Hello'); 29 | print $response; 30 | 31 | .. code-block:: xml 32 | 33 | 34 | monkey.mp3 35 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/requirements.txt: -------------------------------------------------------------------------------- 1 | sphinxcontrib-phpdomain 2 | hg+https://bitbucket.org/tk0miya/tk.phpautodoc 3 | 4 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/usage/rest/accounts.rst: -------------------------------------------------------------------------------- 1 | ================== 2 | Accounts 3 | ================== 4 | 5 | Updating Account Information 6 | ============================== 7 | 8 | Updating :class:`Account ` information is really easy: 9 | 10 | .. code-block:: php 11 | 12 | $client = new Services_Twilio('AC123', '123'); 13 | $account = $client->account; 14 | $account->update(array('FriendlyName' => 'My Awesome Account')); 15 | 16 | Creating a Subaccount 17 | ============================== 18 | 19 | .. code-block:: php 20 | 21 | $client = new Services_Twilio('AC123', '123'); 22 | $subaccount = $client->accounts->create(array( 23 | 'FriendlyName' => 'My Awesome SubAccount' 24 | )); 25 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/usage/rest/applications.rst: -------------------------------------------------------------------------------- 1 | ================== 2 | Applications 3 | ================== 4 | 5 | Creating Applications 6 | ============================== 7 | 8 | .. code-block:: php 9 | 10 | $client = new Services_Twilio('AC123', '123'); 11 | $application = $client->account->applications->create('Application Friendly Name', 12 | array( 13 | 'FriendlyName' => 'My Application Name', 14 | 'VoiceUrl' => 'http://foo.com/voice/url', 15 | 'VoiceFallbackUrl' => 'http://foo.com/voice/fallback/url', 16 | 'VoiceMethod' => 'POST', 17 | 'SmsUrl' => 'http://foo.com/sms/url', 18 | 'SmsFallbackUrl' => 'http://foo.com/sms/fallback/url', 19 | 'SmsMethod' => 'POST' 20 | ) 21 | ); 22 | 23 | 24 | Updating An Application 25 | ============================== 26 | 27 | .. code-block:: php 28 | 29 | $client = new Services_Twilio('AC123', '123'); 30 | $application = $client->account->applications->get('AP123'); 31 | $application->update(array( 32 | 'VoiceUrl' => 'http://foo.com/new/voice/url' 33 | )); 34 | 35 | 36 | Finding an Application by Name 37 | ============================== 38 | 39 | Find an :class:`Application` by its name (full name match). 40 | 41 | .. code-block:: php 42 | 43 | $client = new Services_Twilio('AC123', '123'); 44 | $application = false; 45 | $params = array( 46 | 'FriendlyName' => 'My Application Name' 47 | ); 48 | foreach($client->account->applications->getIterator(0, 1, $params) as $_application) { 49 | $application = $_application; 50 | } -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/usage/rest/callerids.rst: -------------------------------------------------------------------------------- 1 | ============ 2 | Caller Ids 3 | ============ 4 | 5 | Validate a Phone Number 6 | ======================= 7 | Adding a new phone number to your validated numbers is quick and easy: 8 | 9 | .. code-block:: php 10 | 11 | $client = new Services_Twilio('AC123', '123'); 12 | $response = $client->account->outgoing_caller_ids->create('+15554441234'); 13 | print $response->validation_code; 14 | 15 | Twilio will call the provided number and for the validation code to be entered. 16 | 17 | Listing all Validated Phone Numbers 18 | =================================== 19 | 20 | Show all the current caller_ids: 21 | 22 | .. code-block:: php 23 | 24 | $client = new Services_Twilio('AC123', '123'); 25 | foreach ($client->account->outgoing_caller_ids as $caller_id) { 26 | print $caller_id->friendly_name; 27 | } 28 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/usage/rest/conferences.rst: -------------------------------------------------------------------------------- 1 | ============= 2 | Conferences 3 | ============= 4 | 5 | List All Conferences 6 | ==================== 7 | 8 | .. code-block:: php 9 | 10 | $client = new Services_Twilio('AC123', '123'); 11 | foreach ($client->account->conferences as $conference) { 12 | print $conference->friendly_name; 13 | } 14 | 15 | For a full list of properties available on a conference, as well as a full list 16 | of ways to filter a conference, please see the `Conference API Documentation 17 | `_ on our website. 18 | 19 | Filter Conferences by Status 20 | ============================ 21 | 22 | .. code-block:: php 23 | 24 | $client = new Services_Twilio('AC123', '123'); 25 | foreach ($client->account->conferences->getIterator(0, 50, array( 26 | 'Status' => 'in-progress' 27 | )) as $conf) { 28 | print $conf->sid; 29 | } 30 | 31 | Mute all participants 32 | ===================== 33 | 34 | At the moment, using an iterator directly will cause this method to infinitely 35 | loop. Instead, use the getPage function. As conferences are limited to 40 36 | participants, getPage(0, 50) should return a list of every participant in 37 | a conference. 38 | 39 | .. code-block:: php 40 | 41 | $sid = "CO119231312"; 42 | $client = new Services_Twilio('AC123', '123'); 43 | $conference = $client->account->conferences->get($sid); 44 | $page = $conference->participants->getPage(0, 50); 45 | $participants = $page->participants; 46 | foreach ($participants as $p) { 47 | $p->mute(); 48 | } 49 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/usage/rest/members.rst: -------------------------------------------------------------------------------- 1 | ============= 2 | Members 3 | ============= 4 | 5 | List All Members in a Queue 6 | ============================ 7 | 8 | Each queue instance resource has a list of members. 9 | 10 | .. code-block:: php 11 | 12 | $client = new Services_Twilio('AC123', '123'); 13 | $queue_sid = 'QQ123'; 14 | $queue = $client->account->queues->get('QQ123'); 15 | foreach ($queue->members as $member) { 16 | echo "Call Sid: {$member->call_sid}\nWait Time: {$member->wait_time}\n"; 17 | } 18 | 19 | Dequeue a Member 20 | ================= 21 | 22 | .. code-block:: php 23 | 24 | $client = new Services_Twilio('AC123', '123'); 25 | $queue = $client->account->queues->get('QQ123'); 26 | foreach ($queue->members as $member) { 27 | // Dequeue the first member and fetch the Forward twimlet for that 28 | // member. 29 | $member->dequeue('http://twimlets.com/forward', 'GET'); 30 | break; 31 | } 32 | 33 | Retrieve the Member at the Front of a Queue 34 | =========================================== 35 | 36 | The Members class has a method called ``front`` which can be used to retrieve 37 | the member at the front of the queue. 38 | 39 | .. code-block:: php 40 | 41 | $client = new Services_Twilio('AC123', '123'); 42 | $queue = $client->account->queues->get('QQ123'); 43 | $firstMember = $queue->members->front(); 44 | echo $firstMember->position; 45 | echo $firstMember->call_sid; 46 | 47 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/usage/rest/messages.rst: -------------------------------------------------------------------------------- 1 | ============= 2 | Messages 3 | ============= 4 | 5 | Sending a Message 6 | ===================== 7 | 8 | The :class:`Messages ` resource allows you to 9 | send outgoing SMS or MMS messages. 10 | 11 | .. code-block:: php 12 | 13 | require('/path/to/twilio-php/Services/Twilio.php'); 14 | 15 | $client = new Services_Twilio('AC123', '123'); 16 | $message = $client->account->messages->sendMessage( 17 | '+14085551234', // From a Twilio number in your account 18 | '+12125551234', // Text any number 19 | 'Hello monkey!', // Message body (if any) 20 | array('http://example.com/image.jpg'), // An array of MediaUrls 21 | ); 22 | 23 | echo $message->sid; 24 | 25 | Listing Messages 26 | ==================== 27 | 28 | It's easy to iterate over your messages. 29 | 30 | .. code-block:: php 31 | 32 | $client = new Services_Twilio('AC123', '123'); 33 | foreach ($client->account->messages as $message) { 34 | echo "From: {$message->from}\nTo: {$message->to}\nBody: " . $message->body; 35 | } 36 | 37 | Filtering Messages 38 | ====================== 39 | 40 | Let's say you want to find all of the messages that have been sent from 41 | a particular number. You can do so by constructing an iterator explicitly: 42 | 43 | .. code-block:: php 44 | 45 | $client = new Services_Twilio('AC123', '123'); 46 | foreach ($client->account->messages->getIterator(0, 50, array( 47 | 'From' => '+14105551234', 48 | )) as $message) { 49 | echo "From: {$message->from}\nTo: {$message->to}\nBody: " . $message->body; 50 | } 51 | 52 | Redacting or Deleting Messages 53 | ============================== 54 | 55 | To protect your users' privacy, you can delete your Message records or redact 56 | their contents. 57 | 58 | .. code-block:: php 59 | 60 | $client = new Services_Twilio('AC123', '123'); 61 | $message = $client->account->messages->get("MM123"); 62 | $message->redact(); // Erases 'Body' field contents 63 | $message->delete(); // Deletes entire message record -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/usage/rest/notifications.rst: -------------------------------------------------------------------------------- 1 | =============== 2 | Notifications 3 | =============== 4 | 5 | Filter Notifications by Log Level 6 | ================================= 7 | 8 | .. code-block:: php 9 | 10 | $client = new Services_Twilio('AC123', '123'); 11 | foreach ($client->account->notifications->getIterator(0, 50, array("LogLevel" => 0)) as $n) { 12 | print $n->error_code; 13 | } 14 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/usage/rest/queues.rst: -------------------------------------------------------------------------------- 1 | ============= 2 | Queues 3 | ============= 4 | 5 | Create a New Queue 6 | ===================== 7 | 8 | To create a new queue, make an HTTP POST request to the Queues resource. 9 | 10 | .. code-block:: php 11 | 12 | require('/path/to/twilio-php/Services/Twilio.php'); 13 | 14 | $client = new Services_Twilio('AC123', '123'); 15 | // Default MaxSize is 100. Or change it by adding a parameter, like so 16 | $queue = $client->account->queues->create('First Queue', 17 | array('MaxSize' => 10)); 18 | 19 | print $queue->sid; 20 | print $queue->friendly_name; 21 | 22 | Listing Queues 23 | ==================== 24 | 25 | It's easy to iterate over your list of queues. 26 | 27 | .. code-block:: php 28 | 29 | $client = new Services_Twilio('AC123', '123'); 30 | foreach ($client->account->queues as $queue) { 31 | echo $queue->sid; 32 | } 33 | 34 | Deleting Queues 35 | ==================== 36 | 37 | .. code-block:: php 38 | 39 | $client = new Services_Twilio('AC123', '123'); 40 | $queue_sid = 'QQ123'; 41 | $client->account->queues->delete('QQ123'); 42 | 43 | Retrieve the Member at the Front of a Queue 44 | =========================================== 45 | 46 | The Members class has a method called ``front`` which can be used to retrieve 47 | the member at the front of the queue. 48 | 49 | .. code-block:: php 50 | 51 | $client = new Services_Twilio('AC123', '123'); 52 | $queue = $client->account->queues->get('QQ123'); 53 | $firstMember = $queue->members->front(); 54 | echo $firstMember->position; 55 | echo $firstMember->call_sid; 56 | 57 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/usage/rest/recordings.rst: -------------------------------------------------------------------------------- 1 | ========== 2 | Recordings 3 | ========== 4 | 5 | Listing Recordings 6 | ------------------ 7 | 8 | Run the following to get a list of all of your recordings: 9 | 10 | .. code-block:: php 11 | 12 | $accountSid = 'AC1234567890abcdef1234567890a'; 13 | $authToken = 'abcdef1234567890abcdefabcde9'; 14 | $client = new Services_Twilio($accountSid, $authToken); 15 | 16 | foreach($client->account->recordings as $recording) { 17 | echo "Access recording {$recording->sid} at:" . "\n"; 18 | echo $recording->uri; 19 | } 20 | 21 | For more information about which properties are available for a recording 22 | object, please see the `Twilio Recordings API Documentation `_. 23 | 24 | Please note that the ``uri`` returned by default is a JSON dictionary 25 | containing metadata about the recording; you can access the .wav version by 26 | stripping the ``.json`` extension from the ``uri`` returned by the library. 27 | 28 | Filtering Recordings By Call Sid 29 | -------------------------------- 30 | 31 | Pass filters as an array to filter your list of recordings, with any of the 32 | filters listed in the `recording list documentation `_. 33 | 34 | .. code-block:: php 35 | 36 | $accountSid = 'AC1234567890abcdef1234567890a'; 37 | $authToken = 'abcdef1234567890abcdefabcde9'; 38 | $client = new Services_Twilio($accountSid, $authToken); 39 | 40 | foreach($client->account->recordings->getIterator(0, 50, array('DateCreated>' => '2011-01-01')) as $recording) { 41 | echo $recording->uri . "\n"; 42 | } 43 | 44 | Deleting a Recording 45 | -------------------- 46 | 47 | To delete a recording, get the sid of the recording, and then pass it to the 48 | client. 49 | 50 | .. code-block:: php 51 | 52 | $accountSid = 'AC1234567890abcdef1234567890a'; 53 | $authToken = 'abcdef1234567890abcdefabcde9'; 54 | $client = new Services_Twilio($accountSid, $authToken); 55 | 56 | foreach($client->account->recordings as $recording) { 57 | $client->account->recordings->delete($recording->sid); 58 | echo "Deleted recording {$recording->sid}, the first one in the list."; 59 | break; 60 | } 61 | 62 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/usage/rest/sms-messages.rst: -------------------------------------------------------------------------------- 1 | ============= 2 | SMS Messages 3 | ============= 4 | 5 | Sending a SMS Message 6 | ===================== 7 | 8 | 9 | The :php:class:`Services_Twilio_Rest_SmsMessages` resource allows you to send 10 | outgoing text messages. 11 | 12 | .. code-block:: php 13 | 14 | require('/path/to/twilio-php/Services/Twilio.php'); 15 | 16 | $client = new Services_Twilio('AC123', '123'); 17 | $message = $client->account->sms_messages->create( 18 | '+14085551234', // From a Twilio number in your account 19 | '+12125551234', // Text any number 20 | "Hello monkey!" 21 | ); 22 | 23 | print $message->sid; 24 | 25 | Listing SMS Messages 26 | ==================== 27 | 28 | It's easy to iterate over your SMS messages. 29 | 30 | .. code-block:: php 31 | 32 | $client = new Services_Twilio('AC123', '123'); 33 | foreach ($client->account->sms_messages as $message) { 34 | echo "From: {$message->from}\nTo: {$message->to}\nBody: " . $message->body; 35 | } 36 | 37 | Filtering SMS Messages 38 | ====================== 39 | 40 | Let's say you want to find all of the SMS messages that have been sent from 41 | a particular number. You can do so by constructing an iterator explicitly: 42 | 43 | .. code-block:: php 44 | 45 | $client = new Services_Twilio('AC123', '123'); 46 | foreach ($client->account->sms_messages->getIterator(0, 50, array( 47 | 'From' => '+14105551234', 48 | )) as $message) { 49 | echo "From: {$message->from}\nTo: {$message->to}\nBody: " . $message->body; 50 | } 51 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/usage/rest/transcriptions.rst: -------------------------------------------------------------------------------- 1 | ================ 2 | Transcriptions 3 | ================ 4 | 5 | Show all Transcribed Messages 6 | ============================= 7 | 8 | .. code-block:: php 9 | 10 | $client = new Services_Twilio('AC123', '123'); 11 | foreach ($client->account->transcriptions as $t) { 12 | print $t->transcription_text; 13 | } 14 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/usage/taskrouter.rst: -------------------------------------------------------------------------------- 1 | .. _usage-taskrouter: 2 | 3 | ================================ 4 | Getting Started with TaskRouter 5 | ================================ 6 | Twilio TaskRouter enables you to manage a set of Workers, a set of Tasks, and the configuration that determines how the Tasks are matched and distributed to Workers. 7 | 8 | Creating a TaskRouter Client 9 | ============================== 10 | 11 | It is necessary to first create a TaskRouter_Services_Twilio instance. You will need your Twilio account's Account Sid and Auth Token, which are available under your Twilio Account Dashboard. 12 | 13 | .. code-block:: php 14 | 15 | require 'Services/Twilio.php'; 16 | 17 | // set accountSid and authToken 18 | $accountSid = 'YOUR_ACCOUNT_SID'; 19 | $authToken = 'YOUR_AUTH_TOKEN'; 20 | 21 | // set the workspaceSid 22 | $workspaceSid = 'YOUR_WORKSPACE_SID'; 23 | 24 | // instantiate a Twilio TaskRouter Client 25 | $taskrouterClient = new TaskRouter_Services_Twilio($accountSid, $authToken, $workspaceSid); 26 | 27 | If you do not have a workspace to specify, you can pass in **null** for the workspaceSid parameter as follows: 28 | 29 | .. code-block:: php 30 | 31 | $taskrouterClient = new TaskRouter_Services_Twilio($accountSid, $authToken, null); 32 | 33 | 34 | You've now got a Twilio TaskRouter Client up! You can now do things like create a worker, update a task, or reconfigure your workspace amongst other things. 35 | 36 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/usage/taskrouter/events.rst: -------------------------------------------------------------------------------- 1 | =========== 2 | Events 3 | =========== 4 | 5 | TaskRouter logs Events for each state change in the Workspace for the purpose of historical reporting and auditing. TaskRouter will also make an HTTP request containing the Event details to the Workspace's EventCallbackURL each time one these Events takes place. 6 | 7 | Get an Event 8 | ===================== 9 | 10 | You can get details on a specific event by doing the following: 11 | 12 | .. code-block:: php 13 | 14 | require 'Services/Twilio.php'; 15 | 16 | $accountSid = 'YOUR_ACCOUNT_SID'; 17 | $authToken = 'YOUR_AUTH_TOKEN'; 18 | $workspaceSid = 'YOUR_WORKSPACE_SID'; 19 | 20 | $eventSid = 'YOUR_EVENT_SID'; 21 | 22 | // instantiate a Twilio TaskRouter Client 23 | $taskrouterClient = new TaskRouter_Services_Twilio($accountSid, $authToken, $workspaceSid); 24 | 25 | // fetch workspace statistics 26 | $event = taskrouterClient->workspace->events->get($eventSid); 27 | 28 | 29 | Get a List of all Events 30 | ============================== 31 | 32 | You can also loop through the list of all events in a workspace. 33 | 34 | .. code-block:: php 35 | 36 | foreach($taskrouterClient->workspace->events as $event) 37 | { 38 | echo $event->sid; 39 | } -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/usage/taskrouter/reservations.rst: -------------------------------------------------------------------------------- 1 | ============= 2 | Reservations 3 | ============= 4 | 5 | TaskRouter creates a Task Reservation subresource whenever a Task is assigned to a Worker. TaskRouter will provide the details of this Reservation Instance subresource in the Assignment Callback HTTP request it makes to your application server. You must POST **ReservationStatus=accepted** or **ReservationStatus=rejected** to this resource within the reservation timeout to claim or reject this task. 6 | 7 | 8 | Update a Reservation 9 | ======================= 10 | 11 | TO indicate that a Worker has accepted or rejected a Task, you can: 12 | 13 | .. code-block:: php 14 | 15 | require 'Services/Twilio.php'; 16 | 17 | $accountSid = 'YOUR_ACCOUNT_SID'; 18 | $authToken = 'YOUR_AUTH_TOKEN'; 19 | $workspaceSid = 'YOUR_WORKSPACE_SID'; 20 | $taskSid = 'YOUR_TASK_SID'; 21 | 22 | // instantiate a Twilio TaskRouter Client 23 | $taskrouterClient = new TaskRouter_Services_Twilio($accountSid, $authToken, $workspaceSid); 24 | 25 | // set reservation parameters 26 | $reservationStatus = 'accepted'; 27 | 28 | // update the reservation status 29 | $taskrouterClient->workspace->tasks->get($taskSid)->reservations->get($reservationSid)->update('ReservationStatus', $reservationStatus); -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/usage/taskrouter/tasks.rst: -------------------------------------------------------------------------------- 1 | =========== 2 | Tasks 3 | =========== 4 | 5 | A Task instance resource represents a single item of work waiting to be processed. Tasks can represent whatever type of work is important for your team. Twilio applications can create tasks from phone calls or SMS messages. 6 | 7 | Creating a Task 8 | ============================== 9 | 10 | .. code-block:: php 11 | 12 | require 'Services/Twilio.php'; 13 | 14 | $accountSid = 'YOUR_ACCOUNT_SID'; 15 | $authToken = 'YOUR_AUTH_TOKEN'; 16 | $workspaceSid = 'YOUR_WORKSPACE_SID'; 17 | 18 | // instantiate a Twilio TaskRouter Client 19 | $taskrouterClient = new TaskRouter_Services_Twilio($accountSid, $authToken, $workspaceSid); 20 | 21 | // set task parameters 22 | $workflowSid = 'YOUR_WORKFLOW_SID'; 23 | $taskAttributes = '{"selected_language": "fr"}'; 24 | $prioity = 10; 25 | $timeout = 100; 26 | 27 | // create task 28 | $task = $taskrouterClient->workspace->tasks->create( 29 | $taskAttributes, 30 | $workflowSid, 31 | array( 32 | 'Priority' => $priority, 33 | 'Timeout' => $timeout 34 | ) 35 | ); 36 | 37 | // confirm task created 38 | echo "Created Task: ".$task->sid; 39 | 40 | Updating a Task 41 | ============================== 42 | 43 | Here, we modify the above created task to have an updated priority of 20 and contains Swedish instead of French. 44 | 45 | .. code-block:: php 46 | 47 | $taskSid = 'YOUR_TASK_SID'; 48 | 49 | // update task parameters 50 | $updatedTaskAttributes = '{"languages":"sv"}'; 51 | $updatedPriority = 20; 52 | 53 | // update task 54 | $taskrouterClient->workspace->tasks->get($taskSid)->update( 55 | array( 56 | 'Attributes'=> $updatedTaskAttributes, 57 | 'Priority'=> $updatedPriority 58 | ) 59 | ); 60 | 61 | echo 'Updated Task: '.$taskSid; 62 | 63 | 64 | Deleting a Task 65 | ============================== 66 | 67 | .. code-block:: php 68 | 69 | $taskSid = 'YOUR_TASK_SID'; 70 | 71 | $taskrouterClient->workspace->tasks->delete($taskSid); 72 | 73 | echo 'Deleted Task: '.$taskSid; 74 | 75 | 76 | Get a List of all Tasks 77 | ============================== 78 | 79 | .. code-block:: php 80 | 81 | foreach($taskrouterClient->workspace->tasks as $task) 82 | { 83 | echo $task->sid; 84 | } 85 | 86 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/usage/taskrouter/workers.rst: -------------------------------------------------------------------------------- 1 | =========== 2 | Workers 3 | =========== 4 | 5 | Workers represent an entity that is able to perform tasks, such as an agent working in a call center, or a salesperson handling leads. 6 | 7 | Creating a Worker 8 | ============================== 9 | 10 | .. code-block:: php 11 | 12 | require 'Services/Twilio.php'; 13 | 14 | $accountSid = 'YOUR_ACCOUNT_SID'; 15 | $authToken = 'YOUR_AUTH_TOKEN'; 16 | $workspaceSid = 'YOUR_WORKSPACE_SID'; 17 | 18 | // instantiate a Twilio TaskRouter Client 19 | $taskrouterClient = new TaskRouter_Services_Twilio($accountSid, $authToken, $workspaceSid); 20 | 21 | // set worker parameters 22 | $friendlyName = 'Bob'; 23 | $activitySid = 'YOUR_ACTIVITY_SID'; 24 | $workerAttributes = '{"languages":"fr"}'; 25 | 26 | $worker = $taskrouterClient->workspace->workers->create( 27 | $friendlyName, 28 | array( 29 | 'Attributes' => $workerAttributes, 30 | 'ActivitySid' => $idleActivitySid 31 | ) 32 | ); 33 | 34 | // confirm worker created 35 | echo "Created Worker: ".$worker.sid; 36 | 37 | Updating a Worker 38 | ============================== 39 | 40 | This update changes the worker above to now be able to handle additional tasks, specfically, tasks that have a language attribute = "sv". 41 | 42 | .. code-block:: php 43 | 44 | $workerSid = 'YOUR_WORKER_SID'; 45 | 46 | // set updated worker parameters 47 | $updatedWorkerAttributes = '{"language": ["fr", "sv"]}'; 48 | 49 | // update worker 50 | $taskrouterClient->workspace->workers->get($workerSid)->update( 51 | array( 52 | 'Attributes' => $updatedWorkerAttributes 53 | ) 54 | ); 55 | 56 | echo 'Updated Worker: '.$workerSid; 57 | 58 | 59 | Deleting a Worker 60 | ============================== 61 | 62 | .. code-block:: php 63 | 64 | $workerSid = 'YOUR_WORKER_SID'; 65 | 66 | $taskrouterClient->workspace->workers->delete($workerSid); 67 | 68 | echo 'Deleted Worker: '.$workerSid; 69 | 70 | 71 | Get a List of all Workers 72 | ============================== 73 | 74 | .. code-block:: php 75 | 76 | foreach($taskrouterClient->workspace->workers as $worker) 77 | { 78 | echo $worker->sid; 79 | } 80 | 81 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/docs/usage/taskrouter/workspaces.rst: -------------------------------------------------------------------------------- 1 | =========== 2 | Workspaces 3 | =========== 4 | 5 | A Workspace is a container for your Tasks, Workers, TaskQueues, Workflows and Activities. Each of these items exists within a single Workspace and will not be shared across Workspaces. 6 | 7 | Creating a Workspace 8 | ============================== 9 | 10 | .. code-block:: php 11 | 12 | require 'Services/Twilio.php'; 13 | 14 | // set account parameters 15 | $accountSid = 'YOUR_ACCOUNT_SID'; 16 | $authToken = 'YOUR_AUTH_TOKEN'; 17 | 18 | // instantiate a Twilio TaskRouter Client 19 | $taskrouterClient = new TaskRouter_Services_Twilio($accountSid, $authToken, null); 20 | 21 | // create a workspace 22 | $workspace = $taskrouterClient->createWorkspace( 23 | $accountSid, // AccountSid 24 | $authToken, // AuthToken 25 | $friendlyName // name for workspace 26 | ); 27 | 28 | // confirm workspace created 29 | echo 'Created Workspace: '.$workspace->sid; 30 | 31 | Updating a Workspace 32 | ============================== 33 | 34 | This update below alters the workspace to a new FriendlyName and EventCallbackUrl. 35 | 36 | .. code-block:: php 37 | 38 | $workspaceSid = 'YOUR_WORKSPACE_SID'; 39 | 40 | $taskrouterClient = new TaskRouter_Services_Twilio($accountSid, $authToken, $workspaceSid); 41 | 42 | // updated workspace parameters 43 | $updatedFriendlyName = 'My Updated Workspace'; 44 | $updatedEventCallbackUrl = 'http://updatedEventCallbackUrl.org'; 45 | 46 | // update workspace 47 | $taskrouterClient->workspace->update( 48 | array( 49 | 'FriendlyName' => $updatedFriendlyName, 50 | 'EventCallbackUrl' => $updatedEventCallbackUrl 51 | ) 52 | ); 53 | 54 | echo 'Updated Workspace: '.$workspaceSid; 55 | 56 | 57 | Deleting a Workspace 58 | ============================== 59 | 60 | .. code-block:: php 61 | 62 | $workspaceSid = 'YOUR_WORKSPACE_SID'; 63 | 64 | $taskrouterClient->workspaces->delete($workspaceSid); 65 | 66 | echo 'Deleted Workspace: '.$workspaceSid; 67 | 68 | 69 | Get a List of all Workspaces 70 | ============================== 71 | 72 | .. code-block:: php 73 | 74 | foreach($taskrouterClient->workspaces as $workspace) 75 | { 76 | echo $workspace->sid; 77 | } 78 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/Bootstrap.php: -------------------------------------------------------------------------------- 1 | register(); 23 | 24 | require_once 'Twilio.php'; 25 | 26 | unset($root, $library, $tests, $path); 27 | 28 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/BuildQueryTest.php: -------------------------------------------------------------------------------- 1 | 'bar', 10 | 'baz' => 'bin', 11 | ); 12 | 13 | $this->assertEquals(Services_Twilio::buildQuery($data), 'foo=bar&baz=bin'); 14 | } 15 | 16 | public function testSameKey() { 17 | $data = array( 18 | 'foo' => array( 19 | 'bar', 20 | 'baz', 21 | 'bin', 22 | ), 23 | 'boo' => 'bah', 24 | ); 25 | 26 | $this->assertEquals(Services_Twilio::buildQuery($data), 27 | 'foo=bar&foo=baz&foo=bin&boo=bah'); 28 | } 29 | 30 | public function testKeylessData() { 31 | $data = array( 32 | 'bar', 33 | 'baz', 34 | 'bin', 35 | ); 36 | 37 | $this->assertEquals(Services_Twilio::buildQuery($data), '0=bar&1=baz&2=bin'); 38 | } 39 | 40 | public function testKeylessDataPrefix() { 41 | $data = array( 42 | 'bar', 43 | 'baz', 44 | 'bin', 45 | ); 46 | 47 | $this->assertEquals(Services_Twilio::buildQuery($data, 'var'), 'var0=bar&var1=baz&var2=bin'); 48 | } 49 | 50 | public function testQualifiedUserAgent() { 51 | $expected = Services_Twilio::USER_AGENT . " (php 5.4)"; 52 | $this->assertEquals(Services_Twilio::qualifiedUserAgent("5.4"), $expected); 53 | } 54 | 55 | } 56 | 57 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/README: -------------------------------------------------------------------------------- 1 | # To run the tests, navigate to the twilio-php home directory, then run: 2 | 3 | make test 4 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/RequestValidatorTest.php: -------------------------------------------------------------------------------- 1 | "94612", 14 | "AccountSid" => "AC9a9f9392lad99kla0sklakjs90j092j3", 15 | "ApiVersion" => "2010-04-01", 16 | "CallSid" => "CAd800bb12c0426a7ea4230e492fef2a4f", 17 | "CallStatus" => "ringing", 18 | "Called" => "+15306384866", 19 | "CalledCity" => "OAKLAND", 20 | "CalledCountry" => "US", 21 | "CalledState" => "CA", 22 | "Caller" => "+15306666666", 23 | "CallerCity" => "SOUTH LAKE TAHOE", 24 | "CallerCountry" => "US", 25 | "CallerName" => "CA Wireless Call", 26 | "CallerState" => "CA", 27 | "CallerZip" => "89449", 28 | "Direction" => "inbound", 29 | "From" => "+15306666666", 30 | "FromCity" => "SOUTH LAKE TAHOE", 31 | "FromCountry" => "US", 32 | "FromState" => "CA", 33 | "FromZip" => "89449", 34 | "To" => "+15306384866", 35 | "ToCity" => "OAKLAND", 36 | "ToCountry" => "US", 37 | "ToState" => "CA", 38 | "ToZip" => "94612", 39 | ); 40 | 41 | $expected = "fF+xx6dTinOaCdZ0aIeNkHr/ZAA="; 42 | 43 | $this->assertEquals( 44 | $validator->computeSignature($uri, $params), $expected); 45 | $this->assertTrue($validator->validate($expected, $uri, $params)); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ./ 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/resources/AccountsTest.php: -------------------------------------------------------------------------------- 1 | 'application/x-www-form-urlencoded'); 8 | function testPost() 9 | { 10 | $http = m::mock(new Services_Twilio_TinyHttp); 11 | $http->shouldReceive('post')->once() 12 | ->with('/2010-04-01/Accounts.json', 13 | $this->formHeaders, 'FriendlyName=foo') 14 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 15 | json_encode(array('sid' => 'AC345')) 16 | )); 17 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http); 18 | $account = $client->accounts->create(array( 19 | 'FriendlyName' => 'foo', 20 | )); 21 | $this->assertEquals('AC345', $account->sid); 22 | } 23 | 24 | function tearDown() 25 | { 26 | m::close(); 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/resources/ApplicationsTest.php: -------------------------------------------------------------------------------- 1 | 'application/x-www-form-urlencoded'); 7 | function testPost() 8 | { 9 | $http = m::mock(new Services_Twilio_TinyHttp); 10 | $http->shouldReceive('post')->once() 11 | ->with('/2010-04-01/Accounts/AC123/Applications.json', 12 | $this->formHeaders, 'FriendlyName=foo&VoiceUrl=bar') 13 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 14 | json_encode(array('sid' => 'AP123')) 15 | )); 16 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http); 17 | $app = $client->account->applications->create('foo', array( 18 | 'VoiceUrl' => 'bar', 19 | )); 20 | $this->assertEquals('AP123', $app->sid); 21 | } 22 | 23 | function tearDown() 24 | { 25 | m::close(); 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/resources/CallsTest.php: -------------------------------------------------------------------------------- 1 | assertEquals($expected, $result); 13 | } 14 | 15 | function sidProvider() 16 | { 17 | return array( 18 | array("AP2a0747eba6abf96b7e3c3ff0b4530f6e", true), 19 | array("CA2a0747eba6abf96b7e3c3ff0b4530f6e", false), 20 | array("AP2a0747eba6abf96b7e3c3ff0b4530f", false), 21 | array("http://www.google.com/asdfasdfAP", false), 22 | ); 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/resources/KeysTest.php: -------------------------------------------------------------------------------- 1 | 'application/x-www-form-urlencoded'); 9 | 10 | function testDelete() 11 | { 12 | $http = m::mock(new Services_Twilio_TinyHttp); 13 | $http->shouldReceive('delete')->once() 14 | ->with('/2010-04-01/Accounts/AC123/Keys/SK123.json') 15 | ->andReturn(array(204, array('Content-Type' => 'application/json'), '' 16 | )); 17 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http); 18 | $client->account->keys->delete('SK123'); 19 | } 20 | 21 | function testGet() 22 | { 23 | $http = m::mock(new Services_Twilio_TinyHttp); 24 | $http->shouldReceive('get')->once() 25 | ->with('/2010-04-01/Accounts/AC123/Keys/SK123.json') 26 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 27 | json_encode(array('sid' => 'SK123', 'friendly_name' => 'foo')) 28 | )); 29 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http); 30 | $key = $client->account->keys->get('SK123'); 31 | $this->assertNotNull($key); 32 | $this->assertEquals('foo', $key->friendly_name); 33 | } 34 | 35 | function testPost() 36 | { 37 | $http = m::mock(new Services_Twilio_TinyHttp); 38 | $http->shouldReceive('post')->once() 39 | ->with('/2010-04-01/Accounts/AC123/Keys.json', 40 | $this->formHeaders, 'FriendlyName=foo') 41 | ->andReturn(array(201, array('Content-Type' => 'application/json'), 42 | json_encode(array('sid' => 'SK123', 'secret' => 'SomeSecret')) 43 | )); 44 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http); 45 | $key = $client->account->keys->create(array('FriendlyName' => 'foo')); 46 | $this->assertEquals('SK123', $key->sid); 47 | $this->assertEquals('SomeSecret', $key->secret); 48 | } 49 | 50 | function tearDown() 51 | { 52 | m::close(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/resources/MediaTest.php: -------------------------------------------------------------------------------- 1 | shouldReceive('get')->once() 10 | ->with('/2010-04-01/Accounts/AC123/Messages/MM123/Media.json?Page=0&PageSize=50') 11 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 12 | json_encode(array( 13 | 'end' => '0', 14 | 'total' => '2', 15 | 'media_list' => array( 16 | array('sid' => 'ME123'), 17 | array('sid' => 'ME456') 18 | ), 19 | 'next_page_uri' => 'null', 20 | 'start' => 0 21 | )) 22 | )); 23 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http); 24 | $media_list = $client->account->messages->get('MM123')->media->getPage()->getItems(); 25 | $this->assertEquals(count($media_list), 2); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/resources/NotificationTest.php: -------------------------------------------------------------------------------- 1 | shouldReceive('delete')->once() 9 | ->with('/2010-04-01/Accounts/AC123/Notifications/NO123.json') 10 | ->andReturn(array(204, array(), '')); 11 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http); 12 | $client->account->notifications->delete('NO123'); 13 | } 14 | 15 | function tearDown() 16 | { 17 | m::close(); 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/resources/OutgoingCallerIdsTest.php: -------------------------------------------------------------------------------- 1 | 'application/x-www-form-urlencoded'); 7 | function testPost() { 8 | $http = m::mock(new Services_Twilio_TinyHttp); 9 | $http->shouldReceive('post')->once() 10 | ->with('/2010-04-01/Accounts/AC123/OutgoingCallerIds.json', 11 | $this->formHeaders, 'PhoneNumber=%2B14158675309&FriendlyName=My+Home+Phone+Number') 12 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 13 | json_encode(array( 14 | 'account_sid' => 'AC123', 15 | 'phone_number' => '+14158675309', 16 | 'friendly_name' => 'My Home Phone Number', 17 | 'validation_code' => 123456, 18 | )) 19 | )); 20 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http); 21 | $request = $client->account->outgoing_caller_ids->create('+14158675309', array( 22 | 'FriendlyName' => 'My Home Phone Number', 23 | )); 24 | $this->assertEquals(123456, $request->validation_code); 25 | } 26 | 27 | function tearDown() { 28 | m::close(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/resources/QueuesTest.php: -------------------------------------------------------------------------------- 1 | 'application/x-www-form-urlencoded'); 8 | 9 | function testCreate() { 10 | $http = m::mock(new Services_Twilio_TinyHttp); 11 | $http->shouldReceive('post')->once() 12 | ->with('/2010-04-01/Accounts/AC123/Queues.json', $this->formHeaders, 13 | 'FriendlyName=foo&MaxSize=123') 14 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 15 | json_encode(array('sid' => 'QQ123', 'average_wait_time' => 0)) 16 | )); 17 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http); 18 | $queue = $client->account->queues->create('foo', 19 | array('MaxSize' => 123)); 20 | $this->assertSame($queue->sid, 'QQ123'); 21 | $this->assertSame($queue->average_wait_time, 0); 22 | } 23 | 24 | function tearDown() { 25 | m::close(); 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/resources/SMSMessagesTest.php: -------------------------------------------------------------------------------- 1 | 'application/x-www-form-urlencoded'); 7 | 8 | function testCreateMessage() { 9 | $http = m::mock(new Services_Twilio_TinyHttp); 10 | $http->shouldReceive('post')->once() 11 | ->with('/2010-04-01/Accounts/AC123/SMS/Messages.json', $this->formHeaders, 12 | 'From=%2B1222&To=%2B44123&Body=Hi+there') 13 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 14 | json_encode(array('sid' => 'SM123')) 15 | )); 16 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http); 17 | $sms = $client->account->sms_messages->create('+1222', '+44123', 'Hi there'); 18 | $this->assertSame('SM123', $sms->sid); 19 | } 20 | 21 | function testBadMessageThrowsException() { 22 | $this->setExpectedException('Services_Twilio_RestException'); 23 | $http = m::mock(new Services_Twilio_TinyHttp); 24 | $http->shouldReceive('post')->once() 25 | ->with('/2010-04-01/Accounts/AC123/SMS/Messages.json', $this->formHeaders, 26 | 'From=%2B1222&To=%2B44123&Body=' . str_repeat('hi', 81)) 27 | ->andReturn(array(400, array('Content-Type' => 'application/json'), 28 | json_encode(array( 29 | 'status' => '400', 30 | 'message' => 'Too long', 31 | )) 32 | )); 33 | $client = new Services_Twilio('AC123', '123', null, $http); 34 | $sms = $client->account->sms_messages->create('+1222', '+44123', 35 | str_repeat('hi', 81)); 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/resources/SandboxTest.php: -------------------------------------------------------------------------------- 1 | 'application/x-www-form-urlencoded'); 7 | function testUpdateVoiceUrl() 8 | { 9 | $http = m::mock(new Services_Twilio_TinyHttp); 10 | $http->shouldReceive('post')->once() 11 | ->with('/2010-04-01/Accounts/AC123/Sandbox.json', $this->formHeaders, 'VoiceUrl=foo') 12 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 13 | json_encode(array('voice_url' => 'foo')) 14 | )); 15 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http); 16 | $client->account->sandbox->update('VoiceUrl', 'foo'); 17 | $this->assertEquals('foo', $client->account->sandbox->voice_url); 18 | } 19 | 20 | function tearDown() { 21 | m::close(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/resources/ShortCodesTest.php: -------------------------------------------------------------------------------- 1 | shouldReceive('get')->once() 10 | ->with('/2010-04-01/Accounts/AC123/SMS/ShortCodes/SC123.json') 11 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 12 | json_encode(array('sid' => 'SC123', 'short_code' => '1234')) 13 | )); 14 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http); 15 | $sms = $client->account->short_codes->get('SC123'); 16 | $this->assertSame('1234', $sms->short_code); 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/resources/TokensTest.php: -------------------------------------------------------------------------------- 1 | 'application/x-www-form-urlencoded'); 8 | 9 | function testCreateToken() { 10 | $http = m::mock(new Services_Twilio_TinyHttp); 11 | $http->shouldReceive('post')->once() 12 | ->with('/2010-04-01/Accounts/AC123/Tokens.json', $this->formHeaders, '') 13 | ->andReturn(array(201, array('Content-Type' => 'application/json'), 14 | json_encode(array( 15 | 'username' => 'user', 16 | 'password' => 'pass', 17 | 'ttl' => 86400, 18 | 'account_sid' => 'AC123', 19 | 'ice_servers' => array('example.com'), 20 | 'date_created' => 'yesterday', 21 | 'date_updated' => 'right now') 22 | ) 23 | )); 24 | $client = new Services_Twilio('AC123', '123', '2010-04-01', $http); 25 | $token = $client->account->tokens->create(); 26 | $this->assertSame('user', $token->username); 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/resources/monitor/AlertsTest.php: -------------------------------------------------------------------------------- 1 | shouldReceive('get')->once() 11 | ->with('/v1/Alerts/NO123') 12 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 13 | json_encode(array('sid' => 'NO123', 'alert_text' => 'Test')) 14 | )); 15 | $monitorClient = new Monitor_Services_Twilio('AC123', '123', 'v1', $http); 16 | $alert = $monitorClient->alerts->get('NO123'); 17 | $this->assertNotNull($alert); 18 | $this->assertEquals('Test', $alert->alert_text); 19 | } 20 | 21 | function testGetList() 22 | { 23 | $http = m::mock(new Services_Twilio_TinyHttp); 24 | $http->shouldReceive('get')->once() 25 | ->with('/v1/Alerts?Page=0&PageSize=50') 26 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 27 | json_encode(array( 28 | 'meta' => array('key' => 'alerts', 'next_page_url' => null), 29 | 'alerts' => array(array('sid' => 'NO123')) 30 | )) 31 | )); 32 | $monitorClient = new Monitor_Services_Twilio('AC123', '123', 'v1', $http); 33 | foreach ($monitorClient->alerts->getIterator(0, 50) as $alert) { 34 | $this->assertEquals('NO123', $alert->sid); 35 | } 36 | } 37 | 38 | function tearDown() 39 | { 40 | m::close(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/resources/monitor/EventsTest.php: -------------------------------------------------------------------------------- 1 | shouldReceive('get')->once() 11 | ->with('/v1/Events/AE123') 12 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 13 | json_encode(array('sid' => 'AE123', 'description' => 'Test')) 14 | )); 15 | $monitorClient = new Monitor_Services_Twilio('AC123', '123', 'v1', $http); 16 | $event = $monitorClient->events->get('AE123'); 17 | $this->assertNotNull($event); 18 | $this->assertEquals('Test', $event->description); 19 | } 20 | 21 | function testGetList() 22 | { 23 | $http = m::mock(new Services_Twilio_TinyHttp); 24 | $http->shouldReceive('get')->once() 25 | ->with('/v1/Events?Page=0&PageSize=50') 26 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 27 | json_encode(array( 28 | 'meta' => array('key' => 'events', 'next_page_url' => null), 29 | 'events' => array(array('sid' => 'AE123')) 30 | )) 31 | )); 32 | $monitorClient = new Monitor_Services_Twilio('AC123', '123', 'v1', $http); 33 | foreach ($monitorClient->events->getIterator(0, 50) as $event) { 34 | $this->assertEquals('AE123', $event->sid); 35 | } 36 | } 37 | 38 | function tearDown() 39 | { 40 | m::close(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/resources/pricing/MessagingTest.php: -------------------------------------------------------------------------------- 1 | array( 11 | 'key' => 'countries', 12 | 'next_page_url' => null 13 | ), 14 | 'countries' => array( 15 | array('iso_country' => 'US') 16 | ) 17 | ); 18 | $http = m::mock(new Services_Twilio_TinyHttp); 19 | $http->shouldReceive('get')->once()->with( 20 | '/v1/Messaging/Countries?Page=0&PageSize=50' 21 | )->andReturn(array(200, array('Content-Type' => 'application/json'), 22 | json_encode($data))); 23 | 24 | $pricingClient = new Pricing_Services_Twilio('AC123', '123', 'v1', 25 | $http, 1); 26 | $countries = $pricingClient->messagingCountries->getPage(); 27 | $this->assertNotNull($countries); 28 | 29 | $countryList = $countries->getItems(); 30 | $country = $countryList[0]; 31 | $this->assertNotNull($country); 32 | $this->assertEquals($country->iso_country, 'US'); 33 | } 34 | 35 | function testGetCountry() { 36 | $http = m::mock(new Services_Twilio_TinyHttp); 37 | $http->shouldReceive('get')->once()->with('/v1/Messaging/Countries/EE') 38 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 39 | json_encode(array('country' => 'Estonia')))); 40 | $pricingClient = new Pricing_Services_Twilio('AC123', '123', 'v1', $http, 1); 41 | 42 | $country = $pricingClient->messagingCountries->get('EE'); 43 | $this->assertNotNull($country); 44 | $this->assertEquals($country->iso_country, 'EE'); 45 | $this->assertEquals($country->country, 'Estonia'); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/resources/pricing/PhoneNumbersTest.php: -------------------------------------------------------------------------------- 1 | array( 11 | 'key' => 'countries', 12 | 'next_page_url' => null 13 | ), 14 | 'countries' => array( 15 | array('iso_country' => 'US') 16 | ) 17 | ); 18 | $http = m::mock(new Services_Twilio_TinyHttp); 19 | $http->shouldReceive('get')->once()->with( 20 | '/v1/PhoneNumbers/Countries?Page=0&PageSize=50' 21 | )->andReturn(array(200, array('Content-Type' => 'application/json'), 22 | json_encode($data))); 23 | 24 | $pricingClient = new Pricing_Services_Twilio('AC123', '123', 'v1', 25 | $http, 1); 26 | $countries = $pricingClient->phoneNumberCountries->getPage(); 27 | $this->assertNotNull($countries); 28 | 29 | $countryList = $countries->getItems(); 30 | $country = $countryList[0]; 31 | $this->assertNotNull($country); 32 | $this->assertEquals($country->iso_country, 'US'); 33 | } 34 | 35 | function testGetCountry() { 36 | $http = m::mock(new Services_Twilio_TinyHttp); 37 | $http->shouldReceive('get')->once()->with('/v1/PhoneNumbers/Countries/EE') 38 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 39 | json_encode(array('country' => 'Estonia')))); 40 | $pricingClient = new Pricing_Services_Twilio('AC123', '123', 'v1', $http, 1); 41 | 42 | $country = $pricingClient->phoneNumberCountries->get('EE'); 43 | $this->assertNotNull($country); 44 | $this->assertEquals($country->iso_country, 'EE'); 45 | $this->assertEquals($country->country, 'Estonia'); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/resources/task_router/EventsTest.php: -------------------------------------------------------------------------------- 1 | shouldReceive('get')->once() 11 | ->with('/v1/Workspaces/WS123/Events/EV123') 12 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 13 | json_encode(array('sid' => 'EV123', 'description' => 'Test Worker')) 14 | )); 15 | $taskrouterClient = new TaskRouter_Services_Twilio('AC123', '123', 'WS123', 'v1', $http); 16 | $worker = $taskrouterClient->workspace->events->get('EV123'); 17 | $this->assertNotNull($worker); 18 | $this->assertEquals('Test Worker', $worker->description); 19 | } 20 | 21 | function testGetList() 22 | { 23 | $http = m::mock(new Services_Twilio_TinyHttp); 24 | $http->shouldReceive('get')->once() 25 | ->with('/v1/Workspaces/WS123/Events?Page=0&PageSize=50') 26 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 27 | json_encode(array( 28 | 'meta' => array('key' => 'events', 'next_page_url' => null), 29 | 'events' => array(array('sid' => 'EV123')) 30 | )) 31 | )); 32 | $taskrouterClient = new TaskRouter_Services_Twilio('AC123', '123', 'WS123', 'v1', $http); 33 | foreach ($taskrouterClient->workspace->events->getIterator(0, 50) as $event) { 34 | $this->assertEquals('EV123', $event->sid); 35 | } 36 | } 37 | 38 | function tearDown() 39 | { 40 | m::close(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/resources/task_router/TaskQueueStatisticsTest.php: -------------------------------------------------------------------------------- 1 | shouldReceive('get')->once() 12 | ->with('/v1/Workspaces/WS123/TaskQueues/WQ123/Statistics?Minutes=60') 13 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 14 | json_encode(array('account_sid' => 'AC123')) 15 | )); 16 | $taskrouterClient = new TaskRouter_Services_Twilio('AC123', '123', 'WS123', 'v1', $http); 17 | $stats = $taskrouterClient->getTaskQueueStatistics('WQ123', array('Minutes' => 60)); 18 | $this->assertNotNull($stats); 19 | $this->assertEquals('AC123', $stats->account_sid); 20 | } 21 | 22 | function testGetViaTaskQueue() 23 | { 24 | $http = m::mock(new Services_Twilio_TinyHttp); 25 | $http->shouldReceive('get')->once() 26 | ->with('/v1/Workspaces/WS123/TaskQueues/WQ123/Statistics?Minutes=60') 27 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 28 | json_encode(array('account_sid' => 'AC123')) 29 | )); 30 | $taskrouterClient = new TaskRouter_Services_Twilio('AC123', '123', 'WS123', 'v1', $http); 31 | $stats = $taskrouterClient->workspace->task_queues->get("WQ123")->statistics->get(array('Minutes' => 60)); 32 | $this->assertNotNull($stats); 33 | $this->assertEquals('AC123', $stats->account_sid); 34 | } 35 | 36 | function tearDown() 37 | { 38 | m::close(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/resources/task_router/TaskQueuesStatisticsTest.php: -------------------------------------------------------------------------------- 1 | shouldReceive('get')->once() 12 | ->with('/v1/Workspaces/WS123/TaskQueues/Statistics?Minutes=60') 13 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 14 | json_encode(array('account_sid' => 'AC123')) 15 | )); 16 | $taskrouterClient = new TaskRouter_Services_Twilio('AC123', '123', 'WS123', 'v1', $http); 17 | $stats = $taskrouterClient->getTaskQueuesStatistics(array('Minutes' => 60)); 18 | $this->assertNotNull($stats); 19 | $this->assertEquals('AC123', $stats->account_sid); 20 | } 21 | 22 | function testGetViaTaskQueues() 23 | { 24 | $http = m::mock(new Services_Twilio_TinyHttp); 25 | $http->shouldReceive('get')->once() 26 | ->with('/v1/Workspaces/WS123/TaskQueues/Statistics?Page=0&PageSize=50&Minutes=60') 27 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 28 | json_encode(array( 29 | 'meta' => array('key' => 'task_queues_statistics', 'next_page_url' => null), 30 | 'task_queues_statistics' => array(array('task_queue_sid' => 'WQ123')) 31 | )) 32 | )); 33 | $taskrouterClient = new TaskRouter_Services_Twilio('AC123', '123', 'WS123', 'v1', $http); 34 | $stats = $taskrouterClient->workspace->task_queues->statistics->getPage(0, 50, array('Minutes' => 60)); 35 | $this->assertNotNull($stats); 36 | foreach ($stats->getItems() as $stat) { 37 | $this->assertEquals('WQ123', $stat->task_queue_sid); 38 | } 39 | } 40 | 41 | function tearDown() 42 | { 43 | m::close(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/resources/task_router/TaskQueuesTest.php: -------------------------------------------------------------------------------- 1 | shouldReceive('post')->once() 12 | ->with('/v1/Workspaces/WS123/TaskQueues', 13 | array('Content-Type' => 'application/x-www-form-urlencoded'), 14 | 'FriendlyName=Test+Queue&AssignmentActivitySid=WA123&ReservationActivitySid=WR123') 15 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 16 | json_encode(array('sid' => 'WQ123')) 17 | )); 18 | $taskrouterClient = new TaskRouter_Services_Twilio('AC123', '123', 'WS123', 'v1', $http); 19 | $queue = $taskrouterClient->workspace->task_queues->create('Test Queue', 'WA123', 'WR123'); 20 | $this->assertNotNull($queue); 21 | } 22 | 23 | function testGet() { 24 | $http = m::mock(new Services_Twilio_TinyHttp); 25 | $http->shouldReceive('get')->once() 26 | ->with('/v1/Workspaces/WS123/TaskQueues/WQ123') 27 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 28 | json_encode(array('sid' => 'WQ123', 'friendly_name' => 'Test Queue')) 29 | )); 30 | $taskrouterClient = new TaskRouter_Services_Twilio('AC123', '123', 'WS123', 'v1', $http); 31 | $queue = $taskrouterClient->workspace->task_queues->get('WQ123'); 32 | $this->assertNotNull($queue); 33 | $this->assertEquals('Test Queue', $queue->friendly_name); 34 | } 35 | 36 | function tearDown() 37 | { 38 | m::close(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/resources/task_router/WorkerStatisticsTest.php: -------------------------------------------------------------------------------- 1 | shouldReceive('get')->once() 12 | ->with('/v1/Workspaces/WS123/Workers/WK123/Statistics?Minutes=60') 13 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 14 | json_encode(array('account_sid' => 'AC123')) 15 | )); 16 | $taskrouterClient = new TaskRouter_Services_Twilio('AC123', '123', 'WS123', 'v1', $http); 17 | $stats = $taskrouterClient->getWorkerStatistics('WK123', array('Minutes' => 60)); 18 | $this->assertNotNull($stats); 19 | $this->assertEquals('AC123', $stats->account_sid); 20 | } 21 | 22 | function testGetViaWorker() 23 | { 24 | $http = m::mock(new Services_Twilio_TinyHttp); 25 | $http->shouldReceive('get')->once() 26 | ->with('/v1/Workspaces/WS123/Workers/WK123/Statistics?Minutes=60') 27 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 28 | json_encode(array('account_sid' => 'AC123')) 29 | )); 30 | $taskrouterClient = new TaskRouter_Services_Twilio('AC123', '123', 'WS123', 'v1', $http); 31 | $stats = $taskrouterClient->workspace->workers->get("WK123")->statistics->get(array('Minutes' => 60)); 32 | $this->assertNotNull($stats); 33 | $this->assertEquals('AC123', $stats->account_sid); 34 | } 35 | 36 | function tearDown() 37 | { 38 | m::close(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/resources/task_router/WorkersStatisticsTest.php: -------------------------------------------------------------------------------- 1 | shouldReceive('get')->once() 12 | ->with('/v1/Workspaces/WS123/Workers/Statistics?Minutes=60') 13 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 14 | json_encode(array('account_sid' => 'AC123')) 15 | )); 16 | $taskrouterClient = new TaskRouter_Services_Twilio('AC123', '123', 'WS123', 'v1', $http); 17 | $stats = $taskrouterClient->getWorkersStatistics(array('Minutes' => 60)); 18 | $this->assertNotNull($stats); 19 | $this->assertEquals('AC123', $stats->account_sid); 20 | } 21 | 22 | function testGetViaWorkers() 23 | { 24 | $http = m::mock(new Services_Twilio_TinyHttp); 25 | $http->shouldReceive('get')->once() 26 | ->with('/v1/Workspaces/WS123/Workers/Statistics?Minutes=60') 27 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 28 | json_encode(array('account_sid' => 'AC123')) 29 | )); 30 | $taskrouterClient = new TaskRouter_Services_Twilio('AC123', '123', 'WS123', 'v1', $http); 31 | $stats = $taskrouterClient->workspace->workers->statistics->get(array('Minutes' => 60)); 32 | $this->assertNotNull($stats); 33 | $this->assertEquals('AC123', $stats->account_sid); 34 | } 35 | 36 | function tearDown() 37 | { 38 | m::close(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/resources/task_router/WorkersTest.php: -------------------------------------------------------------------------------- 1 | shouldReceive('post')->once() 12 | ->with('/v1/Workspaces/WS123/Workers', 13 | array('Content-Type' => 'application/x-www-form-urlencoded'), 14 | 'FriendlyName=Test+Worker') 15 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 16 | json_encode(array('sid' => 'WK123')) 17 | )); 18 | $taskrouterClient = new TaskRouter_Services_Twilio('AC123', '123', 'WS123', 'v1', $http); 19 | $worker = $taskrouterClient->workspace->workers->create('Test Worker'); 20 | $this->assertNotNull($worker); 21 | } 22 | 23 | function testGet() { 24 | $http = m::mock(new Services_Twilio_TinyHttp); 25 | $http->shouldReceive('get')->once() 26 | ->with('/v1/Workspaces/WS123/Workers/WK123') 27 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 28 | json_encode(array('sid' => 'WQ123', 'friendly_name' => 'Test Worker')) 29 | )); 30 | $taskrouterClient = new TaskRouter_Services_Twilio('AC123', '123', 'WS123', 'v1', $http); 31 | $worker = $taskrouterClient->workspace->workers->get('WK123'); 32 | $this->assertNotNull($worker); 33 | $this->assertEquals('Test Worker', $worker->friendly_name); 34 | } 35 | 36 | function tearDown() 37 | { 38 | m::close(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/resources/task_router/WorkflowStatisticsTest.php: -------------------------------------------------------------------------------- 1 | shouldReceive('get')->once() 12 | ->with('/v1/Workspaces/WS123/Workflows/WF123/Statistics?Minutes=60') 13 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 14 | json_encode(array('account_sid' => 'AC123')) 15 | )); 16 | $taskrouterClient = new TaskRouter_Services_Twilio('AC123', '123', 'WS123', 'v1', $http); 17 | $stats = $taskrouterClient->getWorkflowStatistics('WF123', array('Minutes' => 60)); 18 | $this->assertNotNull($stats); 19 | $this->assertEquals('AC123', $stats->account_sid); 20 | } 21 | 22 | function testGetViaWorkflow() 23 | { 24 | $http = m::mock(new Services_Twilio_TinyHttp); 25 | $http->shouldReceive('get')->once() 26 | ->with('/v1/Workspaces/WS123/Workflows/WF123/Statistics?Minutes=60') 27 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 28 | json_encode(array('account_sid' => 'AC123')) 29 | )); 30 | $taskrouterClient = new TaskRouter_Services_Twilio('AC123', '123', 'WS123', 'v1', $http); 31 | $stats = $taskrouterClient->workspace->workflows->get("WF123")->statistics->get(array('Minutes' => 60)); 32 | $this->assertNotNull($stats); 33 | $this->assertEquals('AC123', $stats->account_sid); 34 | } 35 | 36 | function tearDown() 37 | { 38 | m::close(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/resources/task_router/WorkflowsTest.php: -------------------------------------------------------------------------------- 1 | shouldReceive('post')->once() 11 | ->with('/v1/Workspaces/WS123/Workflows', 12 | array('Content-Type' => 'application/x-www-form-urlencoded'), 13 | 'FriendlyName=Test+Workflow&Configuration=configuration&AssignmentCallbackUrl=http%3A%2F%2Fwww.example.com') 14 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 15 | json_encode(array('sid' => 'WF123')) 16 | )); 17 | $taskrouterClient = new TaskRouter_Services_Twilio('AC123', '123', 'WS123', 'v1', $http); 18 | $workflow = $taskrouterClient->workspace->workflows->create('Test Workflow', 'configuration', 'http://www.example.com'); 19 | $this->assertNotNull($workflow); 20 | } 21 | 22 | function testGet() 23 | { 24 | $http = m::mock(new Services_Twilio_TinyHttp); 25 | $http->shouldReceive('get')->once() 26 | ->with('/v1/Workspaces/WS123/Workflows/WF123') 27 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 28 | json_encode(array('sid' => 'WF123', 'friendly_name' => 'Test Workflow')) 29 | )); 30 | $taskrouterClient = new TaskRouter_Services_Twilio('AC123', '123', 'WS123', 'v1', $http); 31 | $workflow = $taskrouterClient->workspace->workflows->get('WF123'); 32 | $this->assertNotNull($workflow); 33 | $this->assertEquals('Test Workflow', $workflow->friendly_name); 34 | } 35 | 36 | function tearDown() 37 | { 38 | m::close(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/resources/task_router/WorkspaceStatisticsTest.php: -------------------------------------------------------------------------------- 1 | shouldReceive('get')->once() 12 | ->with('/v1/Workspaces/WS123/Statistics?Minutes=60') 13 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 14 | json_encode(array('account_sid' => 'AC123')) 15 | )); 16 | $taskrouterClient = new TaskRouter_Services_Twilio('AC123', '123', 'WS123', 'v1', $http); 17 | $stats = $taskrouterClient->getWorkspaceStatistics(array('Minutes' => 60)); 18 | $this->assertNotNull($stats); 19 | $this->assertEquals('AC123', $stats->account_sid); 20 | } 21 | 22 | function testGetViaWorkspace() 23 | { 24 | $http = m::mock(new Services_Twilio_TinyHttp); 25 | $http->shouldReceive('get')->once() 26 | ->with('/v1/Workspaces/WS123/Statistics?Minutes=60') 27 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 28 | json_encode(array('account_sid' => 'AC123')) 29 | )); 30 | $taskrouterClient = new TaskRouter_Services_Twilio('AC123', '123', 'WS123', 'v1', $http); 31 | $stats = $taskrouterClient->workspace->statistics->get(array('Minutes' => 60)); 32 | $this->assertNotNull($stats); 33 | $this->assertEquals('AC123', $stats->account_sid); 34 | } 35 | 36 | function tearDown() 37 | { 38 | m::close(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /vendor/twilio-php-master/tests/resources/task_router/WorkspacesTest.php: -------------------------------------------------------------------------------- 1 | shouldReceive('post')->once() 12 | ->with('/v1/Workspaces', 13 | array('Content-Type' => 'application/x-www-form-urlencoded'), 14 | 'FriendlyName=Test+Workspace') 15 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 16 | json_encode(array('sid' => 'WS123')) 17 | )); 18 | $taskrouterClient = new TaskRouter_Services_Twilio('AC123', '123', 'WS123', 'v1', $http); 19 | $workspace = $taskrouterClient->workspaces->create('Test Workspace'); 20 | $this->assertNotNull($workspace); 21 | } 22 | 23 | function testGetList() 24 | { 25 | $http = m::mock(new Services_Twilio_TinyHttp); 26 | $http->shouldReceive('get')->once() 27 | ->with('/v1/Workspaces?Page=0&PageSize=50') 28 | ->andReturn(array(200, array('Content-Type' => 'application/json'), 29 | json_encode(array( 30 | 'meta' => array('key' => 'workspaces', 'next_page_url' => null), 31 | 'workspaces' => array(array('sid' => 'WS123')) 32 | )) 33 | )); 34 | $taskrouterClient = new TaskRouter_Services_Twilio('AC123', '123', 'WS123', 'v1', $http); 35 | $this->assertNotNull($taskrouterClient->workspaces); 36 | foreach ($taskrouterClient->workspaces->getIterator(0, 50) as $workspace) { 37 | $this->assertEquals('WS123', $workspace->sid); 38 | } 39 | } 40 | 41 | function tearDown() 42 | { 43 | m::close(); 44 | } 45 | } 46 | --------------------------------------------------------------------------------