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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | <?php $caller = $_GET [ "caller" ]; if (! $fd ) { echo "Cannot open URL" ; } else { while (! feof ( $fd )) { $buffer = fgets ( $fd , 4096); echo $buffer ; } fclose( $fd ); } $message = urlencode( "Anruf von $caller" ); 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.