Specify multiple valid IPs for incoming trunk?

I have a trunk set up with a provider, that does NOT support a sip Register.

incoming calls from them can come from one of 4 IP addresses.

is there a way to specify on my trunk what the allowed IP addresses are for that trunk?
right now, I have to use allow anonymous sip invite, and I would much rather set the source IPs on the trunk.

if I do not allow anonymous invite, the invite is Rejected as the IP is not known.

With a PJSIP trunk, locate the Match Permit field in the trunk settings and populate with list of IPs separated by commas. There is no corresponding setting in chan_sip.

thanks @lgaetz
Oddly… it doesnt seem to be working for me?
I have my pjsip trunk set up and working both inbound and outbound if I allow anonymous invites.

my trunk has:
match (Permit): 54.172.60.0/30, 54.244.51.0/30

if I dial my inbound DID (that worked 30 seconds earlier with Allow Anonymous)
i receive a “that number is not in service” announcement from Freepbx

checking SNGREP for a sip trace, the invite is from 54.172.60.0:5060, which is indeed in that match pattern.

Checking /var/log/asterisk/full, I see:
"WARNING,“Rejecting unknown SIP connection from 54.172.60.0"”) in new stack

strange update. adding the HOSTNAME into the match(permit) section seems to have resolved this.
even though that hostname’s resolvable IP Addresses are already in my list.

Just guessing here: Though Twilio indeed recommends specifying 54.172.60.0/30, pjsip may be interpreting that pedantically as 54.172.60.0 is the ‘network’ address, 54.172.60.3 is the ‘broadcast’ address and only 54.172.60.1 and 54.172.60.2 are valid host addresses. I bet that if you list the four addresses explicitly, it will work.

2 Likes

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.