Asterisk auto dial not working

I am new to Asterisk use.

I am trying to auto dial out from one asterisk(A2) server to another asterisk(A1) server which inturn should dial a external sip device(S1).

A1 acts as a bridge between A2 and S1.
A2 has A1, anonymous configured in sip.conf
A1 has A2,S1 configured in sip.conf

call1.call is the simple auto dial file written using examples found on internet.

Channel: SIP/asterisk1/9001
Application: Playback
Data: hello-world

sip.conf in A2 as below:

[asterisk1]
type=friend
host=192.168.1.239
context=from-internal
insecure=invite
allow=all

[anonymous]
type=friend
host=dynamic
allowguest=yes
context=from-internal
allow=all

extension.conf in A2 as below:

[from-internal]

exten = 10000,1,NoOp(“Call tried in auto dial”)
exten = 10000,2,Answer()
exten = 10000,3,Playback(vm-goodbye)
exten = 10000,4,Hangup()

pjsip.conf in A2 as below:

[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0

[anonymous]
type=endpoint
context=from-internal
disallow=all
allow=ulaw
transport=transport-udp

sip.conf in A1 as below:

[asterisk2]
type=friend
host=192.168.0.180
context=from-internal
insecure=invite
allow=all

[9001]
type=friend
host=dynamic
secret=password
allowguest=yes
context=from-internal
allow=all

extension.conf in A1 as below:
[from-internal]
exten = _9XXX,1,NoOp(“Received a call from other asterisk”)
same = n,NoOp(${CALLERID(num)})
same = n,Dial(SIP/${EXTEN})

asterisk console output

** – Attempting call on SIP/asterisk1/9001 for application Playback(hello-world) (Retry 1)
== Using SIP RTP CoS mark 5
We think we can do text
Audio is at 17680
Adding codec slin to SDP
Adding codec ulaw to SDP
Adding codec alaw to SDP
Adding codec gsm to SDP
Adding codec g723 to SDP
Adding codec g726 to SDP
Adding codec g726aal2 to SDP
Adding codec adpcm to SDP
Adding codec slin to SDP
Adding codec slin to SDP
Adding codec slin to SDP
Adding codec slin to SDP
Adding codec slin to SDP
Adding codec slin to SDP
Adding codec slin to SDP
Adding codec slin to SDP
Adding codec lpc10 to SDP
Adding codec g729 to SDP
Adding codec speex to SDP
Adding codec speex to SDP
Adding codec speex to SDP
Adding codec ilbc to SDP
Adding codec g722 to SDP
Adding codec siren7 to SDP
Adding codec siren14 to SDP
Adding codec testlaw to SDP
Adding codec g719 to SDP
Adding codec opus to SDP
Adding codec silk to SDP
Adding codec silk to SDP
Adding codec silk to SDP
Adding codec silk to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to 192.168.1.239:5060:
INVITE sip:9001@192.168.1.239 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.180:5060;branch=z9hG4bK320676d4
Max-Forwards: 70
From: “Anonymous” sip:anonymous@anonymous.invalid;tag=as28d048c2
To: sip:9001@192.168.1.239
Contact: sip:anonymous@192.168.0.180:5060
Call-ID: 010f24793351c3866a64be64013b053f@192.168.0.180:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 14.2.1
Date: Fri, 10 Mar 2017 12:04:58 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 1096

v=0
o=root 1529497959 1529497959 IN IP4 192.168.0.180
s=Asterisk PBX 14.2.1
c=IN IP4 192.168.0.180
t=0 0
m=audio 17680 RTP/AVP 10 0 8 3 4 111 112 5 122 118 123 124 125 126 127 96 7 18 110 117 119 97 9 102 115 116 107 101
a=rtpmap:10 L16/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:4 G723/8000
a=fmtp:4 annexa=no
a=rtpmap:111 G726-32/8000
a=rtpmap:112 AAL2-G726-32/8000
a=rtpmap:5 DVI4/8000
a=rtpmap:122 L16/12000
a=rtpmap:118 L16/16000
a=rtpmap:123 L16/24000
a=rtpmap:124 L16/32000
a=rtpmap:125 L16/44000
a=rtpmap:126 L16/48000
a=rtpmap:127 L16/96000
a=rtpmap:96 L16/192000
a=rtpmap:7 LPC/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:110 speex/8000
a=rtpmap:117 speex/16000
a=rtpmap:119 speex/32000
a=rtpmap:97 iLBC/8000
a=fmtp:97 mode=20
a=rtpmap:9 G722/8000
a=rtpmap:102 G7221/16000
a=fmtp:102 bitrate=32000
a=rtpmap:115 G7221/32000
a=fmtp:115 bitrate=48000
a=rtpmap:116 G719/48000
a=fmtp:116 bitrate=64000
a=rtpmap:107 opus/48000/2
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=maxptime:20
a=sendrecv


[Mar 10 17:34:58] ERROR[27907]: chan_sip.c:4268 __sip_reliable_xmit: Serious Network Trouble; __sip_xmit returns error for pkt data
– Called asterisk1/9001
Scheduling destruction of SIP dialog ‘010f24793351c3866a64be64013b053f@192.168.0.180:5060’ in 32000 ms (Method: INVITE)
– SIP/asterisk1-0000003d is circuit-busy
Scheduling destruction of SIP dialog ‘010f24793351c3866a64be64013b053f@192.168.0.180:5060’ in 32000 ms (Method: INVITE)
[Mar 10 17:35:30] NOTICE[27905]: pbx_spool.c:413 attempt_thread: Call failed to go through, reason (8) Congestion (circuits busy)
[Mar 10 17:35:30] NOTICE[27905]: pbx_spool.c:416 attempt_thread: Queued call to SIP/asterisk1/9001 expired without completion after 0 attempts**

You can’t have both chan_sip and chan_pjsip bound to the same port number!

(Also, insecure=invite has no effect if there is no secret, type=friend is normally a bad choice, compared with type=peer, I’m not aware of the existence of a reserved device name of anonymous in sip.conf, and, as far as I’m aware, allowguest still must be in the general section.)

Still not working after the changes, had to include pjsip configurations as asterisk was throwing errors when no pjsip configurations were present.

The error seems to be like below for auto dial scenario

call failed to go through reason (8) congestion (circuits busy)

I don’t believe Asterisk will ever generate cause code 8 for SIP, as I don’t think there is any SIP response code that corresponds with ISDN Pre-emption.

Please, remove one of PJSIP and chan_sip, use a configuration that only uses the remaining one, and provide the protocol level debugging (sip set debug on, for chan_sip; there is an equivalent for pjsip).

Same result even after removing pjsip configuration.

localhostCLI> sip set debug on
SIP Debugging re-enabled
localhost
CLI> !clear
Scheduling destruction of SIP dialog ‘001af1576d86de1e75835fca78a3cb25@192.168.0.180:5060’ in 32000 ms (Method: INVITE)
– SIP/asterisk1-00000042 is circuit-busy
Scheduling destruction of SIP dialog ‘001af1576d86de1e75835fca78a3cb25@192.168.0.180:5060’ in 32000 ms (Method: INVITE)
[Mar 12 17:58:37] NOTICE[1543]: pbx_spool.c:413 attempt_thread: Call failed to go through, reason (8) Congestion (circuits busy)
[Mar 12 17:58:37] NOTICE[1543]: pbx_spool.c:416 attempt_thread: Queued call to SIP/asterisk1/9001 expired without completion after 0 attempts
– Attempting call on SIP/asterisk1/9001 for application Playback(hello-world) (Retry 1)
== Using SIP RTP CoS mark 5
We think we can do text
Audio is at 17718
Adding codec slin to SDP
Adding codec ulaw to SDP
Adding codec alaw to SDP
Adding codec gsm to SDP
Adding codec g723 to SDP
Adding codec g726 to SDP
Adding codec g726aal2 to SDP
Adding codec adpcm to SDP
Adding codec slin to SDP
Adding codec slin to SDP
Adding codec slin to SDP
Adding codec slin to SDP
Adding codec slin to SDP
Adding codec slin to SDP
Adding codec slin to SDP
Adding codec slin to SDP
Adding codec lpc10 to SDP
Adding codec g729 to SDP
Adding codec speex to SDP
Adding codec speex to SDP
Adding codec speex to SDP
Adding codec ilbc to SDP
Adding codec g722 to SDP
Adding codec siren7 to SDP
Adding codec siren14 to SDP
Adding codec testlaw to SDP
Adding codec g719 to SDP
Adding codec opus to SDP
Adding codec silk to SDP
Adding codec silk to SDP
Adding codec silk to SDP
Adding codec silk to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to 192.168.1.239:5060:
INVITE sip:9001@192.168.1.239 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.180:5060;branch=z9hG4bK7b873585
Max-Forwards: 70
From: “Anonymous” sip:anonymous@anonymous.invalid;tag=as27bf7832
To: sip:9001@192.168.1.239
Contact: sip:anonymous@192.168.0.180:5060
Call-ID: 1d624ae74142ac1700091d987e8b7cc7@192.168.0.180:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 14.2.1
Date: Sun, 12 Mar 2017 12:28:41 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 1096

v=0
o=root 1061081555 1061081555 IN IP4 192.168.0.180
s=Asterisk PBX 14.2.1
c=IN IP4 192.168.0.180
t=0 0
m=audio 17718 RTP/AVP 10 0 8 3 4 111 112 5 122 118 123 124 125 126 127 96 7 18 110 117 119 97 9 102 115 116 107 101
a=rtpmap:10 L16/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:4 G723/8000
a=fmtp:4 annexa=no
a=rtpmap:111 G726-32/8000
a=rtpmap:112 AAL2-G726-32/8000
a=rtpmap:5 DVI4/8000
a=rtpmap:122 L16/12000
a=rtpmap:118 L16/16000
a=rtpmap:123 L16/24000
a=rtpmap:124 L16/32000
a=rtpmap:125 L16/44000
a=rtpmap:126 L16/48000
a=rtpmap:127 L16/96000
a=rtpmap:96 L16/192000
a=rtpmap:7 LPC/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:110 speex/8000
a=rtpmap:117 speex/16000
a=rtpmap:119 speex/32000
a=rtpmap:97 iLBC/8000
a=fmtp:97 mode=20
a=rtpmap:9 G722/8000
a=rtpmap:102 G7221/16000
a=fmtp:102 bitrate=32000
a=rtpmap:115 G7221/32000
a=fmtp:115 bitrate=48000
a=rtpmap:116 G719/48000
a=fmtp:116 bitrate=64000
a=rtpmap:107 opus/48000/2
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=maxptime:20
a=sendrecv


[Mar 12 17:58:41] ERROR[1571]: chan_sip.c:4268 __sip_reliable_xmit: Serious Network Trouble; __sip_xmit returns error for pkt data
– Called asterisk1/9001
Really destroying SIP dialog ‘001af1576d86de1e75835fca78a3cb25@192.168.0.180:5060’ Method: INVITE
Scheduling destruction of SIP dialog ‘1d624ae74142ac1700091d987e8b7cc7@192.168.0.180:5060’ in 32000 ms (Method: INVITE)
SIP/asterisk1-00000043 is circuit-busy
Scheduling destruction of SIP dialog ‘1d624ae74142ac1700091d987e8b7cc7@192.168.0.180:5060’ in 32000 ms (Method: INVITE)
[Mar 12 17:59:13] NOTICE[1570]: pbx_spool.c:413 attempt_thread: Call failed to go through, reason (8) Congestion (circuits busy)
[Mar 12 17:59:13] NOTICE[1570]: pbx_spool.c:416 attempt_thread: Queued call to SIP/asterisk1/9001 expired without completion after 0 attempts
Really destroying SIP dialog ‘1d624ae74142ac1700091d987e8b7cc7@192.168.0.180:5060’ Method: INVITE

The message you highlighted is a secondary error. The more primary error is above. I am taking this to be the result of trying to bind both the SIP and PJ_SIP sockets to the same port number.

As said earlier I am new to asterisk use. I donot understand how chan_sip and chan_pjsip both got configured. Would be helpful if you could guide me how to change this. I am using asterisk 14.

localhost*CLI> module show like chan_sip.so
Module Description Use Count Status Support Level
chan_sip.so Session Initiation Protocol (SIP) 0 Not Running core
1 modules loaded

localhost*CLI> module show like chan_pjsip.so
Module Description Use Count Status Support Level
chan_pjsip.so PJSIP Channel Driver 0 Running core
1 modules loaded

From the CLI looks like only pjsip is loaded. This was teh status earlier too

Delete the configuration file. If that doesn’t work, add a noload for it in modules.conf.

[Mar 13 16:08:24] WARNING[30741][C-0000000c]: channel.c:6230 ast_request: No channel type registered for ‘SIP’
[Mar 13 16:08:24] WARNING[30741][C-0000000c]: app_dial.c:2530 dial_exec_full: Unable to create channel of type ‘SIP’ (cause 66 - Channel not implemented)

Now, I see PJSIP working fine. However there is still issue with auto dial basic test

call1.call file

Channel: PJSIP/asterisk2/9001
Application: Playback
Data: hello-world

-- Attempting call on PJSIP/asterisk2/9001 for application Playback(hello-world) (Retry 1)

[Mar 14 18:42:22] ERROR[8394]: res_pjsip.c:2887 ast_sip_create_dialog_uac: Could not create dialog to endpoint ‘asterisk2’ as URI ‘9001’ is not valid
[Mar 14 18:42:22] ERROR[8394]: chan_pjsip.c:2146 request: Failed to create outgoing session to endpoint ‘asterisk2’
[Mar 14 18:42:22] NOTICE[9810]: pbx_spool.c:413 attempt_thread: Call failed to go through, reason (0) Call Failure (not BUSY, and not NO_ANSWER, maybe Circuit busy or down?)
[Mar 14 18:42:22] NOTICE[9810]: pbx_spool.c:416 attempt_thread: Queued call to PJSIP/asterisk2/9001 expired without completion after 0 attempts

The format for PJSIP is PJSIP/9001@asterisk2

Thanks, now i can see in console that the call was attempted, whereas I have anonymous configured in the server. As per my service logic, I donot have the presence details of SIP user to configure in pjsip.conf. But i do have the callerid.
Can an outbound call be attempted from auto dial without having the endpoint configured in pjsip.conf.

-- Attempting call on PJSIP/9001/asterisk2 for application Playback(hello-world) (Retry 1)

[Mar 14 21:58:27] ERROR[8394]: chan_pjsip.c:2140 request: Unable to create PJSIP channel - endpoint ‘9001’ was not found
[Mar 14 21:58:27] NOTICE[12494]: pbx_spool.c:413 attempt_thread: Call failed to go through, reason (0) Call Failure (not BUSY, and not NO_ANSWER, maybe Circuit busy or down?)
[Mar 14 21:58:27] NOTICE[12494]: pbx_spool.c:416 attempt_thread: Queued call to PJSIP/9001/asterisk2 expired without completion after 0 attempts

No, you must specify an endpoint in the Dial line. It specifies the configuration to use for the session. How do you expect to send a call to a user if you don’t know where they are? Do you actually need it to go into the dialplan instead of doing a PJSIP call?

The role of asterisk1 is to auto dial using asterisk2 as trunk. Endpoint 9001 is configured in asterisk2. Can asterisk1 create a anonymous call with asterisk2 which inturns checks the endpoint in its database and places the INVITE towards 9001?

Try calling PJSIP/9001@asterisk2 and not PJSIP/9001/asterisk2 as you were previously trying to do.