Page 1 of 1
SMS.ForDeliver in a bulk
Posted: Wed Jul 03, 2019 3:12 pm
by developerlearn999
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);
}
Re: SMS.ForDeliver in a bulk
Posted: Wed Jul 03, 2019 6:27 pm
by alt
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.
Re: SMS.ForDeliver in a bulk
Posted: Thu Jul 04, 2019 7:34 am
by developerlearn999
how do i do it?
i tried and got stuck
Re: SMS.ForDeliver in a bulk
Posted: Sun Jul 07, 2019 11:39 am
by alt
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);
}
Re: SMS.ForDeliver in a bulk
Posted: Mon Jul 08, 2019 12:09 pm
by developerlearn999
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
Re: SMS.ForDeliver in a bulk
Posted: Mon Jul 08, 2019 8:38 pm
by alt
Sorry, you are right should be List<DeliverSm>.
You need to create PDUs from SMS builder:
pduToSubmit.AddRange(dlrBuilder.Create(client));
Re: SMS.ForDeliver in a bulk
Posted: Tue Jul 09, 2019 9:49 am
by developerlearn999
thanks!