PJSIP with Outbound Proxy out-calls fail

Dear all,
For the past few days I’ve been trying to configure a SIP trunk local to my area but still cannot make outbound calls through it.
Here is the log from pjsip set logger on:

<--- Transmitting SIP response (348 bytes) to UDP:192.168.0.162:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.0.162:5060;rport=5060;received=192.168.0.162;branch=z9hG4bK-9ade25fc
Call-ID: [email protected]
From: "MyName" <sip:[email protected]>;tag=105f0470f027ad04o0
To: "DialedPhoneNumber" <sip:[email protected]>
CSeq: 102 INVITE
Server: FPBX-15.0.17.67(16.21.1)
Content-Length:  0


[2022-05-08 17:37:58] ERROR[4378]: res_pjsip_header_funcs.c:547 remove_header: No headers had been previously added to this session.
<--- Transmitting SIP request (1073 bytes) to UDP:178.236.205.68:5060 --->
INVITE sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP MyExternalIP:5060;rport;branch=z9hG4bKPjacaa9c30-c6cb-428b-b7aa-c861465fbdb7
From: <sip:[email protected]>;tag=672759c9-d613-4bb1-8b96-98c8a88852d5
To: <sip:[email protected]>
Contact: <sip:asterisk@MyExternalIP:5060>
Call-ID: eb3e3519-4f52-4e25-a024-39a8c209968f
CSeq: 8339 INVITE
Route: <sip:OutboundProxy.lt:5060;lr>
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub, histinfo
Session-Expires: 1800
Min-SE: 90
Max-Forwards: 70
User-Agent: FPBX-15.0.17.67(16.21.1)
Content-Type: application/sdp
Content-Length:   341

v=0
o=- 1312019594 1312019594 IN IP4 MyExternalIP
s=Asterisk
c=IN IP4 MyExternalIP
t=0 0
m=audio 16312 RTP/AVP 9 8 0 111 3 101
a=rtpmap:9 G722/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:111 G726-32/8000
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

<--- Received SIP response (440 bytes) from UDP:OutboundProxyIP:5060 --->
SIP/2.0 500 Server Internal Error
Via: SIP/2.0/UDP MyExternalIP:5060;received=MyExternalIP;rport=5060;branch=z9hG4bKPjacaa9c30-c6cb-428b-b7aa-c861465fbdb7
From: <sip:[email protected]>;tag=672759c9-d613-4bb1-8b96-98c8a88852d5
To: <sip:[email protected]>;tag=1c1637403635
Call-ID: eb3e3519-4f52-4e25-a024-39a8c209968f
CSeq: 8339 INVITE
Reason: SIP ;cause=500 ;text="Classification Failure"
Content-Length: 0


<--- Transmitting SIP request (461 bytes) to UDP:OutboundProxyIP:5060 --->
ACK sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP MyExternalIP:5060;rport;branch=z9hG4bKPjacaa9c30-c6cb-428b-b7aa-c861465fbdb7
From: <sip:[email protected]>;tag=672759c9-d613-4bb1-8b96-98c8a88852d5
To: <sip:[email protected]>;tag=1c1637403635
Call-ID: eb3e3519-4f52-4e25-a024-39a8c209968f
CSeq: 8339 ACK
Route: <sip:OutboundProxy.lt:5060;lr>
Max-Forwards: 70
User-Agent: FPBX-15.0.17.67(16.21.1)
Content-Length:  0

One thing to note was that in the configuration documentation I was only given a username, password, SIP domain, and outbound proxy.

Can anyone tell me what I could be doing wrong?

Thanks.

There’s probably something missing in the configuration. There’s an explanation in the AlphaGeek blogs that explains what 500 is about. A more polite explanation would be to say that 500 is so generic, that one cannot answer here.

A step by step procedure would be to check first whether the registrations work and whether there are valid contacts.

Try setting From Domain for the trunk to the same value you have in SIP Server (SIP domain from provider). If MySIPPhoneNumber is not the same as your username, try setting From User to your username.

Try ‘hiding’ the outbound proxy by setting Outbound Proxy for the trunk to
sip:sip.csc.lt\;lr\;hide

If no luck, try enabling only alaw and ulaw codecs.

If none of this helps, confirm that you are sending the destination number in the correct format. If incoming calls are working (or at least get something logged), the provider will likely accept the same format as they send you for caller ID.

Possibly, your router/firewall has a SIP ALG that is messing things up. Do you have a way to see the outgoing INVITE on the WAN interface?

As it turns out, my SIP trunk was misconfigured. What I dislike is that my provider, CSC Telecom (Lithuania), almost expects users to figure out the configuration themselves. So here I’m providing the configuration template in both English and Lithuanian to the public:

CSC Telecom (Lithuania) FreePBX configuration / konfigūracija:
Outbound Proxy: sip:OutboundProxy\;lr
Contact User: Username as on your contract / Vartotojo vardas sutartyje
From Domain: SIP Domain as on your contract / SIP domenas sutartyje
From User: Username as on your contract / Vartotojo vardas sutartyje
Client URI: sip:Username@SIPdomain
Server URI: sip:SIPdomain
AOR Contact: sip:SIPdomain

With that said, I request the moderators to mark this topic as solved.

If they actually need this, their system is broken.

I changed it to No and apparently it still works. Gonna amend the message above accordingly.

Also, it should work with Client URI, Server URI and AOR Contact left blank.

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