當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Event\EventMessage類代碼示例

本文整理匯總了PHP中PAMI\Message\Event\EventMessage的典型用法代碼示例。如果您正苦於以下問題:PHP EventMessage類的具體用法?PHP EventMessage怎麽用?PHP EventMessage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了EventMessage類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: handle

 public function handle(EventMessage $event)
 {
     if ($event instanceof \PAMI\Message\Event\AsyncAGIEvent) {
         if ($event->getSubEvent() == 'Start') {
             switch ($pid = pcntl_fork()) {
                 case 0:
                     $logger = \Logger::getLogger(__CLASS__);
                     $this->_client = new ClientImpl($this->_pamiOptions);
                     $this->_client->open();
                     $agi = new \PAMI\AsyncAgi\AsyncClientImpl(array('pamiClient' => $this->_client, 'asyncAgiEvent' => $event));
                     $app = new MyPAGIApplication(array('pagiClient' => $agi));
                     $app->init();
                     $app->run();
                     //$agi->indicateProgress();
                     //$agi->answer();
                     //$agi->streamFile('welcome');
                     //$agi->playCustomTones(array("425/50","0/50"));
                     //sleep(5);
                     //$agi->indicateCongestion(10);
                     //$agi->hangup();
                     $this->_client->close();
                     echo "Application finished\n";
                     exit(0);
                     break;
                 case -1:
                     echo "Could not fork application\n";
                     break;
                 default:
                     echo "Forked Application\n";
                     break;
             }
         }
     }
 }
開發者ID:bit0rez,項目名稱:PAMI,代碼行數:34,代碼來源:example.php

示例2: handle

 /**
  * Forward PAMI event to EventManager.
  *
  * @param EventMessage $e PAMI event
  */
 public function handle(EventMessage $e)
 {
     $eventPrefix = 'event.';
     $eventName = $eventPrefix . $e->getName();
     $event = new PamiEvent();
     $event->setName($eventName);
     $event->setTarget($this->client);
     $event->setEvent($e);
     $this->client->getEventManager()->triggerEvent($event);
 }
開發者ID:thomasvargiu,項目名稱:pami-module,代碼行數:15,代碼來源:EventForwarder.php

示例3: handle

 public function handle(EventMessage $event)
 {
     //This Handler will print the incoming message.
     echo "Message Received from :" . $event->getFrom() . " \n";
     if ($event->getContentEncoding() == 'base64') {
         echo base64_decode($event->getContent());
     } else {
         echo 'Unrecognized encoding - printing message in this encoding :  ';
         $event->getContentEncoding();
         echo '\\n Message:  ';
         $event->getContent();
     }
 }
開發者ID:alesf,項目名稱:PAMI,代碼行數:13,代碼來源:example.php

示例4: handle

 /**
  * Handles pami events.
  *
  * @param EventMessage $event
  *
  * @return void
  */
 public function handle(EventMessage $event)
 {
     if ($event instanceof \PAMI\Message\Event\AsyncAGIEvent) {
         if ($event->getCommandId() == $this->_lastCommandId) {
             $this->_lastAgiResult = trim($event->getResult());
         }
     }
 }
開發者ID:nimdraugsael,項目名稱:furiko-server,代碼行數:15,代碼來源:AsyncClientImpl.php

示例5: addEvent

 /**
  * Adds an event to this response.
  *
  * @param EventMessage $event Child event to add.
  *
  * @return void
  */
 public function addEvent(EventMessage $event)
 {
     $this->events[] = $event;
     if (stristr($event->getEventList(), 'complete') !== false || stristr($event->getName(), 'complete') !== false || stristr($event->getName(), 'DBGetResponse') !== false) {
         $this->completed = true;
     }
 }
開發者ID:alesf,項目名稱:PAMI,代碼行數:14,代碼來源:ResponseMessage.php

示例6: __construct

 /**
  * Constructor.
  *
  * @param string $rawContent Literal message as received from ami.
  *
  * @return void
  */
 public function __construct($rawContent)
 {
     parent::__construct($rawContent);
 }
開發者ID:nimdraugsael,項目名稱:furiko-server,代碼行數:11,代碼來源:OriginateResponseEvent.php

示例7: getMessageKeys

 public static function getMessageKeys()
 {
     return array_merge(parent::getMessageKeys(), ['privilege', 'channel', 'calleridnum', 'calleridname', 'context', 'accountcode', 'uniqueid', 'linkedid', 'destchannel', 'destuniqueid', 'dialstring']);
 }
開發者ID:ryzhov,項目名稱:pami,代碼行數:4,代碼來源:DialBeginEvent.php

示例8: __construct

 /**
  * Constructor.
  *
  * @param string $rawContent Literal message as received from ami.
  *
  * @return void
  */
 public function __construct($rawContent)
 {
     parent::__construct($rawContent);
     $this->setKey('Env', urldecode($this->getEnvironment()));
     $this->setKey('Result', urldecode($this->getResult()));
 }
開發者ID:bit0rez,項目名稱:PAMI,代碼行數:13,代碼來源:AsyncAGIEvent.php

示例9: getMessageKeys

 public static function getMessageKeys()
 {
     return array_merge(parent::getMessageKeys(), ['privilege', 'channel', 'calleridnum', 'calleridname', 'uniqueid', 'cause', 'causetext']);
 }
開發者ID:ryzhov,項目名稱:pami,代碼行數:4,代碼來源:HangupEvent.php


注:本文中的PAMI\Message\Event\EventMessage類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。