Example #1
0
        public EFaxOutboundResponsStatus GetOutboundStatusResponse(long transmissionId)
        {
            var outboundClient = new OutboundClient
            {
                AccountId = AccountId,
                UserName  = UserName,
                Password  = Password
            };
            var response = outboundClient.SendOutboundStatusRequest(transmissionId.ToString(), "");

            return(response == null ? null : new EFaxOutboundResponsStatus
            {
                Classification = response.Recipient.Status.Classification,
                Message = response.Recipient.Status.Message,
                Outcome = response.Recipient.Status.Outcome
            });
        }
Example #2
0
        public EFaxResponse SendCreateEFax(EFaxParmaters parmaters)
        {
            var strArray = parmaters.Message.Split(new[] { ',' });

            var bites = strArray.Select(byte.Parse).ToArray();

            var outboundClient = new OutboundClient
            {
                AccountId = AccountId,
                UserName  = UserName,
                Password  = Password
            };

            var outboundRequest = new OutboundRequest
            {
                TransmissionControl =
                {
                    NoDuplicates   = parmaters.SendDuplicate ? NoDuplicates.Disable : NoDuplicates.Enable,
                    Priority       = parmaters.IsHighPriority ? Priority.High : Priority.Normal,
                    Resolution     = Resolution.Fine,
                    CustomerID     = parmaters.CustomerId,
                    TransmissionID = parmaters.TransmissionId,
                    SelfBusy       = SelfBusy.Disable
                },
                DispositionControl =
                {
                    DispositionEmails                              = { new DispositionEmail {
                                                                           DispositionRecipient = EFaxDispositionRecipient, DispositionAddress = EFaxDispositionEmail
                                                                       } },
                    DispositionLevel  = DispositionLevel.Error,
                    DispositionMethod = DispositionMethod.Email
                },
                Files =
                {
                    new FaxFile
                    {
                        FileContents = bites,
                        FileType     = FaxFileType.pdf
                    }
                },
                Recipient =
                {
                    RecipientFax = parmaters.RecipientFax
                }
            };

            var outboundResponse = outboundClient.SendOutboundRequest(outboundRequest);

            var outputErrorLevel = EFaxErrorLevel.Undefined;

            switch (outboundResponse.ErrorLevel)
            {
            case ErrorLevel.Undefined:
                outputErrorLevel = EFaxErrorLevel.Undefined;
                break;

            case ErrorLevel.User:
                outputErrorLevel = EFaxErrorLevel.User;
                break;

            case ErrorLevel.System:
                outputErrorLevel = EFaxErrorLevel.System;
                break;
            }

            return(new EFaxResponse
            {
                ErrorLevel = outputErrorLevel,
                ErrorMessage = outboundResponse.ErrorMessage,
                StatusCode =
                    (outboundResponse.StatusCode == StatusCode.Success ? EFaxStatusCode.Success : EFaxStatusCode.Failur),
                StatusDescription = outboundResponse.StatusDescription,
                TransmissionId = outboundResponse.TransmissionID
            });
        }