sergey-s-moiseev / restcomm-php
Restcomm-PHP API
dev-master
2017-05-17 17:04 UTC
Requires
- php: >=5.5.9
- ext-curl: *
- guzzlehttp/guzzle: ~6.0
Requires (Dev)
- guzzlehttp/guzzle: ~6.0
- phpunit/phpunit: ^6.1
- squizlabs/php_codesniffer: 2.*
- symfony/var-dumper: >=2.6
This package is auto-updated.
Last update: 2024-09-16 19:56:23 UTC
README
关于
此库提供了对 Restcomm Rest API 一些功能的抽象
需求
- PHP >= 5.3
通过 composer 安装
- 在 composer.json 中添加项目
{ "require": { "sergey-s-moiseev/restcomm-php": "dev-master" } }
并运行
$ php composer.phar update
- 或者使用
$ php composer.phar require sergey-s-moiseev/restcomm-php
用法
$rs = new RestcommService('YOUR_RESTCOMM_SDK_URL','YOUR_RESTCOMM_SDK_PORT', 'RESTCOMM_VERSION like a '2012-04-24'', 'YOUR_SID','YOUR_TOKEN');
$response = $rs->sendSMS('PHONE_NUMBER_FROM','PHONE_NUMBER_TO','MESSAGE_TEXT');
###要作为服务安装,请添加以下内容到 /app/config/services.yml
restcomm_php:
class: SergeySMoiseev\Restcomm\RestcommService
arguments: ['%restcomm_host%', '%restcomm_port%', '%restcomm_ver%', '%restcomm_sid%', '%restcomm_token%', ]
到 /app/config/parameters.yml
restcomm_host: 'YOUR_RESTCOMM_SDK_URL'
restcomm_port: 'YOUR_RESTCOMM_SDK_PORT'
restcomm_ver: 'RESTCOMM_VERSION like a '2012-04-24''
restcomm_sid: 'YOUR_SID'
restcomm_token: 'YOUR_TOKEN'
作为服务使用示例
$rs = $this->container->get('restcomm_php');
$result = $rs->getInformationAboutTheDefaultAccount();
可用函数
[Account Restcomm 账户文档] (http://documentation.telestax.com/connect/api/account-api.html#account)
Account:
->getInformationAboutTheDefaultAccount()
->updatePasswordUsingAccountSid($new_password)
->updatePasswordUsingEmailAddress($email, $new_password)
[Account Restcomm 通话文档] (http://documentation.telestax.com/connect/api/calls-api.html#calls)
Calls:
->makingACall($from, $to, $url)
->terminateInProgressCall($call_id)
->terminateRingingCall($call_id)
[Account Restcomm 客户端文档] (http://documentation.telestax.com/connect/api/clients-api.html#clients)
Clients:
->createAClient($login, $password)
->deleteAClient($sid)
->changeClientsPassword($sid, $password)
->getListOfAvailableClients()
[Account Restcomm SMS 文档] (http://documentation.telestax.com/connect/api/sms-api.html#sms)
SMS:
->sendSMS($from, $to, $text)
->getListOfSMSMessages()
服务将返回一个关联数组或 HTTP 错误消息格式的响应到 $response
变量