public static void SendMonitorEndRequest(Int32 callId, Int32 lineId, Int32 unitId, String ani)
        {
            try
            {
                // Send end request if there are no active listeners on that call.
                if (GetActiveListenerCt(callId) < 1)
                {
                    MailmanResponse mailmanResponse = CircuitsInterop.MonitorRequestEnd(callId, lineId, unitId, ani);
                    UInt32          responseCode    = CircuitsInterop.GetResponseCode(mailmanResponse);

                    _logger.LogInfo($"Sent monitor end request for call ID: {callId}");

                    if (responseCode == ResponseCodes.LM_OK || responseCode == ResponseCodes.LM_NO_MONITORING_SESSION)
                    {
                        return;
                    }

                    _logger.LogWarning($"Request Monitor End returned response code: {responseCode}\r\n\targs: lineId: {lineId}, unitId: {unitId}, ani: {ani}, callId: {callId}");
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, $"Failed to send monitor end request.\r\n\targs: lineId: {lineId}, unitId: {unitId}, ani: {ani}, callId: {callId}");
            }
        }
        //[LMAuthorize(LMRoles.LM_VIEW)]
        public IHttpActionResult RequestMonitorEnd(MonitorRequestArgs args)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    // Send end request if there are no active listeners on that call.
                    if (AudioHandler.GetActiveListenerCt(args.CallId) < 1)
                    {
                        MailmanResponse mailmanResponse = CircuitsInterop.MonitorRequestEnd(args.CallId, args.LineId, args.UnitId, args.Ani);
                        UInt32          responseCode    = CircuitsInterop.GetResponseCode(mailmanResponse);

                        //CircuitsInterop.MonitorRequestEnd(args.CallId, args.LineId, args.UnitId, args.Ani, false);
                        //UInt32 responseCode = ResponseCodes.LM_OK;

                        _logger.LogInfo($"Sent monitor end request for call ID: {args.CallId}");

                        IHttpActionResult result;

                        switch (responseCode)
                        {
                        case ResponseCodes.LM_OK:
                        case ResponseCodes.LM_NO_MONITORING_SESSION:                                 // Monitor session already ended
                            return(Ok());

                        case ResponseCodes.LM_INVALID_INFO:
                        case ResponseCodes.LM_MONITOR_REQ_INVALID:
                            result = BadRequest();
                            break;

                        case ResponseCodes.LM_INTERNAL_ERROR:
                        case ResponseCodes.LM_COMM_FAILURE:
                        case ResponseCodes.LM_NOT_REGISTERED:
                            result = InternalServerError();
                            break;

                        default:
                            result = InternalServerError();
                            break;
                        }

                        // Reaching this point means ResponseCode was something other than OK
                        _logger.LogWarning($"Request Monitor End returned response code: {responseCode}\r\n\targs: {JsonConvert.SerializeObject(args)}");
                        return(result);
                    }

                    return(Ok());
                }

                return(BadRequest(ModelState));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Error sending call monitoring request");
                return(InternalServerError(ex));
            }
        }