As of Version 0.25 MythTV has a very handy Services API (see documentation here), my first go around with the API was to use it to pause my Frontend Machine when a phone call is incoming and display the caller id on screen.
This how I have done it: I own a Snom VoIP Phone so i use the Action URL (incoming call) setting to execute a php script running on the MythTV Backend http://mythtvbackend/caller.php?caller=$caller, $caller is replaced with the caller id by the snom phone. The php script looks like this:
<?php
$caller = $_GET["caller"];
$fd = fopen( "http://192.168.100.30:6547/Frontend/SendAction?Action=PAUSE", "r" );
if (!$fd) {
echo "Cannot open URL";
} else {
while(!feof($fd)) {
$buffer = fgets($fd, 4096);
echo $buffer;
}
fclose( $fd );
}
$message = urlencode("Anruf von $caller");
$fd = fopen( "http://192.168.100.30:6547/Frontend/SendMessage?Message=$message", "r" );
if (!$fd) {
echo "Cannot open URL";
} else {
while(!feof($fd)) {
$buffer = fgets($fd, 4096);
echo $buffer;
}
fclose( $fd );
}
?>
Note that it echoes also the return of the API calls, I did that so that it is possible to debug a bit by calling the script by browser. It should be easy to cook something similar up to use as a asterisk AGI script if you don’t own a snom phone.