Binary file upload via CUPI

Version 1
    This document was generated from CDN thread

    Created by: Bernhard Albler on 19-08-2010 08:21:20 PM
    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

    Subject: RE: Binary file upload via CUPI
    Replied by: Matthew Penning on 19-08-2010 08:21:20 PM
    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

    Subject: RE: Binary file upload via CUPI
    Replied by: FITRA KHAN on 09-02-2012 05:24:22 PM
    Hello,
    I want to upload users' greetings using CUPI.  We currently have Cisco Unity Connection 8.6.  I used the following site for guidance.  Basically, I am trying the following:
     
    <h3>  Setting a Greeting in 8.5 and Later </h3>
    PUT the audio data directly to the standard greeting stream file URI:

    <pre>PUT http://<connection-server>/vmrest/handlers/callhandlers/<call handler object id>/greetings
    /<greeting type>/greetingstreamfiles/<language id>/audio content is audio/wav data
    </pre>
    The response is a 204 indicating that the content has been accepted and copied into the temporary file.

     
     
    http://docwiki.cisco.com/wiki/Cisco_Unity_Connection_Provisioning_Interface_%28CUPI%29_API_--_Greeting
     
     
    We get the error 415 media not supported with the following code:
     
    $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,$wavefile);
    $req->authorization_basic($USER,$PASSWORD);
    $response = $ua->request($req);
     
    Can you please provide an example on how we can upload a greeting using CUTI?  We are new on this and we do not know if this is the correct way.
     
    Thanks.