/// <summary> /// This method sends a submit_sm packet synchronously over to the peer. /// </summary> /// <param name="pdu">submit_sm packet</param> /// <returns>submit_sm response</returns> public submit_sm_resp SubmitSm(submit_sm pdu) { submit_sm_resp response = null; PduSyncronizer sync = AddWaitingPdu(pdu); if (sync != null) { if (IsBound && SendPdu(pdu)) { if (sync.WaitForResponse()) { response = sync.PduResponse as submit_sm_resp; if (response == null) { response = new submit_sm_resp(pdu.SequenceNumber, sync.PduResponse.Status); } } else { response = new submit_sm_resp(pdu.SequenceNumber, StatusCodes.ESME_RINVEXPIRY); } } else { response = new submit_sm_resp(pdu.SequenceNumber, StatusCodes.ESME_RSUBMITFAIL); } FindAndRemoveWaitingPdu(pdu.SequenceNumber); } else { response = new submit_sm_resp(pdu.SequenceNumber, StatusCodes.ESME_RMSGQFUL); } return(response); }
private void SubmitSmCallback(IAsyncResult ar) { if (InvokeRequired) { BeginInvoke((SubmitSmCallbackHandler)SubmitSmCallback, ar); return; } // Process the send/submit result EsmeSession session = (EsmeSession)ar.AsyncState; submit_sm_resp submitResp = session.EndSubmitSm(ar); // Update the message # in the message list using the sequence # string status = "Pending"; if (submitResp.Status != StatusCodes.ESME_ROK) { MessageBox.Show("Error sending message: " + submitResp.Status); UpdateSentMessageId(submitResp.SequenceNumber, "******", "Error: " + submitResp.Status); return; } // Some carriers submit_sm message ID are in hex - convert to decimal since delivery receipt is in decimal string decimalMessageId = Convert.ToInt64(submitResp.MessageID, submitResponseMessageIdBase_).ToString(); UpdateSentMessageId(submitResp.SequenceNumber, decimalMessageId, status); // Re-enable the Send button... btnSendMessage.Enabled = true; }
private static void SubmitSmCallback(IAsyncResult ar) { // Process the send/submit result EsmeSession session = (EsmeSession)ar.AsyncState; submit_sm_resp submitResp = session.EndSubmitSm(ar); Console.WriteLine(string.Format("Submit short message result: {0}, message id: {1}", submitResp.Status, submitResp.MessageID)); }
private void OnSubmitSm(object sender, SmppEventArgs ea) { submit_sm req = (submit_sm)ea.PDU; AddLogText(StatusCode.Normal, string.Format("SendSms: {0}", req.Message)); submit_sm_resp resp = (submit_sm_resp)ea.ResponsePDU; resp.MessageID = Interlocked.Increment(ref nxtMid_).ToString(); // Create our tracking message and insert it into the list. SmsMessage message = new SmsMessage(ea.Session, req, resp.MessageID, req.RegisteredDelivery.DeliveryReceipt); new MessageListViewItem(lvMessages, message); arrMessages.Add(message); // If we need a delivery receipt, then generate a callback to provide it. if (respType_ != MessageResponse.Manual_Response) { new System.Threading.Timer(new TimerCallback(SendAck), message, randGen_.Next(10000), Timeout.Infinite); } }
/// <summary> /// This processes the submit_sm_resp PDU /// </summary> /// <param name="pdu">Protocol Data Unit being processed</param> public override void Process(submit_sm_resp pdu) { }
/// <summary> /// This processes the submit_sm_resp PDU /// </summary> /// <param name="pdu">Protocol Data Unit being processed</param> public virtual void Process(submit_sm_resp pdu) { throw new InvalidSmppStateException("Session is not in the proper state for a submit_sm operation."); }