[Asterisk-Users] Webui to show registered phones
bails
bails at westcomuk.com
Fri Oct 28 08:19:55 MST 2005
Thanks for that Adam, fantastic!
I did need to add one line to get it to work
#!/usr/bin/perl
#
##get lists of registered peers from asterisk
$iaxpeers = `/usr/sbin/asterisk -rx \"iax2 show peers\"`;
$sippeers = `/usr/sbin/asterisk -rx \"sip show peers\"`;
##replace newline characters with html break<br>
$iaxpeers =~ s/\n/<br>/g;
$sippeers =~ s/\n/<br>/g;
##output the webpage
print <<;
Content-type: text/html\n\n ##THIS
<HTML>
<head>
<title>Registered devices</title>
</head>
<body>
<p><h2>CURRENT SIP USERS</h2><br>
$sipppeers
<p><h2>CURRENT IAX USERS</h2><br>
$iaxpeers
</body>
</HTML>;
Adam Moffett wrote:
>
>> Hi all, does anyone know if there is any app/webui that can show
>> phones that are currently registered to *. I guess this sort of
>> funcionality counld be grabbed from the CLI with iax2 show peers and
>> sip show peers, but having little programming knowledge wouldn't know
>> where to start.
>>
>> I'm asking because we currently have several sip phones onsite and
>> lots of remote iax2 users who would like to see availability without
>> dialing.
>>
>> Bails
>
>
>
> Below is a simple perl script that might do the trick. save it to
> [something].cgi and most any distribution's apache web server should
> be able to run it.
>
> If the web server isn't running on the same machine as asterisk then
> it's a little more difficult. An option might be to configure ssh to
> allow authentication based on known RSA keys (so there's no password
> prompt). That is actually pretty easy to do, and you can google for
> instructions on that. Then the script can use ssh to talk to a shell
> on the asterisk server which will in turn execute asterisk -rx and
> give you the output.
>
> By the way, I haven't actually tested this except on the command line
> and my html is lousy. So while I'm sure the script will run, I pretty
> much guarantee the resulting web page to look like crap.
>
>
>
>
> #!/usr/bin/perl
> #
>
> ##get lists of registered peers from asterisk
> $iaxpeers = `/usr/sbin/asterisk -rx \"iax2 show peers\"`;
> $sippeers = `/usr/sbin/asterisk -rx \"sip show peers\"`;
>
> ##replace newline characters with html break<br>
> $iaxpeers =~ s/\n/<br>/g;
> $sippeers =~ s/\n/<br>/g;
>
>
> ##output the webpage
> print <<EOF;
> <html>
> <head>
> <title>Registered devices</title>
> </head>
> <body>
> <p><h2>CURRENT SIP USERS</h2><br>
> $sipppeers
> <p><h2>CURRENT IAX USERS</h2><br>
> $iaxpeers
> </body>
>
> </html>
> EOF
>
> _______________________________________________
> --Bandwidth and Colocation sponsored by Easynews.com --
>
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-users
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
>
>
More information about the asterisk-users
mailing list