Asterisk Bash ami script.

| June 25th, 2009

I have been trying to get appconference/appkonference to work on video with my cisco call manager and have miserably failed time and again, on audio appconference is a dream, but i just cant figure how to get vad ( Voice activity detection, [atleast that's what i think it is]) , anyways looking here and there somehow i landed on to the asterisk manager interface, figured might as well learn something from this. so here is a little bash script, which reloads asterisk, checks out your dialplan and then logs off.It might be useful for those trying to connect to the ami using bash and /dev/tcp — remember, bash has to be compiled using –enable-net-redirections for this script to work. also notice the difference in /r’s and the /n’s , if any bash guru could help me figure out , why it only works in this manner, it would be of great help.

#!/bin/bash
exec 3<>/dev/tcp/localhost/5038;
echo -e “Action: Login\r”>&3;
echo -e “Username: mark\r”>&3;
echo -e “Secret: mysecret\r\n\r\n”>&3;
echo -e “Events: on\r”>&3
echo -e “Action: command\r”>&3
echo -e “Command: module reload\r\n\r”>&3
echo -e “Action: command\r”>&3
echo -e “Command: show dialplan\r\n\r”>&3
echo -e “Action: Logoff\r\n\r”>&3
cat <&3

One Response to “Asterisk Bash ami script.”

  1. shivlu jain Says:

    nice script

Leave a Reply