Source for file generic_smpp.php
Documentation is available at generic_smpp.php
require_once 'Net/SMPP/Client.php';
* This driver interfaces with the email-to-sms gateways provided by many
* carriers, particularly those based in the U.S.
* $Horde: framework/Net_SMS/SMS/generic_smpp.php,v 1.1 2006/08/28 09:52:10 jan Exp $
* Copyright 2005-2007 WebSprockets, LLC
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
* @author Ian Eure <ieure@php.net>
* @link http://pear.php.net/package/Net_SMS
* Capabilities of this driver
'submitParams' => array ()
* Net_SMPP_Client instance
* @param array $params Parameters.
public function __construct($params, Net_SMPP_Client $client)
$this->_client = $client;
* Identifies this driver.
* @return array Driver info.
'name' => _("SMPP Gateway"),
'desc' => _("This driver allows sending of messages through an SMPP gateway.")
* Get required paramaters
* @return array Array of required parameters.
'label' => _("Host"), 'type' => 'text'),
'label' => _("Port"), 'type' => 'int'),
// 'bindParams' => array(
// 'label' => _('bind_transmitter paramaters'), 'type' => 'array'),
// 'submitParams' => array(
// 'label' => _('submit_sm parameters'), 'type' => 'array'
* @param array $message Message to send.
* @param string $to The recipient.
* @return array An array with the success status and additional
function _send($message, $to)
$pdu = Net_SMPP ::PDU ('submit_sm', $this->_params['submitParams']);
$pdu->destination_addr = $to;
$pdu->short_message = $message['text'];
if (count($message) > 1 ) {
$res = $this->_client->sendPDU ($pdu);
return array (0 , _("Error sending PDU"));
$resp = & $this->_client->readPDU ();
return array (0 , _("Could not read response PDU"));
return array (0 , sprintf(_("Sending failed: %s") . $resp->statusDesc ()));
return array (1 , $resp->message_id );
* Authenticates with the SMSC.
* This method connects to the SMSC (if not already connected) and
* authenticates with the bind_transmitter command (if not already bound).
if ($this->_client->state == Net_SMPP_Client ::STATE_CLOSED ) {
$res = $this->_client->connect ();
if ($this->_client->state == Net_SMPP_Client ::STATE_OPEN ) {
$resp = $this->_client->bind ($this->_params['bindParams']);
if ($resp === false || (is_object($resp) && $resp->isError ())) {
* @see Net_SMPP_Client::accept()
* @return mixed {@link Net_SMPP_Client::accept()}'s return value
return $this->_client->accept ($obj);
* Returns a list of parameters specific for this driver.
* @return array Default sending parameters.
Documentation generated on Mon, 11 Mar 2019 15:57:15 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|