Manage Phone Number (DID/TFN)

PHONE NUMBERS (DIDs/TFNs)

  1. Creating New DID

    [[API:Function]] – goAddDID

    • This application is used to create new DID . Newly created DID 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

    • did_pattern – Pattern for DID. Integer

    • did_description – description for DID. String

    • did_active – Values is Y or N only. String

    • user_group – assign user group to specific user group. String

    • did_route- Values is EXTEN, VOICEMAIL, AGENT, PHONE, IN_GROUP, or CALLMENU only.

    • EXTEN

    user – user. String

    user_unavailable_action – user unavailable action. String

    • VOICEMAIL

    group_id – group id. Integer

    • AGENT

    phone – phone. Integer

    server_ip – server ip. String

    • PHONE

    menu_id – menu id. Integer

    • IN_GROUP

    extension – extension. String

    exten_context – extension context. String

     

    Returns:

    result – “success” means that DID has been created. String

     

    result – “error” means that DID has not been created, containing the error occurred. String

    • Error: Set a value for DID ID.

    • Error: Special characters found in did_pattern

    • Error: Special characters found in did_description

    • Error: Default value for user_unavailable_action is IN_GROUP','EXTEN','VOICEMAIL','PHONE', or 'VMAIL_NO_INST'.

    • Error: Default value for active is Y or N only.

    • Error: Default value for did_route are EXTEN, VOICEMAIL, AGENT, PHONE, IN_GROUP, or CALLMENU only.

    • Error: Default value for Record Call are Y, N and Y_QUEUESTOP only.

    • DID not found

    • Error: Failed to modified the Group ID

    For agent:

    • Error: Set Value for user_unavailable_action .

    • Error: Set Value for user

    For in_group:

    • Error: Set Value for group_id

    • Error: Special characters found in group_id

    • For phone:

    • Error: Special characters found in phone

    • Error: Special characters found in server_ip

    • Error: Set Value for phone

    • Error: Set Value for server_ip

    For callmenu:

    • Error: Set Value for menu_id

    • Error: Special characters found in menu_id

    For voicemail:

    • Error: Special characters found in voicemail_ext

    • Error: Set Value for voicemail_ext

    For exten:

    • Error: Set Value for extension

    • Error: Set Value for exten_context

    • Error: Special characters found in extension

    • Error: Special characters found in exten_context

     

    did_id – created did id. Integer

     

    Sample Code:

     

    <?php

    $url = "https://jameshv.goautodial.com/goAPI/goInbound/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["user"] = ""; #Desired user (required if did_route is AGENT)

    $postfields["user_unavailable_action"] = ""; #Desired user unavailable action (required if did_route is AGENT)

    $postfields["group_id"] = ""; #Desired group ID (required if did_route is IN-GROUP)

    $postfields["phone"] = ""; #Desired phone (required if did_route is PHONE)

    $postfields["server_ip"] = ""; #Desired server ip (required if did_route is PHONE)

    $postfields["menu_id"] = ""; #Desired menu id (required if did_route is IVR)

    $postfields["voicemail_ext"] = ""; #Desired voicemail (required if did_route is VOICEMAIL)

    $postfields["extension"] = ""; #Desired extension (required if did_route is CUSTOM EXTENSION)

    $postfields["exten_context"] = ""; #Deisred context (required if did_route is CUSTOM EXTENSION)

    $postfields["did_pattern"] = ""; #Desired pattern (required)

    $postfields["did_description"] = ""; #Desired description(required)

    $postfields["did_route"] = ""; #'EXTEN','VOICEMAIL','AGENT','PHONE','IN_GROUP','CALLMENU', or'VMAIL_NO_INST' (required)

    $postfields["record_call"] = ""; #Desired call record (required)

    $postfields["user_group"] = ""; #Assign to user group

    $postfields["did_active"] = ""; #Y or N (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 "Added New DID ID: ";

    } else {

    # An error occurred

    }

    ?>


  2. Updating DID

    [[API:Function]] – goEditDIDAPI

    • This application is used to update a DID. Only DID 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

    • did_id – did id. Integer

     

    Returns:

    result – “success” means that DID has been updated successfully. String

     

    result – “error” means that DID has not been updated, containing the error occurred. String

    • Error: Set a value for DID ID.

    • DID not found.

    • Duplicate did_pattern, It must be unique!

    • Error: Special characters found in did_pattern

    • Error: Special characters found in did_description

    • Error: Default value for user_unavailable_action is IN_GROUP','EXTEN','VOICEMAIL','PHONE', or 'VMAIL_NO_INST'.

    • Error: Default value for active is Y or N only.

    • Error: Default value for did_route are EXTEN, VOICEMAIL, AGENT, PHONE, IN_GROUP, or CALLMENU only.

    • Error: Default value for Record Call are Y, N and Y_QUEUESTOP only.

    • Error: Special characters found in group_id

    • Error: Special characters found in phone

    • Error: Special characters found in server_ip

    • Error: Special characters found in menu_id

    • Error: Special characters found in voicemail_ext

    • Error: Special characters found in extension

    • Error: Special characters found in exten_context

    • Error: Failed to modified the Group ID

     

    did_id – updated did. Integer

     

    Sample Code:

     

    <?php

    $url = "https://jameshv.goautodial.com/goAPI/goInbound/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["did_id"] = ""; #Desired did 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);

     

    // print_r($data);

     

    if ($output->result=="success") {

    # Result was OK!

    echo "Update Success";

    } else {

    # An error occured

    echo $output->result;

    }

     ?>


  3. Deleting DID

    [[API:Function]] – goDeleteDID

    • This application is used to delete a did. Only did 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

    • did_id – did id. Integer

     

    Returns:

    result – “success” means that did has been deleted successfully. String

     

    result – “error” means that did has not been deleted, containing the error occurred. String

    • Error: Set a value for did id.

    • Error: DID doesn't exist.

     

    did_id – deleted did id. Integer



    Sample Code:

     

    <?php

    $url = "https://YOUR_URL/goAPI/goInbound/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["did_id"] = ""; #Desired did did. (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 "DID deleted successfully";

    } else {

    # An error occured

    echo $output->result;

    }

     ?>


  4. Displaying DID

    [[API:Function]] – goGetDIDsList

    • This application is used to get list of Phone number 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

     

    did_pattern – did pattern. Integer

    did_description – description of did. String

    did_route – route of did. String

    did_activeStatus of did, values is Y or N only. String

     

    Sample Code:

     

    <?php

    $url = "https://YOUR_URL/goAPI/goInbound/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->did_pattern);$i++){

    echo $output->did_pattern[$i]."</br>";

    echo $output->did_description[$i]."</br>";

    echo $output->active[$i]."</br>";

    echo $output->did_route[$i]."</br>";

    }

    } else {

    # An error occured

    echo "The following error occured: ".$results["message"];

    }

     ?>


  5. Displaying DID Information

    [[API:Function]] – goGetDIDInfo

    • Allows to retrieve some attributes of a given DID. DID 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

    • did_pattern – did pattern. 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 did_pattern.

    • Error: DID doesn't exist.

     

    did_pattern – did pattern. Integer

    did_description – description of did. String

    did_route – route of did. String

    did_activeStatus of did, values is Y or N only. Strings

     

    Sample Code:

     

    <?php

    $url = "https://YOUR_URL/goAPI/goInbound/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["did_pattern"] = ""; #Desired DID pattern. (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!

    for($i=0;$i<count($output->did_pattern);$i++){

    echo $output->did_pattern[$i]."</br>";

    echo $output->did_description[$i]."</br>";

    echo $output->active[$i]."</br>";

    echo $output->did_route[$i]."</br>";

    }

    } else {

    # An error occured

    echo $output->result;

    }

    ?>

  • 909 Users Found This Useful
Was this answer helpful?

Related Articles

Manage Carrier

CARRIER Creating New Carrier [[API:Function]] – goAddCarrier This application is used to...

Manage Voice File

VOICE FILE Creating New Voice File [[API:Function]] – goAddVoiceFiles This application...

Manage Tenant

TENANT Creating New Tenant [[API:Function]] – goAddMultiTenant This application is used...

Manage In-group

IN-GROUP Creating New In-group [[API:Function]] – goAddInbound This application is used...

Manage Campaign

CAMPAIGN Creating New Campaign [[API:Function]] – goAddCampaign This application is used...