Skip to content

Getting Problem while submit_multi #3

@india-software

Description

@india-software

public int SendMultiMessage(List phoneNumber, string serviceType, Ton destinationTon, Npi destinationNpi, DataCodings submitDataCoding, DataCodings encodeDataCoding, string message, out SubmitMultiSm submitSm, out SubmitMultiSmResp submitSmResp)
{
int retVal = 1;

        submitSm = null;
        submitSmResp = null;

        try
        {
            if (Client.Status != ConnectionStatus.Bound)
            {
                WriteLog("ESMEConnection : SendMessage : Warning : Not Connected To The SMPP Server");

                return 2;
            }

            // The message to send
            string sendMessage = null;

            // Do we need to cut the message down
            if (encodeDataCoding == DataCodings.UCS2)
            {
                // UCS2 only supports 140 bytes
                if (message.Length > 70)
                {
                    WriteLog(LogEventNotificationTypes.Email, "ESMEConnection : SendMessage : WARNING : Truncating UCS2 message to 70 characters.");

                    // The default is Unicode so truncate the message
                    sendMessage = message.Substring(0, 70);
                }
            }
            else
            {
                if (message.Length > 160)
                {
                    WriteLog(LogEventNotificationTypes.Email, "ESMEConnection : SendMessage : WARNING : Truncating Default message to 160 characters.");

                    sendMessage = message.Substring(0, 160);
                }
            }

            // Prepare the message, I have made sure there is only ever one message
            // with the trunacting above
            submitSm = Client.PrepareSubmit(
                SubmitMode.ShortMessage,
                serviceType,
                (byte)Ton.NetworkSpecific,
                (byte)Npi.Unknown,
                ShortLongCode,
                phoneNumber,
                submitDataCoding,
                encodeDataCoding,
                (sendMessage == null) ? message : sendMessage);
            // Send the message
            submitSmResp = Client.Submit(submitSm);
            // Log the send call
            WriteLog("ESMEConnection : SendMessage : Send : Sequence[{0}] Status[{1}]", submitSmResp.Sequence, submitSmResp.Status);
            // Was it successful
            if (submitSmResp.Status != CommandStatus.ESME_ROK)
            {
                WriteLog("ESMEConnection : SendMessage : ERROR : Failed For Unknown Reason");
                retVal = 1;
            }

            // Success
            retVal = 0;
        }

        catch (Exception exception)
        {
            WriteLog(LogEventNotificationTypes.Email, "ESMEConnection : SendMessage : ERROR : {0}", exception.ToString());

            retVal = 1;
        }

        return retVal;
    }

![image](
error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions