How to find the list of dynamic IP Addresses for the outbound connection to Twilio? - twilio

Our firewall restricts outbound network connections. Hence we need to know the list of IP addresses to which we need to open up the port for outbound network connections that connects to Twilio for the REST API for sending sms.
How to find out what are the list of IP addresses that twilio uses for outbound connections so that we can open those in our firewall?
As per the Twilio docs it says we need to open up for https://api.twilio.com.
Unfortunately our firewall needs to define a list of IP addresses instead of a URL and it looks like the IP Addresses keep changing and is not static.
Does the following hold good for outbound connections from Twilio for Messages via their REST API?
https://forums.aws.amazon.com/ann.jspa?annID=1701
Please advise.

From the FAQ article on this topic:
Twilio makes HTTP requests to your server to fetch your app’s TwiML instructions. Some users prefer to know which IP address the request from Twilio is coming from in order to open up specific ports in a firewall. However, due to the fluid nature of our cloud architecture, we don’t have a set range of IPs that requests are sent from or know in advance what they will be.
Because Twilio’s requests will be coming from different IP addresses, we instead recommend that you validate that a request came from Twilio by other means. Please see our documentation on securing your application for more details.
If the inability to have a request come from a static IP address is a serious concern, please contact our sales department to discuss other options which might be available.

Related

Is it possible to make outbound call using SIP to PSTN with Twilio?

What I'm trying to achieve is the following: Use Twilio's Voice API to make an outbound call to a PSTN mobile number, however, instead of using Twilio's routing (which is 10x more expensive than normal SIP providers in my region), I want to use a 3rd-party SIP Trunk to perform the call.
The two areas I can't figure out are:
Can Twilio even do this when using a standard SIP Trunk
And/or, does the SIP Trunk need certain features for this to work (so I can't just signup for any old SIP Trunk)
I see Twilio can dial a SIP URI, however, I can't see how the SIP Trunk will route that call to the PSTN (ie. it seems it can only dial the SIP user as the final destination). Twilio has recently introduced BYOC - https://www.twilio.com/docs/voice/bring-your-own-carrier-byoc - which looked hopeful, however, when setting up the Origination Target you can only provide the SIP URI. This is the technical point I don't really understand, since my SIP Trunk requires a username and password to authenticate before making a call, and the BYOC setup doesn't offer this. Is there some special feature the SIP Trunk needs to work?
I think I'm missing something fundamental here, because I can't see a way of making this work (maybe it's not possible without a very specialized setup). So any help getting on the right track is appreciated (I did try Twilio Support, but they seem as clueless as I am).
So I can answer my own question for anyone coming across this post. You can use a standard SIP Trunk with Twilio's BYOC. Twilio sends an INVITE request to the SIP address entered in as the Origination on the BYOC setup. However, it must use IP address authentication - there's no way to use standard SIP credential authentication.
The ip addresses used depends on the DC it's coming from. See signalling IPs here - https://www.twilio.com/docs/voice/api/sip-interface#ip-address-whitelist
You can also append the "edge" parameter in the Origination SIP URI to dictate which Twilio DC it comes from - https://www.twilio.com/docs/voice/api/receiving-sip#SIP-URI-edge
For additional security, you could consider Twilio's private Interconnect option, or you could append some custom arguments to the SIP URI, which could be authenticated on the SIP Trunk side when it receives the INVITE - however, this would require a custom setup to achieve that, and whatever argument you use for authentication would be visible in the URI.

Using Twilio SIP Trunk on FusionPBX

Has anyone attempted to use Twilio SIP Trunks with FusionPBX?
I have register disabled, and have attempted to do a IP based setup and a credential-based setup with no success. When doing the IP based setup I remove the user/pass field on Fusion and also remove the credential from the trunk termination on my Twilio console. When doing credential-based I add both back but in both scenarios I've made sure register is disabled.
Proxy is using this format: mytrunknamehere.pstn.twilio.com
Also tried the regionalized version. mytrunknamehere.pstn.us1.twilio.com
Don't really have any other settings configured on the trunk in FusionPBX.
Anyone happen to have a setup guide or advice?
Did you look at the blog, A Step-by-Step Guide to Set Up Twilio Elastic SIP Trunking, and some of the troubleshooting steps presented there? Like looking at packet captures for Twilio's origination attempts toward your PBX (using Wireshark). Is your PBX responding and if so, with what SIP response coe? Also, what is the debug logging on your PBX showing, when you place a call into it via your Twilio phone number (similar with Termination, sending a call from your PBX into Twilio to deliver to the PSTN).
The key thing is trying to look below the surface to see who doesn't like what.

Twilio & ThinQ qustion

I know there are some twilio experts here and would really appreciate it if someone could answer a question for us and if so, please let me know if you do freelance work.
Our website offer clients to purchase numbers, which are twilio numbers, and we forward the calls and SMS to their original number, while doing demographics, call recordings and marketing. The number on which call was received is important to us. We want to use Thinq LCR to reduce cost. But Thinq wants us to port the twilio number to them. If we port the twilio number to Thinq, will the existing twilio services break? and on which routing profile will we forward the numbers after porting, if twilio number has been ported to thinq, there's no twilio number to forward anymore. And will we need to change all the code to work with the new Thinq API as twilio is out of the game now?
Thank you!!!
Chip :)
From what I understand of your problem, you should port your existing Twilio DIDs to ThinQ and switch to provisioning new DIDs from ThinQ directly, going forward.
Once the DIDs are visible in the dashboard (i.thinq.com), you would configure them all to route to a Twilio SIP domain that you will need to create. See https://www.thinq.com/thinq-voice-origination-with-twilios-bring-your-own-number-byon-service/ for instructions on how to do this.
With this setup, people trying to reach your clients would dial the DIDs controlled by ThinQ. ThinQ would send the SIP calls over to the Twilio SIP domain which would then interact with your server's callbacks to handle the call.
Your callback would use the appropriate Twilio API (REST or TwiML) to dial the client's actual phone number via SIP so that it goes over your ThinQ VoIP account for lower costs (e.g dial to sip:#wap.thinq.com?thinQid=&thinQtoken= )

Twilio IP Address Control List for sending SMS/MMS messages

We want to use Twilio to send SMS/MMS messages. It's likely that we'll make API calls to Twilio from more than one of our public IP addresses.
Does Twilio have IP Address Control List for sending SMS/MMS, or it doesn't have any restriction on the IP addresses from which the API calls are made?
Thanks.
Twilio developer evangelist here.
We do not have restrictions on the IP addresses you can send API calls from, just go right ahead and start sending them!

Is there a per-IP-address limit on the Twitter streaming API?

I understand that the Twitter streaming API only allows for a single connection per user account on Twitter. I was wondering if multiple streaming connections from the same IP address are allowed, if each connection has credentials from a different user account? For example, in a scenario where a single server may process tweets for multiple users. Specifically, I am curious about the filtered public streams endpoint.
I have read the following, and cannot locate an answer:
Twitter Streaming API limits?
https://dev.twitter.com/rest/public/rate-limiting
https://dev.twitter.com/streaming/public
Thank you, -Matt
I can confirm that I have three different Twitter API streams in a Node-RED application running on the same IP with no problem. Whenever I make changes or redeploy I do get rate limit errors for the first minute or so, but they go away and do not appear again.
The standard Streaming API supports up to two connections on a single IP. Any more than that will result in the oldest stream being disconnected. The developer agreement and policy states that you should not use multiple application keys and/or IP addresses to circumvent this limitation.
Note that it is on the roadmap for the standard filter and sample streams to eventually be updated with new versions, but it is not yet clear if they will carry the same connection limitations.

Resources