Knowladge Base

PURCHASE A DID

Method for Purchasing a DID

By using this method the user can purchase a DID. The user has to provide user id, password, DID Number (which he wants to purchase), SIP URL or IAX ,flag (1 for SIP URL or 2 for IAX) and/or Vendor ID.

In case of successful purchase, the DID number itself would be returned. Otherwise, an error code would be returned which is described later.

Method Signature

sub BuyDIDByNumber ($UserID,$Password,$DIDNumber,$SIPorIAX, $Flag,$VendorID)

Example Usage

We are providing a sample code in PHP that accesses and uses this service.

<?php

require_once “nusoap.php”;

$parameters=array(“954488″,”54dfg5″,”2607158″,”2607158@supertec.com”,”1″);
$soapclient= new soapclient(‘http://api.didx.net/webservice/WebBuyDIDServer.php’);
$SoapResult = array();
$SoapResult = $soapclient->call(“BuyDIDByNumber”, $parameters,’urn:BuyDIDByNumber’);

print_r($SoapResult);

?>

WSDL Access (PHP Client):

<?php
$parameters = array(“954488″,”54dfg5″,”2607158″,”2607158@supertec.com”,”1″);
$soapclient= new soapclientnusoap(‘http://api.didx.net/webservice/WebBuyDIDServerWSDL.php?wsdl’, true);
$SoapResult = array();
$SoapResult = $soapclient->call(“WebBuyDIDServer”, $parameters,’urn:WebBuyDIDServer’);

print_r($SoapResult);

?>

This code requests to buy a DID number ‘2607158’, giving SIP ‘2607158@supertec.com’. The last arguments tell the service whether the user wants a SIP or an IAX.

Successfull query will return the same DID number.

Flags:

1 = SIP
2 = IAX

Error Codes

In case of any incorrect information provided by the user or in case of no matching data, an error code will be returned. Error codes correspond to the following messages:

-1 = User ID does not exist
-2 = Your Password is Incorrect
-3 = This DID Number is already Sold
-4 = This DID Number is already Reserved
-5 = DID Number doesn’t exit
-6 = The Country Code does not exist
-20 = Account not active
-22 = Due not cleared
-23 = Customer documents required. See Also Submiting Documents
-24 = This DID is reserved for another customer
-30 = Invalid Account Type
-31 = Rating of this DID is less then the one you have been allowed

Method for Purchasing a Channel Based DID

By using this method the user can purchase a DID which has been offered as channel based. The user has to provide user id, password, DID Number (which he wants to purchase), SIP URL or IAX ,flag (1 for SIP URL or 2 for IAX) , Channel ID, Channel Quantity.

In case of successful purchase, the DID number itself would be returned. Otherwise, an error code would be returned which is described later.

Method Signature

sub BuyDIDByNumber ($UserID,$Password,$DIDNumber,$SIPorIAX, $Flag,$ChannelID,$ChannelQuantity)

Example Usage

We are providing a sample code in PHP that accesses and uses this service.

<?php

require_once “nusoap.php”;

$parameters=array(“954488″,”54dfg5″,”2607158″,”2607158@supertec.com”,”1″,”88″,”2″);
$soapclient= new soapclient(‘http://api.didx.net/webservice/WebBuyDIDChannels.php’);
$SoapResult = array();
$SoapResult = $soapclient->call(“BuyDIDByNumber”, $parameters,’urn:BuyDIDByNumber’);

print_r($SoapResult);

?>

WSDL Access (PHP Client):

<?php
$parameters=array(“954488″,”54dfg5″,”2607158″,”2607158@supertec.com”,”1″,”88″,”2″);
$soapclient= new soapclientnusoap(‘http://api.didx.net/webservice/WebBuyDIDChannelsWSDL.php?wsdl’, true);
$SoapResult = array();
$SoapResult = $soapclient->call(“WebBuyDIDChannels”, $parameters,’urn:WebBuyDIDChannels’);

print_r($SoapResult);

?>

This code requests to buy a DID number ‘2607158’, giving SIP ‘2607158@supertec.com’. The last arguments tell the service whether the user wants a SIP or an IAX, with Channel ID 88 and total channels to buy. Channel ID can be retrieved by using this API

Successfull query will return the same DID number.

Flags:

1 = SIP
2 = IAX

Error Codes

In case of any incorrect information provided by the user or in case of no matching data, an error code will be returned. Error codes correspond to the following messages:

-1 = User ID does not exist
-2 = Your Password is Incorrect
-3 = This DID Number is already Sold
-4 = This DID Number is already Reserved
-5 = DID Number doesn’t exit
-6 = The Country Code does not exist
-20 = Account not active
-22 = Due not cleared
-23 = Customer documents required. See Also Submiting Documents
-24 = This DID is reserved for another customer
-30 = Invalid Account Type
-31 = Rating of this DID is less then the one you have been allowed
-110 = Invalid Channel ID
-111 = Not enough Channels Avaiable
-112 = No Channels Avaiable
-113 = No Channels Available for this area.