- Creating New Phone
[[API:Function]] – goAddPhones
-
This application is used to create new phone . Newly created phone 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
-
extension – extension id for phone. Integer
-
server_ip – server ip. Integer
-
pass – password. String
-
protocol – protocol used for phone. String
-
dialplan_number – dialplan number. Integer
-
voicemail_id – voicemail id. String
-
status - status of phone, values are Y or N only. String
-
active - status of phone, values are Y or N only. String
-
fullname – full name. String
-
messages – messages. String
-
old_messages – old messages. String
-
user_group – assign user group to specific user group
Returns:
result – “success” means that phone has been created. String
result – “error” means that phone has not been created, containing the error occurred. String
-
Error: Set a value for Extension.
-
Error: Default value for status is ACTIVE, SUSPENDED, CLOSED, PENDING, ADMIN only.
-
Error: Default value for active is Y or N only.
-
Error: Default value for protocol is SIP, Zap, IAX2, EXTERNAL.
-
Error: Special characters found in extension
-
Error: Special characters found in server_ip
-
Error: Special characters found in password
-
Error: Special characters found in dialplan_number
-
Error: Special characters found in voicemail_id
-
Error: Special characters found in status
-
Error: Special characters found in fullname
-
Error: Special characters found in messages
-
Error: Special characters found in old_messages
-
Error: Special characters found in user_group
-
Error: Phone already exist.
extension – created extension. Integer
Sample Code:
<?php
$url = "https://jameshv.goautodial.com/goAPI/goPhones/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["extension"] = ""; #Deisred extension (required)
$postfields["server_ip"] = ""; #Desired server_ip (required)
$postfields["hostname"] = $_SERVER['REMOTE_ADDR']; #Default value
$postfields["pass"] = ""; #Desired password (required)
$postfields["protocol"] = ""; #SIP, Zap, IAX2, or EXTERNAL. (required)
$postfields["dialplan_number"] = ""; #Desired dialplan number (required)
$postfields["voicemail_id"] = ""; #Desired voicemail (required)
$postfields["status"] = ""; #ACTIVE, SUSPENDED, CLOSED, PENDING, or ADMIN (required)
$postfields["active"] = ""; #Y or N (required)
$postfields["fullname"] = ""; #Desired full name (required)
$postfields["messages"] = ""; #Desire message (required)
$postfields["old_messages"] = ""; #Desired old message (required)
$postfields["user_group"] = ""; #Assign to user group (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);
// print_r($data);
if ($output->result=="success") {
# Result was OK!
echo "Added New Phone ID";
} else {
# An error occured
echo $output->result;
}
?>
-
- Updating Phone
[[API:Function]] – goEditPhone
-
This application is used to update a phone. Only phone 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
-
extension – extension. Integer
Returns:
result – “success” means that phone has been updated successfully. String
result – “error” means that phone has not been updated, containing the error occurred. String
-
Error: Set a value for Extension.
-
Error: Default value for status is ACTIVE, SUSPENDED, CLOSED, PENDING, ADMIN only.
-
Error: Default value for active is Y or N only.
-
Error: Default value for protocol is SIP, Zap, IAX2, EXTERNAL.
-
Error: Special characters found in server_ip
-
Error: Special characters found in password
-
Error: Special characters found in dialplan_number
-
Error: Special characters found in voicemail_id
-
Error: Special characters found in status
-
Error: Special characters found in fullname
-
Error: Special characters found in messages
-
Error: Special characters found in old_messages
-
Error: Special characters found in user_group
-
Error: Set a value for Extension.
-
Error: Default value for status is ACTIVE, SUSPENDED, CLOSED, PENDING, ADMIN only.
-
Error: Default value for active is Y or N only.
-
Error: Default value for protocol is SIP, Zap, IAX2, EXTERNAL.
-
Error: Special characters found in server_ip
-
Error: Special characters found in password
-
Error: Special characters found in dialplan_number
-
Error: Special characters found in voicemail_id
-
Error: Special characters found in status
-
Error: Special characters found in fullname
-
Error: Special characters found in messages
-
Error: Special characters found in old_messages
-
Error: Special characters found in user_group
-
Error: Failed to update
-
Error: Phone doesn't exist
-
Error: Failed to update
-
Error: Phone doesn't exist
extension – updated phone extension. Integer
Sample Code:
<?php
$url = "https://jameshv.goautodial.com/goAPI/goPhones/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["extension"] = ""; #Deisred extension (required)
$postfields["server_ip"] = ""; #Desired server_ip (required)
$postfields["hostname"] = $_SERVER['REMOTE_ADDR']; #Default value
$postfields["pass"] = ""; #Desired password (required)
$postfields["protocol"] = ""; #SIP, Zap, IAX2, or EXTERNAL. (required)
$postfields["dialplan_number"] = ""; #Desired dialplan number (required)
$postfields["voicemail_id"] = ""; #Desired voicemail (required)
$postfields["status"] = ""; #ACTIVE, SUSPENDED, CLOSED, PENDING, or ADMIN (required)
$postfields["active"] = ""; #Y or N (required)
$postfields["fullname"] = ""; #Desired full name (required)
$postfields["messages"] = ""; #Desire message (required)
$postfields["old_messages"] = ""; #Desired old message (required)
$postfields["user_group"] = ""; #Assign to user group (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);
// print_r($data);
if ($output->result=="success") {
# Result was OK!
echo "Update Success";
} else {
# An error occured
echo $output->result;
}
?>
-
- Deleting Phone
[[API:Function]] – goDeletePhone
-
This application is used to delete a phone. Only phone 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
-
extension – extension. Integer
Returns:
result – “success” means that phone has been deleted successfully. String
result – “error” means that phone has not been deleted, containing the error occurred. String
-
Error: Set a value for extension.
-
Error: Phone doesn't exist.
extension – deleted extension. Integer
Sample Code:<?php
$url = "https://YOUR_URL/goAPI/goPhones/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["extension"] = ""; #Desired extension. (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);
// print_r($data);
if ($output->result=="success") {
# Result was OK!
echo "Phone deleted successfully";
} else {
# An error occured
echo $output->result;
}
?>
-
- Displaying Phones
[[API:Function]] – goGetPhonesList
-
This application is used to get list of phone 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
extension – extension. Integer
protocol– protocol. String
active – status of phone. String
server_ip – server ip. Integer
dialplan_number – dialplan number. Integer
voicemail_id – voicemail id of phone. String
active - status of phone. String
fullname – full name. String
messages – messages. String
old_messages – old messages. String
user_group – user group. String
Sample Code:
<?php
$url = "https://YOUR_URL/goAPI/goPhones/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->extension);$i++){
echo $output->extension[$i]."</br>";
echo $output->protocol[$i]."</br>";
echo $output->server_ip[$i]."</br>";
echo $output->dialplan_number[$i]."</br>";
echo $output->active[$i]."</br>";
echo $output->fullname[$i]."</br>";
echo $output->messages[$i]."</br>";
echo $output->old_messages[$i]."</br>";
echo $output->user_group[$i]."<brd>";
}
} else {
# An error occured
echo "The following error occured: ".$results["message"];
}
?>
-
- Displaying Phones Information
[[API:Function]] – goGetPhoneInfo
-
Allows to retrieve some attributes of a given phone. phone 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
-
extension –extension. 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 extension.
-
Error: Phone doesn't exist.
extension – extension. Integer
protocol– protocol. String
active – status of phone. String
server_ip – server ip. Integer
dialplan_number – dialplan number. Integer
- 968 Users Found This Useful
Related Articles
-
PHONES