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!
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
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.
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.
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
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.