FreePBX 17 asterisk 22 results in no outgoing calls

Upgraded to FreePBX 17 & asterisk 22, pulled in a backup from 13 & 22 which converted the sip to pjsip so tested in isolation with a couple of phones and they worked fine. Swapped with running unit and enabled trunk, now left with a system that can receive calls but outgoing calls get dropped with a SIP/2.0 603 decline message.

We use uk sipgate and they don’t provide any specific settings so other than searching online at a loss at the magic setting that’s required to fix this assuming the problem is with the trunk and not elsewhere.

I know the upgrades were substantial so any clues at what area to look at would be welcome!

Hi @andy399
Did you searched at the form for SipGate Sip Trunk setup ? I was published a year ago some Trunk settings.

OK I’ve changed a few things and mine looks the same other than I don’t have an outbound CID and a few less codecs ticked. No change

Here’s a sample of the log when it’s dropped. I’m a bit confused with the port numbers being used as the sip server port is set to 5060 (setting it to 5160 stops the incoming calls also) but the debug output is using 5160 and the sipgate portal is showing the trunk registered on 5160.

    -- Executing [s@macro-dialout-trunk:22] ExecIf("PJSIP/4012-0000004e", "0?AGI(allowlist-autoadd.agi,)") in new stack
    -- Executing [s@macro-dialout-trunk:23] Gosub("PJSIP/4012-0000004e", "macro-dialout-trunk-predial-hook,s,1()") in new stack
[2025-03-25 17:41:14] WARNING[724930][C-00000045]: pbx.c:2927 pbx_extension_helper: No application 'SipAddHeader' for extension (macro-dialout-trunk-predial-hook, s, 1)
  == Spawn extension (macro-dialout-trunk-predial-hook, s, 1) exited non-zero on 'PJSIP/4012-0000004e'
<--- Transmitting SIP response (394 bytes) to UDP:x.x.x.x:5160 --->
SIP/2.0 603 Decline
Via: SIP/2.0/UDP x.x.x.x:5160;rport=5160;received=x.x.x.x;branch=y575e0gturtutri
Call-ID: [email protected]
From: "4012-Andy" <sip:[email protected]>;tag=3925513662
To: <sip:[email protected]>;tag=5fc8b6ca-9583-2298-4e0a-1842ab46874b
CSeq: 2 INVITE
Server: -17.0.19.24(22.1.0)
Reason: Q.850;cause=0
Content-Length:  0

check the port numbers at SIP Settings > chan_pjsip and the phones.

the change over from the old sip to new sometimes change the port number from 5060 to 5061 .

Hi, @andy399
Good morning, Yes i agreed with @robfantini you have to change your PjSip Driver Port number.
@robfantini Freepbx-17 doens’t came with Chan_Sip anymore. I think you did typos but logic is correct.

So, My side is 5060

Hi, yes the old system used chan_sip and they were converted to pjsip during the restore of the backup file from the old system. I checked the SIP Settings > chan_pjsip and it was set to 5160 so I’ve changed that to 5060 and the sip trunk is now registered on 5060. Unfortunately the result is the same incoming OK, no outgoing.

What about Outbound route settings ? I think you have Prefix 9 check that one more time, and try to run SNGREP command to see which side sending you 603.. And Have you checked your SipGate balance ? if you not check that 1st.

Hi @shahin

There is plenty of balance available. I have two outbound routes the first is using a different prefix to the usual 9 which sends the calls out with a different caller ID. Both have the same result.

I’m assuming the 603 at the bottom is being sent by the trunk or is it from the PBX?
Again I’m a bit confused by the sip port, the phone is using 5160, but the trunk is 5060 (made no difference when the trunk was set to 5160)

<--- Transmitting SIP response (329 bytes) to UDP:phone_ip:5160 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP phone_ip:5160;rport=5160;received=phone_ip;branch=z9hD8fg3854330778
Call-ID: 0_3625457785@phone_ip
From: "4012-Andy" <sip:4012@pbx_ip>;tag=376907736
To: <sip:9"phone_number"@pbx_ip>
CSeq: 2 INVITE
Server: 17.0.19.24(22.1.0)
Content-Length:  0


  == Using SIP RTP Audio TOS bits 184
  == Using SIP RTP Audio TOS bits 184 in TCLASS field.
  == Using SIP RTP Audio CoS mark 5
    -- Executing [9"phone_number"@from-internal:1] Gosub("PJSIP/4012-00000060", "macro-user-callerid,s,1(LIMIT)") in new stack
…
…
…

    -- Executing [s@macro-dialout-trunk:18] Set("PJSIP/4012-00000060", "OUTNUM="phone_number"") in new stack
    -- Executing [s@macro-dialout-trunk:19] Set("PJSIP/4012-00000060", "custom=PJSIP") in new stack
    -- Executing [s@macro-dialout-trunk:20] ExecIf("PJSIP/4012-00000060", "0?Set(DIAL_TRUNK_MOH=default)") in new stack
    -- Executing [s@macro-dialout-trunk:21] ExecIf("PJSIP/4012-00000060", "0?Set(DIAL_TRUNK_OPTIONS=TU(macro-confirm))") in new stack
    -- Executing [s@macro-dialout-trunk:22] ExecIf("PJSIP/4012-00000060", "0?AGI(allowlist-autoadd.agi,)") in new stack
    -- Executing [s@macro-dialout-trunk:23] Gosub("PJSIP/4012-00000060", "macro-dialout-trunk-predial-hook,s,1()") in new stack
[2025-03-26 10:34:30] WARNING[1217447][C-00000055]: pbx.c:2927 pbx_extension_helper: No application 'SipAddHeader' for extension (macro-dialout-trunk-predial-hook, s, 1)
  == Spawn extension (macro-dialout-trunk-predial-hook, s, 1) exited non-zero on 'PJSIP/4012-00000060'
<--- Transmitting SIP response (394 bytes) to UDP:phone_ip:5160 --->
SIP/2.0 603 Decline
Via: SIP/2.0/UDP phone_ip:5160;rport=5160;received=phone_ip;branch=z9hD8fg3854330778
Call-ID: 0_3625457785@phone_ip
From: "4012-Andy" <sip:4012@pbx_ip>;tag=376907736
To: <sip:9"phone_number"@pbx_ip>;tag=9c8a9f7f-39b3-6de9-9cb2-680af9ecc64b
CSeq: 2 INVITE
Server: 17.0.19.24(22.1.0)
Reason: Q.850;cause=0
Content-Length:  0

coudl you pls past here some details.

CLI> pjsip list transports 

Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress....................>
==========================================================================================

Transport:  0.0.0.0-udp               udp      3     96  0.0.0.0:5060

CLI> pjsip list registrations 

 <Registration/ServerURI..............................>  <Auth....................>  <Status.......>
==========================================================================================

 SipGate-UK/sip:sipconnect.sipgate.co.uk:5060            SipGate-UK                  Registered        (exp. 81s)

CLI> pjsip list contacts 

  Contact:  <Aor/ContactUri..............................> <Hash....> <Status> <RTT(ms)..>
==========================================================================================

  Contact:  1001/sip:[email protected]:5060                81a85b0982 Avail        14.459
  Contact:  SipGate-UK/sip:[email protected] a1d4ae98db Avail        19.883

Thx

Hmm this don’t look good

 pjsip list transports

Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress....................>
==========================================================================================

Transport:  0.0.0.0-udp               udp      3     96  0.0.0.0:5160
Transport:  0.0.0.0-ws                 ws      3     96  0.0.0.0:5060
Transport:  0.0.0.0-wss               wss      3     96  0.0.0.0:5060

Objects found: 3
*CLI> pjsip list registrations

 <Registration/ServerURI..............................>  <Auth....................>  <Status.......>
==========================================================================================

 SIPGATE_UK/sip:sipconnect.sipgate.co.uk:5060            SIPGATE_UK                  Registered        (exp. 149s)

> pjsip list contacts

  Contact:  <Aor/ContactUri..............................> <Hash....> <Status> <RTT(ms)..>
==========================================================================================

  Contact:  4006/sip:[email protected]:37532             f8ed4db330 Avail         2.081
  Contact:  4012/sip:[email protected]:5160              eae8d2d596 Avail         5.678
  ... (another 12)
  Contact:  SIPGATE_UK/sip:[email protected] b9d96fccdf Avail        13.880

Try to Enable, PjSip Driver TCP to 5160

RestartAsterisk required. Then check transports.

CLI> pjsip list transports

Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress....................>
==========================================================================================

Transport:  0.0.0.0-tcp               tcp      3     96  0.0.0.0:5160
Transport:  0.0.0.0-udp               udp      3     96  0.0.0.0:5060

Objects found: 2
 pjsip list transports

Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress....................>
==========================================================================================

Transport:  0.0.0.0-tcp               tcp      3     96  0.0.0.0:5160
Transport:  0.0.0.0-udp               udp      3     96  0.0.0.0:5060
Transport:  0.0.0.0-ws                 ws      3     96  0.0.0.0:5060
Transport:  0.0.0.0-wss               wss      3     96  0.0.0.0:5060

OK that’s change the behaviour, when dialling out the phone is silent and doesn’t ring. I’ll check the logs..

sngrep just shows several invite msgs. Tried to make another call and after a while get the busy tone. Now the phone is saying no service.

How many Phones you have ? Maybe you can export config change port 5160 to 5060 UDP and upload back..

A reasonable amount so that was the plan but need to get one working correctly first.

Looks to me as though you have custom code to add a SIP header, that is directly trying to use the chan_sip application, when it should use the FreePBX subroutine that copes with different SIP channel drivers.

@david55 I wouldn’t know where or how to add any custom SIP header so maybe that’s something to do with the conversion from chan_sip to pjsip that happened in the restore of the backup. One of the options I think is to reinstall everything and use Asterisk 20? that still has chan_sip I believe and use the original configuration.