MUSIC ON HOLD
- Creating New Music On Hold
[[API:Function]] – goAddMOH
-
This application is used to create new music on hold . Newly created music on hold belongs to user that authenticated a request.
Mandatory parameters from “postfields” variables:
-
goUser- Username. String
-
goPass- Password. String
-
goAction- Action performed by the [[API:Functions]]. String
-
moh_id – music on hold id. Integer
-
moh_name – name of music on hold. String
-
user_group – assign user group to specific user group. String
-
active – Values is Y or N only. String
Returns:
result – “success” means that MOH has been created. String
result – “error” means that MOH has not been created, containing the error occurred. String
-
Error: Set a value for MOH ID not less than 3 characters.
-
Error: Special characters found in moh_name
-
Error: Special characters found in moh_id
-
Error: Default value for active is Y or N only.
-
Error: Default value for random is Y or N only.
-
Error: Add failed, check your details
-
Error: Invalid User Group.
moh_id – created MOH id. Integer
Sample Code:
<?php
$url = "https://jameshv.goautodial.com/goAPI/goMusicOnHold/goAPI.php"; # URL to GoAutoDial API file
$postfields["goUser"] = ""; #Username goes here. (required)
$postfields["goPass"] = ""; #Password goes here. (required)
$postfields["goAction"] = ""; #action performed by the [[API:Functions]]
$postfields["responsetype"] = "json"; #json. (required)
$postfields["moh_id"] = ""; #Desired Music On Hold (required)
$postfields["hostname"] = $_SERVER['REMOTE_ADDR']; #Default value
$postfields["moh_name"] = ""; #Desired name (required)
$postfields["user_group"] = ""; #assign to user group
$postfields["active"] = ""; #Y or N (required)
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$data = curl_exec($ch);
curl_close($ch);
$output = json_decode($data);
if ($output->result=="success") {
# Result was OK!
echo "Added New MOH ID: ";
} else {
# An error occured
echo $output->result;
}
?>
-
- Updating Music On Hold
[[API:Function]] – goEditMOH
-
This application is used to update a music on hold. Only music on hold that belongs to authenticated user can be updated.
Mandatory parameters from “postfields” variables:
-
goUser- Username. String
-
goPass- Password. String
-
goAction- Action performed by the [[API:Functions]]. String
-
moh_id – music on hold id. Integer
Returns:
result – “success” means that MOH has been updated successfully. String
result – “error” means that MOH has not been updated, containing the error occurred. String
moh_id – updated music on hold id. integer
Sample Code:
<?php
$url = "https://jameshv.goautodial.com/goAPI/goMusicOnHold/goAPI.php"; # URL to GoAutoDial API file
$postfields["goUser"] = ""; #Username goes here. (required)
$postfields["goPass"] = ""; #Password goes here. (required)
$postfields["goAction"] = ""; #action performed by the [[API:Functions]]
$postfields["responsetype"] = "json"; #json. (required)
$postfields["moh_id"] = ""; #Desired Music On Hold (required)
$postfields["hostname"] = $_SERVER['REMOTE_ADDR']; #Default value
$postfields["moh_name"] = ""; #Desired name (required)
$postfields["random"] = ""; #Desired random (required)
$postfields["active"] = ""; #Y or N (required)
$postfields["user_group"] = ""; #Assigned to user group
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$data = curl_exec($ch);
curl_close($ch);
$output = json_decode($data);
// print_r($data);
if ($output->result=="success") {
# Result was OK!
echo "Update Success";
} else {
# An error occured
echo $output->result;
}
?>
-
- Deleting MUsic On Hold
[[API:Function]] – goDeleteMOH
-
This application is used to delete a music on hold. Only music on hold that belongs to authenticated user can be delete.
Mandatory parameters from “postfields” variables:
-
goUser- Username. String
-
goPass- Password. String
-
goAction- Action performed by the [[API:Functions]]. String
-
moh_id – music on hold id. Integer
Returns:
result – “success” means that list has been deleted successfully. String
result – “error” means that list has not been deleted, containing the error occurred. String
-
Error: Set a value for music on hold ID.
-
Error: music on hold doesn't exist.
moh_id – deleted music on hold id. Integer
Sample Code:<?php
$url = "https://YOUR_URL/goAPI/goMusicOnHOld/goAPI.php"; #URL to GoAutoDial API. (required)
$postfields["goUser"] = ""; #Username goes here. (required)
$postfields["goPass"] = ""; #Password goes here. (required)
$postfields["goAction"] = ""; #action performed by the [[API:Functions]]. (required)
$postfields["responsetype"] = "json"; #json. (required)
$postfields["moh_id"] = ""; #Desired Music On Hold ID. (required)
$postfields["hostname"] = $_SERVER['REMOTE_ADDR']; #Default value
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$data = curl_exec($ch);
curl_close($ch);
$output = json_decode($data);
if ($output->result=="success") {
# Result was OK!
echo "Music On Hold deleted successfully";
} else {
# An error occured
echo $output->result;
}
?>
-
- Displaying Music On Hold
[[API:Function]] – goGetAllMusicOnHold
-
This application is used to get list of music on hold belongs to user.
Mandatory parameters from “postfields” variables:
-
goUser- Username. String
-
goPass- Password. String
-
goAction- Action performed by the [[API:Functions]]. String
Returns:
result – “success” means that query was successful. String
result – “error” means that query was not successful. , containing the error occurred. String
moh_id – music on hold id. Integer
moh_name – name of music on hold. String
active – status of list. String
random– random. String
user_group –user group of music on hold. String
Sample Code:
<?php
$url = "https://YOUR_URL/goAPI/goMusicOnHold/goAPI.php"; #URL to GoAutoDial API. (required)
$postfields["goUser"] = ""; #Username goes here. (required)
$postfields["goPass"] = ""; #Password goes here. (required)
$postfields["goAction"] = ""; #action performed by the [[API:Functions]]. (required)
$postfields["responsetype"] = "json"; #json. (required)
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$data = curl_exec($ch);
curl_close($ch);
$output = json_decode($data);
if ($output->result=="success") {
# Result was OK!
for($i=0;$i<count($output->moh_id);$i++){
echo $output->moh_id[$i]."</br>";
echo $output->moh_name[$i]."</br>";
echo $output->active[$i]."</br>";
echo $output->random[$i]."</br>";
echo $output->user_group[$i]."</br>";
}
} else {
# An error occured
echo "The following error occured: ".$results["message"];
}
?>
-
- Displaying Music On Hold Information
[[API:Function]] – goGetListInfo
-
Allows to retrieve some attributes of a given music on hold. Music on hold should belong to the user that authenticated the request.
Mandatory parameters from “postfields” variables:
-
goUser- Username. String
-
goPass- Password. String
-
goAction- Action performed by the [[API:Functions]]. String
-
moh_id – music on hold id. Integer
Returns:
result – “success” means that query was successful. String
result – “error” means that query was not successful. , containing the error occurred. String
-
Error: Set a value for MOH ID.
-
Error: Music on Hold doesn't exist.
moh_id – music on hold id. Integer
moh_name – name of music on hold. String
active – status of list. String
random– random. String
user_group –user group of music on hold. String
Sample Code:
<?php
$url = "https://YOUR_URL/goAPI/goMusicOnHold/goAPI.php"; #URL to GoAutoDial API. (required)
$postfields["goUser"] = ""; #Username goes here. (required)
$postfields["goPass"] = ""; #Password goes here. (required)
$postfields["goAction"] = ""; #action performed by the [[API:Functions]]. (required)
$postfields["responsetype"] = "json"; #json. (required)
$postfields["moh_id"] = ""; #Desired Music On Hold ID. (required)
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$data = curl_exec($ch);
curl_close($ch);
$output = json_decode($data);
if ($output->result=="success") {
# Result was OK!
for($i=0;$i<count($output->moh_id);$i++){
echo $output->moh_id[$i]."</br>";
echo $output->moh_name[$i]."</br>";
echo $output->active[$i]."</br>";
echo $output->random[$i]."</br>";
echo $output->user_group[$i]."</br>";
}
} else {
# An error occured
echo $output->result;
}
?>
-