ChanIsAvail setup

Good morning!
I need help…
I have two channels: one with dahdi and one with a voip provider (sip)
I would like this to happen: when someone calls dahdi channel asterisk verify that the other channel (sip) is free and then transfer that call to the sip channel, making free the dahdi channel.
I think that i have to use the chanisAvail application but i don’t know why it doesn’t work.
I searched on google and nothing…

Can anyone give me an example of what I would do ?

Thank you

It sounds like you’re trying to keep track of the number of channels that are currently communicating with some provider, and, if there are n channels communicating with that provider, fall-back to a secondary. Is that correct?

If so, you’d want to use the GROUP family of functions:

  • GROUP to set a group on a channel

  • GROUP_COUNT to get the number of channels in a group

The strategy is basically:

  1. Have a group per provider. Using GROUP_COUNT, check to see if your primary provider has fewer than n members in its group. If so, set the GROUP on the current channel to that provider and proceed on.

  2. If the GROUP_COUNT of the primary provider is already at n, check the next provider in the same fashion, and set the GROUP on the current channel to that provider if it is usable.

Rinse & repeat for as many providers as you want.

Hi! I searched a lot of examples but i can’t do it…
Can you write here an example code please?
Thank you


exten => _X,1,Set(GROUP(MyGroup)=${EXTEN})
 same =>    n,GotoIf($[${GROUP_COUNT(${EXTEN}@MyGroup)} >= 2]?BUSY)

This would return a busy if you have more than 1 call.

1 Like

It up to here I was successful.
My problem is how to forward the call from the channel (dahdi) where i received the call to another channel (cheapvoip)?

Thank you really much


I assume you mean redirect, rather than just relay.

Digital DAHDI cannot do that. For Analogue DAHDI, you need to find the procedure required by your network operator. Hopefully it is a a combination of hook flash, and DTMF.

For analogue DAHDI, you must answer the call.

PSTN operators will typically charge for the redirected leg as though you had relayed the call.

1 Like