In IIS7 and IIS7.5 which runs on Windows Server 2008 or Windows Server 2008 R2, it is not possible to use the WebDav PUT command without ‘authentication’.
This is a problem for your Avaya VOIP phones. Avaya uses the PUT command to backup a phone configuration and to store contacts.
Now, there are 3 possible options:
- Install Apache on Windows or Linux. I know many of you guys don’t like this…Especially because you need to configure and update/patch it.
- Use a WebDav server like IP Tel from Avaya. However, that program looks like a Windows95 program,.. is it supported at all. ?
- Install my Avaya script / workarround! I’ll tell you how it works below.
My Avaya WebDav workarround:
- Install IIS on a Workstation or Server. You might have already installed IIS for phones to download the firmware and settings file.
Make sure to have the WebDav module UNinstalled! (If you install it and disable it inside the IIS Manager, it will not work!) - Install the URL Rewrite module of IIS.
- Add a rewrite rule on your backup directory which looks like this:
(click to enlarge) - Use the following script:
avayaupload.asp
< %
'#THIS IS THE ONLY VARIABLE NEEDED! PLEASE END WITH A SLASH!!#
backup_dir = "c:\inetpub\wwwroot\backup\"
uri = Request.ServerVariables("REQUEST_URI")
filename = Right( uri, Len(uri) - InStrRev(uri,"/",Len(uri)) )
If UCase(Request.ServerVariables("HTTP_METHOD"))="PUT" Then
If Request.Totalbytes>0 Then
sourcedata = Request.BinaryRead(Request.Totalbytes)
SaveBinaryData backup_dir&filename, sourcedata
Response.Status="201 Created"
End If
Else
Set fs = CreateObject("Scripting.FileSystemObject")
If fs.FileExists (backup_dir&filename) Then
filecontent = ReadBinaryFile(backup_dir&filename)
response.binarywrite filecontent
End If
End If
Function SaveBinaryData(FileName, ByteArray)
Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2
'Create Stream object
Dim BinaryStream
Set BinaryStream = CreateObject("ADODB.Stream")
'Specify stream type - we want To save binary data.
BinaryStream.Type = adTypeBinary
'Open the stream And write binary data To the object
BinaryStream.Open
BinaryStream.Write ByteArray
'Save binary data To disk
BinaryStream.SaveToFile FileName, adSaveCreateOverWrite
End Function
Function ReadBinaryFile(FileName)
Const adTypeBinary = 1
'Create Stream object
Dim BinaryStream
Set BinaryStream = CreateObject("ADODB.Stream")
'Specify stream type - we want To get binary data.
BinaryStream.Type = adTypeBinary
'Open the stream
BinaryStream.Open
'Load the file data from disk To stream object
BinaryStream.LoadFromFile FileName
'Open the stream And get binary data from the object
ReadBinaryFile = BinaryStream.Read
End Function
%>
Don’t forget to give the backup directory Write permissions (NTFS) for the IUSR account.
Implemented this today on IIS 7.5 with a few adjustments:
– I also had to activate the PUT verb for classic ASP
– I adjusted the matching condition for the rewrite rule to a regex that is accurate enough to make sure that only files in the expected path / filename are passed to the script, everything else get’s handled static by IIS. *txt* breaks a lot of other stuff and might be a security risk.
– highly recommended: harden the setup by restricting access to only your phone networks
– MOST IMPORTANT: put this in a separate App pool, configure