Exemplo n.º 1
0
        private void UpdateSentMessageFinalStatus(smsc_delivery_receipt receipt)
        {
            if (InvokeRequired)
            {
                BeginInvoke((UpdateSentMessageFinalStatusHandler)UpdateSentMessageFinalStatus, receipt);
                return;
            }

            // Locate the sent message using the message Id
            ListViewItem msgItem = lvSentMsgs.FindItemWithText(receipt.OriginalMessageId);

            if (msgItem != null)
            {
                msgItem.SubItems[3].Text = receipt.FinalMessageStatus.ToString();
                msgItem.SubItems[4].Text = receipt.DeliveryDateTime.ToString();
            }
//            MessageBox.Show(receipt.FormattedReceiptMessage);
        }
Exemplo n.º 2
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.º 3
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;
            }
        }