本文整理汇总了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;
}
}
}
}
示例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);
}
示例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();
}
}
示例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());
}
}
}
示例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;
}
}
示例6: __construct
/**
* Constructor.
*
* @param string $rawContent Literal message as received from ami.
*
* @return void
*/
public function __construct($rawContent)
{
parent::__construct($rawContent);
}
示例7: getMessageKeys
public static function getMessageKeys()
{
return array_merge(parent::getMessageKeys(), ['privilege', 'channel', 'calleridnum', 'calleridname', 'context', 'accountcode', 'uniqueid', 'linkedid', 'destchannel', 'destuniqueid', 'dialstring']);
}
示例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()));
}
示例9: getMessageKeys
public static function getMessageKeys()
{
return array_merge(parent::getMessageKeys(), ['privilege', 'channel', 'calleridnum', 'calleridname', 'uniqueid', 'cause', 'causetext']);
}