Two Asterisk connected problem

Hi, I’m new to Asterisk so I’m running several tests in order to learn. Right now I have 2 Asterisk’s connected through IAX2, for example A and B. Server A is connected to the PSTN through an E1 card. The extensions in A can reach extensions in B and vice versa and besides extensions in A can call to external phones through the PSTN. So far so good. The problem is that extensions in B can’t access to the PSTN, I don’t know how to do that. Can anybody help me please??? Thanks in advance.

BR.

Show us what you have tried and we will try to explain where you went wrong.

In Server A I have:

dahdi-channels.conf:

; Span 1: WCT1/0 "Wildcard TE121 Card 0"
group=0,11
context=bestel
switchtype = euroisdn
signalling = mfcr2
channel => 1-15,17-31

chan_dahdi.conf:

;spanmap => 1,1,1
;spanmap => 2,1,2
;spanmap => 3,1,3
;spanmap => 4,1,4

[channels]
usecallerid=yes
context=bestel
group=11
echocancel=yes
signalling=mfcr2
mfcr2_variant=mx
mfcr2_max_ani=10
mfcr2_max_dnis=4
mfcr2_category=national_subscriber
mfcr2_mfback_timeout=-1
mfcr2_metering_pulse_timeout=-1
channel=>1-15,17-31

In Server B I do:

exten_aditional.conf:

[celulares]
exten => _904[45]XXXXXXXXXX,1,Dial(DAHDI/g11/${EXTEN:1},60,T)
exten => _904[45]XXXXXXXXXX,n,Hangup()

chan_dahdi.conf:

;spanmap => 1,1,1
;spanmap => 2,1,2
;spanmap => 3,1,3
;spanmap => 4,1,4

[channels]
usecallerid=yes
context=bestel
group=11
echocancel=yes
signalling=mfcr2
mfcr2_variant=mx
mfcr2_max_ani=10
mfcr2_max_dnis=4
mfcr2_category=national_subscriber
mfcr2_mfback_timeout=-1
mfcr2_metering_pulse_timeout=-1
channel=>1-15,17-31

and here’s no dahdi-channels.conf file in this Server. When I dial an external number I get this:

== Using SIP RTP CoS mark 5
– Executing [9044##########@users:1] Dial(“SIP/6001-0000002a”, “DAHDI/g11/044##########,60,T”) in new stack
[Jan 6 13:51:56] WARNING[9455]: app_dial.c:2345 dial_exec_full: Unable to create channel of type ‘DAHDI’ (cause 0 - Unknown)
== Everyone is busy/congested at this time (1:0/0/1)
– Executing [9044##########@users:2] Hangup(“SIP/6001-0000002a”, “”) in new stack
== Spawn extension (users, 9044##########, 2) exited non-zero on ‘SIP/6001-0000002a’

I believe that I need to use the DAHDI channel on Server A but I don’t know how to…

You didn’t say you were using a GUI. The expertise here is on Asterisk itself. GUIs have large and complex dialplans, and you need to go to the support forum for the GUI for the expertise on how those work.

Sorry David but I’m not using any graphical, Asterisk A is running on CentOS and Asterisk B is running on Debian, both are managed through CLI…

extensions_additional.conf doesn’t exist in raw Asterisk, which is why I assume that your dialplan has been created by a GUI.

Are you possibly following instructions for a GUI, and putting your extensions in a file that isn’t actually included from extensions.conf, so is orphaned?

The other thing that made me assume a GUI is that you didn’t provide any dialplan for server A, but you would need it on both for this to work.

You need to Dial IAX/trunk-name/${EXTEN} on server B and have the IAX trunk on server A be in a context that includes Dial’s for DAHDI. (IAX might be IAX2. My experience is with SIP, but the principles are the same.)

sorry for the lack of information, my mistake…

I need to say that Server A is actually in production, is the one providing all telephony services for the company I work for. When I started to work for this company the Server was already working, so we could say that “comes with the job”. Server B was implemented by me for testing/learning purposes like I said.

about files, I created them manually, and they are included in extensions.conf (#include “exten_aditional.conf”)

here’s exten_aditional.conf in Server B:

[users]
exten => 6001,1,macro(userconmail,SIP,6001,user6001)
exten => 6002,1,macro(userconmail,SIP,6002,user6002)
include => features

[prueba]
exten => _60XX,1,NoOp(recibe: ${EXTEN})
exten => _60XX,n,Goto(users,${EXTEN},1)
include => desconocido

[privilegiado]
include => users
include => desconocido

[desconocido]
exten => _X.,1,Answer()
exten => _X.,n,Wait(0.5)
exten => _X.,n,Playback(invalid)
exten => _X.,n,Hangup()

[features]
exten => _3[0123]XX,1,Dial(IAX2/asteriskprueba@192.168.0.133/${EXTEN})
exten => _3[0123]XX,n,Hangup()
include => locales
include => nacionales
include => celulares
include => desconocido

[macro-userconmail]
exten => s,1,NoOp(Llamada en proceso ${CALLERID})
exten => s,n,GotoIf($["${DB(users/${ARG3}/DND)}" = “1”]?NOUNAVAIL)
exten => s,n,SET(LLAMADA=${ARG1}/${ARG2})
exten => s,n,Dial(${LLAMADA},30,Tt)
exten => s,n,NoOp(${DIALSTATUS})
exten => s,n,Gotoif($["${DIALSTATUS}" = “NOANSWER”]?PARAVOICE)
exten => s,n,Gotoif($["${DIALSTATUS}" = “CHANUNAVAIL”]?PARAVOICE)
exten => s,n,Gotoif($["${DIALSTATUS}" = “CONGESTION”]?NOUNAVAIL)
exten => s,n,Gotoif($["${DIALSTATUS}" = “CANCEL”]?HANGUP)
exten => s,n,Gotoif($["${DIALSTATUS}" = “BUSY”]?PARAVOICE)
exten => s,n(PARAVOICE),Voicemail(${ARG2}@default)
exten => s,n,Hangup()
exten => s,n(NOUNAVAIL),Answer()
exten => s,n,Wait(0.5)
exten => s,n,Playback(no_existe)
exten => s,n,Hangup()
exten => s,n(HANGUP),Hangup()

[locales]
exten => _9[12486]XXXXXX,1,Dial(DAHDI/g11/${EXTEN:1},60,T)
exten => _9[12486]XXXXXX,n,Hangup()

[nacionales]
exten => _901XXXXXXXXXX,1,Dial(DAHDI/g11/${EXTEN:1},60,T)
exten => _901XXXXXXXXXX,n,Hangup()

[celulares]
exten => _904[45]XXXXXXXXXX,1,Dial(DAHDI/g11/${EXTEN:1},60,T)
exten => _904[45]XXXXXXXXXX,n,Hangup()

dialplan in Server A is more complex and too big, so the parts I think we could be interested are:

[users]
.
.
.
exten => _60XX,1,Dial(IAX2/asteriskprueba/${EXTEN})

[prueba]
exten => _60XX,1,Dial(IAX2/asteriskprueba,50,tT)
exten => _60XX,n,Hangup()
exten => _3[0123]XX,1,Goto(users,${EXTEN},1)
exten => _901XXXXXXXXXX,1,Dial(DAHDI/g11/${EXTEN:1},60,T)
exten => _901XXXXXXXXXX,n,Hangup()
exten => _9[12486]XXXXXX,1,Dial(DAHDI/g11/${EXTEN:1},60,T)
exten => _9[12486]XXXXXX,n,Hangup()

[nacionales]
exten => _901XXXXXXXXXX,1,Dial(DAHDI/g11/${EXTEN:1},60,T)
exten => _901XXXXXXXXXX,n,Hangup()

[locales]
exten => _9[12486]XXXXXX,1,Dial(DAHDI/g11/${EXTEN:1},60,T)
exten => _9[12486]XXXXXX,n,Hangup()

[celulares]
exten => _904[45]XXXXXXXXXX,1,Dial(DAHDI/g11/${EXTEN:1},60,T)
exten => _904[45]XXXXXXXXXX,n,Hangup()

I keep thinking that the solution is to link Dahdi cahnnels on Server A to Server B, but I don’t know how to do that.

Here’s where I think the problem is:

[Jan 7 11:49:00] WARNING[9819]: app_dial.c:2345 dial_exec_full: Unable to create channel of type ‘DAHDI’ (cause 0 - Unknown)

Delete all the contexts on server B, which contain DAHDI, as you say there are no DAHDI interfaces on server B. Replece them with code similar to that which you use for the pattern _3[0123]XX.

You will still need an extensions.conf on server B that include extension_additonal.conf, but I assume, from the logs that you do have one.

Make sure that contexts containing every number you want to call from server B are in, or included from the context associated with the iax.conf entry for the link to server B, the configuration for which you do not seem to have provided.

hello, I already did what you suggested, and I think we’ve made some progresses. Now when I call to an external phone from Server B I receive “invalid extension” audio. Here are the logs of Server A and B when I dial the external number:

Server A:

  • Accepting AUTHENTICATED call from 192.168.0.162:
    > requested format = gsm,
    > requested prefs = (),
    > actual format = gsm,
    > host prefs = (gsm|g729|ulaw|alaw),
    > priority = mine
    – Executing [1371391@prueba:1] Answer(“IAX2/asteriskprueba-8102”, “”) in new stack
    – Executing [1371391@prueba:2] Wait(“IAX2/asteriskprueba-8102”, “0.5”) in new stack
    – Executing [1371391@prueba:3] Playback(“IAX2/asteriskprueba-8102”, “invalid”) in new stack
    – <IAX2/asteriskprueba-8102> Playing ‘invalid.gsm’ (language ‘es’)
    – Executing [1371391@prueba:4] Hangup(“IAX2/asteriskprueba-8102”, “”) in new stack
    == Spawn extension (prueba, 1371391, 4) exited non-zero on ‘IAX2/asteriskprueba-8102’
    – Hungup ‘IAX2/asteriskprueba-8102’

Server B:

== Using SIP RTP CoS mark 5
– Executing [91371391@users:1] Dial(“SIP/6001-00000042”, “IAX2/asteriskprueba@192.168.0.133/1371391,60,T”) in new stack
– Called IAX2/asteriskprueba@192.168.0.133/1371391
– Call accepted by 192.168.0.133 (format gsm)
– Format for call is gsm
– IAX2/192.168.0.133:4569-11187 answered SIP/6001-00000042
– Hungup ‘IAX2/192.168.0.133:4569-11187’
== Spawn extension (users, 91371391, 1) exited non-zero on ‘SIP/6001-00000042’

and here are the configurations of “exten_aditional.conf” file from Server A and B (the codes related to this issue):

Server A:

[prueba]
exten => _60XX,1,Dial(IAX2/asteriskprueba,50,tT)
exten => _60XX,n,Hangup()
exten => _3[0123]XX,1,Goto(users,${EXTEN},1)
include => locales
include => nacionales
include => celulares
include => desconocido

[locales]
exten => _9[12486]XXXXXX,1,Dial(DAHDI/g11/${EXTEN:1},60,T)
exten => _9[12486]XXXXXX,n,Hangup()

[celulares]
exten => _904[45]XXXXXXXXXX,1,Dial(DAHDI/g11/${EXTEN:1},60,T)
exten => _904[45]XXXXXXXXXX,n,Hangup()

[nacionales]
exten => _901XXXXXXXXXX,1,Dial(DAHDI/g11/${EXTEN:1},60,T)
exten => _901XXXXXXXXXX,n,Hangup()

Server B:

[users]
exten => 6001,1,macro(userconmail,SIP,6001,user6001)
exten => 6002,1,macro(userconmail,SIP,6002,user6002)
include => features

[prueba]
exten => _60XX,1,NoOp(recibe: ${EXTEN})
exten => _60XX,n,Goto(users,${EXTEN},1)
include => desconocido

[privilegiado]
include => users
include => desconocido

[desconocido]
exten => _X.,1,Answer()
exten => _X.,n,Wait(0.5)
exten => _X.,n,Playback(invalid)
exten => _X.,n,Hangup()

[features]
exten => _3[0123]XX,1,Dial(IAX2/asteriskprueba@192.168.0.133/${EXTEN})
exten => _3[0123]XX,n,Hangup()
include => locales
include => nacionales
include => celulares
include => desconocido

[locales]
exten => _9[12486]XXXXXX,1,Dial(IAX2/asteriskprueba@192.168.0.133/${EXTEN:1},60,T)
exten => _9[12486]XXXXXX,n,Hangup()

[nacionales]
exten => _901XXXXXXXXXX,1,Dial(IAX2/asteriskprueba@192.168.0.133/${EXTEN:1},60,T)
exten => _901XXXXXXXXXX,n,Hangup()

[celulares]
exten => _904[45]XXXXXXXXXX,1,Dial(IAX2/asteriskprueba@192.168.0.133/${EXTEN:1},60,T)
exten => _904[45]XXXXXXXXXX,n,Hangup()

Any more ideas???..

You would nor normally include @192.168… and you have no entry in your users context that would match an extension containing that. Although it might be possible to construct a dialplan that worked with that, I’ve never heard of anyone doing it.

Also you provided two copies of the log from one machine.

Sorry for the duplicity…

log from Server A is:

-Accepting AUTHENTICATED call from 192.168.0.162:
> requested format = gsm,
> requested prefs = (),
> actual format = gsm,
> host prefs = (gsm|g729|ulaw|alaw),
> priority = mine
– Executing [1371391@prueba:1] Answer(“IAX2/asteriskprueba-8102”, “”) in new stack
– Executing [1371391@prueba:2] Wait(“IAX2/asteriskprueba-8102”, “0.5”) in new stack
– Executing [1371391@prueba:3] Playback(“IAX2/asteriskprueba-8102”, “invalid”) in new stack
– <IAX2/asteriskprueba-8102> Playing ‘invalid.gsm’ (language ‘es’)
– Executing [1371391@prueba:4] Hangup(“IAX2/asteriskprueba-8102”, “”) in new stack
== Spawn extension (prueba, 1371391, 4) exited non-zero on ‘IAX2/asteriskprueba-8102’
– Hungup ‘IAX2/asteriskprueba-8102’

about users context I have include => features and in features context I have extensions.

I’ll keep trying. Thanks a lot!!!

Hi, I’m trying to look into Asterisk’s log file (/var/log/messages) to see if I can find the problem but shows nothing… there’s no log…
Also when I do: nano /var/log/asterisk/messages the file is empty…

do you know why???

I’m trying to see log from Server A

log from Server B is ok

try issuing a ‘logger rotate’ in the console and see if that starts your logging back up.

Thank you very much friends!! “logger reload” did the job…

I’m still struggling with my original problem…any more ideas??

BR.

What are your context= and peercontext= settings in iax.conf?
You want server B to enter the prueba context on server A when it calls. Since prueba context on server A includes locales, nacionales, cellulares and desconocido contexts, that should get you what you need.

On server B, you don’t want to call ${EXTEN:1} on server A because you’re stripping off the first digit (9) which means the EXTEN in server A would no longer match
exten => _9[12486]XXXXXX,1,Dial(DAHDI/g11/${EXTEN:1},60,T)
or
exten => _904[45]XXXXXXXXXX,1,Dial(DAHDI/g11/${EXTEN:1},60,T)
or
exten => _901XXXXXXXXXX,1,Dial(DAHDI/g11/${EXTEN:1},60,T)

I believe you should be passing the ${EXTEN} from server B to server A so the pattern matching on server A would be the same as if the number were dialed from server A.