Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Clarity on Authourization regarding ESME server connections. #17

Open
acaciabengo opened this issue Jan 1, 2015 · 0 comments
Open

Clarity on Authourization regarding ESME server connections. #17

acaciabengo opened this issue Jan 1, 2015 · 0 comments

Comments

@acaciabengo
Copy link

With reference to the methods below. How exactly does authourization of ESME to the SMPP server occur.
I would wish to call an API on my ruby app to cross check info and balance as part of authourization and go on to send submit message

self.handleBind = function(pdu) {
switch (pdu.command_id) {
case smpp.commands.bind_receiver:
self.bind_type = smpp.RECEIVER;
break;
case smpp.commands.bind_transceiver:
self.bind_type = smpp.TRANSCEIVER;
break;
case smpp.commands.bind_transmitter:
self.bind_type = smpp.TRANSMITTER;
break;
}

    // Ask the callback (if there is one) if the credentials are okay
    if (self.listeners('bind').length > 0) {
        self.emit('bind', self, pdu, function(status) {
            self.bindAuthorization(pdu, status);
        });
    } else {
        self.bindAuthorization(pdu, "ESME_ROK");
    }
};

self.bindAuthorization = function(pdu, status) {
    var newPdu, command;

    switch (self.bind_type) {
        case smpp.RECEIVER:
            command = "bind_receiver_resp";
            break;
        case smpp.TRANSMITTER:
            command = "bind_transmitter_resp";
            break;
        case smpp.TRANSCEIVER:
            command = "bind_transceiver_resp";
            break;
    }

    newPdu = {
        command: command,
        command_status: status,
        sequence_number: pdu.sequence_number,
        fields: {
            system_id: self.config.system_id
        },
        optional_params: {}
    };

    // Create a new PDU with our response
    if (status === "ESME_ROK") {
        self.system_id = pdu.system_id.toString('ascii');
        self.bound = true;
        self.socket.setTimeout(self.config.timeout * 1000);
        self.socket.on('timeout', self.enquire_link);
    } else {
        self.bound = false;
        self.bind_type = smpp.UNBOUND;
    }

    self.sendPdu(newPdu);

    self.emit('bindSuccess', self, pdu);
};
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant