Forwarding Call If Extension Busy

Home » Asterisk Users » Forwarding Call If Extension Busy
Asterisk Users 5 Comments

Hi and happy new year!

My question:

– two extensions: 1111 and 2222
– an active call on 1111
incoming calls to 1111 should be forwarded to 1111 (call advice!) and 2222

I know how can I forward an incoming call to more than an extension,
but I have no idea how can I get the information, that 1111 has
already an active call…

I think, I need something like:

exten => _2222,1,Verbose(2,Incoming call for 2222 – [${CALLERID(num)}])
exten => _2222,n,GotoIf( ?busy)
exten => _2222,n,Dial(SIP/2222,19,RcxX)
exten => _2222,n,VoiceMail(2222,us)
exten => _2222,n,Hangup exten => _2222(busy),n,Dial(SIP/2222&SIP/1111,19,RcxX)
exten => _2222,n,VoiceMail(2222,us)
exten => _2222,n,Hangup

Well, the problem is the second line, of course…

Of course the extension 2222 is NOT “really busy”, since the phone can
support more active channels, but I hope I explained my problem…

Any suggestion?

Thanks Luca Bertoncello
(lucabert@lucabert.de)

5 thoughts on - Forwarding Call If Extension Busy

  • asterisk-users-bounces@lists.digium.com wrote on 01/04/2016 08:55:40 AM:

    2222

    I am not sure if I completely understand what you are trying to do, but it sounds like you want to query the DEVICE_STATE function.

    For instance, my customer service department has this thing against ever having their phone ring a call while they are already on a call, so for these special little snowflakes, I have the following line:

    same => n(voice),GotoIf($[“${DEVICE_STATE(sip/${EXTEN})}” !”NOT_INUSE”]?voicebusy)

    Basically, this little line looks at the extension and if it shows anything other than free (NOT_INUSE), it jumps to the voicebusy line in the dialplan. The voicebusy line just hits voicemail directly.

    You can use this same idea to branch your logic and handle a variety of situations. In my case, I only want to actually perform the dial if the phone is currently not in use, so my logic was fairly simple.

    See here for reference:
    https://wiki.asterisk.org/wiki/display/AST/Device+State

  • There may not be a general solution as the end points can accept more than a single call themselves as described by yourself, i.e. the phone may not be in a busy state unless the max. number of calls has been reached or a call has been actively rejected. In that case you might put another Dial just after the first Dial application. If there is still no answer, VoiceMail gets called.

    You need to configure your phone to accept only a single call. Another approach would be to check from within Asterisk whether a particular endpoint has already active calls and Dial() as required, i.e. one would delete the phones with active calls from a given list. Since there is no real “busy” condition, this seems to be a cleaner approach.

    At first you should be able to describe exactly which behavior you want.

    jg

  • Zitat von Kevin Larsen :

    Hi Kevin

    I think, this is EXACTLY what I’m looking for…

    I’ll try this evening!

    Thanks Luca Bertoncello
    (lucabert@lucabert.de)

  • Kevin Larsen schrieb:

    IT WORKS!!!!

    Thank you very much!

    Luca Bertoncello
    (lucabert@lucabert.de)