private void CheckErrorSms(string errorMessage, InProgressSms smsItem)
        {
            smsItem.SendStatus     = (int)SendStatus.ErrorInSending;
            smsItem.DeliveryStatus = (int)DeliveryStatus.NotSent;
            smsItem.SendTryCount  += 1;

            switch (errorMessage.Trim())
            {
            case "Error! Authentication Failed.":
            case "Error! Account is not active.":
            case "Error! Account date is expired.":
                break;

            case "Error! Credit is not enough.":
                break;

            case "Error! Debug ID (123).":
            case "Error! Server temporarily out of service, please try later.":
            case "Error! ShortCode is invalid.":
            case "Error! IP is invalid.":
                break;

            case "Error!.":
                smsItem.DeliveryStatus = (int)DeliveryStatus.ErrorInSending;
                break;

            case "Error! Invalid XML file format.":
            case "Error! Valid XML not found.":
                smsItem.DeliveryStatus = (int)DeliveryStatus.InvalidInputXml;
                break;

            case "Error! Your message filtered because it has invalid content.":
                smsItem.DeliveryStatus = (int)DeliveryStatus.SmsIsFilter;
                break;

            case "Error! Valid cellphone not found or maybe blocked.":
                smsItem.DeliveryStatus = (int)DeliveryStatus.BlackList;
                break;

            case "Error! Valid cellphone not found.":
                smsItem.DeliveryStatus = (int)DeliveryStatus.InvalidMobile;
                break;

            case "Error! Invalid arguments length.":
                break;

            default:
                break;
            }
        }
Exemplo n.º 2
0
        private void CheckErrorSms(Cls_SMS.ClsSend.STC_SMSSend result, InProgressSms inProgressSms, string batchId)
        {
            try
            {
                inProgressSms.SendTryCount   += 1;
                inProgressSms.RecipientNumber = result.DestAddress;
                //inProgressSms.SendStatus = (int) SendStatus.Sent;
                //inProgressSms.DeliveryStatus = (int) DeliveryStatus.Sent;

                //  LogController<ServiceLogs>.LogInFile(ServiceLogs.RahyabRG, result.DestAddress + " / Response : " + result.Response + " / Status : " + result.Status);
                bool setSmsStatus = false;

                switch (result.Response)
                {
                case "Insufficient_Balance_Amount":
                    setSmsStatus = true;
                    break;

                case "BLACKLISTED_DESTINATION":
                    inProgressSms.SendStatus     = (int)SendStatus.BlackList;
                    inProgressSms.DeliveryStatus = (int)DeliveryStatus.BlackList;
                    break;

                case "SOURCE_ADDRESS_NOT_ALLOWED":
                    setSmsStatus = true;
                    break;
                }

                if (setSmsStatus)
                {
                    inProgressSms.SendStatus     = (int)SendStatus.ErrorInSending;
                    inProgressSms.DeliveryStatus = (int)DeliveryStatus.NotSent;
                }
            }
            catch (Exception ex)
            {
                LogController <ServiceLogs> .LogInFile(ServiceLogs.RahyabRG, ex.Message);

                throw ex;
            }
        }
 private void CheckErrorSms(ResponseMessage responseMessage, InProgressSms smsItem)
 {
     smsItem.SendTryCount += 1;
     if (responseMessage == null)
     {
         smsItem.ReturnID       = responseMessage.StatusCode.ToString();
         smsItem.SendStatus     = (int)SendStatus.ErrorInSending;
         smsItem.DeliveryStatus = (int)DeliveryStatus.NotSent;
     }
     else if (!responseMessage.IsSuccessful)
     {
         smsItem.ReturnID       = responseMessage.StatusCode.ToString();
         smsItem.SendStatus     = (int)SendStatus.ErrorInSending;
         smsItem.DeliveryStatus = (int)DeliveryStatus.NotSent;
     }
     else if (responseMessage.IsSuccessful)
     {
         smsItem.ReturnID        = responseMessage.BatchId.ToString();
         smsItem.DeliveryStatus  = (int)DeliveryStatus.SentToItc;
         smsItem.DeliveryGetTime = DateTime.Now.AddMinutes(5);
     }
 }
Exemplo n.º 4
0
        private bool CheckErrorSms(ref long result, InProgressSms inProgressSms)
        {
            inProgressSms.SendTryCount += 1;

            if (result < 1000)
            {
                inProgressSms.SendStatus     = (int)SendStatus.ErrorInSending;
                inProgressSms.DeliveryStatus = (int)DeliveryStatus.NotSent;

                switch (result)
                {
                case (int)MagfaSmsSendError.AuthenticationFailure:
                    result = (int)Business.SmsSendError.AuthenticationFailure;
                    break;

                case (int)MagfaSmsSendError.DeactiveAccount:
                    result = (int)Business.SmsSendError.DeactiveAccount;
                    break;

                case (int)MagfaSmsSendError.ExpiredAccount:
                    result = (int)Business.SmsSendError.ExpiredAccount;
                    break;

                case (int)MagfaSmsSendError.InvalidUsernameOrPassword:
                    result = (int)Business.SmsSendError.InvalidUsernameOrPassword;
                    break;

                case (int)MagfaSmsSendError.NotEnoughCrdit:
                    result = (int)Business.SmsSendError.NotEnoughCredit;
                    break;

                case (int)MagfaSmsSendError.ServerBusy:
                    result = (int)Business.SmsSendError.ServerBusy;
                    inProgressSms.SendStatus = (int)SendStatus.ErrorInGetItc;
                    break;

                case (int)MagfaSmsSendError.ServerError:
                    result = (int)Business.SmsSendError.ServerError;
                    inProgressSms.SendStatus = (int)SendStatus.ErrorInGetItc;
                    break;

                case (int)MagfaSmsSendError.NumberAtBlackList:
                    result = (int)Business.SmsSendError.NumberAtBlackList;
                    inProgressSms.SendStatus     = (int)SendStatus.BlackList;
                    inProgressSms.DeliveryStatus = (int)DeliveryStatus.BlackList;
                    break;

                case (int)MagfaSmsSendError.SendError:
                    result = (int)Business.SmsSendError.SendError;
                    inProgressSms.SendStatus = (int)SendStatus.ErrorInGetItc;
                    break;

                case (int)MagfaSmsSendError.InvalidCheckMessageID:
                    result = (int)Business.SmsSendError.SendError;
                    break;
                }
                return(true);
            }
            else
            {
                inProgressSms.SendStatus     = (int)SendStatus.Sent;
                inProgressSms.DeliveryStatus = (int)DeliveryStatus.SentToItc;
                return(false);
            }
        }