Here are my adapted scripts. The most important one, the cam.php I found here
Cisco webcam script
extensions_custom.conf (THANKS to dicko!!!)
[from-trunk-sip-fritzbox]
exten=>s,1,TrySystem(/var/lib/asterisk/agi-bin/showcam.agi > /dev/null 2>&1 &)
exten=>n,Hangup()
/var/lib/asterisk/agi-bin/showcam.agi
#!/bin/sh
cd /var/www/html/xmlservices/
php cam-start-11.php;
php cam-start-12.php;
php cam-start-13.php;
php cam-start-14.php;
php cam-start-15.php;
php cam-start-17.php;
sleep 40
php cam-stop-11.php;
php cam-stop-12.php;
php cam-stop-13.php;
php cam-stop-14.php;
php cam-stop-15.php;
php cam-stop-17.php;
/var/www/html/xmlservices/cam-start-11.php
<?php
$ip = "192.168.0.211";
$uri = "http://192.168.0.34/xmlservices/cam-11.php";
$uid = "admin";
$pwd = "cisco";
function push2phone($ip, $uri, $uid, $pwd)
{
$auth = base64_encode($uid.":".$pwd);
$xml = "<CiscoIPPhoneExecute><ExecuteItem Priority=\"0\"URL=\"".$uri."\"/></CiscoIPPhoneExecute>";
$xml = "XML=".urlencode($xml);
$post = "POST /CGI/Execute HTTP/1.0\r\n";
$post .= "Host: $ip\r\n";
$post .= "Authorization: Basic $auth\r\n";
$post .= "Connection: close\r\n";
$post .= "Content-Type: application/x-www-form-urlencoded\r\n";
$post .= "Content-Length: ".strlen($xml)."\r\n\r\n";
$fp = fsockopen ( $ip, 80, $errno, $errstr, 30);
if(!$fp){ echo "$errstr ($errno)<br>\n"; }
else
{
fputs($fp, $post.$xml);
flush();
while (!feof($fp))
{
$response .= fgets($fp, 128);
flush();
}
}
return $response;
}
echo push2phone($ip, $uri, $uid, $pwd);
?>
/var/www/html/xmlservices/cam-stop-11.php
<?php
$ip = "192.168.0.211";
$uri = "Init:Services";
$uid = "admin";
$pwd = "cisco";
function push2phone($ip, $uri, $uid, $pwd)
{
$auth = base64_encode($uid.":".$pwd);
$xml = "<CiscoIPPhoneExecute><ExecuteItem Priority=\"0\"URL=\"".$uri."\"/></CiscoIPPhoneExecute>";
$xml = "XML=".urlencode($xml);
$post = "POST /CGI/Execute HTTP/1.0\r\n";
$post .= "Host: $ip\r\n";
$post .= "Authorization: Basic $auth\r\n";
$post .= "Connection: close\r\n";
$post .= "Content-Type: application/x-www-form-urlencoded\r\n";
$post .= "Content-Length: ".strlen($xml)."\r\n\r\n";
$fp = fsockopen ( $ip, 80, $errno, $errstr, 30);
if(!$fp){ echo "$errstr ($errno)<br>\n"; }
else
{
fputs($fp, $post.$xml);
flush();
while (!feof($fp))
{
$response .= fgets($fp, 128);
flush();
}
}
return $response;
}
echo push2phone($ip, $uri, $uid, $pwd);
?>
Last but not least, the open-door.php.
(My intercom door system requires digits #9 to be pressed during a call to unlock the door.)
/var/www/html/xmlservices/open-door-11.php
<?php
$ip = "192.168.0.211";
$uri = "SendDigits:#9";
$uid = "admin";
$pwd = "cisco";
function push2phone($ip, $uri, $uid, $pwd)
{
$auth = base64_encode($uid.":".$pwd);
$xml = "<CiscoIPPhoneExecute><ExecuteItem Priority=\"0\"URL=\"".$uri."\"/></CiscoIPPhoneExecute>";
$xml = "XML=".urlencode($xml);
$post = "POST /CGI/Execute HTTP/1.0\r\n";
$post .= "Host: $ip\r\n";
$post .= "Authorization: Basic $auth\r\n";
$post .= "Connection: close\r\n";
$post .= "Content-Type: application/x-www-form-urlencoded\r\n";
$post .= "Content-Length: ".strlen($xml)."\r\n\r\n";
$fp = fsockopen ( $ip, 80, $errno, $errstr, 30);
if(!$fp){ echo "$errstr ($errno)<br>\n"; }
else
{
fputs($fp, $post.$xml);
flush();
while (!feof($fp))
{
$response .= fgets($fp, 128);
flush();
}
}
return "Das HAUSTOR wurde entriegelt, bitte HÖRER auflegen und FENSTER schliessen! DANACH im KAMERAFENSTER auf Taste AKTUAL. drücken.";
}
echo push2phone($ip, $uri, $uid, $pwd);
?>
One LineButton on the Cisco 7975s is configured to execute the script.
SEP.conf.xml
<line button="8">
<featureID>20</featureID>
<featureLabel>HAUSTOR ÖFFNEN</featureLabel>
<serviceURI>http://192.168.0.34/xmlservices/open-door-11.php</serviceURI>
</line>