Call Transfer hungup after transfered on both side and didn't reach to endpoint

I try to transfer incoming call to destiation which is 012399001@superagents context
but when i try to transfer the call from caller got hungup and no error can’t be found.
i use sip.js to transfer the calls here is the logs

<--- Transmitting (no NAT) to 172.250.230.134:5060 --->
SIP/2.0 183 Session Progress
Via: SIP/2.0/WSS n650gss11soo.invalid;branch=z9hG4bK3063751;received=172.250.230.134
From: <sip:012399009@172.250.230.160>;tag=v0qbe7n5ap
To: <sip:09978551579@192.168.130.20>;tag=as5e04fe2a
Call-ID: vusm32hhcl4hfvev8a4r
CSeq: 2 INVITE
Server: Asterisk PBX GIT-18-591c1c77c7
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:09978551579@172.250.230.160:5060;transport=ws>
Content-Type: application/sdp
Content-Length: 805

v=0
o=root 186646699 186646699 IN IP4 172.250.230.160
s=Asterisk PBX GIT-18-591c1c77c7
c=IN IP4 172.250.230.160
t=0 0
m=audio 14788 UDP/TLS/RTP/SAVPF 8 0 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=maxptime:140
a=ice-ufrag:3c05996b6306cd35387805357c3858ae
a=ice-pwd:00c273fb123c680146f403003d0ef7cb
a=candidate:Hacfae6a0 1 UDP 2130706431 172.250.230.160 14788 typ host
a=candidate:Ha010ec0 1 UDP 2130706431 10.1.14.192 14788 typ host
a=candidate:Hacfae6a0 2 UDP 2130706430 172.250.230.160 14789 typ host
a=candidate:Ha010ec0 2 UDP 2130706430 10.1.14.192 14789 typ host
a=connection:new
a=setup:active
a=fingerprint:SHA-256 20:A4:9C:5A:8F:69:60:73:DE:D0:12:42:F0:2C:9C:88:5E:9E:68:2C:CF:CA:B7:C1:C2:CF:71:2D:FD:C2:19:D8
a=sendrecv

<------------>
    -- SIP/012399009-00000025 requested media update control 26, passing it to SIP/192.168.130.20-00000026
    -- SIP/012399009-00000025 requested media update control 26, passing it to SIP/192.168.130.20-00000026
Reliably Transmitting (NAT) to 192.168.130.20:5060:
OPTIONS sip:192.168.130.20 SIP/2.0
Via: SIP/2.0/UDP 172.250.230.160:5060;branch=z9hG4bK0f61a771;rport
Max-Forwards: 70
From: "asterisk" <sip:asterisk@172.250.230.160>;tag=as4b12156b
To: <sip:192.168.130.20>
Contact: <sip:asterisk@172.250.230.160:5060>
Call-ID: 7428122b1cc97b1f1f7ec17100134bac@172.250.230.160:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX GIT-18-591c1c77c7
Date: Thu, 08 Aug 2024 13:54:49 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


---

<--- SIP read from UDP:192.168.130.20:5060 --->
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 172.250.230.160:5060;branch=z9hG4bK0f61a771;received=172.250.230.160;rport=5060
From: "asterisk" <sip:asterisk@172.250.230.160>;tag=as4b12156b
To: <sip:192.168.130.20>;tag=as5cac9423
Call-ID: 7428122b1cc97b1f1f7ec17100134bac@172.250.230.160:5060
CSeq: 102 OPTIONS
Server: CAIP SIP 2.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Accept: application/sdp
Content-Length: 0

<------------->
--- (11 headers 0 lines) ---
Really destroying SIP dialog '7428122b1cc97b1f1f7ec17100134bac@172.250.230.160:5060' Method: OPTIONS

<--- SIP read from UDP:192.168.130.20:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 172.250.230.160:5060;branch=z9hG4bK45939671;received=172.250.230.160;rport=5060
From: <sip:012399009@172.250.230.160>;tag=as3051bba4
To: <sip:09978551579@192.168.130.20>;tag=as4642b0cb
Call-ID: 69e3373c5c136f79521b3ac7145b1a4f@172.250.230.160:5060
CSeq: 102 INVITE
Server: CAIP SIP 2.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Session-Expires: 1800;refresher=uas
Contact: <sip:09978551579@192.168.130.20:5060>
Content-Type: application/sdp
Require: timer
Content-Length: 295

v=0
o=root 1145565986 1145565986 IN IP4 192.168.130.20
s=CAIP SIP 2.0
c=IN IP4 192.168.130.20
t=0 0
m=audio 19336 RTP/AVP 0 8 3 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/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
<------------->
--- (14 headers 14 lines) ---
Comparing SDP version 1145565986 -> 1145565986 and unique parts [root 1145565986 IN IP4 192.168.130.20] -> [root 1145565986 IN IP4 192.168.130.20]
sip_route_dump: route/path hop: <sip:09978551579@192.168.130.20:5060>
set_destination: Parsing <sip:09978551579@192.168.130.20:5060> for address/port to send to
set_destination: set destination to 192.168.130.20:5060
Transmitting (no NAT) to 192.168.130.20:5060:
ACK sip:09978551579@192.168.130.20:5060 SIP/2.0
Via: SIP/2.0/UDP 172.250.230.160:5060;branch=z9hG4bK2c061702
Max-Forwards: 70
From: <sip:012399009@172.250.230.160>;tag=as3051bba4
To: <sip:09978551579@192.168.130.20>;tag=as4642b0cb
Contact: <sip:012399009@172.250.230.160:5060>
Call-ID: 69e3373c5c136f79521b3ac7145b1a4f@172.250.230.160:5060
CSeq: 102 ACK
User-Agent: Asterisk PBX GIT-18-591c1c77c7
Content-Length: 0


---
    -- SIP/192.168.130.20-00000026 answered SIP/012399009-00000025
Audio is at 14788
Adding codec alaw to SDP
Adding codec ulaw to SDP
Adding non-codec 0x1 (telephone-event) to SDP

<--- Reliably Transmitting (no NAT) to 172.250.230.134:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/WSS n650gss11soo.invalid;branch=z9hG4bK3063751;received=172.250.230.134
From: <sip:012399009@172.250.230.160>;tag=v0qbe7n5ap
To: <sip:09978551579@192.168.130.20>;tag=as5e04fe2a
Call-ID: vusm32hhcl4hfvev8a4r
CSeq: 2 INVITE
Server: Asterisk PBX GIT-18-591c1c77c7
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:09978551579@172.250.230.160:5060;transport=ws>
Content-Type: application/sdp
Content-Length: 810

v=0
o=root 186646699 186646699 IN IP4 172.250.230.160
s=Asterisk PBX GIT-18-591c1c77c7
c=IN IP4 172.250.230.160
t=0 0
m=audio 14788 UDP/TLS/RTP/SAVPF 8 0 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=maxptime:140
a=ice-ufrag:3c05996b6306cd35387805357c3858ae
a=ice-pwd:00c273fb123c680146f403003d0ef7cb
a=candidate:Hacfae6a0 1 UDP 2130706431 172.250.230.160 14788 typ host
a=candidate:Ha010ec0 1 UDP 2130706431 10.1.14.192 14788 typ host
a=candidate:Hacfae6a0 2 UDP 2130706430 172.250.230.160 14789 typ host
a=candidate:Ha010ec0 2 UDP 2130706430 10.1.14.192 14789 typ host
a=connection:existing
a=setup:active
a=fingerprint:SHA-256 20:A4:9C:5A:8F:69:60:73:DE:D0:12:42:F0:2C:9C:88:5E:9E:68:2C:CF:CA:B7:C1:C2:CF:71:2D:FD:C2:19:D8
a=sendrecv

<------------>
    -- Channel SIP/192.168.130.20-00000026 joined 'simple_bridge' basic-bridge <3b098ee1-7416-4663-9830-8d1955015a63>
    -- Channel SIP/012399009-00000025 joined 'simple_bridge' basic-bridge <3b098ee1-7416-4663-9830-8d1955015a63>

<--- SIP read from WS:172.250.230.134:36714 --->
ACK sip:09978551579@172.250.230.160:5060;transport=ws SIP/2.0
Via: SIP/2.0/WSS n650gss11soo.invalid;branch=z9hG4bK2078363
To: <sip:09978551579@192.168.130.20>;tag=as5e04fe2a
From: <sip:012399009@172.250.230.160>;tag=v0qbe7n5ap
CSeq: 2 ACK
Call-ID: vusm32hhcl4hfvev8a4r
Max-Forwards: 70
Supported: outbound
User-Agent: SIP.js/0.21.1
Content-Length: 0

<------------->
--- (10 headers 0 lines) ---
Really destroying SIP dialog '307658a77be5eb915295e1f711ac7d52@172.250.230.160:5060' Method: INVITE

<--- SIP read from WS:172.250.230.134:36714 --->
REFER sip:09978551579@172.250.230.160:5060;transport=ws SIP/2.0
Via: SIP/2.0/WSS n650gss11soo.invalid;branch=z9hG4bK2709429
To: <sip:09978551579@192.168.130.20>;tag=as5e04fe2a
From: <sip:012399009@172.250.230.160>;tag=v0qbe7n5ap
CSeq: 3 REFER
Call-ID: vusm32hhcl4hfvev8a4r
Max-Forwards: 70
Referred-By: <sip:012399009@172.250.230.160>
Contact: <sip:peltr5qc@n650gss11soo.invalid;transport=ws;ob>
Allow: ACK,CANCEL,INVITE,MESSAGE,BYE,OPTIONS,INFO,NOTIFY,REFER
Refer-To: sip:012399000@superagents
Supported: outbound
User-Agent: SIP.js/0.21.1
Content-Length: 0

<------------->
--- (14 headers 0 lines) ---
Call vusm32hhcl4hfvev8a4r got a SIP call transfer from caller: (REFER)!
SIP transfer to extension 012399000@outbound by 012399009@172.250.230.160

<--- Transmitting (no NAT) to 172.250.230.134:5060 --->
SIP/2.0 202 Accepted
Via: SIP/2.0/WSS n650gss11soo.invalid;branch=z9hG4bK2709429;received=172.250.230.134
From: <sip:012399009@172.250.230.160>;tag=v0qbe7n5ap
To: <sip:09978551579@192.168.130.20>;tag=as5e04fe2a
Call-ID: vusm32hhcl4hfvev8a4r
CSeq: 3 REFER
Server: Asterisk PBX GIT-18-591c1c77c7
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:09978551579@172.250.230.160:5060;transport=ws>
Content-Length: 0


<------------>
    -- Channel SIP/012399009-00000025 left 'simple_bridge' basic-bridge <3b098ee1-7416-4663-9830-8d1955015a63>
    -- Channel SIP/192.168.130.20-00000026 left 'simple_bridge' basic-bridge <3b098ee1-7416-4663-9830-8d1955015a63>
set_destination: Parsing <sip:peltr5qc@n650gss11soo.invalid;transport=ws;ob> for address/port to send to
set_destination: URI is for WebSocket, we can't set destination
Reliably Transmitting (no NAT) to 172.250.230.134:5060:
NOTIFY sip:peltr5qc@n650gss11soo.invalid;transport=ws;ob SIP/2.0
Via: SIP/2.0/WS 172.250.230.160:5060;branch=z9hG4bK708c1bf6
Max-Forwards: 70
From: <sip:09978551579@192.168.130.20>;tag=as5e04fe2a
To: <sip:012399009@172.250.230.160>;tag=v0qbe7n5ap
Contact: <sip:09978551579@172.250.230.160:5060;transport=ws>
Call-ID: vusm32hhcl4hfvev8a4r
CSeq: 102 NOTIFY
User-Agent: Asterisk PBX GIT-18-591c1c77c7
Event: refer;id=3
Subscription-state: terminated;reason=noresource
Content-Type: message/sipfrag;version=2.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 16

SIP/2.0 200 OK

---
    -- Executing [012399000@outbound:1] NoOp("SIP/192.168.130.20-00000026", ""Calling "") in new stack
    -- Executing [012399000@outbound:2] Dial("SIP/192.168.130.20-00000026", "SIP/012399000@192.168.130.20") in new stack
  == Spawn extension (outbound, 09978551579, 2) exited non-zero on 'SIP/012399009-00000025'
Scheduling destruction of SIP dialog 'vusm32hhcl4hfvev8a4r' in 6400 ms (Method: REFER)
  == Using SIP RTP CoS mark 5
[Aug  8 20:25:01] ERROR[2100646]: cdr_pgsql.c:235 pgsql_log: Unable to connect to database server localhost.  Calls will not be logged!
[Aug  8 20:25:01] ERROR[2100646]: cdr_pgsql.c:236 pgsql_log: Reason: connection to server at "localhost" (127.0.0.1), port 5432 failed: FATAL:  database "asteriskdbcdr" does not exist


<--- SIP read from WS:172.250.230.134:36714 --->
SIP/2.0 200 OK
Via: SIP/2.0/WS 172.250.230.160:5060;branch=z9hG4bK708c1bf6
From: <sip:09978551579@192.168.130.20>;tag=as5e04fe2a
To: <sip:012399009@172.250.230.160>;tag=v0qbe7n5ap
CSeq: 102 NOTIFY
Call-ID: vusm32hhcl4hfvev8a4r
Supported: outbound
User-Agent: SIP.js/0.21.1
Content-Length: 0

<------------->
--- (9 headers 0 lines) ---
Audio is at 17044
Adding codec ulaw to SDP
Adding codec alaw to SDP
Adding codec gsm to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to 192.168.130.20:5060:
INVITE sip:012399000@192.168.130.20 SIP/2.0
Via: SIP/2.0/UDP 172.250.230.160:5060;branch=z9hG4bK638c5f79
Max-Forwards: 70
From: <sip:09978551579@172.250.230.160>;tag=as3ff40776
To: <sip:012399000@192.168.130.20>
Contact: <sip:09978551579@172.250.230.160:5060>
Call-ID: 00d12772550e5a8a267271b15e48bcfd@172.250.230.160:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX GIT-18-591c1c77c7
Date: Thu, 08 Aug 2024 13:55:01 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 301

v=0
o=root 469999257 469999257 IN IP4 172.250.230.160
s=Asterisk PBX GIT-18-591c1c77c7
c=IN IP4 172.250.230.160
t=0 0
m=audio 17044 RTP/AVP 0 8 3 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=maxptime:140
a=sendrecv

---
    -- Called SIP/012399000@192.168.130.20

<--- SIP read from UDP:192.168.130.20:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 172.250.230.160:5060;branch=z9hG4bK638c5f79;received=172.250.230.160;rport=5060
From: <sip:09978551579@172.250.230.160>;tag=as3ff40776
To: <sip:012399000@192.168.130.20>
Call-ID: 00d12772550e5a8a267271b15e48bcfd@172.250.230.160:5060
CSeq: 102 INVITE
Server: CAIP SIP 2.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Session-Expires: 1800;refresher=uas
Contact: <sip:012399000@192.168.130.20:5060>
Content-Length: 0

<------------->
--- (12 headers 0 lines) ---

<--- SIP read from UDP:192.168.130.20:5060 --->
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 172.250.230.160:5060;branch=z9hG4bK638c5f79;received=172.250.230.160;rport=5060
From: <sip:09978551579@172.250.230.160>;tag=as3ff40776
To: <sip:012399000@192.168.130.20>;tag=as513ed9ec
Call-ID: 00d12772550e5a8a267271b15e48bcfd@172.250.230.160:5060
CSeq: 102 INVITE
Server: CAIP SIP 2.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Session-Expires: 1800;refresher=uas
Content-Length: 0

<------------->
--- (11 headers 0 lines) ---
Transmitting (no NAT) to 192.168.130.20:5060:
ACK sip:012399000@192.168.130.20 SIP/2.0
Via: SIP/2.0/UDP 172.250.230.160:5060;branch=z9hG4bK638c5f79
Max-Forwards: 70
From: <sip:09978551579@172.250.230.160>;tag=as3ff40776
To: <sip:012399000@192.168.130.20>;tag=as513ed9ec
Contact: <sip:09978551579@172.250.230.160:5060>
Call-ID: 00d12772550e5a8a267271b15e48bcfd@172.250.230.160:5060
CSeq: 102 ACK
User-Agent: Asterisk PBX GIT-18-591c1c77c7
Content-Length: 0


---
Scheduling destruction of SIP dialog '00d12772550e5a8a267271b15e48bcfd@172.250.230.160:5060' in 32000 ms (Method: INVITE)
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [012399000@outbound:3] Hangup("SIP/192.168.130.20-00000026", "") in new stack
  == Spawn extension (outbound, 012399000, 3) exited non-zero on 'SIP/192.168.130.20-00000026'
Scheduling destruction of SIP dialog '69e3373c5c136f79521b3ac7145b1a4f@172.250.230.160:5060' in 32000 ms (Method: INVITE)
set_destination: Parsing <sip:09978551579@192.168.130.20:5060> for address/port to send to
set_destination: set destination to 192.168.130.20:5060
Reliably Transmitting (no NAT) to 192.168.130.20:5060:
BYE sip:09978551579@192.168.130.20:5060 SIP/2.0
Via: SIP/2.0/UDP 172.250.230.160:5060;branch=z9hG4bK0f0ba1ed
Max-Forwards: 70
From: <sip:012399009@172.250.230.160>;tag=as3051bba4
To: <sip:09978551579@192.168.130.20>;tag=as4642b0cb
Call-ID: 69e3373c5c136f79521b3ac7145b1a4f@172.250.230.160:5060
CSeq: 103 BYE
User-Agent: Asterisk PBX GIT-18-591c1c77c7
X-Asterisk-HangupCause: Unallocated (unassigned) number
X-Asterisk-HangupCauseCode: 1
Content-Length: 0


---

<--- SIP read from UDP:192.168.130.20:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 172.250.230.160:5060;branch=z9hG4bK0f0ba1ed;received=172.250.230.160;rport=5060
From: <sip:012399009@172.250.230.160>;tag=as3051bba4
To: <sip:09978551579@192.168.130.20>;tag=as4642b0cb
Call-ID: 69e3373c5c136f79521b3ac7145b1a4f@172.250.230.160:5060
CSeq: 103 BYE
Server: CAIP SIP 2.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0

<------------->
--- (10 headers 0 lines) ---
Really destroying SIP dialog '69e3373c5c136f79521b3ac7145b1a4f@172.250.230.160:5060' Method: INVITE
[Aug  8 20:25:01] ERROR[2100646]: cdr_pgsql.c:235 pgsql_log: Unable to connect to database server localhost.  Calls will not be logged!
[Aug  8 20:25:01] ERROR[2100646]: cdr_pgsql.c:236 pgsql_log: Reason: connection to server at "localhost" (127.0.0.1), port 5432 failed: FATAL:  database "asteriskdbcdr" does not exist

[Aug  8 20:25:01] ERROR[2100646]: cdr_pgsql.c:235 pgsql_log: Unable to connect to database server localhost.  Calls will not be logged!
[Aug  8 20:25:01] ERROR[2100646]: cdr_pgsql.c:236 pgsql_log: Reason: connection to server at "localhost" (127.0.0.1), port 5432 failed: FATAL:  database "asteriskdbcdr" does not exist


<--- SIP read from UDP:192.168.130.20:5060 --->
OPTIONS sip:172.250.230.160 SIP/2.0
Via: SIP/2.0/UDP 192.168.130.20:5060;branch=z9hG4bK42a6869f;rport
Max-Forwards: 70
From: "asterisk" <sip:asterisk@192.168.130.20>;tag=as6875f993
To: <sip:172.250.230.160>
Contact: <sip:asterisk@192.168.130.20:5060>
Call-ID: 28fee5b01f7ca23e3774d1387248e8af@192.168.130.20:5060
CSeq: 102 OPTIONS
User-Agent: CAIP SIP 2.0
Date: Thu, 08 Aug 2024 13:35:17 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0

<------------->
--- (13 headers 0 lines) ---
Sending to 192.168.130.20:5060 (no NAT)
Looking for s in default (domain 172.250.230.160)

<--- Transmitting (no NAT) to 192.168.130.20:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.130.20:5060;branch=z9hG4bK42a6869f;received=192.168.130.20;rport=5060
From: "asterisk" <sip:asterisk@192.168.130.20>;tag=as6875f993
To: <sip:172.250.230.160>;tag=as4bf280cc
Call-ID: 28fee5b01f7ca23e3774d1387248e8af@192.168.130.20:5060
CSeq: 102 OPTIONS
Server: Asterisk PBX GIT-18-591c1c77c7
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:172.250.230.160:5060>
Accept: application/sdp
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog '28fee5b01f7ca23e3774d1387248e8af@192.168.130.20:5060' in 32000 ms (Method: OPTIONS)
set_destination: Parsing <sip:peltr5qc@n650gss11soo.invalid;transport=ws;ob> for address/port to send to
set_destination: URI is for WebSocket, we can't set destination
Reliably Transmitting (no NAT) to 172.250.230.134:5060:
BYE sip:peltr5qc@n650gss11soo.invalid;transport=ws;ob SIP/2.0
Via: SIP/2.0/WS 172.250.230.160:5060;branch=z9hG4bK50d33845
Max-Forwards: 70
From: <sip:09978551579@192.168.130.20>;tag=as5e04fe2a
To: <sip:012399009@172.250.230.160>;tag=v0qbe7n5ap
Call-ID: vusm32hhcl4hfvev8a4r
CSeq: 103 BYE
User-Agent: Asterisk PBX GIT-18-591c1c77c7
Proxy-Authorization: Digest username="k98p1un7", realm="asterisk", algorithm=MD5, uri="sip:192.168.130.20", nonce="0c6b9320", response="80e92b081711ae2418f7727f06478de4"
X-Asterisk-HangupCause: Normal Clearing
X-Asterisk-HangupCauseCode: 16
Content-Length: 0


---
Scheduling destruction of SIP dialog 'vusm32hhcl4hfvev8a4r' in 6400 ms (Method: REFER)

<--- SIP read from WS:172.250.230.134:36714 --->
SIP/2.0 200 OK
Via: SIP/2.0/WS 172.250.230.160:5060;branch=z9hG4bK50d33845
From: <sip:09978551579@192.168.130.20>;tag=as5e04fe2a
To: <sip:012399009@172.250.230.160>;tag=v0qbe7n5ap
CSeq: 103 BYE
Call-ID: vusm32hhcl4hfvev8a4r
Supported: outbound
User-Agent: SIP.js/0.21.1
Content-Length: 0


sip.conf

[general]
udpbindaddr=0.0.0.0:5060 ; Replace this with your IP address
transport=udp
websocket_enable=no

[012399000] ; This will be WebRTC client
type=friend
host=dynamic ; Allows any host to register  
transport=wss
avpf=yes
qualify=yes
secret=password
encryption=yes ; Tell Asterisk to use encryption for this peer
disallow=all
context=outbound
allow=alaw,ulaw,gsm
icesupport=yes ; Enable ICE support
directmedia=yes ; Ensure direct media is disabled
dtlsenable=yes ; Enable DTLS
dtlsverify=fingerprint ; Verify DTLS fingerprint
dtlscertfile=/etc/asterisk/keys/asterisk.crt ; Path to your certificate
dtlsprivatekey=/etc/asterisk/keys/asterisk.key ; Path to your private key
dtlssetup=actpass ; DTLS setup method
dtlsfingerprint=/etc/asterisk/keys/asterisk.key

[012399009] ; This will be WebRTC client
type=friend
host=dynamic ; Allows any host to register  
transport=wss
avpf=yes
qualify=yes
secret=password
encryption=yes ; Tell Asterisk to use encryption for this peer
disallow=all
allow=alaw,ulaw,gsm
context=outbound
icesupport=yes ; Enable ICE support
directmedia=yes ; Ensure direct media is disabled
dtlsenable=yes ; Enable DTLS
dtlsverify=fingerprint ; Verify DTLS fingerprint
dtlscertfile=/etc/asterisk/keys/asterisk.crt ; Path to your certificate
dtlsprivatekey=/etc/asterisk/keys/asterisk.key ; Path to your private key
dtlssetup=actpass ; DTLS setup method
dtlsfingerprint=/etc/asterisk/keys/asterisk.key


[mgluaye]
host=192.168.130.20
type=peer
qualify=yes
canreinvite=no
disallow=all
allow=alaw,ulaw,gsm
transport=udp
dtmfmode=rfc2833
context=inbound
nat=force_rport,comedia
directmedia=no

extension.conf

[default]
exten => 2399009,1,NoOp(executing inbound call); Dialing 1060 will call the SIP client registered to 1060
exten => 012399000,hint,SIP/012399000
exten => 012399009,hint,SIP/012399009



[outbound]
exten => _X.,1,NoOp("Calling ")
same => n,Dial(SIP/${EXTEN}@192.168.130.20)
same => n,Hangup()


[inbound]
exten => 2399009,1,NoOp(Call to sales queue)
same => n,GotoIfTime(09:00-17:00,mon-sat,*,*?within-office-hours,s,1)
same => n,Stasis(my-ari-client)
same => n,Hangup()


[within-office-hours]
exten => s,1,NoOp(Within office hours)
same => n,Answer()
same => n,Queue(sales)
same => n,Return()

[superagents]
exten => 012399001,1,NoOp(Calling to queue superagents)
same => n,Answer()
same => n,Queue(superagent)
same => n,Return()

optionally here is my code in javascript

  const remoteAudioRef = useRef(null);
  const [simpleUser, setSimpleUser] = useState(null);
  const [isCalling, setIsCalling] = useState(false);
  const [isInCall, setIsInCall] = useState(false);
  const [isRinging, setIsRinging] = useState(false);
  const [dialpadNumber, setDialpadNumber] = useState(null)

  useEffect(() => {
    const server = "wss://172.250.230.160:8089/ws";
    const aor = "sip:012399009@172.250.230.160";
    const authorizationUsername = "012399009";
    const authorizationPassword = "password";

    const options = {
      aor,
      media: {
        remote: {
          audio: remoteAudioRef.current,
        },
      },
      userAgentOptions: {
        authorizationPassword,
        authorizationUsername,
      },
    };


    const user = new SimpleUser(server, options);
    user.delegate = {
      onCallReceived: async () => {
        console.log("Call received");
        setIsRinging(true);
      },
      onCallHangup: () => {
        console.log("Call ended");
        setIsInCall(false);
        setIsRinging(false);
      },
      onRefer: (referral) => {
        console.log("working")
        // Determine if you should accept or reject the referral
        if (shouldAcceptReferral(referral)) {
          referral.accept().then(() => {
            referral.makeInviter().invite();
          });
        } else {
          referral.reject();
        }
      }
    };

    const initialize = async () => {
      try {
        await user.connect();
        await user.register();
        setSimpleUser(user);
      } catch (error) {
        console.error("Failure", error);
      }
    };

    initialize();

    return () => {
      if (user) {
        user.disconnect();
      }
    };
  }, []);
  const emptyDialpad = () => {
    setDialpadNumber(undefined)
  }

  useEffect(() => {
    emptyDialpad()
  }, [isCalling])

  const handleCall = async () => {
    if (dialpadNumber?.length <= 0) {
      window.alert("invalid phone number!");
      return
    }
    if (simpleUser && !isCalling && !isInCall) {
      setIsCalling(true);
      console.log(dialpadNumber)
      try {
        const destination = `sip:${dialpadNumber}@192.168.130.20`;
        console.log('calling')
        await simpleUser.call(destination, {
          inviteWithoutSdp: false,
          earlyMedia: true,
          requestDelegate: {
            onAccept: (response) => {
              console.log("SIP response received:", response);
              // Modify SDP to disable secure RTP if necessary
            },
          },
        });
        setIsCalling(false);
        setIsInCall(true);
      } catch (error) {
        console.error("Call failed", error);
        setIsCalling(false);
      }
    }
  };

  const handleHangup = async () => {
    if (simpleUser && isInCall) {
      try {
        await simpleUser.hangup();
        setIsInCall(false);
        setIsRinging(false);
      } catch (error) {
        console.error("Hangup failed", error);
      }
    }
  };

  const handleAnswer = async () => {
    if (simpleUser && isRinging) {
      try {
        await simpleUser.answer();
        setIsInCall(true);
        setIsRinging(false);
      } catch (error) {
        console.error("Answer failed", error);
      }
    }
  };
  const transferCall = async () => {
    if (simpleUser && simpleUser.session) {
      const uri = UserAgent.makeURI("sip:012399000@superagents");


      try {
        console.log(simpleUser.session?.id)
        await simpleUser.session.refer(uri);
        console.log('Transfer initiated');
      } catch (error) {
        console.error('Transfer failed', error);
      }
    } else {
      console.error('No active session to transfer');
    }
  };
  const sendDTMF = (value) => {
    if (simpleUser && isInCall) {
      simpleUser.sendDTMF(value);
    }
  };

This was dialed. The remote side responded with “404 Not Found” and the call ended.

hi jcolp i think i mistakenly configured the dialplan
i wan’t to transfer to local sip user and numbers at ISP(Sims)
the service is running to transfer inoffice sip accounts and outside number but i mistakenly configured.Is there any solution to add dynamic extension,provider to that dialplan?

Thank you :3

I don’t know what that means really, or why it would need to be dynamic.

i want to send refer request to internal sip users and to my isp

i have agents 012399009,0123990000,012399001 and 012399001 is super agent.If normal agents can’t answer the customer questions they would transfer call to super agent.I want to transfer the calls to the number outside number(public number) like 192.168.130.20 and transfer super agent calls will be SIP/012399001@superagents or Queue(superagents)

Thank You.

It’s all in how you write the dialplan… a REFER just sends the call to a new target in the dialplan, and then it’s up to you how that is handled/routed/etc.

Exactly,But i don’t know how to send the call to new target.
if i call EXTEN variable it will result output of the target number but not including any extension context or sip address that’s why i don’t know how to route them.

How would it know that information? Where should it come from in the first place?

i make a sip uri to call target number from code level but the result is just number when i log at Dialplan ,it says (012399001) but not “superagent” or “192.168.130.xx”

sip:012399001@superagent

i search for online but can’t find any Dialplan function that catch the context or hostname.

i got a point,can i use SIP_HEADER() to extract the domain?

SIP_HEADER(To)

but the request will be 192.168.130.xx when i refer 012399001@superagents

edit here is the dialplan

[default]
exten => 2399009,1,NoOp(executing inbound call); Dialing 1060 will call the SIP client registered to 1060
exten => 012399000,hint,SIP/012399000
exten => 012399009,hint,SIP/012399009



[outbound]
exten => _X.,1,NoOp("Calling ")
same => n,Set(TO_IP_HEADER=${SIP_HEADER(To)})
same => n,NoOp(SIP Header To: ${TO_IP_HEADER})

; Extract the IP address from the To header
same => n,Set(TO_IP_PART=${CUT(TO_IP_HEADER,@,2)})
same => n,Set(TO_IP_PART=${CUT(TO_IP_PART,>,1)}) ;
same => n,NoOp(Extracted IP Address: ${TO_IP_PART})

; Dial using the extracted IP address
same => n,Dial(SIP/${EXTEN}@${TO_IP_PART})
same => n,Hangup()

[dial-outside]
exten => s,1,Dial(SIP/${EXTEN}@192.168.130.20)

[inbound]
exten => 2399009,1,NoOp(Call to sales queue)
same => n,GotoIfTime(09:00-17:00,mon-sat,*,*?within-office-hours,s,1)
same => n,Stasis(my-ari-client)
same => n,Hangup()


[within-office-hours]
exten => s,1,NoOp(Within office hours)
same => n,Answer()
same => n,Queue(sales)
same => n,Return()

[superagents]
exten => 012399001,1,NoOp(Calling to queue superagents)
same => n,Answer()
same => n,Queue(superagent)
same => n,Return()

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