sms testv3

This commit is contained in:
merdan 2022-02-01 19:31:34 +05:00
parent 961d90064f
commit 9366e803d9
1 changed files with 29 additions and 1 deletions

View File

@ -4,12 +4,15 @@ namespace AhmadFatoni\ApiGenerator\Controllers\API;
use Cms\Classes\Controller;
use LaravelSmpp\SmppServiceInterface;
use SmppClient;
use SmppException;
use SocketTransport;
use TPS\Birzha\Classes\SMPP;
class SmsController extends Controller
{
public function index(SmppServiceInterface $smpp) {
$smpp->sendOne(99363432211, 'Hi, this SMS was send via SMPP protocol');
// $smpp->sendOne(99363432211, 'Hi, this SMS was send via SMPP protocol');
// $tx=new SMPP('217.174.228.218', 5019); // make sure the port is integer
// $tx->debug=true;
// $tx->bindTransmitter("birja","Birj@1");
@ -20,5 +23,30 @@ class SmsController extends Controller
// $tx->close();
// unset($tx);
// return 'success';
return $this->setupSMPP();
}
private function setupSMPP(){
$transport = new SocketTransport(['217.174.228.218'], 5019);
try {
$transport->setRecvTimeout(10000);
$smpp = new SmppClient($transport);
$smpp->debug = true;
$transport->open();
$smpp->bindTransmitter('birja', 'Birj@1');
return 'ok';
}
// Skipping unavailable
catch (SmppException $ex) {
$transport->close();
throw $ex;
}
}
}