Priority for outgoing calls

hello, I’m using a TE121 card with 30 digital channels for inbound and outbound calls in my Asterisk. Besides that I have 6 analog lines (two AEX410 cards), right now are not in use. I would like that all the outgoing calls use the analog lines as first option and in case the whole 6 are taken then start to use the digital channels. Here is part of my chan_dahdi.conf for better understanding:

[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

group=32
signalling=fxs_ks
context=lineone
callwaiting=no
transfer=yes
channel => 32

group=33
signalling=fxs_ks
callwaiting=no
context=linetwo
channel => 33

group=40
signalling=fxs_ks
callwaiting=no
context=linethree
channel => 34

group=35
signalling=fxs_ks
callwaiting=no
context=linefour
channel => 35

;group=40
;signalling=fxs_ks
;callwaiting=no
;context=linefive
;channel => 36

group=40
signalling=fxs_ks
callwaiting=no
context=linesix
channel => 37

group=40
signalling=fxs_ks
callwaiting=no
context=lineseven
channel => 38

group=40
signalling=fxs_ks
callwaiting=no
context=lineeight
channel => 39

is possible what I want to achieve??? a little help please ???

Thanks in advance.

Do your dial to a group (comprised of your analog lines - you need to put them in the same group), and then if that dial fails, do another dial using the group for your E1.

1 Like

thanks @malcolmd, actually some time ago when I tested the analog lines made a group for them and did dial to that group, but eventually I returned the dial to the E1. How can make what you suggest ?? by simply adding another dial to the context ?? something like this:

[locales]
exten => _9[12486]XXXXXX,1,Dial(DAHDI/g40/${EXTEN:1},60,T) ==> line added , g40 group for analog lines
exten => _9[12486]XXXXXX,1,Dial(DAHDI/g11/${EXTEN:1},60,T) ==> g11 E1 card
exten => _9[12486]XXXXXX,n,Hangup()

it would be right???

thanks a lot

I’d suggest using the GROUP and GROUP_COUNT functions to determine if you have an available channel before the dial

https://wiki.asterisk.org/wiki/display/AST/Function_GROUP

https://wiki.asterisk.org/wiki/display/AST/Function_GROUP_COUNT



same => n,GotoIf($[${GROUP_COUNT(ANALOG@CallCount)} >= 6]?PRI:ANALOG)
same => n(PRI),NoOP()
same => n,Set(GROUP(CallCount)=PRI)
same => n,Dial(DAHDI/G11/${EXTEN})
same => n,NoOP(PRI_CAUSE is ${PRI_CAUSE} - DIALSTATUS is ${DIALSTATUS} - HANGUPCAUSE is ${HANGUPCAUSE})
same => n,Hangup()
same => n(ANALOG),NoOP()
same => n,Set(GROUP(CallCount)=ANALOG)
same => n,Dial(DAHDI/G40/${EXTEN})
same => n,NoOP(PRI_CAUSE is ${PRI_CAUSE} - DIALSTATUS is ${DIALSTATUS} - HANGUPCAUSE is ${HANGUPCAUSE})
same => n,Hangup()

ok @johnkiniston, I’ll check the GROUP and GROUP_COUNT functions, but I must say both are totally new to me, so I’ll get back here if any doubt shows up…

thanks!!