diff --git a/composer.json b/composer.json index 31762f0..513c227 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,8 @@ "src/interfaces/events.php", "src/interfaces/mailboxes.php", "src/interfaces/sounds.php", - "src/interfaces/playbacks.php" + "src/interfaces/playbacks.php", + "src/helper/logger.php" ] } } diff --git a/examples/ApplicationList.php b/examples/ApplicationList.php index a5a0420..46aa060 100644 --- a/examples/ApplicationList.php +++ b/examples/ApplicationList.php @@ -1,4 +1,5 @@ applications_list()); diff --git a/examples/BasicAriConnector.php b/examples/BasicAriConnector.php deleted file mode 100644 index f4f3d07..0000000 --- a/examples/BasicAriConnector.php +++ /dev/null @@ -1,158 +0,0 @@ -phpariObject = new phpari(ARI_USERNAME, ARI_PASSWORD, "hello-world", ARI_SERVER, ARI_PORT, ARI_ENDPOINT); - - $this->ariEndpoint = $this->phpariObject->ariEndpoint; - $this->stasisClient = $this->phpariObject->stasisClient; - $this->stasisLoop = $this->phpariObject->stasisLoop; - $this->stasisLogger = $this->phpariObject->stasisLogger; - } - - public function setDtmf($digit = null) { - try { - - $this->dtmfSequence .= $digit; - - return true; - - } catch (Exception $e) { - return false; - } - } - - public function handlers() - { - try { - $stasisClientLocal = $this->stasisClient; - $stasisLoggerLocal = $this->stasisLogger; - - $this->stasisClient->on("request", function ($headers) { - $this->stasisLogger->notice("Request received!"); - }); - - $this->stasisClient->on("handshake", function () { - $this->stasisLogger->notice("Handshake received!"); - }); - - $this->stasisClient->on("message", function ($message) { - $messageObject = json_decode($message->getData()); - echo $messageObject->type . " Received \n"; - switch ($messageObject->type) { - case "StasisStart"; - echo "StasisStart"; - $this->stasisChannelID = $messageObject->channel->id; - $this->phpariObject->channels()->channel_answer($this->stasisChannelID); - $this->phpariObject->channels()->channel_playback($this->stasisChannelID, 'sound:demo-thanks',null,null,null,'play1'); - break; - case "StasisEnd": - echo "StasisEnd"; - $this->phpariObject->channels()->channel_delete($this->stasisChannelID); - break; - case "PlaybackStarted": - echo "+++ PlaybackStarted +++ " . json_encode($messageObject->playback) . "\n"; - break; - case "PlaybackFinished": - switch ($messageObject->playback->id) { - case "play1": - $this->phpariObject->channels()->channel_playback($this->stasisChannelID, 'sound:demo-congrats',null,null,null,'play2'); - break; - case "play2": - $this->phpariObject->channels()->channel_playback($this->stasisChannelID, 'sound:demo-echotest',null,null,null,'end'); - break; - case "end": - $this->phpariObject->channels()->channel_continue($this->stasisChannelID); - break; - } - break; - case "ChannelDtmfReceived": - $this->setDtmf($messageObject->digit); - echo "+++ DTMF Received +++ [" . $messageObject->digit . "] [" . $this->dtmfSequence. "]\n"; - switch ($messageObject->digit) { - case "*": - $this->dtmfSequence = ""; - echo "+++ Resetting DTMF buffer\n"; - break; - case "#": - echo "+++ Playback ID: " . $this->phpariObject->playbacks()->get_playback(); - $this->phpariObject->channels()->channel_continue($this->stasisChannelID,"demo","s",1); - break; - default: - break; - } - break; - default: - print_r($messageObject); - break; - - } - }); - - } catch (Exception $e) { - echo $e->getMessage(); - exit(99); - } - } - - public function execute() - { - try { - $this->stasisClient->open(); - $this->stasisLoop->run(); - - } catch (Exception $e) { - echo $e->getMessage(); - exit(99); - } - } - - } - - $basicAriClient = new BasicAriConnector(); - - /** - * Get some basic information from ARI - */ - $basicAriClient->handlers(); - $basicAriClient->execute(); - - exit(0); \ No newline at end of file diff --git a/examples/BasicStasisApplication.php b/examples/BasicStasisApplication.php new file mode 100644 index 0000000..007ccdd --- /dev/null +++ b/examples/BasicStasisApplication.php @@ -0,0 +1,172 @@ +phpariObject = new phpari($appname); + + $this->ariEndpoint = $this->phpariObject->ariEndpoint; + $this->stasisClient = $this->phpariObject->stasisClient; + $this->stasisLoop = $this->phpariObject->stasisLoop; + $this->stasisLogger = $this->phpariObject->stasisLogger; + $this->stasisEvents = $this->phpariObject->stasisEvents; + } catch (Exception $e) { + echo $e->getMessage(); + exit(99); + } + } + + public function setDtmf($digit = NULL) + { + try { + + $this->dtmfSequence .= $digit; + + return TRUE; + + } catch (Exception $e) { + return FALSE; + } + } + + // process stasis events + public function StasisAppEventHandler() + { + $this->stasisEvents->on('StasisStart', function ($event) { + $this->stasisLogger->notice("Event received: StasisStart"); + $this->stasisChannelID = $event->channel->id; + $this->phpariObject->channels()->channel_answer($this->stasisChannelID); + $this->phpariObject->channels()->channel_playback($this->stasisChannelID, 'sound:demo-thanks', NULL, NULL, NULL, 'play1'); + }); + + $this->stasisEvents->on('StasisEnd', function ($event) { + $this->stasisLogger->notice("Event received: StasisEnd"); + $this->phpariObject->channels()->channel_delete($this->stasisChannelID); + }); + + + $this->stasisEvents->on('PlaybackStarted', function ($event) { + $this->stasisLogger->notice("+++ PlaybackStarted +++ " . json_encode($event->playback) . "\n"); + }); + + $this->stasisEvents->on('PlaybackFinished', function ($event) { + switch ($event->playback->id) { + case "play1": + $this->phpariObject->channels()->channel_playback($this->stasisChannelID, 'sound:demo-congrats', NULL, NULL, NULL, 'play2'); + break; + case "play2": + $this->phpariObject->channels()->channel_playback($this->stasisChannelID, 'sound:demo-echotest', NULL, NULL, NULL, 'end'); + break; + case "end": + $this->phpariObject->channels()->channel_continue($this->stasisChannelID); + break; + } + }); + + $this->stasisEvents->on('ChannelDtmfReceived', function ($event) { + $this->setDtmf($event->digit); + $this->stasisLogger->notice("+++ DTMF Received +++ [" . $event->digit . "] [" . $this->dtmfSequence . "]\n"); + switch ($event->digit) { + case "*": + $this->dtmfSequence = ""; + $this->stasisLogger->notice("+++ Resetting DTMF buffer\n"); + break; + case "#": + $this->stasisLogger->notice("+++ Playback ID: " . $this->phpariObject->playbacks()->get_playback()); + $this->phpariObject->channels()->channel_continue($this->stasisChannelID, "demo", "s", 1); + break; + default: + break; + } + }); + } + + public function StasisAppConnectionHandlers() + { + try { + $this->stasisClient->on("request", function ($headers) { + $this->stasisLogger->notice("Request received!"); + }); + + $this->stasisClient->on("handshake", function () { + $this->stasisLogger->notice("Handshake received!"); + }); + + $this->stasisClient->on("message", function ($message) { + $event = json_decode($message->getData()); + $this->stasisLogger->notice('Received event: ' . $event->type); + $this->stasisEvents->emit($event->type, array($event)); + }); + + } catch (Exception $e) { + echo $e->getMessage(); + exit(99); + } + } + + public function execute() + { + try { + $this->stasisClient->open(); + $this->stasisLoop->run(); + } catch (Exception $e) { + echo $e->getMessage(); + exit(99); + } + } + + } + + $basicAriClient = new BasicStasisApplication("hello-world"); + + $basicAriClient->stasisLogger->info("Starting Stasis Program... Waiting for handshake..."); + $basicAriClient->StasisAppEventHandler(); + + $basicAriClient->stasisLogger->info("Initializing Handlers... Waiting for handshake..."); + $basicAriClient->StasisAppConnectionHandlers(); + + $basicAriClient->stasisLogger->info("Connecting... Waiting for handshake..."); + $basicAriClient->execute(); + + exit(0); \ No newline at end of file diff --git a/examples/BridgesList.php b/examples/BridgesList.php index 749c440..aba11b6 100644 --- a/examples/BridgesList.php +++ b/examples/BridgesList.php @@ -1,4 +1,5 @@ channel_list()); diff --git a/examples/ChannelDelete.php b/examples/ChannelDelete.php index 4f512da..5da63eb 100644 --- a/examples/ChannelDelete.php +++ b/examples/ChannelDelete.php @@ -1,4 +1,5 @@ channelID; $response = $channels->channel_delete($channelID); - header('Content-Type: application/json'); echo json_encode($response); exit(0); } catch (Exception $e) { - header('Content-Type: application/json'); echo json_encode(array('status' => $e->getCode(), 'message' => $e->getMessage())); } diff --git a/examples/ChannelOriginate.php b/examples/ChannelOriginate.php index ceaf070..3ca5f36 100644 --- a/examples/ChannelOriginate.php +++ b/examples/ChannelOriginate.php @@ -1,4 +1,5 @@ channel_originate( 'SIP/7001', - $data = array( + array( "extension" => "7001", "context" => 'from-phone', "priority" => 1, @@ -41,10 +41,9 @@ "channelId" => '324234', "otherChannelId" => "" ), - $valiables = array("var1" => "cool") + array("var1" => "cool") ); - header('Content-Type: application/json'); echo json_encode($response); exit(0); diff --git a/examples/ChannelsList.php b/examples/ChannelsList.php index d29c797..110404c 100644 --- a/examples/ChannelsList.php +++ b/examples/ChannelsList.php @@ -1,4 +1,5 @@ channel_list()); ?> \ No newline at end of file diff --git a/examples/DeviceStatesList.php b/examples/DeviceStatesList.php index 93ad90b..c694fdc 100644 --- a/examples/DeviceStatesList.php +++ b/examples/DeviceStatesList.php @@ -1,12 +1,35 @@ devicestates_list()); + require_once "../vendor/autoload.php"; + $conn = new phpari("hello-world"); //create new object + $devicesState = new devicestates($conn); -exit(0); \ No newline at end of file + echo json_encode($devicesState->devicestates_list()); + + + exit(0); \ No newline at end of file diff --git a/examples/EndPointList.php b/examples/EndPointList.php index 420ee3e..f24348a 100644 --- a/examples/EndPointList.php +++ b/examples/EndPointList.php @@ -1,4 +1,5 @@ endpoints_list(); - header('Content-Type: application/json'); + echo json_encode($response); exit(0); diff --git a/examples/EventGenerateExample.php b/examples/EventGenerateExample.php index 9f7452f..1eff644 100644 --- a/examples/EventGenerateExample.php +++ b/examples/EventGenerateExample.php @@ -1,28 +1,43 @@ "cool"); - $response = $event->event_generate('justName',"hello-world","141",null,'SIP/7008',"leosip",$valiables); - - - - header('Content-Type: application/json'); - echo json_encode($response); - exit(0); -} - -catch (Exception $e) -{ - header('Content-Type: application/json'); - echo json_encode(array('status'=>$e->getCode(),'message'=>$e->getMessage())); -} + /** + * phpari - A PHP Class Library for interfacing with Asterisk(R) ARI + * Copyright (C) 2014 Nir Simionovich + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * Also add information on how to contact you by electronic and paper mail. + * + * Greenfield Technologies Ltd., hereby disclaims all copyright interest in + * the library `phpari' (a library for creating smart telephony applications) + * written by Nir Simionovich and its respective list of contributors. + */ + + require_once "../vendor/autoload.php"; + + try { + + $conn = new phpari("hello-world"); //create new object + $event = new events($conn); + $valiables = array("var1" => "cool"); + $response = $event->event_generate('justName', "hello-world", "141", NULL, 'SIP/7008', "leosip", $valiables); + + echo json_encode($response); + exit(0); + } catch (Exception $e) { + echo json_encode(array('status' => $e->getCode(), 'message' => $e->getMessage())); + } ?> \ No newline at end of file diff --git a/examples/EventsForApp.php b/examples/EventsForApp.php index 4328090..7a71f6a 100644 --- a/examples/EventsForApp.php +++ b/examples/EventsForApp.php @@ -1,12 +1,34 @@ events('hello-world')); -exit(0); + $conn = new phpari("hello-world"); //create new object + $efa = new events($conn); + + echo json_encode($efa->events('hello-world')); + exit(0); ?> \ No newline at end of file diff --git a/examples/EventsForAppStasis.php b/examples/EventsForAppStasis.php index a7fc7b2..f9c883f 100644 --- a/examples/EventsForAppStasis.php +++ b/examples/EventsForAppStasis.php @@ -1,69 +1,85 @@ events = new events($this->conn); + public function __construct() + { + $this->conn = new phpari("hello-world"); //create new object + $this->events = new events($this->conn); - } + } - public function handlers() - { - try { - $this->conn->stasisClient->on("request", function ($headers) { - $this->conn->stasisLogger->notice("Request received!"); - }); + public function handlers() + { + try { + $this->conn->stasisClient->on("request", function ($headers) { + $this->conn->stasisLogger->notice("Request received!"); + }); - $this->conn->stasisClient->on("handshake", function () { - $this->conn->stasisLogger->notice("Handshake received!"); - }); + $this->conn->stasisClient->on("handshake", function () { + $this->conn->stasisLogger->notice("Handshake received!"); + }); - $this->conn->stasisClient->on("message", function ($message) { + $this->conn->stasisClient->on("message", function ($message) { - $this->stasisLogger->notice(json_encode($message)); - $this->stasisLogger->notice($this->events->events('hello-world')); - }); + $this->stasisLogger->notice(json_encode($message)); + $this->stasisLogger->notice($this->events->events('hello-world')); + }); - } catch (Exception $e) { - echo $e->getMessage(); - exit(99); + } catch (Exception $e) { + echo $e->getMessage(); + exit(99); + } } - } - public function execute() - { - try { - $this->conn->stasisClient->open(); - $this->conn->stasisLoop->run(); + public function execute() + { + try { + $this->conn->stasisClient->open(); + $this->conn->stasisLoop->run(); - } catch (Exception $e) { - echo $e->getMessage(); - exit(99); + } catch (Exception $e) { + echo $e->getMessage(); + exit(99); + } } - } -} + } -$eventForApp = new EventsForAppStasis(); -$eventForApp->handlers(); -$eventForApp->execute(); + $eventForApp = new EventsForAppStasis(); + $eventForApp->handlers(); + $eventForApp->execute(); -exit(0); \ No newline at end of file + exit(0); \ No newline at end of file diff --git a/examples/MailBoxCreate.php b/examples/MailBoxCreate.php index c48edd5..8f744f9 100644 --- a/examples/MailBoxCreate.php +++ b/examples/MailBoxCreate.php @@ -1,12 +1,34 @@ mailbox_change_state('testMailBox',0,0)); -exit(0); + $conn = new phpari("hello-world"); //create new object + $mailboxes = new mailboxes($conn); + + echo json_encode($mailboxes->mailbox_change_state('testMailBox', 0, 0)); + exit(0); ?> \ No newline at end of file diff --git a/examples/MailBoxesList.php b/examples/MailBoxesList.php index 5d8635b..4959bf5 100644 --- a/examples/MailBoxesList.php +++ b/examples/MailBoxesList.php @@ -1,12 +1,34 @@ mailboxes_list()); -exit(0); + $conn = new phpari("hello-world"); //create new object + $mailboxes = new mailboxes($conn); + + echo json_encode($mailboxes->mailboxes_list()); + exit(0); ?> \ No newline at end of file diff --git a/examples/RecordingList.php b/examples/RecordingList.php index 7e64157..061a722 100644 --- a/examples/RecordingList.php +++ b/examples/RecordingList.php @@ -1,4 +1,5 @@ recording_list()); exit(0); ?> \ No newline at end of file diff --git a/examples/SoundsList.php b/examples/SoundsList.php index 685749f..50dd30a 100644 --- a/examples/SoundsList.php +++ b/examples/SoundsList.php @@ -1,13 +1,34 @@ sounds_list('en','gsm')); -exit(0); + echo json_encode($sounds->sounds_list('en', 'gsm')); + exit(0); ?> \ No newline at end of file diff --git a/examples/examples-config.php b/examples/examples-config.php deleted file mode 100644 index d6d35a1..0000000 --- a/examples/examples-config.php +++ /dev/null @@ -1,40 +0,0 @@ -configuration = (object)parse_ini_file($configFile, TRUE); - $result = $this->connect($ariUsername, $ariPassword, $stasisApplication, $ariServer, $ariPort, $ariEndpoint); - return $result; + /* Some general information */ + $this->debug = $this->configuration->general['debug']; + $this->logfile = $this->configuration->general['logfile']; + /* Connect to ARI server */ + $result = $this->connect($this->configuration->asterisk_ari['username'], + $this->configuration->asterisk_ari['password'], + $stasisApplication, + $this->configuration->asterisk_ari['host'], + $this->configuration->asterisk_ari['port'], + $this->configuration->asterisk_ari['endpoint'], + $this->configuration->asterisk_ari['transport']); + + return $result; + + + } catch (Exception $e) { + die("Exception raised: " . $e->getMessage() . "\nFile: " . $e->getFile() . "\nLine: " . $e->getLine()); + } - } catch (Exception $e) { - die("Exception raised: " . $e->getMessage() . "\nFile: " . $e->getFile() . "\nLine: " . $e->getLine()); } - } + /** + * This function is connecting and returning a phpari client object which + * transferred to any of the interfaces will assist with the connection process + * to the Asterisk Stasis or to the Asterisk 12 web server (Channels list , End Points list) + * etc. + * + * @param $ariUsername + * @param $ariPassword + * @param $stasisApplication + * @param $ariServer + * @param $ariPort + * @param $ariEndpoint + * + * @return array + */ + private function connect($ariUsername, $ariPassword, $stasisApplication, $ariServer, $ariPort, $ariEndpoint, $ariTransport) + { - /** - * This function is connecting and returning a phpari client object which - * transferred to any of the interfaces will assist with the connection process - * to the Asterisk Stasis or to the Asterisk 12 web server (Channels list , End Points list) - * etc. - * - * @param $ariUsername - * @param $ariPassword - * @param $stasisApplication - * @param $ariServer - * @param $ariPort - * @param $ariEndpoint - * @return array - */ - private function connect($ariUsername, $ariPassword, $stasisApplication, $ariServer, $ariPort, $ariEndpoint) - { + try { + + $this->ariEndpoint = new PestJSON("http://" . $ariServer . ":" . $ariPort . $ariEndpoint); + $this->ariEndpoint->setupAuth($ariUsername, $ariPassword, "basic"); + + $this->stasisLoop = \React\EventLoop\Factory::create(); + + $this->stasisLogger = new \Zend\Log\Logger(); + + if ($this->configuration->general['logfile'] == "console") + $this->logWriter = new Zend\Log\Writer\Stream("php://output"); + else + $this->logWriter = new Zend\Log\Writer\Stream($this->configuration->general['logfile']); - try { + $this->stasisLogger->addWriter($this->logWriter); - $this->ariEndpoint = new PestJSON("http://" . $ariServer . ":" . $ariPort . $ariEndpoint); - $this->ariEndpoint->setupAuth($ariUsername, $ariPassword, "basic"); - $this->stasisLoop = \React\EventLoop\Factory::create(); + if ($this->debug) $this->stasisLogger->debug("Initializing WebSocket Information"); - $this->stasisLogger = new \Zend\Log\Logger(); - $this->logWriter = new Zend\Log\Writer\Stream("php://output"); - $this->stasisLogger->addWriter($this->logWriter); + $this->stasisClient = new \Devristo\Phpws\Client\WebSocket($ariTransport . "://" . $ariServer . ":" . $ariPort . "/ari/events?api_key=" . $ariUsername . ":" . $ariPassword . "&app=" . $stasisApplication, $this->stasisLoop, $this->stasisLogger); + if ($this->debug) $this->stasisLogger->debug("Initializing Stasis Event Emitter"); - $this->stasisClient = new \Devristo\Phpws\Client\WebSocket("ws://" . $ariServer . ":" . $ariPort . "/ari/events?api_key=" . $ariUsername . ":" . $ariPassword . "&app=" . $stasisApplication, $this->stasisLoop, $this->stasisLogger); + $this->stasisEvents = new Evenement\EventEmitter(); - return array("stasisClient" => $this->stasisClient, "stasisLoop" => $this->stasisLoop, "stasisLogger" => $this->stasisLogger, "ariEndpoint" => $this->ariEndpoint); - } catch (Exception $e) { - die("Exception raised: " . $e->getMessage() . "\nFile: " . $e->getFile() . "\nLine: " . $e->getLine()); + return true; + //return array("stasisClient" => $this->stasisClient, "stasisLoop" => $this->stasisLoop, "stasisLogger" => $this->stasisLogger, "ariEndpoint" => $this->ariEndpoint); + + } catch (Exception $e) { + die("Exception raised: " . $e->getMessage() . "\nFile: " . $e->getFile() . "\nLine: " . $e->getLine()); + } } - } - public function applications() - { - $this->applications = new applications($this); - return $this->applications; - } + public function applications() + { + try { + $this->applications = new applications($this); + if ($this->debug) $this->stasisLogger->debug("applications class had been initiated"); + return $this->applications; + } catch (Exception $e) { - public function asterisk() - { - $this->asterisk = new asterisk($this); - return $this->asterisk; - } + if ($this->debug) $this->stasisLogger->debug("applications has failed initialization"); + return TRUE; + } + } - public function bridges() - { - $this->bridges = new bridges($this); - return $this->bridges; - } + public function asterisk() + { + try { + $this->asterisk = new asterisk($this); + if ($this->debug) $this->stasisLogger->debug("asterisk class had been initiated"); + return $this->asterisk; + } catch (Exception $e) { - public function channels() - { - $this->channels = new channels($this); - return $this->channels; - } + if ($this->debug) $this->stasisLogger->debug("asterisk has failed initialization"); + return TRUE; + } + } - public function deviceStates() - { - $this->devicestates = new devicestates($this); - return $this->devicestates; - } + public function bridges() + { + try { + $this->bridges = new bridges($this); + if ($this->debug) $this->stasisLogger->debug("bridges class had been initiated"); + return $this->bridges; + } catch (Exception $e) { - public function endPoints() - { - $this->endpoints = new endpoints($this); - return $this->endpoints; - } + if ($this->debug) $this->stasisLogger->debug("bridges has failed initialization"); + return TRUE; + } + } - public function events() - { - $this->events = new events($this); - return $this->events; - } + public function channels() + { + try { + $this->channels = new channels($this); + if ($this->debug) $this->stasisLogger->debug("channels class had been initiated"); + return $this->channels; + } catch (Exception $e) { - public function mailBoxes() - { - $this->mailboxes = new mailboxes($this); - return $this->mailboxes; - } + if ($this->debug) $this->stasisLogger->debug("channels has failed initialization"); + return TRUE; + } + } - public function recordings() - { - $this->recordings = new recordings($this); - return $this->recordings; - } + public function devicestates() + { + try { + $this->devicestates = new devicestates($this); + if ($this->debug) $this->stasisLogger->debug("devicestates class had been initiated"); + return $this->devicestates; + } catch (Exception $e) { - public function sounds() - { - $this->sounds = new sounds($this); - return $this->sounds; - } + if ($this->debug) $this->stasisLogger->debug("devicestates has failed initialization"); + return TRUE; + } + } - public function playbacks() - { - $this->playbacks = new playbacks($this); - return $this->playbacks; - } + public function endpoints() + { + try { + $this->endpoints = new endpoints($this); + if ($this->debug) $this->stasisLogger->debug("endpoints class had been initiated"); + return $this->endpoints; + } catch (Exception $e) { + + if ($this->debug) $this->stasisLogger->debug("endpoints has failed initialization"); + return TRUE; + } + } + + public function events() + { + try { + $this->events = new events($this); + if ($this->debug) $this->stasisLogger->debug("events class had been initiated"); + return $this->events; + } catch (Exception $e) { -} + if ($this->debug) $this->stasisLogger->debug("events has failed initialization"); + return TRUE; + } + } + + public function mailboxes() + { + try { + $this->mailboxes = new mailboxes($this); + if ($this->debug) $this->stasisLogger->debug("mailboxes class had been initiated"); + return $this->mailboxes; + } catch (Exception $e) { + + if ($this->debug) $this->stasisLogger->debug("mailboxes has failed initialization"); + return TRUE; + } + } + + public function recordings() + { + try { + $this->recordings = new recordings($this); + if ($this->debug) $this->stasisLogger->debug("recordings class had been initiated"); + return $this->recordings; + } catch (Exception $e) { + + if ($this->debug) $this->stasisLogger->debug("recordings has failed initialization"); + return TRUE; + } + } + + public function sounds() + { + try { + $this->sounds = new sounds($this); + if ($this->debug) $this->stasisLogger->debug("sounds class had been initiated"); + return $this->sounds; + } catch (Exception $e) { + + if ($this->debug) $this->stasisLogger->debug("sounds has failed initialization"); + return TRUE; + } + } + + public function playbacks() + { + try { + $this->playbacks = new playbacks($this); + if ($this->debug) $this->stasisLogger->debug("playbacks class had been initiated"); + return $this->playbacks; + } catch (Exception $e) { + + if ($this->debug) $this->stasisLogger->debug("playbacks has failed initialization"); + return TRUE; + } + } + + }