Tzafrir Cohen
2005-Dec-22 12:01 UTC
[Asterisk-Users] ast_sock_cmd: pipe commands to asterisk
If you need to pipe commands to Asterisk without resorting to the manager interface (e.g: requiring a specific user, hard-wiring password or other authentication messure. After all: you're root of the machine and know better than that lousy Asterisk process), you may want to use the following. It is a simple C program to pipe commands to asterisk.ctl . It was written to help me and thus hardwires the path I use (/var/run/asterisk/asterisk.ctl ) , but I'd welcome any fixes for that. Usage: build with: make ast_sock_cmd example usage: echo -e "set verbose 3\nset debug 5" | ./ast_sock_cmd echo -e "restart now" | ./ast_sock_cmd I'd also be happy to know of existing alternatives. It looked strange I could not find such an existing tool to pipe text into a unix-domain socket. -- Tzafrir Cohen | tzafrir@jbr.cohens.org.il | VIM is http://tzafrir.org.il | | a Mutt's tzafrir@cohens.org.il | | best ICQ# 16849755 | | friend -------------- next part -------------- A non-text attachment was scrubbed... Name: ast_sock_cmd.c Type: text/x-csrc Size: 3037 bytes Desc: not available Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20051222/d720ae40/ast_sock_cmd.c
Tzafrir Cohen
2005-Dec-22 13:21 UTC
[Asterisk-Users] ast_sock_cmd: pipe commands to asterisk
On Thu, Dec 22, 2005 at 09:01:04PM +0200, Tzafrir Cohen wrote:> If you need to pipe commands to Asterisk without resorting to the > manager interface (e.g: requiring a specific user, hard-wiring password > or other authentication messure. After all: you're root of the machine > and know better than that lousy Asterisk process), you may want to use > the following. > > It is a simple C program to pipe commands to asterisk.ctl . It was > written to help me and thus hardwires the path I use > (/var/run/asterisk/asterisk.ctl ) , but I'd welcome any fixes for that.Or a simpler and aslightly more capable perl script. Attached. -- Tzafrir Cohen | tzafrir@jbr.cohens.org.il | VIM is http://tzafrir.org.il | | a Mutt's tzafrir@cohens.org.il | | best ICQ# 16849755 | | friend -------------- next part -------------- A non-text attachment was scrubbed... Name: ast_sock_cmd Type: application/octet-stream Size: 13527 bytes Desc: not available Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20051222/bf803c5e/ast_sock_cmd.obj
Dinesh Nair
2005-Dec-22 22:31 UTC
[Asterisk-Users] ast_sock_cmd: pipe commands to asterisk
On 12/23/05 03:01 Tzafrir Cohen said the following:> example usage: > > echo -e "set verbose 3\nset debug 5" | ./ast_sock_cmd > > echo -e "restart now" | ./ast_sock_cmd > > I'd also be happy to know of existing alternatives. It looked strange I > could not find such an existing tool to pipe text into a unix-domain > socket.how different is this from using the following, asterisk -rx 'set verbose 3' asterisk -rx 'restart now' -- Regards, /\_/\ "All dogs go to heaven." dinesh@alphaque.com (0 0) http://www.alphaque.com/ +==========================----oOO--(_)--OOo----==========================+ | for a in past present future; do | | for b in clients employers associates relatives neighbours pets; do | | echo "The opinions here in no way reflect the opinions of my $a $b." | | done; done | +=========================================================================+