[mythtv-users] Asterisk Extension for Frontend WOL?

Eloy Paris peloy at chapus.net
Mon Mar 22 16:34:21 UTC 2010


On Mon, Mar 22, 2010 at 09:39:07AM +0000, Tom Gerrard wrote:

> On 20 March 2010 01:28, Tortise <tortise at paradise.net.nz> wrote:
> > Has anyone tried to wake up their myth front end(s) using an asterisk
> > extension, say in FreePBX, to do WOL?
> > The extension might be rang from a phone on the pbx including a WiFi or Cell
> > phone.
> 
> HI Tortise,
> 
> Never tried to do this specifically.  I'd probably use a php agi
> script, e.g. add to extensions_custom.conf:
> 
> exten => 1234,1,AGI(wakeup.php)
> exten => 1234,n,Hangup()
> 
> and then in /var/lib/asterisk/agi-bin add a file like this:
> 
> #!/usr/bin/php
> <?php
> include "phpagi.php";
> $agi = new AGI();
> $agi->answer();
> $agi->stream_file('silence');
> sleep(2);
> $agi->stream_file('vm-password');
> $r = $agi->get_data('beep', 15000, 5);
> $pass=$r['result'];
> if ($pass == '4444')
> {
>     etherwake 00:22:44:66:88:aa
>     $agi->stream_file('saved');
> }
> else
> {
> 	$agi->stream_file('tt-somethingwrong');
> }
> $agi->hangup();
> ?>

I have the following rule in my s extension so I can see who's calling
when watching something on MythTV:

exten => s,n,System(/usr/local/bin/mythtvosd --template=cid --caller_name="${CALLERID(name)}" --caller_number="${CALLERID(num)}" --caller_date="${STRFTIME(${EPOCH},,%x)})" --caller_time="${STRFTIME(${EPOCH},,%X)})")

Replacing the /usr/local/bin/mythtvosd command with the wakeonlan
command and creating an extension for this could be another option,
e.g.:

exten => 1234,1,System(/usr/bin/wakeonlan <options>)
exten => 1234,n,Hangup()

Cheers,

Eloy Paris.-


More information about the mythtv-users mailing list