cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2699
Views
0
Helpful
21
Replies

IPPhoneExecute XML

gshonting
Level 1
Level 1

Has anyone gotten this to work with "automatic" authentication? I can make it work from a browser window, as the authentication windows will popup. But I want to push data from a server, and the server must have a predefined name and password which it will pass to the phone when it does the post. I have tried several methods, but I am not an HTML/JAVA/VB expert so I m really struggling. I basically want to post from one server (the big web server) to another (the web server on the phone) without any user interaction.

21 Replies 21

rkiamil
Level 1
Level 1

There are some e.g. on the following web site

http://groups.yahoo.com/group/CiscoApplicationDevelopment

rchapman
Level 1
Level 1

You must send the authentication in the header since that is the way a POST works. I am not sure what programming language you are using but most have some type of url method/function available. If you are a c or c++ guy you can just use sockets (that is fun). If you like java there is a URL and HTTP object running around. I just used it to build an application within a cra script that call a method to post to the phone so I know it works.

If you still need more help try posting at - www.iptnetworkers.com - I am sure they can get you the code

gshonting
Level 1
Level 1

Update- I got it working!!! I finally gave up on IIS and switched to a Perl Script using LWP. Here is the code that works. This script will open a full-duplex conference between 2 phones. I am going to keep working on it and try to develop it into a usable application. I still need a way to find the phones IP addresses, to close the channel when the conference is done, and many other things. If anyone has any experience with perl, maybe you can exlpain to me why I have to use the %xx characters rather than the actual characters. Im off to buy a perl book.....

use LWP::UserAgent;

$uatx = LWP::UserAgent->new;

my $reqtx = HTTP::Request->new(POST => 'http://172.16.20.26/CGI/Execute');

$reqtx->content_type('application/x-www-form-urlencoded');

$reqtx->content('XML=%3CCiscoIPPhoneExecute%3E%0D%0A%09%3CExecuteItem+URL%3D%22RTPTx%3A%2F%2F172.16.20.24%3A20002%22%2F%3E%0D%0A%3C%2FCiscoIPPhoneExecute%3E%0D%0A');

$reqtx->authorization_basic('intercom', 'password');

my $restx = $uatx->request($reqtx);

print $restx->as_string;

$uarx = LWP::UserAgent->new;

my $reqrx = HTTP::Request->new(POST => 'http://172.16.20.24/CGI/Execute');

$reqrx->content_type('application/x-www-form-urlencoded');

$reqrx->content('XML=%3CCiscoIPPhoneExecute%3E%0D%0A%09%3CExecuteItem+URL%3D%22RTPRx%3A%2F%2F172.16.20.26%3A20002%22%2F%3E%0D%0A%3C%2FCiscoIPPhoneExecute%3E%0D%0A');

$reqrx->authorization_basic('intercom', 'password');

my $resrx = $uarx->request($reqrx);

print $resrx->as_string;

use LWP::UserAgent;

$uatx2 = LWP::UserAgent->new;

my $reqtx2 = HTTP::Request->new(POST => 'http://172.16.20.24/CGI/Execute');

$reqtx2->content_type('application/x-www-form-urlencoded');

$reqtx2->content('XML=%3CCiscoIPPhoneExecute%3E%0D%0A%09%3CExecuteItem+URL%3D%22RTPTx%3A%2F%2F172.16.20.26%3A20002%22%2F%3E%0D%0A%3C%2FCiscoIPPhoneExecute%3E%0D%0A');

$reqtx2->authorization_basic('intercom', 'password');

my $restx2 = $uatx2->request($reqtx2);

print $restx2->as_string;

$uarx2 = LWP::UserAgent->new;

my $reqrx2 = HTTP::Request->new(POST => 'http://172.16.20.26/CGI/Execute');

$reqrx2->content_type('application/x-www-form-urlencoded');

$reqrx2->content('XML=%3CCiscoIPPhoneExecute%3E%0D%0A%09%3CExecuteItem+URL%3D%22RTPRx%3A%2F%2F172.16.20.24%3A20002%22%2F%3E%0D%0A%3C%2FCiscoIPPhoneExecute%3E%0D%0A');

$reqrx2->authorization_basic('intercom', 'password');

my $resrx2 = $uarx2->request($reqrx2);

print $resrx2->as_string;

When I tried what you're doing, I found the user still had to hit speakerphone or pickup the handset to transmit (a good thing since it prevents eavesdropping)

My problem is how to get the phone to dial extra digits after an initial dial. Is there a URI for hitting numbers on the keypad?

I'm not sure why you need the char codes. Maybe because you're calling HTTP:Request directly instead of having LWP call it behind the scenes.

Here's a snippet of the subroutine code I've been using.

=============================

&PostToPhone('192.168.101.53','Dial:2300');

sub PostToPhone

{

use HTTP::Request::Common qw(POST);

require LWP::UserAgent;

my($IPAddr, $Command, $FormData, $ua, $req);

$IPAddr = $_[0];

$Command = $_[1];

$FormData{'XML'} = "

";

$ua = LWP::UserAgent->new;

$req = POST "http://$IPAddr/CGI/Execute", [ %FormData ];

$req->authorization_basic($AuthName, $AuthPwd);

$req->content_type('application/x-www-form-urlencoded');

$res = $ua->request($req);

}

I did not experience that. But you do have to run 4 post requests for each full duplex conference. You could do only the first two for a one-way announcement.

I am thinking about implementing an acceptance process. Setup the first Tx-RX pair and have the receiving phone load a web page that has an accept or reject button, if the receiver accepts the call, then I setup the other half of the conference.

Post Phone a--> transmit to phone b

Post phone b--> receive from phone a

Post Phone b--> transmit to phone a

Post phone a--> receive from phone b

The reason you have to use the %xx characters is more about how web servers work rather than how Perl works. Converting non-alpha characters to hex is something browsers do transparently, but you have to do it yourself when using LWP. If you prefer, you can use the URI pm to do it for you:

use URI;

$url = "http://chambers.dprecision.com";

$xml = '' . "\n" . ''

. "\n" . '';

# Or Whatever, then

$xml = URI::Escape::uri_escape("$xml")

Even better, go get the Cisco::IPPhone module off of CPAN and let it worry about doing the crappy part for you ...

Grant

ghartline
Level 1
Level 1

You have two options; you can pass the authentication information in the header of the POST message; or you can do it when you call the URL by using the http://username:password@host convention. The former is preferable, obviously, since it doesn't show the authentication informatin in the location bar.

Grant