0

I am using inetlab.smpp in c# web app to send sms. A client is created and connected successfully and bound but the message is not delivered to the recipient

public partial class sendsmss : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected async void send_Click(object sender, EventArgs e)
    {
        SmppClient client = new SmppClient();
        await client.Connect("xx.xx.xx.xx", 00000);
        if (client.Status == Inetlab.SMPP.Common.ConnectionStatus.Open)
        {
            await client.Bind("user", "pass");
            if (client.Status == Inetlab.SMPP.Common.ConnectionStatus.Open)
            {
                SubmitSm sm = new SubmitSm();
                sm.UserData.ShortMessage = client.EncodingMapper.GetMessageBytes("Test Test Test Test Test Test Test Test Test Test", DataCodings.Default);
                sm.SourceAddress = new SmeAddress("1111");
                sm.DestinationAddress = new SmeAddress("12345678");
                sm.DataCoding = DataCodings.UCS2;
                sm.RegisteredDelivery = 1;
                await client.Submit(sm);
                SubmitSmResp response = await client.Submit(sm);
                if (response.MessageId != "")
                {

                    Response.Write("response.messageID is " + response.MessageId.ToString() + "</br> ");

                }
                else { Response.Write("response null </br> "); }
                await client.UnBind();
            }
        }
    }
}

I expect the sms is delivered to recipient

Bùi Đức Khánh
  • 3,975
  • 6
  • 27
  • 43
  • SMS are not free to send, do you have a device that is allowed to send SMS/pay per SMS? Something with a SIM-Card or similar? – Kiwimanshare Jun 27 '19 at 07:29
  • Maybe [this](https://stackoverflow.com/questions/4820560/a-robust-smpp-library-for-net) would help. Similar to your question – Syafiqur__ Jun 27 '19 at 09:56
  • hello Kiwimanshare i have a trial free session with a username and password – mywork mary Jun 30 '19 at 09:10
  • hello @Syafiqur__ i have another solution using jamaa smpp it sends the sms but the sender is not shown as a name and i also posted a question for it and here is the link [link](https://stackoverflow.com/questions/56336677/how-to-set-submit-sm-to-let-the-client-use-its-properties-in-jamaa-smpp-to-send) – mywork mary Jun 30 '19 at 09:13

1 Answers1

0

Runs for me perfectly

    private async void button1_Click(object sender, EventArgs e)
    {
        Inetlab.SMPP.SmppClient client = new Inetlab.SMPP.SmppClient();
        await client.Connect("x.x.x.x", y);
        await client.Bind("systemid", "password", ConnectionMode.Transceiver);
        var resp = await client.Submit(
           SMS.ForSubmit()
               .From("SOURCEADDR", AddressTON.Alphanumeric, AddressNPI.Unknown )
               .To("mobilenumber", AddressTON.International, AddressNPI.ISDN)
               .Coding(DataCodings.Default)
               .Text("test text")
           );
        if (resp.All(x => x.Header.Status == CommandStatus.ESME_ROK))
        {
            MessageBox.Show("Message has been sent.");
        }
        else
        {
            MessageBox.Show(resp.GetValue(0).ToString());
        }
    }