• ×
    Information
    Windows update impacting certain printer icons and names. Microsoft is working on a solution.
    Click here to learn more
    Information
    Need Windows 11 help?
    Check documents on compatibility, FAQs, upgrade information and available fixes.
    Windows 11 Support Center.
  • post a message
  • ×
    Information
    Windows update impacting certain printer icons and names. Microsoft is working on a solution.
    Click here to learn more
    Information
    Need Windows 11 help?
    Check documents on compatibility, FAQs, upgrade information and available fixes.
    Windows 11 Support Center.
  • post a message
Guidelines
The Poly Video Conferencing Knowledge Base is live! We look forward to helping you with common issues and troubleshooting advice!
HP Recommended

Hello, Is it possible right now to use an API/Curl script to call an audiotransmitlevel Set change? Currently, Lens Provisioning is unable to provide updates to this Field. "Transmission Audio Gain (dB)" 


Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
HP Recommended

Hello @Daniel Petrillo ,

 

Welcome to the Poly Community.

 

Untested and no official support via Poly for single device with hardcoded password as 789 and fixed IP

 

 

curl -b cookies.txt -c cookies.txt -d "{\"user\": \"admin\",\"password\": \"789\"}" -H "Content-Type: application/json" -k https://192.168.1.100/rest/session
curl -b cookies.txt -c cookies.txt -X POST -H "Content-Type: application/json" -k https://192.168.1.100/rest/config -d "{\"vars\":[{\"name\":\"audio.volume.audiotransmitlevel\",\"value\":\"18\"}]}

 

 

CURL Batch processing

 

Create a txt file via Excel or similar with 1 column of the IP address and one Column of the password. Save as IP_Pass.csv file

 

Create an MS-Dos Batch file and copy this:

 

 

@echo off
echo Reading IP_Pass.csv
for /F "tokens=1,2 delims=," %%a in (IP_Pass.csv) do (
curl -b cookies.txt -c cookies.txt -X POST -d "{\"user\": \"admin\",\"password\": \"%%b\"}" -H "Content-Type: application/json" -k https://%%a/rest/session
curl -b cookies.txt -c cookies.txt -H "Content-Type: application/JSON" -k https://%%a/rest/config -d "{\"vars\":[{\"name\":\"audio.volume.audiotransmitlevel\",\"value\":\"18\"}]}
timeout /t 5 /NOBREAK
)

 

Call it audiotransmit.bat and save it in the same directory as the CSV file

 

Run audiotransmit.bat and it changes this for all IPs specified.

 

Power Shell Batch Processing

 

Create a txt file via Excel or similar with 1 column of the IP address and one Column of the password. Save as IP_Pass.csv file

 

 

#BEGIN POWERSHELL SCRIPT FOR REBOOTING Poly GroupSeries command
 
$File = get-content "IP_Pass.csv"
foreach ($line in $File){
    $Arr = $line.Split(',')
    [array]
#URL to make new session
$sessionURL = (https:// + $Arr[0] + "/rest/session");
#Command to make new session
$sessionBody = "{`"user`": `"admin`",`"password`": `""  + $Arr[1] + "`"}"
 
#URL to issue reboot
$rebootURL = (https:// + $Arr[0] + "/rest/config");
#Command to issue reboot
$rebootBody =  @{
        vars = @(
            @{
                name = "audio.volume.audiotransmitlevel"
                value = "18"
            }
        )
    } | ConvertTo-Json
 
 
# disable self signed certificate check
if (-not ([System.Management.Automation.PSTypeName]'ServerCertificateValidationCallback').Type)
{
$certCallback = @"
    using System;
    using System.Net;
    using System.Net.Security;
    using System.Security.Cryptography.X509Certificates;
    public class ServerCertificateValidationCallback
    {
        public static void Ignore()
        {
            if(ServicePointManager.ServerCertificateValidationCallback ==null)
            {
                ServicePointManager.ServerCertificateValidationCallback +=
                    delegate
                    (
                        Object obj,
                        X509Certificate certificate,
                        X509Chain chain,
                        SslPolicyErrors errors
                    )
                    {
                        return true;
                    };
            }
        }
    }
"@
    Add-Type $certCallback
}
[ServerCertificateValidationCallback]::Ignore()
# End self signed certificate commands
 
Invoke-WebRequest $sessionURL -UseBasicParsing -ContentType "application/json" -Method Post -body $sessionBody -SessionVariable sess;
Invoke-WebRequest $rebootURL -UseBasicParsing -ContentType "application/json" -WebSession $sess -Method POST -Body $rebootBody
}

 

 

Call it audiotransmit.ps1 and save it in the same directory as the CSV file

 

It uses the same CSV source file but you may need to allow the script execution via Power Shell:

 

    • By default, PowerShell will not allow you to execute this script:
      image

       

    • If you see the above error, you will need to change the ExecutionPolicy from Default to RemoteSigned:

      > Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
      image

       

Now start power shell and run audiotransmit.ps1

 

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

Best Regards

Steffen Baier

------------------------------------------------
Notice: I am an HP Poly employee but all replies within the community are done as a volunteer outside of my day role. This community forum is not an official HP Poly support resource, thus responses from HP Poly employees, partners, and customers alike are best-effort in attempts to share learned knowledge.
If you need immediate and/or official assistance for former Poly\Plantronics\Polycom please open a service ticket through your support channels
For HP products please check HP Support.

Please also ensure you always check the General VoIP , Video Endpoint , UC Platform (Microsoft) , PSTN

View solution in original post

4 REPLIES 4
HP Recommended

Hello @Daniel Petrillo ,

 

Welcome to the Poly Community.

 

Untested and no official support via Poly for single device with hardcoded password as 789 and fixed IP

 

 

curl -b cookies.txt -c cookies.txt -d "{\"user\": \"admin\",\"password\": \"789\"}" -H "Content-Type: application/json" -k https://192.168.1.100/rest/session
curl -b cookies.txt -c cookies.txt -X POST -H "Content-Type: application/json" -k https://192.168.1.100/rest/config -d "{\"vars\":[{\"name\":\"audio.volume.audiotransmitlevel\",\"value\":\"18\"}]}

 

 

CURL Batch processing

 

Create a txt file via Excel or similar with 1 column of the IP address and one Column of the password. Save as IP_Pass.csv file

 

Create an MS-Dos Batch file and copy this:

 

 

@echo off
echo Reading IP_Pass.csv
for /F "tokens=1,2 delims=," %%a in (IP_Pass.csv) do (
curl -b cookies.txt -c cookies.txt -X POST -d "{\"user\": \"admin\",\"password\": \"%%b\"}" -H "Content-Type: application/json" -k https://%%a/rest/session
curl -b cookies.txt -c cookies.txt -H "Content-Type: application/JSON" -k https://%%a/rest/config -d "{\"vars\":[{\"name\":\"audio.volume.audiotransmitlevel\",\"value\":\"18\"}]}
timeout /t 5 /NOBREAK
)

 

Call it audiotransmit.bat and save it in the same directory as the CSV file

 

Run audiotransmit.bat and it changes this for all IPs specified.

 

Power Shell Batch Processing

 

Create a txt file via Excel or similar with 1 column of the IP address and one Column of the password. Save as IP_Pass.csv file

 

 

#BEGIN POWERSHELL SCRIPT FOR REBOOTING Poly GroupSeries command
 
$File = get-content "IP_Pass.csv"
foreach ($line in $File){
    $Arr = $line.Split(',')
    [array]
#URL to make new session
$sessionURL = (https:// + $Arr[0] + "/rest/session");
#Command to make new session
$sessionBody = "{`"user`": `"admin`",`"password`": `""  + $Arr[1] + "`"}"
 
#URL to issue reboot
$rebootURL = (https:// + $Arr[0] + "/rest/config");
#Command to issue reboot
$rebootBody =  @{
        vars = @(
            @{
                name = "audio.volume.audiotransmitlevel"
                value = "18"
            }
        )
    } | ConvertTo-Json
 
 
# disable self signed certificate check
if (-not ([System.Management.Automation.PSTypeName]'ServerCertificateValidationCallback').Type)
{
$certCallback = @"
    using System;
    using System.Net;
    using System.Net.Security;
    using System.Security.Cryptography.X509Certificates;
    public class ServerCertificateValidationCallback
    {
        public static void Ignore()
        {
            if(ServicePointManager.ServerCertificateValidationCallback ==null)
            {
                ServicePointManager.ServerCertificateValidationCallback +=
                    delegate
                    (
                        Object obj,
                        X509Certificate certificate,
                        X509Chain chain,
                        SslPolicyErrors errors
                    )
                    {
                        return true;
                    };
            }
        }
    }
"@
    Add-Type $certCallback
}
[ServerCertificateValidationCallback]::Ignore()
# End self signed certificate commands
 
Invoke-WebRequest $sessionURL -UseBasicParsing -ContentType "application/json" -Method Post -body $sessionBody -SessionVariable sess;
Invoke-WebRequest $rebootURL -UseBasicParsing -ContentType "application/json" -WebSession $sess -Method POST -Body $rebootBody
}

 

 

Call it audiotransmit.ps1 and save it in the same directory as the CSV file

 

It uses the same CSV source file but you may need to allow the script execution via Power Shell:

 

    • By default, PowerShell will not allow you to execute this script:
      image

       

    • If you see the above error, you will need to change the ExecutionPolicy from Default to RemoteSigned:

      > Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
      image

       

Now start power shell and run audiotransmit.ps1

 

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

Best Regards

Steffen Baier

------------------------------------------------
Notice: I am an HP Poly employee but all replies within the community are done as a volunteer outside of my day role. This community forum is not an official HP Poly support resource, thus responses from HP Poly employees, partners, and customers alike are best-effort in attempts to share learned knowledge.
If you need immediate and/or official assistance for former Poly\Plantronics\Polycom please open a service ticket through your support channels
For HP products please check HP Support.

Please also ensure you always check the General VoIP , Video Endpoint , UC Platform (Microsoft) , PSTN
HP Recommended

Great, thank you, Tremendous Help/assistance, I was able to figure out a Powershell script to generate from a multiple list of IP's listed in a TXT file.

HP Recommended

Hello @Daniel Petrillo 

 

my >here< FAQ has examples if you ever stuck.

 

Best regards

 

Steffen Baier

------------------------------------------------
Notice: I am an HP Poly employee but all replies within the community are done as a volunteer outside of my day role. This community forum is not an official HP Poly support resource, thus responses from HP Poly employees, partners, and customers alike are best-effort in attempts to share learned knowledge.
If you need immediate and/or official assistance for former Poly\Plantronics\Polycom please open a service ticket through your support channels
For HP products please check HP Support.

Please also ensure you always check the General VoIP , Video Endpoint , UC Platform (Microsoft) , PSTN
HP Recommended

Good Morning Poly Community/Fam - 

PS Script for Bulk Changes in your environment -

 

Dump all the Hostname/IP's into the Get-Content -Path "IP.txt"

Update $Password

Value of AudioTransmitLevel should reflect Poly's recommended , we used 18 across the board.

 

#BEGIN POWERSHELL SCRIPT FOR POLY X50/G7500/ REST Command Bulk AudioTransmitLevel Change

# Ignore SSL certificate checks
add-type @"
    using System.Net;
    using System.Security.Cryptography.X509Certificates;
    public class TrustAllCertsPolicy : ICertificatePolicy {
        public bool CheckValidationResult(
            ServicePoint srvPoint, X509Certificate certificate,
            WebRequest request, int certificateProblem) {
            return true;
        }
    }
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy

# Get the content of the text file
$IPAddresses = Get-Content -Path "IP.txt"

# Prepare a list to store the results
$results = @()

# Loop through each IP address
foreach ($IP in $IPAddresses) {
    $loginUrl = "https://$IP/rest/session"
    $configUrl = "https://$IP/rest/config"

    $loginBody = @{
        user = "admin"
        password = "789"
    } | ConvertTo-Json

    $configBody = @{
        vars = @(
            @{
                name = "audio.volume.audiotransmitlevel"
                value = "18"
            }
        )
    } | ConvertTo-Json

    try {
        # Create a new web request session
        $sessionRequest = Invoke-WebRequest -Uri $loginUrl -Method Post -Body $loginBody -ContentType "application/json" -SessionVariable session -UseBasicParsing

        # Now apply the new audio configuration
        $configRequest = Invoke-WebRequest -Uri $configUrl -WebSession $session -Method POST -Body $configBody -ContentType "application/json" -UseBasicParsing

        # Add the result to the list
        $results += New-Object PSObject -Property @{
            IPAddress = $IP
            LoginStatusCode = $sessionRequest.StatusCode
            LoginStatusDescription = $sessionRequest.StatusDescription
            ConfigStatusCode = $configRequest.StatusCode
            ConfigStatusDescription = $configRequest.StatusDescription
            Status = "Successful"
        }
    }
    catch {
        # If there was an error, add the result to the list
        $results += New-Object PSObject -Property @{
            IPAddress = $IP
            LoginStatusCode = $null
            LoginStatusDescription = $null
            ConfigStatusCode = $null
            ConfigStatusDescription = $null
            Status = "NA Check Credentials or Hostname"
        }
    }
}

# Export the results to a CSV file
$results | Export-Csv -Path "AudioResults.csv" -NoTypeInformation

 

The results above will export to "AudioResults.csv" file which will include the below results upon successful or not successful operation. 

ConfigStatusDescriptionConfigStatusCodeIPAddressLoginStatusCodeStatusLoginStatusDescription
OK200Hostname200OKOK
† The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the <a href="https://www8.hp.com/us/en/terms-of-use.html" class="udrlinesmall">Terms of Use</a> and <a href="/t5/custom/page/page-id/hp.rulespage" class="udrlinesmall"> Rules of Participation</a>.