SMPP有效载荷以及其他信息



是否可以使用自定义参数或任何其他方式发送一些带有SMPP有效载荷/PDU的额外数据。语言API可以是任何Java,JSMPP或其他任何人。如果可能的话,请分享一个示例。

在SMPP规格中,您有此段落:" 5.3.2 SMPP可选参数标签定义",您可以在其中找到所有可选参数,您可以添加到PDU中。

以下是将sar_*选项设置为submis_sm的示例>

pdu = SubmitSM()
pdu.params['sar_total_segments'] = 3
pdu.params['sar_segment_seqnum'] = 1
pdu.params['sar_msg_ref_num'] = 56

无论如何,如果您需要设置"供应商特定"选项而不使用标准的可选参数,则需要在客户端和服务器侧面的库中实现它,您可能找不到准备就绪并在任何标准中实现图书馆。

您还可以考虑定义消息结构以发送数据(这取决于您需要做什么...)检查drive_sm内容是否代表收据或普通消息的方法:

def isDeliveryReceipt(self, DeliverSM):
    """Check whether DeliverSM is a DLR or not, will return None if not
    or a dict with the DLR elements"""
    ret = None
    # Example of DLR content
    # id:IIIIIIIIII sub:SSS dlvrd:DDD submit date:YYMMDDhhmm done
    # date:YYMMDDhhmm stat:DDDDDDD err:E text: . . . . . . . . .
    pattern = r"^id:(?P<id>d{10}) sub:(?P<sub>d{3}) dlvrd:(?P<dlvrd>d{3}) submit date:(?P<sdate>d{10}) done date:(?P<ddate>d{10}) stat:(?P<stat>w{7}) err:(?P<err>w{3}) text:(?P<text>.*)"
    m = re.search(pattern, DeliverSM.params['short_message'], flags=re.IGNORECASE)
    if m is not None:
        ret = m.groupdict()
    return ret

最新更新