Plantronics + Polycom. Now together as Poly Logo

Reboot or Factory reset VVX phones using submit-form POST method is not working

afahmy
Occasional Contributor

Reboot or Factory reset VVX phones using submit-form POST method is not working

Hello folks,

I am trying to automate reboot and factory reset polycom VVX phones using the submit-form/Reboot in the below code ( I'm verifying functionality on one phone then i have another script to iterate through a list of phones).

 

import requests

url = "https://<ip-address>/form-submit/Reboot"

headers = {
'Authorization': 'Basic UG9seWNvbTphZG1uODAyNzk5NTE4MDEwcHdk'
}

response = requests.request("POST", url, headers=headers, verify=False)

print(response.text)

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

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head><title>401 Unauthorized</title></head><body>
Authorization failed.
</body></html>

 

Process finished with exit code 0

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

I am 100% sure of the authorization in the headers because i can use it with POST method to login to the polycom phone

 

import requests

url = "https://<ip-address>/form-submit/auth.htm"

headers = {
'Authorization': 'Basic UG9seWNvbTphZG1uODAyNzk5NTE4MDEwcHdk'
}

response = requests.request("POST", url, headers=headers, verify=False)

print(response.text)

lockparams|SUCCESS|0

Process finished with exit code 0

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

So i am not sure why it is not authorizing me to make the Reboot or factory reset functions?

 

In other posts for different phones series i tried the Curl commands to do the same but also this gives the same results (using Postman, Python script, or Curl Command). any suggestions would be appreciated.

 

Phone model: VVX201

UC Software Version 6.3.0.14929

Updater Version 6.3.0.6751

 

Note: i don't want to make the Reboot or Factory reset using REST API as there are constraints prevents me from using it, however i verified it is working properly.

 

Regards, Ahmed

Message 1 of 2
1 REPLY 1
SteffenBaierUK
Polycom Employee & Community Manager

Re: Reboot or Factory reset VVX phones using submit-form POST method is not working

Hello @afahmy ,

 

Welcome to the Poly Community.

 

A Perl script I have used in the past:

#!/usr/bin/perl -w
# RebootScript.pl - Reboot range of Polycom phones using the Web Interface
# Initial Script (???) - bm
# Updated (???) - sb
# Update (28 April 2017) - mcab
# 	- Set the admin username and password at the top of the file. (Script will generate the cookie automatically now)
# 	- Removed dependency on CGI.pm
# Update (28 April 2017 #2) - mcab
# 	- add IO::Socket::SSL
# 	- ignore validating TLS certs from phone
# Update (5 June 2017) - mcab
# 	- Added reset to factory defaults

use strict;
use LWP::UserAgent;
use IO::Socket;
use Socket; 
use IO::Socket::SSL;
use MIME::Base64;

my $username = "Polycom";
my $password = "789";

#####################################
# Netmask 255.255.255.0	= 0xFFFFFF00#
# Netmask 255.255.0.0	= 0xFFFF0000#
# Netmask 255.0.0.0		= 0xFF000000#
# Netmask 0.0.0.0		= 0x00000000#
#####################################

my $netmask = 0xFFFFFF00; # 255.255.255.0

#########################################
# Define IP Address Start Range	$Start	#
# Define IP Address End Range $finish	#
#########################################

my $start_address = unpack 'N', inet_aton( '10.252.149.57' );
my $finish_address = unpack 'N', inet_aton( '10.252.149.58' );


for ( my $address = $start_address; $address <= $finish_address; ++$address ) {
next if ( $address & $netmask ) == $address or ( $address & ~$netmask ) == ~$netmask;


my $ua = LWP::UserAgent->new( );
$ua->ssl_opts( verify_hostname => 0, SSL_verify_mode => SSL_VERIFY_NONE );
my $destination = inet_ntoa( pack 'N', $address);

#############################
# Define Reboot or Restart  #
# Simply remove # and add # #
#############################

#my $restartUrl = "http://$destination/form-submit/Restart";
my $restartUrl = "https://$destination/form-submit/Reboot";
#my $restartUrl = "https://$destination/form-submit/Utilities/restorePhoneToFactory";
  
# Create request object and add the authentication header and the expected cookie
  my $req =  HTTP::Request->new(POST => $restartUrl);
  $req->header('Cookie' => 'Authorization=Basic ' . encode_base64("$username:$password"));
  $req->authorization_basic( $username, $password );
 
 
# Send the reset request to the user agent
  my $res = $ua->request( $req );
  print $res->status_line, "\n";
  sleep (5)
}

 

The password is hardcoded and simply move the # and replace for the action wanted.

 

Please ensure to provide some feedback if this reply has helped you so other users can profit from your experience.

Best Regards

Steffen Baier

----------------
The title Polycom Employee & Community Manager is a community setting and does not reflect my role. I am just a simple volunteer in the community like everybody else. My official "day" Job is 3rd Level support at Poly but I am unable to provide official support via the community.

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

Notice: This community forum is not an official Poly support resource, thus responses from Poly employees, partners, and customers alike are best-effort in attempts to share learned knowledge. If you need immediate and/or official assistance please open a service ticket through your proper support channels.
Please also ensure you always check the VoIP , Video Endpoint , Skype for Business , PSTN or RPM FAQ's
Message 2 of 2