diff --git a/config/laravel-smpp.php b/config/laravel-smpp.php index 8f7f366..abc7946 100644 --- a/config/laravel-smpp.php +++ b/config/laravel-smpp.php @@ -1,7 +1,6 @@ [ 'system_type' => 'default', - 'null_terminate_octetstrings' => false + 'null_terminate_octetstrings' => false, + 'debug' => false ] -]; \ No newline at end of file +]; diff --git a/src/SmppService.php b/src/SmppService.php index b44dfe7..13b376f 100644 --- a/src/SmppService.php +++ b/src/SmppService.php @@ -74,7 +74,7 @@ public function __construct(Repository $config) /** * Send a single SMS. - * + * * @param $phone * @param $message * @@ -106,13 +106,12 @@ public function sendBulk(array $phones, $message) $this->setupSmpp(); $sender = $this->getSender(); - foreach($phones as $idx => $phone) { + foreach ($phones as $idx => $phone) { try { $message = (is_array($message) ? $message[$idx] : $message); $this->sendSms($sender, $phone, $message); - } - catch(Exception $ex) { + } catch (Exception $ex) { $this->alertSendingError($ex, $phone); } } @@ -122,7 +121,7 @@ public function sendBulk(array $phones, $message) /** * Alert error occured while sending SMSes. - * + * * @param Exception $ex * @param int $phone */ @@ -145,11 +144,13 @@ protected function setupSmpp() try { $transport->setRecvTimeout($config['timeout']); - $this->smpp = new SmppClient($transport); + $smpp = new SmppClient($transport); + $smpp->debug = $this->config->get('laravel-smpp.client.debug', false); $transport->open(); - $this->smpp->bindTransmitter($config['login'], $config['password']); + $smpp->bindTransmitter($config['login'], $config['password']); + $this->smpp = $smpp; $this->provider = $provider; break; @@ -243,4 +244,4 @@ protected function getConfig($option) return Arr::get($this->providers, $key, $default); } -} \ No newline at end of file +}