Dial 5 for the IP Camera

I wanted to build a phone interface to control cameras on an arduino. Step 1 in that direction was building a sinatra interface for the phone -i.e. access an IP camera by dialing into the phone server.

The phone dialplan is programmed to redirect the browser to the IP camera on dialing 5.

Here’s the Javascript code that runs on that page

AGI to Ajax Demo

function startLoop(){
//check every 1 second
setInterval(“loadCallData()”, 1000);
}

function loadCallData() {
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
} else {// code for IE6, IE5
xmlhttp=new ActiveXObject(“Microsoft.XMLHTTP”);
}
//get caller ID
xmlhttp.open(“GET”,’main_agi/digitinfo’,false);
xmlhttp.send(null);
var call_dig = xmlhttp.responseText.split(“,”);
document.getElementById(‘callerID’).innerHTML=call_dig[0];
document.getElementById(‘button’).innerHTML=call_dig[1];

if(call_dig[1] == 5)
{
document.location = “http://128.122.151.188/view/index.shtml”;
}
}

Call x100:

Caller:

none.

Button:

none.

Comments are closed.