Пример #1
0
Файл: Ami.php Проект: dafik/dfi
<?php

use PAMI\Autoloader\Autoloader;
use PAMI\Client\Impl\ClientImpl;
use PAMI\Message\Action\CommandAction;
use PAMI\Message\OutgoingMessage;
Autoloader::register();
class Dfi_Asterisk_Ami
{
    /**
     * AMI Client object
     * @var Dfi_Asterisk_Client
     */
    private static $amiClient;
    public static function reload()
    {
        try {
            $client = self::getAmiClient();
            if (!Dfi_App_Config::getString('asterisk.fake', true)) {
                $res = $client->send(new CommandAction('core reload'));
            } else {
                $res = 'fake';
            }
        } catch (Exception $e) {
            Dfi_Controller_Action_Helper_Messages::getInstance()->addMessage('debug', $e->getMessage());
            $res = $e;
        }
        return $res;
    }
    public static function reloadDialplan()
    {
Пример #2
0
 * limitations under the License.
 *
 */
if ($argc < 7) {
    echo "Use: {$argv['0']} <host> <port> <user> <pass> <msg> <phone> [test_multipart <1|0> ] ";
    echo "example: example_sms.php 192.168.1.20 5038 smsuser smspass 'PAMI is great!' +17865394747 1\n";
    exit(254);
}
// Setup include path.
ini_set('include_path', implode(PATH_SEPARATOR, array(ini_get('include_path'), implode(DIRECTORY_SEPARATOR, array('..', '..', '..', 'src', 'mg')))));
////////////////////////////////////////////////////////////////////////////////
// Mandatory stuff to bootstrap.
////////////////////////////////////////////////////////////////////////////////
require_once 'PAMI/Autoloader/Autoloader.php';
// Include PAMI autoloader.
\PAMI\Autoloader\Autoloader::register();
// Call autoloader register for PAMI autoloader.
use PAMI\Client\Impl\ClientImpl;
use PAMI\Listener\IEventListener;
use PAMI\Message\Event\EventMessage;
use PAMI\Message\Action\ListCommandsAction;
use PAMI\Message\Action\ListCategoriesAction;
use PAMI\Message\Event\vgsm_sms_rxEvent;
use PAMI\Message\Action\VGSMSMSTxAction;
class A implements IEventListener
{
    public function handle(EventMessage $event)
    {
        //This Handler will print the incoming message.
        echo "Message Received from :" . $event->getFrom() . " \n";
        if ($event->getContentEncoding() == 'base64') {
Пример #3
0
 /**
  * @test
  */
 public function can_register_autoloader()
 {
     \PAMI\Autoloader\Autoloader::register();
     spl_autoload_register(array($this, 'dummyAutoloader'));
     $this->assertFalse(class_exists('A\\B\\C', true));
 }