如何在kannel opensmppbox中定义自定义供应商特定的错误代码

时间:2016-08-18 12:10:34

标签: kannel

我在opensmppbox中添加了一个函数,但我需要为ESME用户生成一个自定义供应商特定的错误代码

            octstr_destroy(smpp_queued_response_pdu->pdu->u.data_sm_resp.message_id);
            smpp_queued_response_pdu->pdu->u.data_sm_resp.message_id = NULL;
            smpp_queued_response_pdu->pdu->u.data_sm_resp.command_status = **CUSTOM STATUS HERE**;
            msg_destroy(smpp_queued_response_pdu->msg);
            smpp_queued_response_pdu->msg = NULL;
            smpp_queues_add_outbound(smpp_queued_response_pdu);

如何添加自定义错误代码?

1 个答案:

答案 0 :(得分:0)

添加新案例SMPP_ESME_RXXXXXXXXX:并附上您的状态讯息

const char *smpp_error_to_string(enum SMPP_ERROR_MESSAGES error)
{
    switch (error) {
        case SMPP_ESME_ROK:
        .........
...............
case SMPP_ESME_RXXXXXXXXX:
            return "Your return status message";

 default:
            /* tell the user that we have a vendor-specific beast here */
            if (error >= 0x0400 && error <= 0x04FF)
                return "Vendor-specific error, please refer to your SMPP provider";
            else
                return "Unknown/Reserved";
    }

您已在gw / smsc / smpp_pdu.h中定义了SMPP_ESME_RXXXXXXXXX及其错误代码

    /*
 * Some SMPP error messages we come across
 */
enum SMPP_ERROR_MESSAGES {
    SMPP_ESME_ROK = 0x00000000,
............
.............
    SMPP_ESME_RXXXXXXXXX = 0x00000432,
};

在您的代码中,

smpp_queued_response_pdu->pdu->u.data_sm_resp.command_status = SMPP_ESME_RXXXXXXXXX;