CUC Forums

« Back to CUPI Questions

Binary file upload via CUPI

Combination View Flat View Tree View
Threads [ Previous | Next ]
Hello,
 
is there a way to upload binary data (specifically prompts) via CUPI. We can download prompts via CUPI but have not found any way to upload files via CUPI.
many thanks
bernhard

RE: Binary file upload via CUPI
cupi greetings
Answer
10/20/09 10:29 PM as a reply to Bernhard Albler.
Hi Bernhard - great question, since it's not really that obvious how to do this via the API. If you're talking about call handler greetings (like the opening greeting), yes CUPI can upload those. I'm assuming you are talking about greetings since CUPI doesn't provide a way to download the static system prompts.
 
To upload a new greeting for a call handler, here are the steps:
 
1) Create a new voice file on Connection that you can upload to:
 
POST /vmrest/voicefiles
 
This will return a voice file name that has been allocated for you to upload to.
 
2) Upload voice data to this file
 
PUT /vmrest/voicefiles/{voiceFileName}
 
The mime type should be audio/wav
 
3) Tell the call handler to use this new file
 
PUT /vmrest/callhandlers/{objectid}/greetings/Standard/greetingstreamfiles/1033
 
PUT data:
<GreetingStreamFile>
<StreamFile>{voiceFileName}</StreamFile>
</GreetingStreamFile>
 
This is assuming there already is a greeting - otherwise you will have to use POST instead of PUT.
 
Notice that I'm setting the "Standard" greeting here, and for english (1033).
 
- Matt

Hi Experts,

I am using Java code to accomplish the PUT and POST commands described above. I can get the filename as stated in the step 1 above but when I try to upload the wav file using PUT , I get Forbidden" access code. What could the possible reasons for that?

Thanks!
Navjeet

Hello,
I want to change users' greetings using CUPI.  I have Cisco Unity Connection 8.6.  I used the following site to set the greeting and the following code. 



http://docwiki.cisco.com/wiki/Cisco_Unity_Connection_Provisioning_Interface_%28CUPI%29_API_--_Greetings
Setting a Greeting in 8.5 and Later

PUT the audio data directly to the standard greeting stream file URI:

PUT http://<connection-server>/vmrest/handlers/callhandlers/<call handler object id>/greetings
/<greeting type>/greetingstreamfiles/<language id>/audio content is audio/wav data

The response is a 204 indicating that the content has been accepted and copied into the temporary file.


With the following code, I am getting error 415 (Media not supported):


my $url="https://$serverIP/vmrest/handlers/callhandlers/$objectID/greetings/Standard/greetingstreamfiles/$language/";

my $ua = LWP::UserAgent->new;
my $header = HTTP::Headers->new;
$header->header("Content-Type","audio/wav");
$req = HTTP::Request->new(POST =>$url,$header,$tempfile);
$req->authorization_basic($USER,$PASSWORD);
$response = $ua->request($req);

Can you please let me know if this is the correct way to upload the greeting?  Also, if there is a example of how to do it.

Thanks for your help,
 
Hi Bernhard - great question, since it's not really that obvious how to do this via the API. If you're talking about call handler greetings (like the opening greeting), yes CUPI can upload those. I'm assuming you are talking about greetings since CUPI doesn't provide a way to download the static system prompts.
 
To upload a new greeting for a call handler, here are the steps:
 
1) Create a new voice file on Connection that you can upload to:
 
POST /vmrest/voicefiles
 
This will return a voice file name that has been allocated for you to upload to.
 
2) Upload voice data to this file
 
PUT /vmrest/voicefiles/{voiceFileName}
 
The mime type should be audio/wav
 
3) Tell the call handler to use this new file
 
PUT /vmrest/callhandlers/{objectid}/greetings/Standard/greetingstreamfiles/1033
 
PUT data:
<GreetingStreamFile>
<StreamFile>{voiceFileName}</StreamFile>
</GreetingStreamFile>
 
This is assuming there already is a greeting - otherwise you will have to use POST instead of PUT.
 
Notice that I'm setting the "Standard" greeting here, and for english (1033).
 
- Matt