Increase the wait time of Twilio messaging? - twilio

Let's assume a server has a lag in its internet network. Whenever, Twilio is attempting to message it, then the messaging are succceding 50% of the time , while the other 50% are failing because of HTTP: connection timed out.
Is there any way to tell TWilio to increase the wait-time or retry messaging the server?

Twilio developer evangelist here.
You won't be able to increase the timeout on Twilio or have it retry but what you can do is check the response you get from Twilio using the callback url. That is obviously providing Twilio is able to make a request to your server at that time.
Twilio will then make a request to your server to tell you whether it was able to send the message or not.
You could then add those messages into a queue, and try to resend them later on.
What you could also do is use the API to get the error logs for your application, and try to resend the messages for any message that wasn't sent. Have a look at the Events Monitor API for this.
Let me know if this helps you.

Related

Is there a Twilio outbound SMS magic number that hits a timeout value?

I'm testing some flows that use outbound SMS via Twilio and have been really pleased and impressed by the magic numbers provided e.g. https://www.twilio.com/docs/iam/test-credentials
However, I'm interested to see how our application responds if there's some issue sending an SMS to a number where it essentially hits a timeout value. I haven't found a magic number such as this or know of a way to recreate the scenario, can anyone help me here?
Even if you were using a real auth credentials and real phone number (instead of magic number), I suspect Twilio just queues the request on their side and responds with a HTTP 201, so you'll always get a very fast response from Twilio, but it doesn't necessarily mean the message has been sent to a carrier and delivered to a device.
If you're using Twilio messaging services, you can subscribe to delivery status callbacks to get the status of a SMS e.g. sending, sent, delivered, failed, etc - see here. Note: I don't know if you'd receive callbacks with magic numbers - I suspect not... either way you can provision a Twilio phone number pretty cheaply to test e.g. in Australia (where I'm from) I can purchase a AU phone number for $6 per month and I can release the phone number when ever I want to stop getting billed for it...
If you just want your app to timeout on invocation of the Twilio API you can do something like the following (in .NET core) to force timeout a request in a specified amount of time (1 second in example below):
using var tokenSource = new CancellationTokenSource(TimeSpan.FromMilliseconds(1000));
response = await twilioHttpClient.PostAsJsonAsync($"2010-04-01/Accounts/{accountSID}/Messages.json", request, jsonSerializerOptions, tokenSource.Token);
If timeout is exceeded, an exception will be thrown that you can handle. Note: there's various networking tools that can be used to block or limit outbound requests, which you can use to test timeout scenarios.

Too Many Requests in sending Bulk Messages using Twilio Message Service

I am getting the error below when I send bulk messages using Twilio Message Service.
[HTTP 429] Unable to create record: Too Many Requests
I have around 50 numbers in the sender pool in this Message Service.
And I am trying to send about 5K messages at once, some delays are Okay,
But the messages couldn't be sent due to this error,
Thanks in advance,
Twilio developer evangelist here.
A 429 error means that you are exceeding the number of concurrent connections to the Twilio API. By default, this is 100, though it can vary depending on your account.
To counteract this, you should aim to make less than 100 concurrent requests to the API and implement retries with an exponential back off to allow for your other requests to finish.
There is more information on the 429 error here including further links for implementing the above strategies.

Twilio Client - Sometimes no receiving disconnect from the caller

We're using twilio client (1.4) to place/receive calls and we have noticed that sometimes when the caller hangs up the call, twilio client doesn't receive the disconnect signaling and therefore, it keeps like it has a ongoing call.
Could we somehow avoid or minimize this behavior?
Regards,
Carlos
You can check call status issue in twilio website www.twilio.com with your credentitals. Go to calllogs and find the particular call(with SID- this Sid you can get it from twilio.device.incoming method ) and check the call status http response.(Most probably your statuscallback has some issue)

How many times Twilio will try sending texts to a number which has been, out of range, network disconnected?

I am trying to understand before twilio generated error #30003, how many times it tried reaching the end cellphone #, if the subscriber's cell phone is out of range, not available? switched off, temporary disconnected and so on?
Twilio developer here.
Twilio only spends a few seconds trying to deliver an SMS message before determining that the message delivery failed. The exact amount of time varies based on which carrier is used for the delivery.
So if your first attempt to deliver a message failed but you want to try again later, you should add some logic to your application that resends the message to Twilio at a time that makes sense.
Note that Twilio does not charge you for failed attempts to send a message.
Let me know if that helps!

USSD session timeout (udp PROMPT)

I want to develop a ussd application that waits for user input (PROMPT). I was wondering how to handle a case, when for example ussd message is sent at night and user replies after several hours. For sure any timeout cannot handle it. On my phone (sony xperia) the message with the question is still displayed and i can reply seeing no error. But server side, I do not receive this reply because ussd session expired.
Resending the message several times is not a solution.
You cannot do it!
You want to develop an application(server side) that accept input from mobile handset(client side)
I didn't understand well if your application is:
Mobile-initiated (USSD/ PULL)
Network-initiated (USSD/ PUSH)
but however in both cases you cannot achieve your goal.
Because session timeout is server side and there is nothing client could do about it, beside to resend the request which is not an option in your case.

Resources