[Asterisk-Users] asterisk -rx under cron?

Christopher Arnold chris at terrabee.net
Thu Jun 19 05:56:41 MST 2003


On Wed, 18 Jun 2003, Martin Pycko wrote:

> This works for me.
>
> #!/usr/bin/perl -w
> use Socket;
> use IO::Handle;
>
> socket(SOCK, AF_INET, SOCK_STREAM, getprotobyname('tcp'))
>         or die "Cannot create a socket: $!\n";
> connect(SOCK, sockaddr_in(5038, inet_aton('localhost')))
>         or die "Cannot connect to the manager port\n";
> SOCK->autoflush(1);
> $text = "Action: Login\r\n";
> $text .= "Username: mark\r\n";
> $text .= "Secret: pass\r\n\r\n";
> $text .= "Action: Command\r\nCommand: show channels\r\n\r\n";
> print SOCK $text;
> while (<SOCK>) {
>         print if not /Message:/ and not /Response:/ and not /END COMMAND/;
>         exit 0 if /END COMMAND/
> }
>
> exit 0;
>
And it solwed my immediate need too.

But is asterisk -rx "show channels" really not meant to work from cron or
an noninteractive script? If so i guess some documentaion about the
limitations would help other folks out there.


	/Chris



More information about the asterisk-users mailing list