Filter based on command 'core show hints' (SOLVED!)

Hello People,

Has anybody got an idea or AGI script to get the following to work;

  1. A call is placed to an extension

  2. With an external script check with the help of the command
    ’core show hints’ if a phonenumber is ‘InUse’

  3. Goto Busy tone IF ‘InUse’.

  4. Else Dial/SIP:extensions

Help is very appreciated

Hendrik van der Ploeg
The Netherlands

Hello People,

After thinking a bit and 1000 sleepless nights I solved the issue.
Finally I can force a busy tone!!!
Maybe the scripting code I use is a bit dirty, but remember I’m not a programmer :smiley:

At priority 2 I call a script where it sends the command ‘core show hints’ to the Asterisk console.
Doing some ‘grep’ commands and if the ‘result = yes’ then it should go to priority 5, if it’s ‘result = no’, then go to priority 4.


exten => _18XX,1,Ringing
exten => _18XX,2,AGI(|${EXTEN})
exten => _18XX,3,GotoIf($["${result}" = “yes”]?5) ;If result = yes go to 5 else 4
exten => _18XX,4,Dial(SIP/${EXTEN})
exten => _18XX,5,Busy


if [ “/usr/sbin/asterisk -r -x "core show hints" |grep "$1" |grep -o InUse” == “InUse” ]; then
echo SET VARIABLE result yes
echo SET VARIABLE result no

Best regards,

Hendrik van der Ploeg
The Netherlands