cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
Please note that Remote Expert Mobile announced end-of-life and support will end on February 28, 2022.
1066
Views
0
Helpful
4
Replies
Highlighted
Beginner

Hand over Parameters from a IP Phone Service to Perl Script

Hi,

I am starting a Perl script as an IP Phone Service without any parameters and this is working fine.

My next step is to hand over the devicename to the perl script while calling the IP Phone service. If I call this script from a command line with an argument (i.e. perl parameter.pl 123) it is working, but if I call it as an IP Phone Service it is not working

Can anybody help please?

My little Sample Perl Script:

use strict;

use warnings;

print "Content-type: text/html\n\n";

my $DevName;

$DevName = $ARGV[0];

print "Devicename: $DevName\n";

My Sample IP Phone Service (tried all of them)

http://172.16.0.13/parameter.pl?#DEVICENAME#

http://172.16.0.13/parameter.pl?name=#DEVICENAME#

I am also interested how to hand over Parameters which are defined as IP Phone Service Parameter to a perl script.

Best regards

Manfred

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Beginner

The problem is solved in the meantime.

In Perl you can use the param() command to get parameters from an URL.

Best regards

Manfred

View solution in original post

4 REPLIES 4
Highlighted
Cisco Employee

If I understand correctly what you are trying to do, I believe you're going to have to extract the Devicename from the URL that the phone sends to your webservice when you invoke the IP phone service. It won't come as a discrete argv, it's going to come as a URL that will have to be parsed with perl.

I do mostly python, so if I want to extract something from a URL, I have to do something like the following to extract a 'number' parameter from the URL:

import cgi

def index(req):

    numbr = req.form.getfirst('number', '')

Highlighted

Thanks for your answer. I guess you can see by my asking my knowledge in programing is very bad. Normaly I have projects with all that UCC stuff, but not with programing anything.

I am not able to translate your python code to perl.

Can you or somebody else tell me the exact perl code to use to extract the devicename from the URL?

How is the right IP Phone Service URL?

Best regards

Manfred

Highlighted
Beginner

In the meantime I took some sniffer traces from 2 szenarios.

-------------------------------------------------------------------------------------------------------------------------------------------

1st I tried to display a parameter from a URL pasted to a browser on my PC.

URL pasted to browser:

http://172.16.0.13/parameter.pl?SEP3037A617C375

Result in Browser:

Devicename: SEP3037A617C375

Sniffer Trace:

GET /parameteruebergabe.pl?SEP3037A617C375 HTTP/1.1\r\n

=> only one parameter and this is working

-------------------------------------------------------------------------------------------------------------------------------------------

2nd I tried to display the Devicename of a IP Phone in the phone Display

URL of the IP Phone Service:

http://172.16.0.13/parameter.pl#DEVICENAME#

Result on Phone Display:

Devicename:

Sniffer Trace:

GET /parameteruebergabe.pl?SEP3037A617C375&locale=English_United_States&name=SEP3037A617C375 HTTP/1.1\\r\\n

=> three parameters seperated by a "&" and this ist not working.

Any suggests how to extract the "SEP3037A617C375" from all the parameters?

Best regards

Manfred

Highlighted
Beginner

The problem is solved in the meantime.

In Perl you can use the param() command to get parameters from an URL.

Best regards

Manfred

View solution in original post