Skip to content

Commit

Permalink
Merge pull request #13 from barnoma-soz/debugging
Browse files Browse the repository at this point in the history
Added the ability to debug the client
  • Loading branch information
franzose authored Aug 31, 2020
2 parents 78240e2 + c0dda01 commit 1ddfa91
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
6 changes: 3 additions & 3 deletions config/laravel-smpp.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php

return [

/*
|--------------------------------------------------------------------------
| Default SMPP settings
Expand Down Expand Up @@ -75,6 +74,7 @@

'client' => [
'system_type' => 'default',
'null_terminate_octetstrings' => false
'null_terminate_octetstrings' => false,
'debug' => false
]
];
];
17 changes: 9 additions & 8 deletions src/SmppService.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function __construct(Repository $config)

/**
* Send a single SMS.
*
*
* @param $phone
* @param $message
*
Expand Down Expand Up @@ -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);
}
}
Expand All @@ -122,7 +121,7 @@ public function sendBulk(array $phones, $message)

/**
* Alert error occured while sending SMSes.
*
*
* @param Exception $ex
* @param int $phone
*/
Expand All @@ -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;
Expand Down Expand Up @@ -243,4 +244,4 @@ protected function getConfig($option)

return Arr::get($this->providers, $key, $default);
}
}
}

0 comments on commit 1ddfa91

Please sign in to comment.