You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to integrate PAMI with my web application which should open a particular URL which is nothing but a web page in our application (Details of the caller) of the incoming caller.
I have the api details of PAMI e.g hostname,username,password,port no.
I used your sample code to achieve what I wanted to but I'm stuck at a point.
My question is: How do I run every condition so that it runs only one time whenever different event occurs in a call like Ringing,Not responding,Rejected by receiver,Answered by receiver,Call ended. (Below code for description).
Following is the code which I have implemented so far
<?php
// declare(ticks=1);
require 'vendor/autoload.php';
$options = array(
'host' => 'sip3.intupbx.wave-tell.com',
'scheme' => 'tcp://',
'port' => 5039,
'username' => 'someusername',
'secret' => '******',
'connect_timeout' => 1000,
'read_timeout' => 1000
);
$client = new \PAMI\Client\Impl\ClientImpl($options);
// Open the connection
$client->open();
use PAMI\Message\Event\EventMessage;
use PAMI\Listener\IEventListener;
use PAMI\Message\Event\HangupEvent;
// use PAMI\Listener\IEventListener;
$running = true;
while($running) {
$client->registerEventListener(function ( $event) {
$eventType = $event->getKeys()['event'];
$stateType = $event->getKeys()['channelstatedesc'];
if($eventType=='Newstate' && $stateType=='Ring'){
echo('Ringing..');
// Perform some Database Query and custom event perform by web app.
// Show StateType on Popup Screen in web app.
}
else if($eventType=='HangupRequest' && $stateType=='Ringing'){
echo('Not Responding..');
// Show StateType on Popup Screen in web app.
}
else if($eventType=='Hangup' && $stateType=='Ringing'){
echo('Rejected by receiver..');
// Show StateType on Popup Screen in web app.
}
else if($eventType=='Newstate' && $stateType=='Up'){
echo('Answered by receiver..');
// Show StateType on Popup Screen in web app.
}
else if($eventType=='HangupRequest' && $stateType=='Up'){
echo('Call Ended..');
// Show StateType on Popup Screen in web app.
}
echo '<pre>';print_r($event);
die;
});
$client->process();
usleep(1000);
}
// Close the connection
$client->close();
?>
I want to integrate PAMI with my web application which should open a particular URL which is nothing but a web page in our application (Details of the caller) of the incoming caller.
I have the api details of PAMI e.g hostname,username,password,port no.
I used your sample code to achieve what I wanted to but I'm stuck at a point.
My question is: How do I run every condition so that it runs only one time whenever different event occurs in a call like Ringing,Not responding,Rejected by receiver,Answered by receiver,Call ended. (Below code for description).
Following is the code which I have implemented so far
Response from the asterisk server is as follows:
The text was updated successfully, but these errors were encountered: