My Collab Lab

My Collab Lab

mycollablab.org

Unity Prompt Upload

March 15, 2016 UnityConnection

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
TwitterLinkedIn

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.

ROVE Senior Technical Consultant
CCIE Collaboration 51786
Cisco Spark Professional Ambassador
2018 Cisco Champion

Categories

  • Cloud (5)
  • DevNet (2)
  • PHP (10)
  • Python (3)
  • SQL (1)
  • UCCX (1)
  • Uncategorized (1)
  • UnityConnection (5)
  • Video (2)
  • Voice (11)
  • Webex Teams (8)

Recent Posts

  • Connecting to UCCX INFORMIX DB with Python on Linux November 13, 2020
  • Exporting CUCM to an Offline Local DB with Python October 25, 2020
  • Get Started Coding with Python: System Setup and Running Scripts September 20, 2020
  • Pass-through Gateway Routing and Dial Peer Groups January 7, 2020
  • Azure OAuth2.0 User Authentication December 16, 2019
Proudly powered by WordPress | Theme: Doo by ThemeVS.