SMS.ForSubMulti

Post Reply
Zac
Posts: 1
Joined: Mon Aug 24, 2020 6:44 am

SMS.ForSubMulti

Post by Zac » Mon Aug 24, 2020 6:56 am

Hi,

I would like to ask you to help him, because it's been more than a week now that I try to send an SMS to several people(100 for a test).

I have read the FAQ and have tried all the methods listed in it but cannot achieve the desired result. Besides, none of the messages are sent.

There is an exemple of the code I use,

Code: Select all

 static async System.Threading.Tasks.Task Main(string[] args)
        {
            SmppClient _client = new SmppClient();
            _client.evDeliverSm += OnDeliverSmTracking;
            _client.evDeliverSm += OnDeliverSm;

            var pduBuilder = SMS.ForSubmitMulti().ServiceType("test").Text("Test : Zac").From("11111111111");
            
            List<string> phonenumbers = new List<string>();

            for (int cpt = 0; cpt < 100; cpt++)
            {
                phonenumbers.Add("22222222222");
                
            }
            foreach (string phone in phonenumbers)
            {
                pduBuilder.To(phone);
            }

            

            bool connected = await _client.ConnectAsync("**.**.***.**", ****);
            if(connected == true)
            {
                BindResp bindResp = await _client.BindAsync("login", "password", ConnectionMode.Transceiver);
                if (bindResp.Header.Status == CommandStatus.ESME_ROK)
                {
                    Console.WriteLine("Bound with SMPP server");
                                        
                   // int compteur = 0;
                        //while(compteur < phonenumbers.Count())
                     // {
                       // pduBuilder.To(phonenumbers[compteur]);
                        IList<SubmitMultiResp> responses = await _client.SubmitAsync(pduBuilder);
                       
                        _client.ConnectionRecovery = true;
                        
                        Console.WriteLine(" Response Received" + responses);// + "\n compteur = "+ compteur);                        
                        

                        _client.ConnectionRecovery = true;
                       // compteur++;
                       // }
                    
                }
            }
        }

     
        public static void OnDeliverSmTracking(object o, DeliverSm deliverSm)
        { 
            if (deliverSm.MessageType == MessageTypes.SMSCDeliveryReceipt)
            {
                Console.WriteLine("Delivery Receipt received");

                string messageId = deliverSm.Receipt.MessageId;
                MessageState deliveryStatus = deliverSm.Receipt.State;
            }
         }

        public static void OnDeliverSm(object o, DeliverSm deliverSm)
        {
            if (deliverSm.MessageType == MessageTypes.SMSCDeliveryReceipt)
            {
                Console.WriteLine("Delivery Receipt received");
            }
            else
            {
                Console.WriteLine("Incoming SMS received");
            }
        }

    }


I have also tried sending a message to a single recipient on a loop but only 55/100 messages are sent and it takes too long.

Would it be possible for you to tell me where I am going wrong?


Thank you so much
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: SMS.ForSubMulti

Post by alt » Tue Aug 25, 2020 6:32 pm

Hi,

Please note: some SMPP providers do not support SubmitMulti PDU.

I hope the exampe in the this post helps to send faster.

Please check status of all responses. They all must be ESME_ROK.
Post Reply