Can't make call from softphone to Asterisk server

I setup Asterisk according to this [1] document. Below are my configurations.
Then I used Zoiper softphone to call extension 2600. But dial to 2600 fails with SIP 502 Bad gateway error

/////////////////////////////////
sip.conf
/////////////////////////////////
[general]
context=default
allowguest=no
[test_phone_random1]
type=friend
host=dynamic
secret= random2
context=demo

///////////////////////////////////////////
extensions.conf
///////////////////////////////////////////
[default]
exten => _.,1,Hangup()
[demo]
exten => 2600,1,Dial(IAX2/guest@pbx.digium.com/s@default)
same => n,Hangup()

/////////////////////////////////////
iax.conf
///////////////////////////////////
[demo]
type=peer
username=asterisk
secret=supersecret
host=216.207.245.47

Below is Asterisk CLI output

laptopCLI> sip show users
Username Secret Accountcode Def.Context ACL Forcerport
test_phone_random1 random2 demo No No
laptop
CLI> sip show peers
Name/username Host Dyn Forcerport Comedia ACL Port Status Description
test_phone_random1/test_p (Unspecified) D Auto (Yes) No 0 Unmonitored
1 sip peers [Monitored: 0 online, 0 offline Unmonitored: 0 online, 1 offline]

[1]http://www.asterisk.org/sites/asterisk/files/mce_files/documents/asterisk_quick_start_guide.pdf

Can you provide output of the full asterisk CLI before/during/after the call? You use a domain name in the trunk, is the domain name resolvable by the system?

Why do you have a domain name in the dialplan, and the IP address in the iax.conf file? Why not use the IP in the dialplan too?

Adnan.

Hi,

Thanks for your help. Actually I used the same configs as mentioned in the pdf document I mentioned earlier.

Now I changed the hostname to local ip address, so both configs have ip address now.
Please note that both Asterisk and Zoiper runs on my local laptop since I want a simple local PBX.

exten => 2600,1,Dial(IAX2/guest@127.0.0.1/s@default)

Below is the warning log appeared in CLI when call to 2600 fails.

root@laptop:/usr/src# asterisk -r
Asterisk 13.7.2, Copyright © 1999 - 2014, Digium, Inc. and others.
Created by Mark Spencer markster@digium.com
Asterisk comes with ABSOLUTELY NO WARRANTY; type ‘core show warranty’ for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type ‘core show license’ for details.

Connected to Asterisk 13.7.2 currently running on laptop (pid = 27243)
[Feb 15 09:23:42] WARNING[27271]: chan_iax2.c:3572 __attempt_transmit: Max retries exceeded to host 127.0.0.1 on IAX2/demo-6414 (type = 6, subclass = 1, ts=7, seqno=0)

Can you do the CLI output of,

sip set debug on

why change the domain name to localhost ip? why not to the IP that the domain name resolves to?

"why change the domain name to localhost ip? why not to the IP that the domain name resolves to?"
Could you please elaborate more in this? I don’t have any domain name, Asterisk server and Zoiper both runs on my local machine. That is why I put 127.0.0.1.
Could you please let me know what is the domain name your are referring to?

Below is the debug output

<— SIP read from UDP:127.0.0.1:5080 —>
PUBLISH sip:test_phone_random1@127.0.0.1;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 112.134.42.204:46800;branch=z9hG4bK-d8754z-bf35996309cd46ca-1—d8754z-
Max-Forwards: 70
Contact: sip:test_phone_random1@112.134.42.204:46800;transport=UDP
To: sip:test_phone_random1@127.0.0.1;transport=UDP
From: sip:test_phone_random1@127.0.0.1;transport=UDP;tag=382adf40
Call-ID: N2UzOGIyMWMyNWQ5MTk3ZDkwZDUyNzgyYTk0ZjQ0YTA.
CSeq: 1 PUBLISH
Expires: 600
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
Content-Type: application/pidf+xml
Supported: replaces, norefersub, extended-refer, timer, X-cisco-serviceuri
User-Agent: Z 3.3.25608 r25552
Event: presence
Allow-Events: presence, kpml
Content-Length: 291

<?xml version="1.0" encoding="UTF-8"?>

open On the phone

<------------->
— (16 headers 3 lines) —
Sending to 127.0.0.1:5080 (NAT)

<— Transmitting (NAT) to 127.0.0.1:5080 —>
SIP/2.0 489 Bad Event
Via: SIP/2.0/UDP 112.134.42.204:46800;branch=z9hG4bK-d8754z-bf35996309cd46ca-1—d8754z-;received=127.0.0.1;rport=5080
From: sip:test_phone_random1@127.0.0.1;transport=UDP;tag=382adf40
To: sip:test_phone_random1@127.0.0.1;transport=UDP;tag=as57b27d3e
Call-ID: N2UzOGIyMWMyNWQ5MTk3ZDkwZDUyNzgyYTk0ZjQ0YTA.
CSeq: 1 PUBLISH
Server: Asterisk PBX 13.7.2
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0

<------------>
Really destroying SIP dialog ‘N2UzOGIyMWMyNWQ5MTk3ZDkwZDUyNzgyYTk0ZjQ0YTA.’ Method: PUBLISH

<— SIP read from UDP:127.0.0.1:5080 —>
SUBSCRIBE sip:test_phone_random1@127.0.0.1;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 112.134.42.204:46800;branch=z9hG4bK-d8754z-3979903e34b83033-1—d8754z-
Max-Forwards: 70
Contact: sip:test_phone_random1@112.134.42.204:46800;transport=UDP
To: sip:test_phone_random1@127.0.0.1;transport=UDP
From: sip:test_phone_random1@127.0.0.1;transport=UDP;tag=b4e0753f
Call-ID: ZDJlNGJhZjY1ZDJmMWZkMzI2YjgwNmYwY2M2NmUwY2M.
CSeq: 1 SUBSCRIBE
Expires: 600
Accept: application/watcherinfo+xml
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
Supported: replaces, norefersub, extended-refer, timer, X-cisco-serviceuri
User-Agent: Z 3.3.25608 r25552
Event: presence.winfo
Allow-Events: presence, kpml
Content-Length: 0

<------------->
— (16 headers 0 lines) —
Sending to 127.0.0.1:5080 (NAT)
Creating new subscription
Sending to 127.0.0.1:5080 (NAT)
sip_route_dump: route/path hop: sip:test_phone_random1@112.134.42.204:46800;transport=UDP
Found peer ‘test_phone_random1’ for ‘test_phone_random1’ from 127.0.0.1:5080

<— Transmitting (NAT) to 127.0.0.1:5080 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 112.134.42.204:46800;branch=z9hG4bK-d8754z-3979903e34b83033-1—d8754z-;received=127.0.0.1;rport=5080
From: sip:test_phone_random1@127.0.0.1;transport=UDP;tag=b4e0753f
To: sip:test_phone_random1@127.0.0.1;transport=UDP;tag=as43e693fe
Call-ID: ZDJlNGJhZjY1ZDJmMWZkMzI2YjgwNmYwY2M2NmUwY2M.
CSeq: 1 SUBSCRIBE
Server: Asterisk PBX 13.7.2
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce="76a3bce9"
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘ZDJlNGJhZjY1ZDJmMWZkMzI2YjgwNmYwY2M2NmUwY2M.’ in 32000 ms (Method: SUBSCRIBE)

<— SIP read from UDP:127.0.0.1:5080 —>
SUBSCRIBE sip:test_phone_random1@127.0.0.1;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 112.134.42.204:46800;branch=z9hG4bK-d8754z-a4efcea99580bf23-1—d8754z-
Max-Forwards: 70
Contact: sip:test_phone_random1@112.134.42.204:46800;transport=UDP
To: sip:test_phone_random1@127.0.0.1;transport=UDP
From: sip:test_phone_random1@127.0.0.1;transport=UDP;tag=b4e0753f
Call-ID: ZDJlNGJhZjY1ZDJmMWZkMzI2YjgwNmYwY2M2NmUwY2M.
CSeq: 2 SUBSCRIBE
Expires: 600
Accept: application/watcherinfo+xml
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
Supported: replaces, norefersub, extended-refer, timer, X-cisco-serviceuri
User-Agent: Z 3.3.25608 r25552
Authorization: Digest username=“test_phone_random1”,realm=“asterisk”,nonce=“76a3bce9”,uri="sip:test_phone_random1@127.0.0.1;transport=UDP",response=“afa8bd2a0474f6e39582485e5de43f9f”,algorithm=MD5
Event: presence.winfo
Allow-Events: presence, kpml
Content-Length: 0

<------------->
— (17 headers 0 lines) —
Creating new subscription
Sending to 127.0.0.1:5080 (NAT)
Found peer ‘test_phone_random1’ for ‘test_phone_random1’ from 127.0.0.1:5080

<— Transmitting (NAT) to 127.0.0.1:5080 —>
SIP/2.0 489 Bad Event
Via: SIP/2.0/UDP 112.134.42.204:46800;branch=z9hG4bK-d8754z-a4efcea99580bf23-1—d8754z-;received=127.0.0.1;rport=5080
From: sip:test_phone_random1@127.0.0.1;transport=UDP;tag=b4e0753f
To: sip:test_phone_random1@127.0.0.1;transport=UDP;tag=as43e693fe
Call-ID: ZDJlNGJhZjY1ZDJmMWZkMzI2YjgwNmYwY2M2NmUwY2M.
CSeq: 2 SUBSCRIBE
Server: Asterisk PBX 13.7.2
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0

<------------>
Really destroying SIP dialog ‘ZDJlNGJhZjY1ZDJmMWZkMzI2YjgwNmYwY2M2NmUwY2M.’ Method: SUBSCRIBE

<— SIP read from UDP:127.0.0.1:5080 —>
INVITE sip:2600@127.0.0.1;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 112.134.42.204:46800;branch=z9hG4bK-d8754z-6cecb154b5b4cdcd-1—d8754z-
Max-Forwards: 70
Contact: sip:test_phone_random1@112.134.42.204:46800;transport=UDP
To: sip:2600@127.0.0.1;transport=UDP
From: sip:test_phone_random1@127.0.0.1;transport=UDP;tag=d498316e
Call-ID: OTllMzJlZDY4MTZlY2VkMGU2MjFiMmQ2MDFhNWFhNWY.
CSeq: 1 INVITE
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
Content-Type: application/sdp
Supported: replaces, norefersub, extended-refer, timer, X-cisco-serviceuri
User-Agent: Z 3.3.25608 r25552
Allow-Events: presence, kpml
Content-Length: 244

v=0
o=Z 0 0 IN IP4 112.134.42.204
s=Z
c=IN IP4 112.134.42.204
t=0 0
m=audio 46470 RTP/AVP 3 110 8 0 98 101
a=rtpmap:110 speex/8000
a=rtpmap:98 iLBC/8000
a=fmtp:98 mode=20
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
<------------->
— (14 headers 12 lines) —
Sending to 127.0.0.1:5080 (NAT)
Sending to 127.0.0.1:5080 (NAT)
Using INVITE request as basis request - OTllMzJlZDY4MTZlY2VkMGU2MjFiMmQ2MDFhNWFhNWY.
Found peer ‘test_phone_random1’ for ‘test_phone_random1’ from 127.0.0.1:5080

<— Reliably Transmitting (NAT) to 127.0.0.1:5080 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 112.134.42.204:46800;branch=z9hG4bK-d8754z-6cecb154b5b4cdcd-1—d8754z-;received=127.0.0.1;rport=5080
From: sip:test_phone_random1@127.0.0.1;transport=UDP;tag=d498316e
To: sip:2600@127.0.0.1;transport=UDP;tag=as232afc38
Call-ID: OTllMzJlZDY4MTZlY2VkMGU2MjFiMmQ2MDFhNWFhNWY.
CSeq: 1 INVITE
Server: Asterisk PBX 13.7.2
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce="55808370"
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘OTllMzJlZDY4MTZlY2VkMGU2MjFiMmQ2MDFhNWFhNWY.’ in 32000 ms (Method: INVITE)

<— SIP read from UDP:127.0.0.1:5080 —>
ACK sip:2600@127.0.0.1;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 112.134.42.204:46800;branch=z9hG4bK-d8754z-6cecb154b5b4cdcd-1—d8754z-
Max-Forwards: 70
To: sip:2600@127.0.0.1;transport=UDP;tag=as232afc38
From: sip:test_phone_random1@127.0.0.1;transport=UDP;tag=d498316e
Call-ID: OTllMzJlZDY4MTZlY2VkMGU2MjFiMmQ2MDFhNWFhNWY.
CSeq: 1 ACK
Content-Length: 0

<------------->
— (8 headers 0 lines) —

<— SIP read from UDP:127.0.0.1:5080 —>
INVITE sip:2600@127.0.0.1;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 112.134.42.204:46800;branch=z9hG4bK-d8754z-094c652bb54cfe71-1—d8754z-
Max-Forwards: 70
Contact: sip:test_phone_random1@112.134.42.204:46800;transport=UDP
To: sip:2600@127.0.0.1;transport=UDP
From: sip:test_phone_random1@127.0.0.1;transport=UDP;tag=d498316e
Call-ID: OTllMzJlZDY4MTZlY2VkMGU2MjFiMmQ2MDFhNWFhNWY.
CSeq: 2 INVITE
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
Content-Type: application/sdp
Supported: replaces, norefersub, extended-refer, timer, X-cisco-serviceuri
User-Agent: Z 3.3.25608 r25552
Authorization: Digest username=“test_phone_random1”,realm=“asterisk”,nonce=“55808370”,uri="sip:2600@127.0.0.1;transport=UDP",response=“b6a1de090e96034a42e2aac1f3514918”,algorithm=MD5
Allow-Events: presence, kpml
Content-Length: 244

v=0
o=Z 0 0 IN IP4 112.134.42.204
s=Z
c=IN IP4 112.134.42.204
t=0 0
m=audio 46470 RTP/AVP 3 110 8 0 98 101
a=rtpmap:110 speex/8000
a=rtpmap:98 iLBC/8000
a=fmtp:98 mode=20
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
<------------->
— (15 headers 12 lines) —
Sending to 127.0.0.1:5080 (NAT)
Using INVITE request as basis request - OTllMzJlZDY4MTZlY2VkMGU2MjFiMmQ2MDFhNWFhNWY.
Found peer ‘test_phone_random1’ for ‘test_phone_random1’ from 127.0.0.1:5080
Found RTP audio format 3
Found RTP audio format 110
Found RTP audio format 8
Found RTP audio format 0
Found RTP audio format 98
Found RTP audio format 101
Found audio description format speex for ID 110
Found audio description format iLBC for ID 98
Found audio description format telephone-event for ID 101
Capabilities: us - (ulaw|alaw|gsm|h263), peer - audio=(ulaw|gsm|alaw|ilbc|speex)/video=(nothing)/text=(nothing), combined - (ulaw|alaw|gsm)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
Peer audio RTP is at port 112.134.42.204:46470
Looking for 2600 in demo (domain 127.0.0.1)
sip_route_dump: route/path hop: sip:test_phone_random1@112.134.42.204:46800;transport=UDP

<— Transmitting (NAT) to 127.0.0.1:5080 —>
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 112.134.42.204:46800;branch=z9hG4bK-d8754z-094c652bb54cfe71-1—d8754z-;received=127.0.0.1;rport=5080
From: sip:test_phone_random1@127.0.0.1;transport=UDP;tag=d498316e
To: sip:2600@127.0.0.1;transport=UDP
Call-ID: OTllMzJlZDY4MTZlY2VkMGU2MjFiMmQ2MDFhNWFhNWY.
CSeq: 2 INVITE
Server: Asterisk PBX 13.7.2
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Session-Expires: 1800;refresher=uas
Contact: sip:2600@127.0.0.1:5060
Content-Length: 0

<------------>
Really destroying SIP dialog ‘ZTYzZmRiM2NlM2MwODRjNDgxMTlkYzU5MmRlMDc2OWI.’ Method: ACK
[Feb 17 15:57:36] WARNING[9016]: chan_iax2.c:3572 __attempt_transmit: Max retries exceeded to host 127.0.0.1 on IAX2/demo-15871 (type = 6, subclass = 1, ts=19, seqno=0)
Scheduling destruction of SIP dialog ‘OTllMzJlZDY4MTZlY2VkMGU2MjFiMmQ2MDFhNWFhNWY.’ in 32000 ms (Method: INVITE)

<— Reliably Transmitting (NAT) to 127.0.0.1:5080 —>
SIP/2.0 502 Bad Gateway
Via: SIP/2.0/UDP 112.134.42.204:46800;branch=z9hG4bK-d8754z-094c652bb54cfe71-1—d8754z-;received=127.0.0.1;rport=5080
From: sip:test_phone_random1@127.0.0.1;transport=UDP;tag=d498316e
To: sip:2600@127.0.0.1;transport=UDP;tag=as07f337be
Call-ID: OTllMzJlZDY4MTZlY2VkMGU2MjFiMmQ2MDFhNWFhNWY.
CSeq: 2 INVITE
Server: Asterisk PBX 13.7.2
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Session-Expires: 1800;refresher=uas
Content-Length: 0

<------------>

<— SIP read from UDP:127.0.0.1:5080 —>
ACK sip:2600@127.0.0.1;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 112.134.42.204:46800;branch=z9hG4bK-d8754z-094c652bb54cfe71-1—d8754z-
Max-Forwards: 70
To: sip:2600@127.0.0.1;transport=UDP;tag=as07f337be
From: sip:test_phone_random1@127.0.0.1;transport=UDP;tag=d498316e
Call-ID: OTllMzJlZDY4MTZlY2VkMGU2MjFiMmQ2MDFhNWFhNWY.
CSeq: 2 ACK
Content-Length: 0

<------------->
— (8 headers 0 lines) —

<— SIP read from UDP:127.0.0.1:5080 —>
PUBLISH sip:test_phone_random1@127.0.0.1;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 112.134.42.204:46800;branch=z9hG4bK-d8754z-4d0166ad1ed2ce9f-1—d8754z-
Max-Forwards: 70
Contact: sip:test_phone_random1@112.134.42.204:46800;transport=UDP
To: sip:test_phone_random1@127.0.0.1;transport=UDP
From: sip:test_phone_random1@127.0.0.1;transport=UDP;tag=90c57c1b
Call-ID: YTAxZDEzZTZiNzJiNmU2MjNkNjBjMTM0NTE5NjNmNDY.
CSeq: 1 PUBLISH
Expires: 600
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
Content-Type: application/pidf+xml
Supported: replaces, norefersub, extended-refer, timer, X-cisco-serviceuri
User-Agent: Z 3.3.25608 r25552
Event: presence
Allow-Events: presence, kpml
Content-Length: 285

<?xml version="1.0" encoding="UTF-8"?>

open Online

<------------->
— (16 headers 3 lines) —
Sending to 127.0.0.1:5080 (NAT)

<— Transmitting (NAT) to 127.0.0.1:5080 —>
SIP/2.0 489 Bad Event
Via: SIP/2.0/UDP 112.134.42.204:46800;branch=z9hG4bK-d8754z-4d0166ad1ed2ce9f-1—d8754z-;received=127.0.0.1;rport=5080
From: sip:test_phone_random1@127.0.0.1;transport=UDP;tag=90c57c1b
To: sip:test_phone_random1@127.0.0.1;transport=UDP;tag=as5c419d1e
Call-ID: YTAxZDEzZTZiNzJiNmU2MjNkNjBjMTM0NTE5NjNmNDY.
CSeq: 1 PUBLISH
Server: Asterisk PBX 13.7.2
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0

<------------>
Really destroying SIP dialog ‘YTAxZDEzZTZiNzJiNmU2MjNkNjBjMTM0NTE5NjNmNDY.’ Method: PUBLISH

<— SIP read from UDP:127.0.0.1:5080 —>
SUBSCRIBE sip:test_phone_random1@127.0.0.1;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 112.134.42.204:46800;branch=z9hG4bK-d8754z-06c85a9b3599e6fc-1—d8754z-
Max-Forwards: 70
Contact: sip:test_phone_random1@112.134.42.204:46800;transport=UDP
To: sip:test_phone_random1@127.0.0.1;transport=UDP
From: sip:test_phone_random1@127.0.0.1;transport=UDP;tag=7c2e665d
Call-ID: ZjQ3MzJmZWQzM2U1YzgzNmI1NWMxY2FmYmQ4ODRlYTE.
CSeq: 1 SUBSCRIBE
Expires: 600
Accept: application/watcherinfo+xml
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
Supported: replaces, norefersub, extended-refer, timer, X-cisco-serviceuri
User-Agent: Z 3.3.25608 r25552
Event: presence.winfo
Allow-Events: presence, kpml
Content-Length: 0

<------------->
— (16 headers 0 lines) —
Sending to 127.0.0.1:5080 (NAT)
Creating new subscription
Sending to 127.0.0.1:5080 (NAT)
sip_route_dump: route/path hop: sip:test_phone_random1@112.134.42.204:46800;transport=UDP
Found peer ‘test_phone_random1’ for ‘test_phone_random1’ from 127.0.0.1:5080

<— Transmitting (NAT) to 127.0.0.1:5080 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 112.134.42.204:46800;branch=z9hG4bK-d8754z-06c85a9b3599e6fc-1—d8754z-;received=127.0.0.1;rport=5080
From: sip:test_phone_random1@127.0.0.1;transport=UDP;tag=7c2e665d
To: sip:test_phone_random1@127.0.0.1;transport=UDP;tag=as77b28b39
Call-ID: ZjQ3MzJmZWQzM2U1YzgzNmI1NWMxY2FmYmQ4ODRlYTE.
CSeq: 1 SUBSCRIBE
Server: Asterisk PBX 13.7.2
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce="69176b3c"
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘ZjQ3MzJmZWQzM2U1YzgzNmI1NWMxY2FmYmQ4ODRlYTE.’ in 32000 ms (Method: SUBSCRIBE)

<— SIP read from UDP:127.0.0.1:5080 —>
SUBSCRIBE sip:test_phone_random1@127.0.0.1;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 112.134.42.204:46800;branch=z9hG4bK-d8754z-8f84146ea6db90ff-1—d8754z-
Max-Forwards: 70
Contact: sip:test_phone_random1@112.134.42.204:46800;transport=UDP
To: sip:test_phone_random1@127.0.0.1;transport=UDP
From: sip:test_phone_random1@127.0.0.1;transport=UDP;tag=7c2e665d
Call-ID: ZjQ3MzJmZWQzM2U1YzgzNmI1NWMxY2FmYmQ4ODRlYTE.
CSeq: 2 SUBSCRIBE
Expires: 600
Accept: application/watcherinfo+xml
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
Supported: replaces, norefersub, extended-refer, timer, X-cisco-serviceuri
User-Agent: Z 3.3.25608 r25552
Authorization: Digest username=“test_phone_random1”,realm=“asterisk”,nonce=“69176b3c”,uri="sip:test_phone_random1@127.0.0.1;transport=UDP",response=“ed19306a02e75f22ba87f39ed3b82ef7”,algorithm=MD5
Event: presence.winfo
Allow-Events: presence, kpml
Content-Length: 0

<------------->
— (17 headers 0 lines) —
Creating new subscription
Sending to 127.0.0.1:5080 (NAT)
Found peer ‘test_phone_random1’ for ‘test_phone_random1’ from 127.0.0.1:5080

<— Transmitting (NAT) to 127.0.0.1:5080 —>
SIP/2.0 489 Bad Event
Via: SIP/2.0/UDP 112.134.42.204:46800;branch=z9hG4bK-d8754z-8f84146ea6db90ff-1—d8754z-;received=127.0.0.1;rport=5080
From: sip:test_phone_random1@127.0.0.1;transport=UDP;tag=7c2e665d
To: sip:test_phone_random1@127.0.0.1;transport=UDP;tag=as77b28b39
Call-ID: ZjQ3MzJmZWQzM2U1YzgzNmI1NWMxY2FmYmQ4ODRlYTE.
CSeq: 2 SUBSCRIBE
Server: Asterisk PBX 13.7.2
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0

<------------>
Really destroying SIP dialog ‘ZjQ3MzJmZWQzM2U1YzgzNmI1NWMxY2FmYmQ4ODRlYTE.’ Method: SUBSCRIBE
laptop*CLI>

In your original post you had pbx.digium.com as part of your gateway, you since replaced it with 127.0.0.1 in your next post. However in your first post for iax configuration you had the host line,

host=216.207.245.47

So I was asking why you had used domain in one line, but then IP in the other.

As I mentioned earlier I fallowed the document mentioned, without changing anything that is not mentioned since I a newby and had no good understanding of the configurations.

Later I changed both to refer to 127.0.0.1 since both are running on local host.

Were you able to identify root cause from the debug logs?

My goal is to setup a simple local PBX for the moment, if you can point me to another working document it is also fine.

OK i get it now. Even though both are running on localhost, you are testing with a remote server (pbx.digium.com).

Put the domain name back … and make sure that from the server you can ping that domain name, ie. your internet access and your DNS are set properly.

Also, first try putting up two SIP clients, and having then make a call between them to test it without having to worry about NAT, firewall, dns, internet or anything outside of your network that may interfere.