Open ritmas opened 9 years ago
Same here
How to keep sessions alive in smpp after sending sms.
require_once 'smppclient.class.php'; require_once 'gsmencoder.class.php'; require_once 'sockettransport.class.php';
// Construct transport and client
$transport = new SocketTransport(array(''),); $transport->setSendTimeout(100000);
// Open the connection $transport->open();
$smpp = new SmppClient($transport);
// Activate binary hex-output of server interaction $smpp->debug = true; $transport->debug = true;
$smpp->bindTransmitter("","");
// Optional connection specific overrides //SmppClient::$sms_null_terminate_octetstrings = false; //SmppClient::$csms_method = SmppClient::CSMS_PAYLOAD; //SmppClient::$sms_registered_delivery_flag = SMPP::REG_DELIVERY_SMSC_BOTH;
// Prepare message
for($i = 0; $i < 2; $i++){
$mobile = "";
$message = "msg";
$senderid = "";
$encodedMessage = GsmEncoder::utf8_to_gsm0338($message);
$from = new SmppAddress($senderid,SMPP::TON_ALPHANUMERIC);
$to = new SmppAddress("91".$mobile,SMPP::TON_INTERNATIONAL,SMPP::NPI_E164);
$tags = array();
// Send
if($sm = $smpp->sendSMS($from,$to,$encodedMessage, $tags)){
echo $sm;
echo "Msg Sent<br/>";
}
}
$vv = $smpp->enquireLink();
print_r($vv);
// Close connection //$smpp->close();
ENQUIRE_LINK_RESP
PDU body length is 1 character longer than expected. Currently it's used as follows:but
strlen("\x00") = 1
and according to SMPP 3.4 (p. 106) only header must be sent, without body.I've stumbled on this lately while establishing connection with as I assume strictly configured SMSC (not sure). Upon sending response to
ENQUIRE_LINK
I was keep getting generick nack:Once I truncated PDU body issue's gone.