Simulate a SIP Phone request for config

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.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

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
Uros GaberdirectorCommented:
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" ?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bmcollisAuthor 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.
bmcollisAuthor 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)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Voice Over IP

From novice to tech pro — start learning today.