Exemplo n.º 1
0
        public ActionResult DLR([FromUri] SMS.SMSDeliveryReceipt response)
        {
            Debug.WriteLine("------------------------------------");
            Debug.WriteLine("DELIVERY RECIEPT");
            Debug.WriteLine("Message ID: " + response.messageId);
            Debug.WriteLine("From: " + response.msisdn);
            Debug.WriteLine("To: " + response.to);
            Debug.WriteLine("Status: " + response.status);
            Debug.WriteLine("------------------------------------");

            return(new HttpStatusCodeResult(200));
        }
Exemplo n.º 2
0
 private void AddReceipt(SMS.SMSDeliveryReceipt response)
 {
     lock (_cacheLock)
     {
         List <SMS.SMSDeliveryReceipt> receipts;
         const string cachekey = "sms_receipts";
         _cache.TryGetValue(cachekey, out receipts);
         if (null == receipts)
         {
             receipts = new List <SMS.SMSDeliveryReceipt>();
         }
         receipts.Add(response);
         _cache.Set(cachekey, receipts, DateTimeOffset.MaxValue);
     }
 }
        public ActionResult Get([FromUri] SMS.SMSDeliveryReceipt response)
        {
            // Upon initial setup with Nexmo, this action will be tested up to 5 times. No response data will be included. Just accept the empty request with a 200.
            if (null == response.to && null == response.msisdn)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.OK));
            }

            lock (_cacheLock)
            {
                var          receipts = new List <SMS.SMSDeliveryReceipt>();
                const string cachekey = "sms_receipts";
                if (MemoryCache.Default.Contains(cachekey))
                {
                    receipts = (List <SMS.SMSDeliveryReceipt>)MemoryCache.Default.Get(cachekey);
                }
                receipts.Add(response);
                MemoryCache.Default.Set(cachekey, receipts, DateTimeOffset.MaxValue);
            }

            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }