我想用SMPP发送长短信。我使用这个类php-smpp:https://github.com/agladkov/php-smpp/tree/master
和文档http://opensmpp.org/specs/smppv34_gsmumts_ig_v10.pdf
然而,当我收到短信时,他们并没有连接起来。 每个短信在开头包含以下字符:é¥ò@ $$(第一个短信)和é@¥$$$(第二个短信) 这些字符对应于UDH
esm_class = 0x40(用于启用UDH)
public function sendSMS(SmppAddress $from, SmppAddress $to, $message, $tags=null, $dataCoding=SMPP::DATA_CODING_ISO8859_1, $priority=0x00, $scheduleDeliveryTime=null, $validityPeriod=null)
{
...
$seqnum = 1;
foreach ($parts as $part)
{
$udh = pack('cccccc',5,0,3,substr($csmsReference,1,1),count($parts),$seqnum);
$res = $this->submit_sm($from, $to, $udh.$part, $tags, $dataCoding, $priority, $scheduleDeliveryTime, $validityPeriod, (SmppClient::$sms_esm_class|0x40));
$seqnum++;
}
...
}
protected function submit_sm(SmppAddress $source, SmppAddress $destination, $short_message=null, $tags=null, $dataCoding=SMPP::DATA_CODING_DEFAULT, $priority=0x00, $scheduleDeliveryTime=null, $validityPeriod=null, $esmClass=null)
{
if (is_null($esmClass)) $esmClass = self::$sms_esm_class;
// Construct PDU with mandatory fields
$pdu = pack('a2cca'.(strlen($source->value)+1).'cca'.(strlen($destination->value)+1).'ccc'.($scheduleDeliveryTime ? 'a16x' : 'a1').($validityPeriod ? 'a16x' : 'a1').'ccccca'.(strlen($short_message)+(self::$sms_null_terminate_octetstrings ? 1 : 0)),
self::$sms_service_type,
$source->ton,
$source->npi,
$source->value,
$destination->ton,
$destination->npi,
$destination->value,
$esmClass,
self::$sms_protocol_id,
$priority,
$scheduleDeliveryTime,
$validityPeriod,
self::$sms_registered_delivery_flag,
self::$sms_replace_if_present_flag,
$dataCoding,
self::$sms_sm_default_msg_id,
strlen($short_message),//sm_length
$short_message//short_message
);
// Add any tags
if (!empty($tags)) {
foreach ($tags as $tag) {
$pdu .= $tag->getBinary();
}
}
$response=$this->sendCommand(SMPP::SUBMIT_SM,$pdu);
$body = unpack("a*msgid",$response->body);
return $body['msgid'];
}
感谢任何帮助。
答案 0 :(得分:0)
当我在" esme"中添加UDH片段支持时,我遇到了同样的问题。但我的问题是UDHI被忽略了(通过我的测试服务器 - 我修复了那个消息:))。如果您在MS上收到错误的短信,那么您可以尝试实施SAR碎片,因为它被广泛使用。 SAR碎片非常相似,但您应该设置以sar _ *
开头的可选TLV参数