smsc/lib/GG-SmsRequest.js
function CheckOutboxCB(err, results) {
        var result = results[0];  // Query result is alway an array of response even when unique
        self.retry ++; // update retry counter
        // if message is still in queue retry
        self.Debug (6,"CheckOutboxCB Phone=%s Result=%j Retry=%d/%d", smscmd.phone, result, self.retry, smsc.opts.retry);
        if (result !== undefined) {
            // message is still in queue loop one more time
            if (self.retry <= smsc.opts.retry) {
                setTimeout (function() {CheckOutbox (result.ID);}, smsc.opts.delay);
            } else {
                // notify appcb that SMS failed and was deleted
                self.Debug (6,"CheckOutboxCB Fail SqlId=%s SMS=%j", result.ID, smscmd);
                smsc.DelById (DelByIdCB, result.ID);
                appcb ({status: -1, smsid: smscmd.id});

            }
        } else {
            // le message à été expédié
            self.Debug (6,"CheckOutboxCB OK SMS=%j", smscmd);
            appcb ({status: 1, smsid: smscmd.id});

            // if an acknowledgement is asked loop until we get it.
            if (smscmd.ack) {
                self.retry = 0; // reset retry counter for ack
                setTimeout (function() {CheckDevAck (smscmd);}, smsc.opts.delay);
            } else {
                  appcb ({status: 0});
            }
        }
    }
function CheckOutboxCB(err, results) {
        var result = results[0];  // Query result is alway an array of response even when unique
        self.retry ++; // update retry counter
        // if message is still in queue retry
        self.Debug (6,"CheckOutboxCB Phone=%s Result=%j Retry=%d/%d", smscmd.phone, result, self.retry, smsc.opts.retry);
        if (result !== undefined) {
            // message is still in queue loop one more time
            if (self.retry <= smsc.opts.retry) {
                setTimeout (function() {CheckOutbox (result.ID);}, smsc.opts.delay);
            } else {
                // notify appcb that SMS failed and was deleted
                self.Debug (6,"CheckOutboxCB Fail SqlId=%s SMS=%j", result.ID, smscmd);
                smsc.DelById (DelByIdCB, result.ID);
                appcb ({status: -1, smsid: smscmd.id});

            }
        } else {
            // le message à été expédié
            self.Debug (6,"CheckOutboxCB OK SMS=%j", smscmd);
            appcb ({status: 1, smsid: smscmd.id});

            // if an acknowledgement is asked loop until we get it.
            if (smscmd.ack) {
                self.retry = 0; // reset retry counter for ack
                setTimeout (function() {CheckDevAck (smscmd);}, smsc.opts.delay);
            } else {
                  appcb ({status: 0});
            }
        }
    }
function CheckOutboxCB ( err , results ) { var result = results [ 0 ] ; // Query result is alway an array of response even when unique self . retry ++ ; // update retry counter // if message is still in queue retry self . Debug ( 6 , "CheckOutboxCB Phone=%s Result=%j Retry=%d/%d" , smscmd . phone , result , self . retry , smsc . opts . retry ) ; if ( result !== undefined ) { // message is still in queue loop one more time if ( self . retry <= smsc . opts . retry ) { setTimeout ( function ( ) { CheckOutbox ( result . ID ) ; } , smsc . opts . delay ) ; } else { // notify appcb that SMS failed and was deleted self . Debug ( 6 , "CheckOutboxCB Fail SqlId=%s SMS=%j" , result . ID , smscmd ) ; smsc . DelById ( DelByIdCB , result . ID ) ; appcb ( { status : - 1 , smsid : smscmd . id } ) ; } } else { // le message à été expédié self . Debug ( 6 , "CheckOutboxCB OK SMS=%j" , smscmd ) ; appcb ( { status : 1 , smsid : smscmd . id } ) ; // if an acknowledgement is asked loop until we get it. if ( smscmd . ack ) { self . retry = 0 ; // reset retry counter for ack setTimeout ( function ( ) { CheckDevAck ( smscmd ) ; } , smsc . opts . delay ) ; } else { appcb ( { status : 0 } ) ; } } }
this function is call when MySql checked outbox
this function is call when MySql checked outbox