My Collab Lab

mycollablab.org

Unity Prompt Upload

March 15, 2016 Voicemail

For that horrible time before you were on 11.5 and had the HTML5 prompt uploader and after your Java had already upgraded and when AudioText Manager didn’t work for whatever reason. Here is the API type way to upload a prompt to unity. You will need to find out the call handler/user object ID by going to https:///vmrest/handlers/callhandlers or go to https:///vmrest/users?query=(DtmfAccessId = 1001) and look for the CallHandlerURI and plop that in here updating the rest as needed. Prompt needs to be in the correct format – g711.org provdes easy converting


#!/usr/bin/php -q
<?php

  $host     = "172.20.0.12";
  $username = "admin";
  $password = "<password>";


function promptUpload($callhander_id,$greeting,$prompt_file) {

    global $host;
    global $username;
    global $password;
    $prompt = fopen($prompt_file,"r");

    $cupiurl="https://".$host.":8443/vmrest/handlers/callhandlers/"
            .$callhander_id."/greetings/".$greeting.
            "/greetingstreamfiles/1033/audio";

    $ch=curl_init();
    curl_setopt( $ch, CURLOPT_URL, $cupiurl );
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
    curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type: audio/wav'));
    curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
    curl_setopt($ch, CURLOPT_USERPWD, $username.":".$password);
    curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);

    curl_setopt($ch, CURLOPT_PUT, 1);
    curl_setopt($ch, CURLOPT_INFILE, $prompt);
    curl_setopt($ch, CURLOPT_INFILESIZE, filesize($prompt_file));

    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    $result = curl_exec($ch);
    curl_close($ch);


    $cupi = json_decode(json_encode((array)simplexml_load_string($result)),1);

  fclose($prompt);

    return var_dump($cupi);
}


//Prompt Names = Standard, Alternate, Error, Internal, Holiday, Off Hours, Busy
promptUpload("ca22db19-1428-4a11-9435-84534844a967","Off Hours","./prompt.wav");

echo "\n\n";

?>

apicupipromptunityupload

User Account Status

Get Device Registration Status


Jon Snipes
LinkedIn

My career progressed from head butcher to Collaboration CCIE. There isn’t much technically that carries over between professions, but 8 years of direct customer service experience and squeezing margin out of processes provided a solid base and direction for the rest of my career. My focus today is deep into collaboration messaging, voice and video with the expertise to develop processes and programmatic solutions to complex business problems.

Principal Architect at Cloverhound
CCIE Collaboration 51786
Cisco Webex Expert
2018-2021 Cisco Champion

Categories
  • Cloud (4)
  • Contact Center (1)
  • Development (1)
  • PHP (10)
  • Python (3)
  • Uncategorized (1)
  • Video (2)
  • Voice (12)
  • Voicemail (5)
  • Webex (7)
Recent Posts
  • Azure OAuth2.0 User Authentication December 4, 2021
  • Pass-through Gateway Routing and Dial Peer Groups December 4, 2021
  • Get Started Coding with Python: System Setup and Running Scripts December 4, 2021
  • Exporting CUCM to an Offline Local DB with Python December 4, 2021
  • Connecting to UCCX INFORMIX DB with Python on Linux December 4, 2021
Proudly powered by WordPress | Theme: Doo by ThemeVS.