Hello People,
Has anybody got an idea or AGI script to get the following to work;
-
A call is placed to an extension
-
With an external script check with the help of the command
’core show hints’ if a phonenumber is ‘InUse’
-
Goto Busy tone IF ‘InUse’.
-
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
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.
Voilaaaa,
[context]
exten => _18XX,1,Ringing
exten => _18XX,2,AGI(busydetect.sh|${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
busydetect.sh:
#!/bin/sh
if [ “/usr/sbin/asterisk -r -x "core show hints" |grep "$1" |grep -o InUse
” == “InUse” ]; then
echo SET VARIABLE result yes
else
echo SET VARIABLE result no
fi
Best regards,
Hendrik van der Ploeg
The Netherlands