Example #1
0
        public async Task <IHttpActionResult> AddCallStartMessage([FromBody] EventCallStartMsg msg)
        {
            try
            {
                if (msg?.Header == null || msg.Data == null)
                {
                    _logger.LogWarning("Unable to deserialize EventCallStartMsg object. msg, msg.header or msg.data was null.");
                    return(BadRequest("Unable to deserialize EventCallStartMsg object."));
                }

                try
                {
                    msg.PopulateInmateNames();
                    msg.SetIsRecorded();
                }
                catch (Exception prodigyEx)
                {
                    _logger.LogError(prodigyEx, $"Error getting inmate info within AddCallStartMessage pin: {msg.Header?.Pin ?? "null"} | site ID: {msg.Header?.SiteId ?? "null"}");
                }

                EventCallStartMsg addedMsg = await CircuitsMsgRepo.AddAndBroadcast(msg);

                if (addedMsg == null)
                {
                    ArgumentException argEx = new ArgumentException("Unable to broadcast event call start message");
                    _logger.LogError(argEx, "addedMsg returned null in add call-start message.");
                    return(InternalServerError(argEx));
                }

                return(Ok());
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Error adding RTCM call-start message.");
                return(InternalServerError(ex));
            }
        }
Example #2
0
 public IEnumerable <IRtcmMsg> GetRtcmMessages()
 {
     return(CircuitsMsgRepo.GetAllMessages());
 }