Change states from a Cisco IP phone's button
Posted: Wed Aug 28, 2013 1:35 pm
Here's an XML service to change ZoneMinder states from a Cisco IP phone's custom services menu.
This is useful when you don't want or you don't have access to a PC-based browser interface at a certain location (for example near the door or when leaving the area), but an IP telephone set is there and can do the state change for you.
It's pretty much like having a hardware user interface to engage or disengage the alarm system. Pressing the Services button on the phone brings up a menu with the states. Selecting the corresponding menu item will activate the selected state on the ZM server.
Put this php script (cisco_change_states.php) on your ZoneMinder box. Change the menu item names and the state names as you wish. Feel free to add more states. Check the path for zmpkg.pl, below it's the one for Ubuntu.
After that, just assign the script URL to your Cisco IP phone's Services button. How to do that depends on your Cisco Phone setup, should be either to add the URL to your phone's SEPmac.cnf.xml file like thisor set the URL correctly in Cisco's CallManager server if you have any.
Tested and working with a Cisco 7942 phone and Cisco IP Communicator softphone.
This is useful when you don't want or you don't have access to a PC-based browser interface at a certain location (for example near the door or when leaving the area), but an IP telephone set is there and can do the state change for you.
It's pretty much like having a hardware user interface to engage or disengage the alarm system. Pressing the Services button on the phone brings up a menu with the states. Selecting the corresponding menu item will activate the selected state on the ZM server.
Put this php script (cisco_change_states.php) on your ZoneMinder box. Change the menu item names and the state names as you wish. Feel free to add more states. Check the path for zmpkg.pl, below it's the one for Ubuntu.
Code: Select all
<?php
$url = $_SERVER['REQUEST_URI'];
$parts = explode('/',$url);
$dir = $_SERVER['SERVER_NAME'];
for ($i = 0; $i < count($parts) - 1; $i++) {
$dir .= $parts[$i] . "/";
}
$myurl = "http://" . $dir . basename($_SERVER["SCRIPT_FILENAME"]);
header("Content-Type: text/xml; charset=UTF-8");
header("Connection: close");
header("Expires: -1");
print "<?xml version='1.0' encoding='utf-8'?>\n";
switch ($_GET['sw']) {
case 0:
?><CiscoIPPhoneMenu>
<Title>Change camera system state</Title>
<Prompt>STATE CHANGING NEEDS TIME</Prompt>
<MenuItem>
<Name>State 1</Name>
<URL><? print $myurl . "?sw=1"; ?></URL>
</MenuItem>
<MenuItem>
<Name>State 2</Name>
<URL><? print $myurl . "?sw=2"; ?></URL>
</MenuItem>
</CiscoIPPhoneMenu><?
break;
case 1:
$output = shell_exec('/usr/bin/zmpkg.pl State1');
?><CiscoIPPhoneText>
<Title>Camera system state</Title>
<Prompt>Activated</Prompt>
<Text>State activated: State 1</Text>
</CiscoIPPhoneText><?
break;
case 2:
$output = shell_exec('/usr/bin/zmpkg.pl State2');
?><CiscoIPPhoneText>
<Title>Camera system state</Title>
<Prompt>Activated</Prompt>
<Text>State activated: State 2</Text>
</CiscoIPPhoneText><?
break;
}
?>
Code: Select all
<servicesURL>http://zm_server/cisco_change_states.php</servicesURL>
Tested and working with a Cisco 7942 phone and Cisco IP Communicator softphone.