This works for me.
Martin
#!/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;
On Thu, 19 Jun 2003, Christopher Arnold wrote:
>
>
> On Wed, 18 Jun 2003, Jeremy McNamara wrote:
>
> > Why not write a [insert favorite scripting language here] script to use
> > the Asterisk manager interface?
> >
> > I've wrote quite a few little perl scripts each doing their own specific
> > function. Works quite well.
> >
> Could you give us a pointer to info about the Asterisk manager interface?
> Perhaps even an example script in your favorite scripting language ?
>
> /Chris
> _______________________________________________
> Asterisk-Users mailing list
> [EMAIL PROTECTED]
> http://lists.digium.com/mailman/listinfo/asterisk-users
>
_______________________________________________
Asterisk-Users mailing list
[EMAIL PROTECTED]
http://lists.digium.com/mailman/listinfo/asterisk-users