Manage Carrier

CARRIER

  1. Creating New Carrier

    [[API:Function]] – goAddCarrier

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

    • carrier_id – carrier id. String

    • carrier_name – name of the carrier. String

    • carrier_description – description of carrier. String

    • protocol – protocol used in carrier. String

    • server_ip – server ip of carrier. Integer

    • active – status of carrier, values is Y or N only. String

     

    Returns:

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

     

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

    • Error: Set a value for Carrier ID.

    • Error: Set a value for server ip.

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

    • Error: Default value for protocol is SIP, Zap, IAX2 or EXTERNAL only.

    • Error: Special characters found in carrier_id

    • Error: Special characters found in carrier_name

    • Error: Special characters found in carrier_description

    • Error: Special characters found in user_group

    • Error: Special characters found in account_entry

    • Error: Special characters found in dialplan_entry

     

    carrier_id – created carrier id. Integer

     

    Sample Code:

     

    <?php

    $url = "https://jameshv.goautodial.com/goAPI/goCarriers/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["hostname"] = $_SERVER['REMOTE_ADDR']; #Default value

    $postfields["carrier_id"] = ""; #Desired carrier ID (required)

    $postfields["carrier_name"] = ""; #Desired name (required)

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

    $postfields["protocol"] = ""; #'SIP','Zap','IAX2',or 'EXTERNAL' (required)

    $postfields["server_ip"] = ""; #Desired server ip (required)

    $postfields["active"] = ""; #Y or N (required)

     

    $postfields["item"] = "$values";

     

    $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 Carrier ID: ".$carrier_id;

    } else {

    # An error occured

    echo $output->result;

    }

    ?>


  2. Updating Carrier

    [[API:Function]] – goEditCarrier

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

    • carrier_id – id of carrier. String

     

    Returns:

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

     

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

    • Error: Set a value for Carrier ID.

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

    • Error: Default value for protocol is SIP, Zap, IAX2 or EXTERNAL only.

    • Error: Special characters found in registration_string.

    • Error: Special characters found in carrier_name

    • Error: Special characters found in carrier_description.

    • Error: Special characters found in global_string.

    • Error: Special characters found in account_entry.

    • Error: Special characters found in server_ip.

    • Error: Carrier doesn't exist.

     

    Sample Code:

     

    <?php

    $url = "https://jameshv.goautodial.com/goAPI/goCarriers/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["hostname"] = $_SERVER['REMOTE_ADDR']; #Default value

    $postfields["carrier_id"] = ""; #Desired carrier ID (required)

    $postfields["carrier_name"] = ""; #Desired name (required)

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

    $postfields["protocol"] = ""; #'SIP','Zap','IAX2',or 'EXTERNAL' (required)

    $postfields["server_ip"] = ""; #Desired server ip (required)

    $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);

     

    // print_r($data);

     

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

    # Result was OK!

    echo "Update Success";

    } else {

    # An error occured

    echo $output->result;

    }

     ?>


  3. Deleting Carrier

    [[API:Function]] – goDeleteCarrier

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

    • carrier_id – carrier id. Integer

     

    Returns:

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

     

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

    • Error: Set a value for carrier ID.

    • Error: carrier doesn't exist.

     

    carrier_id – deleted carrier id. String



    Sample Code:

     

    <?php

    $url = "https://YOUR_URL/goAPI/goCarriers/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["carrier_id"] = ""; #Desired carrier 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 "Carrier deleted successfully";

    } else {

    # An error occured

    echo $output->result;

    } 

    ?>


  4. Displaying Carrier

    [[API:Function]] – goGetCarriersList

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

     

    carrier_id – carrier id. String

    carrier_name – name of carrier. String

    active – status of carrier. String

    server_ip – server ip. Integer

    protocol – protocol used by carrier. String

    registration_stringregistration string. String

    user_group – user group. String

     

    Sample Code:

     

    <?php

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

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

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

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

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

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

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

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

    }

    } else {

    # An error occured

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

    }

    ?>


  5. Displaying Carrier Information

    [[API:Function]] – goGetCarrierInfo

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

    • carrier_id – carrier id. String

     

    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 carrier ID.

    • Error: carrier doesn't exist.

     

    carrier_id – carrier id. String

    carrier_name – name of carrier. String

    active – status of carrier. String

    server_ip – server ip. Integer

    protocol – protocol used by carrier. String

    registration_stringregistration string. String

    user_group – user group. String

     

    Sample Code:

     

    <?php

     $url = "https://YOUR_URL/goAPI/goCarriers/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["carrier_id"] = ""; #Desired carrier 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!

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

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

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

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

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

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

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

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

     

    }

    } else {

    # An error occured

    echo $output->result;

    }
    ?>

  • 1039 Users Found This Useful
Was this answer helpful?

Related Articles

Manage Interactive Voice Response (IVR) Menu

INTERACTIVE VOICE RESPONSE (IVR) MENUS Creating New Interactive Voice Response...

Manage Campaign

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

Manage In-group

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

Manage Tenant

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

Manage Call Recording

CALL RECORDING Displaying Call Recording [[API:Function]] – goGetCallRecordingList This...