PJSIP over TLS Forbidden

(United Kingdom) #1

Hi Folks,

So I am having a small issue here, don’t know why as this worked the other day for me I am sure. I am using both SIP and PJSIP as Twilio only connects through SIP but I wish to use PJSIP for my extensions. This works fine over UDP and TCP but over TLS I get a Forbidden error when I try to dial out although the extension is registered. This does not happen when I use the standard port 5061 which I can’t do as I have to use it for SIP to talk to Twilio and the PTSN. Any idea why I can’t use PJSIP on a non-default port?


Untrue that Twilio only works with chan_sip. First solve that misunderstanding and then disable chan_sip altogether. Use only PJSIP and you can simplify your config.

(United Kingdom) #3

See I don’t think you’ve understood the issue, that may be due to the way I wrote it. I am connected to Twilio fine on Chan_SIP using 5061 but when I try and use an extension on PJSIP via TLS on another port I get a Forbidden error when I dial any number, even internal extansions, this does not occur when I use port 5061 for PJSIP but then means I can’t connect to the PTSN does that make a little more sense?


Well, no, because you haven’t posted any logs or anything that would help someone understand the problem.

But you’ve started off with a false premise (Twilio only works with chan_sip) so I’d like to help you solve that and get your PBX configured to only have one SIP stack running. Then there won’t be any confusion about ports.

(United Kingdom) #5

Thanks for your help Bill but I need both as the client wants to use the features of PJSIP on their extensions but Twilio uses ChanSIP so maybe I just change trunking providers maybe that’s your next idea? This should work I can’t work out what’s blocking it, as for the log a single line appears

90442[2021-01-25 17:11:20] NOTICE[402][C-00000012] chan_sip.c: Failed to authenticate device “1001” <sip:*** @sip.********.co.uk>;tag=7d577c1f62e542b59e90c46b278ed79f for INVITE, code = -1

Does that help maybe?


Why? I’m telling you it doesn’t need to. It can use pjsip.

Your phone is talking to the chan_sip port and not the pjsip port which is why it is being rejected.

(United Kingdom) #7

How do I use Twilio with PJSIP then because the documentation is not very clear could you tell me that please?


(Jared Busch) #9

^-- That… Don’t use outdated guides.

(Jared Busch) #10

These are completely not the same thing.

You are using non-TLS chan_sip and complainaing that you cannot make TLS chan_pjsip work.

(Avayax) #11

Chansip and pjsip are concepts internal to Asterisk and no endpoint including Twilio knows which one you are using and it doesn’t make any difference to them.
If there is a working config for chansip, there is one for pjsip.
All that matters is that you get the config right, including the correct ports, etc.

(United Kingdom) #12

So turns out my local softphone was messing up, all works and all is sweet now :slight_smile: