HOW-To - Upload music on hold

65 views
Skip to first unread message

Gary N

unread,
Aug 21, 2015, 11:37:21 AM8/21/15
to NetSapiens Developer Forum
Do you have an example of how to upload music on hold files via the API?

Chris Aaker

unread,
Aug 21, 2015, 11:58:15 AM8/21/15
to Gary N, NetSapiens Developer Forum
Gary, 

Here is a bit of pseudo code mimicking what our portal does in php, basically the only difference from a normal update is you will want to send "file" parameter as the contents of the file, in curl it uses the "@" syntax and the file path. 

public function upload($data) {
$payload = array(
'object' => 'audio',
'action' => 'upload',
'type'  => 'moh',
'owner'   => '<USER>',
'owner_domain'   => '<DOMAIN>',
);
if (isset($data['Music']['upload']['tmp_name']))
$payload['file'] = '@'.$data['Music']['upload']['tmp_name'];
if (isset($data['Music']['script']))
$payload['script'] = $data['Music']['script'];
if (isset($data['Music']['index']))
$payload['index'] = $data['Music']['index'];
else
$payload['index'] = 55;
$payload['convert'] = "wav";
$api->post('audio', null, $payload);
}

On Fri, Aug 21, 2015 at 8:37 AM, Gary N <ga...@davco-tech.com> wrote:
Do you have an example of how to upload music on hold files via the API?

--
You received this message because you are subscribed to the Google Groups "NetSapiens Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netsapiens-develope...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Chris Aaker

Vice President of Engineering | NetSapiens Inc.

P.O. Box 8588 La Jolla, CA 92038

(P) 858.764.5226 (F) 858.208.4424

(E) caa...@netsapiens.com


Website | News | Events | Facebook | Twitter | Linkedin


Reply all
Reply to author
Forward
0 new messages