Match/Permit on PJSIP trunk / Allow several IP addresses

Could you please check if this one has the call information log1 - FreePBX Pastebin ?

Thank you very much.

It appears that you have chan_sip Bind Port on 5060 and pjsip Port To Listen On on 5061.
But the call sent by Gradwell came to port 5060 so it was processed by chan_sip, which didn’t recognize it, presumably because it was set up as a pjsip trunk.

Assuming that you are using IP authentication with Gradwell, you need to enter port 5061 in the appropriate field on their portal. If that’s not provided, specify the destination IP as e.g.

If the above is not correct or doesn’t help, provide more details about the trunk setup.

This is correct.

Originally the Gradwell trunk was set as chan_sip, but we were getting some weird calls and also some weird extensions were showing up in the CDR’s, so I changed it to pjsip to try to configure the match/permit ip addresses we are getting the traffic from to have the the “Allow Anonymous Inbound SIP Calls” and “Allow SIP Guests” options disabled, since I thought this could help with those weird calls.
But Gradwell does not support pjsip so they did not give me instructions on how to configure the pjsip trunk. All I did was create the trunk and played with the settings based on their chansip configuration until I got it to work, so maybe something in the trunk may not be properly configured?
Everything works as it is now with the exception of inbound calls not being received when setting the “Allow Anonymous Inbound SIP Calls” and “Allow SIP Guests” options to “no”.

There is no option in the Gradwell control panel to enter the port. I am not sure what do you mean by this “If that’s not provided, specify the destination IP as e.g.”, could you clarify?

Gradwell sip inbound does not accept registrations, you point the trunk at your fixed IP address or domain name.

I suggest trying with :5061 after the IP address or domain name on the Gradwell portal.
If that doesn’t work, setting up a DNS SRV record might; ask them whether that is supported.

Otherwise, consider putting pjsip on port 5060, which unfortunately would require adjusting your other endpoints, changing either the channel driver or the port to which they connect.

Other options include:
A second IP address on the PBX, set up with a pjsip transport on UDP port 5060.

Changing some endpoints to use TCP or TLS transport.

Using a different provider that can deliver calls to a nonstandard port. Sorry but I don’t have a good recommendation. I have a (very reliable) UK DDI from Voxbeam, but they don’t show Freephone on their site; you might ask them whether they offer it. I also have AnveoDirect, who does offer UK Freephone, but suspect that they are more expensive than Gradwell; see Anveo Direct: Wholesale Toll Free prices and rates . I’ve no UK experience with them, though my US and France DIDs work fine.

I think any business provider that neither supports registration nor explicit port numbers should be considered broken, as it is no longer considered safe to SIP UAS on port 5060, or anything close, because you will be rapidly found by toll fraudsters. You should ask Gradwell about how to use an alternative port number to avoid attacks.

Also, I’d suggest, by now, any business provider that claims not to support Asterisk with chan_pjsip, is not maintaining their offering, not that many properly supported chan_sip, as the provider supplied configurations I see here and on the Asterisk forums are almost always badly designed.

1 Like

Thanks @Stewart1. I contacted Gradwell and they said they are not able to set port 5061. They told me I had to do it my end, but it seems that the person helping me will have to escalate for someone else to take over.
I am waiting for them to confirm about DNS SRV records, but don’t think they support that.

I will have to look at the other options mentioned. I appreciate your help.

I have a question. My sip trunk is disabled, since I created a pjsip trunk and enabled that one, but if I check the Asterisk CLI with “core show channels” when an inbound call is in process it shows the channel for inbound calls as “SIP/IPaddress”. Does this means that all my inbound calls are still using sip? I am confused because I don’t have any sip trunks enabled anymore and when I get inbound calls on a trunk setup with another provider the channel shown is “PJSIP/trunkname”.

Thanks again!

Hi @david55 ,

I did and they said this: “You asked if the port used can be changed through the control panel, as discussed this cannot be done. In the control panel the sip uri is set which just routes calls to your PBX. With regards to changing the port you use I have checked internally and this would need to be set on the PBX rather than on our system.”

Hi @Stewart1. I was able to add the port :5061 in the SIP URI on Gradwell’s control panel and it is working! I was able to get inbound calls even when the Allow Anonymous Inbound SIP Calls” and “Allow SIP Guests” options are set to NO.
The only problem I am having now is with the call not being hung up on the callers end when the agent hangs up on our end.
I made a test call to one of our inbound numbers and I hung up but I realized that the call was not disconnected on the other end and went to see if we were getting charged for that call and we are.
I was able to remain in the call for around two minutes with no audio issues. The only issue is that it is not being disconnected on the other end.
What could be causing this?

Gradwell made a data base change for our numbers and now the calls are hanging up properly.
Thank you!

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

Ticket is closed as fixed: [FREEPBX-23226] Expand pjsip match setting to support 8192 bytes - Sangoma Issue Tracker

Core module versions 15.0.16 and 16.0.57 will accept a match string up to 8100 bytes.