Example #1
0
        public ActionResult Initiate(Models.Callout.CalloutOccurrence model)
        {
            Services.Telephony t = new Services.Telephony(_applicationOptions, _config, _context);

            //send a text message
            var members = this.memberSummaryItems();

            t.SendCalloutHeadsupSMS(members);

            //save the new callout message
            Models.DB.Callout newCallout = new Models.DB.Callout();
            newCallout.Created        = DateTime.UtcNow;
            newCallout.CalloutMessage = model.VoiceMessage = model.VoiceMessage;

            _context.Callout.Add(newCallout);
            _context.SaveChanges();

            t.SendCalloutPhoneCallsandSMS(members, newCallout);

            return(View());
        }
Example #2
0
        private void sendVoiceCall(String numbertocall, Models.DB.Callout callout)
        {
            try
            {
                string accountSid = this._config["twilio-accountsid"];
                string authToken  = this._config["twilio-authtoken"];
                string baseurl    = _applicationSettings.BaseURL;

                String url = _applicationSettings.BaseURL + "/Callout/GetTwilioMessage/" + callout.CalloutId.ToString();

                TwilioClient.Init(accountSid, authToken);

                var to   = new PhoneNumber(numbertocall);
                var from = new PhoneNumber("+17602034033");

                var call = CallResource.Create(to,
                                               from,
                                               url: new Uri(url));
            }
            catch (Exception exc)
            {
                throw exc;
            }
        }
Example #3
0
        /// <summary>
        /// This method is for real-actual callout notifications.
        /// </summary>
        /// <param name="members"></param>
        /// <param name="callout"></param>
        public void SendCalloutPhoneCallsandSMS(IEnumerable <Models.Membership.MemberSummaryItem> members, Models.DB.Callout callout)
        {
            //for testing the foreach is disabled, and just sending it to me
            this.sendSMS("6197564765", callout.CalloutMessage); //for production, delete this code
            this.sendVoiceCall("6197564765", callout);          //for production, delete this code

            foreach (var x in members)
            {
                //this.sendSMS(x.PhoneCell, callout.CalloutMessage); //for production, uncomment this code
                //this.sendVoiceCall(x.PhoneCell, callout); //for production, uncomment this code
            }
        }