[asterisk-users] Reading/Writing the Astdb

Tzafrir Cohen tzafrir.cohen at xorcom.com
Mon Jan 26 22:52:06 CST 2009


On Mon, Jan 26, 2009 at 06:31:30PM -0800, Steve Edwards wrote:
> On Mon, 26 Jan 2009, cbbs70a at hotmail.com wrote:
> 
> >   That's a really good idea, however, I am having problems getting it to work. I tried the following:
> >
> > echo -n "asterisk -rx \"database put FOO BAR 1\" " | socat - /var/run/asterisk/asterisk.ctl
> >
> > and
> >
> > echo -n "asterisk -rx \"database put FOO BAR 1\" " | socat - UNIX-CONNECT: /var/run/asterisk/asterisk.ctl
> 
> echo -n "show channels"\
>  	| sudo socat STDIO UNIX-CONNECT:/var/run/asterisk.ctl
> 
> and
> 
> echo -n "show channels"\
>  	| sudo socat STDIO /var/run/asterisk.ctl

For a loop, though, you'll have to make sure each command is sent in its
own separate call to write() . The way I used was to put a 'sleep 0.001'
after each command.

Also note that you don't get the output of the command, nor is there any
error handling.

-- 
               Tzafrir Cohen
icq#16849755              jabber:tzafrir.cohen at xorcom.com
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com
http://www.xorcom.com  iax:guest at local.xorcom.com/tzafrir



More information about the asterisk-users mailing list