this object handle sms transaction. SmsRequest call application callback with a status [1=send to phone, -1=fail to send] [2=ack received, -2 ack not received]
354794
function SmsRequest (smsc, appcb, smscmd) {
    var self=this; // nodejs is still a bad language
    this.debug = smsc.debug;
    this.retry = 0;

    // this method is called when DelById is executed
    function DelByIdCB (err) {
        self.Debug (9,"DelCallBack err=%s", err);
    }

    // this method is called by MySql when sms.GetFrom return
    function CheckDevAckCB(err, results) {
        self.retry ++; // retry counter for ACK
        self.Debug (6, "CheckDevAckCB Phone=%s Retry=%d/%d Result=%j", smscmd.phone, self.retry, smsc.opts.retry, results);
        // ack no received
        if (results.length === 0) {
            if (self.retry <= smsc.opts.retry) {
                setTimeout (function() {CheckDevAck ();}, smsc.opts.delay);
            } else {
                self.Debug (7, "CheckDevAckCB Ack Abandoned MaxRetry=%s", smsc.opts.retry);
                appcb ({status: -2, smsid: smscmd.id});
            }
        } else {
            // we may have more than one responses for a given command
            for (var slot in results) {
                var ack =
                { status: 2
                    , smsid: smscmd.id
                    , phone: smscmd.phone
                    , ack: results[slot].TextDecoded
                };
                // ACK received, delete it from inbox and send it to application
                self.Debug (6, "CheckDevAckCB Ack Received %j", ack);
                smsc.DelById (DelByIdCB, results[slot].Id);
                appcb({status: 2, smsid: smscmd.id, msg: ack});
            }
            appcb({status: 0});
        }
    }

    // this method check sms inbox table for OK ack from device
    function CheckDevAck() {
        self.Debug (3,"Waiting Acknowledgment Response %d/%d", self.retry, smsc.opts.retry);
        smsc.GetFrom (CheckDevAckCB, smscmd.phone)
    }

    // this function is call when MySql checked outbox
    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 loop until SMS is effectively sent
    function CheckOutbox (insertId) {
        self.Debug (3,"Waiting Sent Confirmation  %d/%d", self.retry, smsc.opts.retry);
        smsc.CheckById (CheckOutboxCB, insertId)
    }

    // this function is called when MySql inserted SMS in outbox
    function SendToCB (err, result) {
        // check if sms was sent from output table
        self.Debug (7,"SendToCB SMS=%j result=%j err=%j", smscmd, result, err);
        if (err) {
            self.Debug (1, "Insert in MySql outbox refused %s", err);
            appcb ({status: -1, id: smscmd.id, error: err});
        } else {
            setTimeout (function() {CheckOutbox (result.insertId);}, smsc.opts.delay);
        }
    }
    this.Debug (2,"Queuing Phone=%s SMS=%s", smscmd.phone, smscmd.msg);
    if (smscmd.phone == undefined ||  smscmd.msg == undefined) {
        SendToCB ({status: -1, info: 'Invalid SMS [missing phone and/or message'});
        return;
    }
    smsc.SendTo (SendToCB, smscmd);
}
399649
def _receive_callback(self, raw_message):
        """"""
        message = self.backend.message_to_python(raw_message)

        if self.auto_ack and not message.acknowledged:
            message.ack()
        self.receive(message.payload, message)
178970
def message(from, to, body, callback_url=nil)
      callback = callback_url ? {:StatusCallback => callback_url} : {}
      Twilio.post("/SMS/Messages", :body => {:From => from, :To => to, :Body => body}.merge(callback))
    end
668851
protected void handlePendingCallResult(RTMPConnection conn, Invoke invoke) {
        final IServiceCall call = invoke.getCall();
        final IPendingServiceCall pendingCall = conn.retrievePendingCall(invoke.getTransactionId());
        if (pendingCall != null) {
            // The client sent a response to a previously made call.
            Object[] args = call.getArguments();
            if (args != null && args.length > 0) {
                // TODO: can a client return multiple results?
                pendingCall.setResult(args[0]);
            }
            Set<IPendingServiceCallback> callbacks = pendingCall.getCallbacks();
            if (!callbacks.isEmpty()) {
                HashSet<IPendingServiceCallback> tmp = new HashSet<>();
                tmp.addAll(callbacks);
                for (IPendingServiceCallback callback : tmp) {
                    try {
                        callback.resultReceived(pendingCall);
                    } catch (Exception e) {
                        log.error("Error while executing callback {}", callback, e);
                    }
                }
            }
        }
    }
126147
def send_sms(self, text, **kw):
        

        params = {
            'user': self._user,
            'pass': self._passwd,
            'msg': text
        }

        kw.setdefault("verify", False)

        if not kw["verify"]:
            # remove SSL warning
            requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

        res = requests.get(FreeClient.BASE_URL, params=params, **kw)
        return FreeResponse(res.status_code)
1004679
def _on_msg(self, msg):
        """"""
        data = msg['content']['data']

        # If the message is a call invoke, run the function and send
        # the results.
        if 'callback' in data:
            guid = data['callback']
            callback = callback_registry[guid]
            args = data['arguments']
            args = [self.deserialize(a) for a in args]
            index = data['index']

            results = callback(*args)
            return self.serialize(self._send('return', index=index, results=results))

        # The message is not a call invoke, it must be an object
        # that is a response to a Python request.
        else:
            index = data['index']
            immutable = data['immutable']
            value = data['value']
            if index in self._callbacks:
                self._callbacks[index].resolve({
                    'immutable': immutable,
                    'value': value
                })
                del self._callbacks[index]
467035
function CheckDevAck() {
        self.Debug (3,"Waiting Acknowledgment Response %d/%d", self.retry, smsc.opts.retry);
        smsc.GetFrom (CheckDevAckCB, smscmd.phone)
    }
1032521
public void manage(final Ack ack) {
		
		if (logger.isDebugEnabled()) {
			logger.debug("Receiving ack : " + 
				     "  - id : " + ack.getId() + 
				     "  - type : " + ack.getType() + 
				     "  - count : " + ack.getCount());
		}
		
		if (SMText.EXPECTED_ACK_TYPE.equalsIgnoreCase(ack.getType())) {
			//
			
		} else {
			logger.error("Ack received is not and SMText ack : " + 
				     "  - id : " + ack.getId() + 
				     "  - type : " + ack.getType() + 
				     "  - count : " + ack.getCount() + 
				     "Ack not managed ");
		}
		
	 }
1056641
def _handle_sending(self, data):
        

        matches = re.match('^!Sending(\.{1,5})done.*', data)
        if matches is not None:
            good_send = False
            if len(matches.group(1)) < 5:
                good_send = True

            self.on_sending_received(status=good_send, message=data)
232756
function handleCallback(callback, err, httpResponse, body) {

    if(err){
        return callback(err);
    }

    //
    // API returns error
    //
    if( body.status !== 'OK' ){
        return callback(new Error(body.comment));
    }

    return callback(null, body.result);
}
45227
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});
            }
        }
    }
188908
function (txResult) {
    var errorCode = {
      OUT_OF_GAS: 'out of gas',
      STACK_UNDERFLOW: 'stack underflow',
      STACK_OVERFLOW: 'stack overflow',
      INVALID_JUMP: 'invalid JUMP',
      INVALID_OPCODE: 'invalid opcode',
      REVERT: 'revert',
      STATIC_STATE_CHANGE: 'static state change'
    }
    var ret = {
      error: false,
      message: ''
    }
    if (!txResult.result.vm.exceptionError) {
      return ret
    }
    var exceptionError = txResult.result.vm.exceptionError.error || ''
    var error = `VM error: ${exceptionError}.\n`
    var msg
    if (exceptionError === errorCode.INVALID_OPCODE) {
      msg = `\t\n\tThe execution might have thrown.\n`
      ret.error = true
    } else if (exceptionError === errorCode.OUT_OF_GAS) {
      msg = `\tThe transaction ran out of gas. Please increase the Gas Limit.\n`
      ret.error = true
    } else if (exceptionError === errorCode.REVERT) {
      var returnData = txResult.result.vm.return
      // It is the hash of Error(string)
      if (returnData && (returnData.slice(0, 4).toString('hex') === '08c379a0')) {
        var abiCoder = new ethers.utils.AbiCoder()
        var reason = abiCoder.decode(['string'], returnData.slice(4))[0]
        msg = `\tThe transaction has been reverted to the initial state.\nReason provided by the contract: "${reason}".`
      } else {
        msg = `\tThe transaction has been reverted to the initial state.\nNote: The called function should be payable if you send value and the value you send should be less than your current balance.`
      }
      ret.error = true
    } else if (exceptionError === errorCode.STATIC_STATE_CHANGE) {
      msg = `\tState changes is not allowed in Static Call context\n`
      ret.error = true
    }
    ret.message = `${error}${exceptionError}${msg}\tDebug the transaction to get more information.`
    return ret
  }
3522
function BatchCB (response) {
        console.log ("### Batch SMS CallBack --> Status=%j", response);

        if (response.status === 0 || response.status === -4) {
              console.log ("SMS Batch Test done");
              setTimeout (process.exit, 1000);
        }
    }
1111553
def _receive_callback(self, raw_message):
        """"""
        message = self.backend.message_to_python(raw_message)
        if self.auto_ack and not message.acknowledged:
            message.ack()
        try:
            decoded = message.decode()
        except Exception, exc:
            if not self.on_decode_error:
                raise
            self.on_decode_error(message, exc)
        else:
            self.receive(decoded, message)
1137682
def send_messages(self, sms_messages):
        
        if not sms_messages:
            return
        
        num_sent = 0
        for message in sms_messages:
            if self._send(message):
                num_sent += 1
        return num_sent
1120000
function(id) {
        var q = queues[id];
        q.finished = true;

        if (q.aborted) {
            var msg = "transaction " + id + " was aborted";
            _fail(id, msg);
            return;
        }

        // execute success callback
        if (q.onSuccess) {
            var sc=q.scope || q.win;
            q.onSuccess.call(sc, _returnData(q));
        }
    }
1049780
def send_sms(message_body, phone_no, type = 1)
      request_body = {}
      request_body[:un] = ISMS.username
      request_body[:pwd] = ISMS.password
      request_body[:dstno] = phone_no
      request_body[:msg] = message_body
      request_body[:type] = type

      faraday_response = connection.post do |request|
        request.url SEND_SMS_URL
        request.body = request_body
      end

      parse_response(faraday_response.body)
    end