public HttpResponseMessage ReceiveSms(TwilioSmsRequest twilioSmsRequest)
        {
            Check.If(twilioSmsRequest).IsNotNull();

            var result = _externalSmsService.ProcessSms(SmsFactory.CreateCoreSms(twilioSmsRequest));

            return result
                ? Request.CreateResponse(HttpStatusCode.OK, new TwilioResponse().Element, new XmlMediaTypeFormatter())
                : Request.CreateResponse(HttpStatusCode.InternalServerError);
        }
Ejemplo n.º 2
0
 public static Core.Objects.Sms CreateCoreSms(TwilioSmsRequest twilioSmsRequest)
 {
     return new Core.Objects.Sms
     {
         SmsUid = twilioSmsRequest.MessageSid,
         DateSent = DateTime.UtcNow,
         From = twilioSmsRequest.From,
         To = twilioSmsRequest.To,
         Body = twilioSmsRequest.Body,
         Status = Status.Received,
         Direction = Direction.Inbound,
         DateCreated = DateTime.UtcNow,
         DateUpdated = DateTime.UtcNow,
     };
 }