On Wed, Aug 30, 2006 at 09:15:56PM -0700, Steve Edwards wrote:
> If you meant "can Asterisk read a series of commands from a file" the
> answer is no, but something like the following may do:
>
> cat batch-file\
> | awk '{printf "/usr/sbin/asterisk -r -x \"%s\"\n", $0}'\
> | sh
This is very slow.
A faster option is to use socat and write the commands directly to the
Asterisk socket.
#!/bin/sh
while read line
do
echo -n "$line"
sleep 0.001
done \
| socat STDIN UNIX-CONNECT:/var/run/asterisk/asterisk.ctl
The short sleep is only needed to guarantee that every line is written
in a separate write() call .
It will not print any output from any command, though, or even report an
error. And you'll have to end your "programs" with a "quit" line.
With some more tweaking one would get a #!-executable...
--
Tzafrir Cohen sip:[EMAIL PROTECTED]
icq#16849755 iax:[EMAIL PROTECTED]
+972-50-7952406 jabber:[EMAIL PROTECTED]
[EMAIL PROTECTED] http://www.xorcom.com
_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users