Simulate a SIP Phone request for config

bmcollis
bmcollis used Ask the Experts™
on
I am having issues with the config for a sip phone (Aastra 6737i) and would like to manually download the config and look at it.

The basic settings I have are - directly from the phone;
  Download Protocol - Http
  HTTP Server - FQDN
  HTTP Path - aastra6737i
  HTTP Port - 80

I also know the MAC address of the phone and the SIP Username and Password

After some reading, I tried to use the Powershell "invoke-webrequest" command to download the file.

I have tried two different ways to pass the Username & Password.
Please Note - I did not write this code, but copied it from examples I found substituting my SIP username and Password

Method One
        $username = "username"
        $password = "password" | ConvertTo-SecureString -asPlainText -Force
        $cred = New-Object System.Management.Automation.PSCredential($username,$password)
        invoke-webrequest -outfile mac.cfg http://fqdn/aastra6737i/mac.cfg -Credential $cred

Method Two
       $user = 'username'
       $pass = 'password'

       $pair = "$($user):$($pass)"

       $encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))

       $basicAuthValue = "Basic $encodedCreds"

       $Headers = @{
             Authorization = $basicAuthValue
        }
        invoke-webrequest -outfile mac.cfg http://fqdn/aastra6737i/mac.cfg -Headers $Headers

 === Again I did not write these scripts, and I am NOT a programmer.

However regardless of the script I get;
     invoke-webrequest : Forbidden
     You don't have permission to access /aastra6737i/mac.cfg on this server.


I know the file name "mac.cfg" that I am trying to download is correct


Does anyone know how a SIP phone contacts, authenticates and then downloads it config file and how this could be accomplished manually/programmably.


Thank you



Very much appreciated.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Uros Gaberdirector

Commented:
Did you try opening the URL in a web browser?

Author

Commented:
Yes,

In IE - it comes back with a 403 error

The website declined to show this webpage
                                                                                                                            HTTP 403
     
Most likely causes:
•This website requires you to log in.
 
I am not prompted for a username and password
director
Commented:
I would suggest using a tool like WireShark to catch the packets going from the phone to the server and see how they handle authentication as it obviously is not basic authentication or any standard http authentication otherwise the browser would ask for your username/password.

Also are you sure that the file name is actually "mac.cfg" and not the "<mac address of the phone>.cfg" ?
Commented:
Hi Uros,

Sorry did not see your comment until now.
And you are correct it is "<mac address of the phone>.cfg" - I was just shorting it up to "mac.cfg" sorry for the confusion.

I did indeed resort to using Wireshark to look at the traffic, and could see that it was pulling the correct config file down.

As I could see the config file, I did not go any further with trying to simulate the login as I could see what I needed to at that point.

Author

Commented:
Only giving a B as it was a work around rather than answering the actual question.
Split the points between Uros (because he did suggest the workaround) and myself (as I did the workaround prior to reading his suggestion)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial