SMS.ForDeliver in a bulk

Post Reply
developerlearn999
Posts: 85
Joined: Thu Jun 20, 2019 9:34 am

SMS.ForDeliver in a bulk

Post by developerlearn999 » Wed Jul 03, 2019 3:12 pm

i need to send to some customers all parts of the Delivered sms, and for some not.
for the ones which i need to send all parts, is there another way except looping through this and sending all 1 bulk?

Code: Select all

foreach (string internalId in internalIds)
            {
                var dlrBuilder = SMS.ForDeliver()............
                ..............
                client.Deliver(dlrBuilder).ConfigureAwait(false);
               } 
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: SMS.ForDeliver in a bulk

Post by alt » Wed Jul 03, 2019 6:27 pm

client.Deliver method accept also a collection of DeliverSm PDUs.
You can create all PDUs with SMS.ForDeliver()...Create(client);, add all PDU in the collection and send it with one call of Deliver method.
This method sends all DeliverSm PDUs to the client and waits for all responses. When all responses are received, it returns collection of responses.
developerlearn999
Posts: 85
Joined: Thu Jun 20, 2019 9:34 am

Re: SMS.ForDeliver in a bulk

Post by developerlearn999 » Thu Jul 04, 2019 7:34 am

how do i do it?
i tried and got stuck
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: SMS.ForDeliver in a bulk

Post by alt » Sun Jul 07, 2019 11:39 am

Code: Select all

public async Task SubmitAll() 
{

   List<SubmitSm> pduToSubmit = new List<SubmitSm>();
   foreach (string internalId in internalIds)
   {
            
                var pduList = SMS.ForDeliver().......Create(client);
                
                pduToSubmit.AddRange(pduList );
   }
             
   var allResponses =  await  client.Deliver(pduToSubmit).ConfigureAwait(false); 
                
 }
developerlearn999
Posts: 85
Joined: Thu Jun 20, 2019 9:34 am

Re: SMS.ForDeliver in a bulk

Post by developerlearn999 » Mon Jul 08, 2019 12:09 pm

shouldn't it be
List<DeliverSm> pduToSubmit = new List<DeliverSm>();
because the SMS.ForDeliver() return IDeliverSmBuilder.
i tried to change and add to list
pduToSubmit.AddRange(dlrBuilder);
but still i do something wrong.
thanks fr the help
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: SMS.ForDeliver in a bulk

Post by alt » Mon Jul 08, 2019 8:38 pm

Sorry, you are right should be List<DeliverSm>.

You need to create PDUs from SMS builder:
pduToSubmit.AddRange(dlrBuilder.Create(client));
developerlearn999
Posts: 85
Joined: Thu Jun 20, 2019 9:34 am

Re: SMS.ForDeliver in a bulk

Post by developerlearn999 » Tue Jul 09, 2019 9:49 am

thanks!
Post Reply