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