kannel

How to define custom vendor specific err code in kannel opensmppbox


I have added a function in opensmppbox but I need to generate a custom vendor specific err code to ESME users

            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);

How can I add my custom error code?


Solution

  • add a new case SMPP_ESME_RXXXXXXXXX: with your status message

    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";
        }
    

    You have define SMPP_ESME_RXXXXXXXXX and its err code in gw/smsc/smpp_pdu.h

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

    In your code,

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