Advertisement
Guest User

Untitled

a guest
May 11th, 2018
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.84 KB | None | 0 0
  1. class TestController extends \yii\base\Controller
  2. {
  3.     const ROUTE = parent::ROUTE.'/test';
  4.     const SIP = 'sip:[email protected]';
  5.  
  6.     public $defaultAction = 'welcome';
  7.  
  8.     /**
  9.      * @throws \yii\base\InvalidArgumentException
  10.      * @throws \Twilio\Exceptions\TwimlException
  11.      */
  12.     public function actionWelcome()
  13.     {
  14.         $response = new Twiml();
  15.         $response->say('Hello. Calling SIP now.', ['voice' => 'alice']);
  16.  
  17.         $dial = $response->dial();
  18.         $dial->sip(self::SIP, ['username' => 'testuser', 'password' => '*******']);
  19.  
  20.         echo $response;
  21.     }
  22.  
  23.     public function actionSip() {
  24.         $response = new Twiml();
  25.         $response->say('Hi. Welcome to your SIP connection.', ['voice' => 'alice']);
  26.         $response->hangup();
  27.  
  28.         echo $response;
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement