UCCX Scripting: Uploading Files to Windows File Share

Enabling Cisco UCCX to upload files (wav files etc) to a Windows file share is very useful feature that not many Engineers know about.

Uploading file to Windows file share can be useful for many tasks including transferring Voice Messages from customers, backing up greetings, uploading xml documents with customer responses etc.

The procedure is fairly simple and I found a great discussion regarding this on the Cisco Support Forums.

https://supportforums.cisco.com/document/96366/uccx-8x-how-playwrite-file-prompts-fromto-windows-shares

I will more or less rehash this into a shortened version for quick reference.

1. Download the jcifs-1.3.18.zip file.
2. Upload the .jar file to UCCX Server. System -> Custom File Configuration.
3. Restart the CCX Engine.
4. In the CCX Scripting Editor, create a variable of type String. Name this variable smbFileURL, do not give it a value.
5. Add a Set Sep into the script. Select the variable created in the previous step. For the value go to the expressions editor and type the following:

“smb://domain_name;username:password@server_ip_address/share_name/filename.wav”

6. Create a variable of type Integer. Name the variable exitCode. Value should remain at “0”
7. Add a second Set Step into the UCCX Script. Select the variable created in the previous step. For the value go to the expressions editor and type the following:

{
java.io.OutputStream os = null;
java.io.InputStream in = null;
try {
int bufSize = 4096;
jcifs.smb.SmbFile smbFile = new jcifs.smb.SmbFile(smbFileURL);
os = smbFile.getOutputStream();
in = dVoicemail.getInputStream();
byte[] bytesRead = new byte[bufSize];
int bytesReadLength = 0;
while ((bytesReadLength = in.read(bytesRead)) > 0 ) {
os.write(bytesRead,0,bytesReadLength);
}
} catch (Exception e) {
return -1;
} finally {
in.close();
os.close();
return 0;
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>