Exemplo n.º 1
0
        /// <summary>
        /// This method sends a deliver_sm packet synchronously over to the peer.
        /// </summary>
        /// <param name="pdu">deliver_sm packet</param>
        /// <returns>deliver_sm response</returns>
        public deliver_sm_resp DeliverSm(deliver_sm pdu)
        {
            deliver_sm_resp rpdu = null;
            PduSyncronizer  evt  = AddWaitingPdu(pdu);

            if (IsBound && SendPdu(pdu))
            {
                SmppPdu pduR = evt.PduResponse;
                if ((pduR as deliver_sm_resp) != null)
                {
                    rpdu = (deliver_sm_resp)pduR;
                }
                else
                {
                    rpdu        = new deliver_sm_resp();
                    rpdu.Status = pduR.Status;
                }
            }
            else
            {
                FindAndRemoveWaitingPdu(pdu.SequenceNumber);
                rpdu        = new deliver_sm_resp();
                rpdu.Status = StatusCodes.ESME_RDELIVERYFAILURE;
            }
            return(rpdu);
        }
Exemplo n.º 2
0
        private void EndDeliverSm(IAsyncResult ar)
        {
            SmscSession     session = (SmscSession)ar.AsyncState;
            deliver_sm_resp dresp   = session.EndDeliverSm(ar);

            if (!dresp.Succeeded)
            {
                AddLogText(StatusCode.Error, string.Format("DeliverSm failed: {0}", dresp));
            }
        }
Exemplo n.º 3
0
        // Used to get delivery ack.'s and MO messages from SMSC
        private void OnDeliverSm(object sender, SmppEventArgs args)
        {
            deliver_sm      req  = (deliver_sm)args.PDU;
            deliver_sm_resp resp = (deliver_sm_resp)args.ResponsePDU;
            esm_class       esm  = req.EsmClass;

            switch (esm.MessageType)
            {
            case MessageType.SMSC_DELIVERY_RCPT:        // Delivery receipt for previously sent short message
                smsc_delivery_receipt receipt = new smsc_delivery_receipt(req.Message);
                // Update the final deleivery status for the sent message using the message Id to locate
                UpdateSentMessageFinalStatus(receipt);
                break;

            case MessageType.DEFAULT_MSG_TYPE:                  // Mobile originated message
                AddNewMessage("Mobile Orig.", req.SourceAddress.Address, req.Message, "DELIVRD", DateTime.Now.ToString("d"), 0);
                break;

            default:
                AddNewMessage("Error", req.SourceAddress.Address, "Unknown message type - " + esm.MessageType, "n/a", "n/a", 0);
                break;
            }
        }
Exemplo n.º 4
0
        // Used to get delivery ack.'s and MO messages from SMSC
        private static void OnDeliverSm(object sender, SmppEventArgs args)
        {
            deliver_sm      req  = (deliver_sm)args.PDU;
            deliver_sm_resp resp = (deliver_sm_resp)args.ResponsePDU;
            esm_class       esm  = req.EsmClass;

            switch (esm.MessageType)
            {
            case MessageType.SMSC_DELIVERY_RCPT:                        // Delivery receipt for previously sent short message
                smsc_delivery_receipt receipt = new smsc_delivery_receipt(req.Message);
                Console.WriteLine(string.Format("Delivery receipt for message {0}: Type: {1}",
                                                receipt.OriginalMessageId, receipt.FinalMessageStatus));
                break;

            case MessageType.DEFAULT_MSG_TYPE:                                  // Mobile originated message
                Console.WriteLine(string.Format("Mobile originated message from {0}: {1}",
                                                req.SourceAddress, req.Message));
                break;

            default:
                Console.WriteLine("Unexpected deliver_sm message type: " + esm.MessageType.ToString());
                break;
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// This processes the deliver_sm_resp PDU
 /// </summary>
 /// <param name="pdu">Protocol Data Unit being processed</param>
 public virtual void Process(deliver_sm_resp pdu)
 {
     throw new InvalidSmppStateException("Session is not in the proper state for a deliver_sm operation.");
 }