Hi there,
I have a Cisco 7970 phone with SIP firmware 8-3-3SR2S that is registered with Asterisk 1.4 , and I am trying to be able to make Asterisk push XML content to a phone when it dials a specific extension.
So basically what needs to happen for Cisco 7970 phones is :
(1) Call in to an extension (in this case 4567) , and Asterisk will push an XML describing the CiscoIPPhoneExecute object to the phone ( cisco.com/univercd/cc/td/doc … #wp1033858 )
(2) Phone receives CiscoIPPhoneExecute object and tries to grab the specified URL
(3) Phone loads up the content of that URL
So I basically wrote a PHPAGI script that gets called when I call this special extension 4567. That part works and I know the script gets called.
Now the problem is what goes on inside the script. I am basing it off what I found at : voip-info.org/wiki/view/Cisco+79XX+XML+Push
Now, in the script, there is a part in the push2phone() function that opens a socket to port 80 of the phone to push the XML over.
I enabled “Web Access” for the 7970 phone such that Settings–>Security Configuration–>Web Access Enabled is “Yes” on the phone.
Now, when I enabled AGI debugging on Asterisk, I see this response from the phone when I push it the CiscoIPPhoneExecute XML object :
HTTP/1.1 200 OK
Content-Type: text/xml; charset="utf-8"
Date: Thu, 20 Dec 2007 01:58:43 GMT
Expires: Thu, 26 Oct 1995 00:00:00 GMT
Last-Modified: Thu, 20 Dec 2007 01:58:43 GMT
Pragma: no-cache
Content-Length: 188
Server: Allegro-Software-RomPager/4.34
But I still only hear a busy tone on the phone side and the URL does not pop up, and this is where I am stuck. The that CiscoIPPhoneErrorNumber 0 means it has problem with the CiscoIPPhoneExecute XML object, but I am not sure what the problem is. It is as simple as possible already.
In my extensions.conf, I have something like :
exten => 4567,1,Answer()
exten => 4567,2,AGI(push_execute.agi) ;push_execute.agi is the script pushing the XML
exten => 4567,3,Hangup()
exten => h,1,Hangup()
This is my push_execute.agi :
#!/usr/bin/php -q
<?php require_once "phpagi.php"; require_once "phpagi-asmanager.php"; $agi = new AGI() ; function push2phone($ip, $uri, $uid, $pwd , $agi) { $agi->verbose( "Entered push2phone \n" , 1) ; $response = "" ; $auth = base64_encode($uid.":".$pwd); $xml = ""; $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) { $agi->verbose( "ERROR : $errstr ($errno) \n" , 1) ; } else { $agi->verbose( "Sending Data \n" , 1) ; fputs($fp, $post.$xml); flush(); while (!feof($fp)) { $response .= fgets($fp, 128); flush(); } } return $response; } $ip = "Phone IP"; $uri = "URL to Phone"; $uid = "admin"; $pwd = "password"; $result = push2phone($ip, $uri, $uid, $pwd , $agi); $agi->verbose("result is $result \n" , 1) ; I did see some comments somewhere that this code from that Voip-Info link works for SIP , and was hoping to check with everyone here. Thanks!