Call.cgi API use case
This information is provided for reference purposes only. Technical support for this capability is beyond the scope of service of what’s provided in the support plan for Fonality service. Â
Fonality is unable to provide assistance with debugging of customized applications.
I created this page to document how to use and test the Call.cgi API. The ultimate goal of this guide is to provide some insight on a practical use of this API. Please note this document is a work in progress.
The api documentation can be found here:
Â
First step of using this API is pulling the token. In my example im using cURL. Please note the variables user and passwd. Please note the header modifications in order to authenticate correctly.Â
Â
HUDUSER="your hud username"
PASSWD="your hud password"
CPVER="your cp version" Â ; i.e. http://cp52-2.fonality.com
DIAL="phone number to dial" ; format 15551231234 or 1(XXX)XXX+XXXX
CNUM= "out bound CID number" ; (optional)
CNAM= "outbound CID name" Â ; (optional)
Â
to make sure variables are set echo $VARIABLE
example:
echo $HUDUSER
Â
curl -k -X POST -d "method=login&user=$HUDUSER&pass=$PASSWD" https://$CPVER/call.cgi? --header "Access-Control-Allow-Credals:true" --header "X-Requested-By:FonalityClickToDial"
if executed correctly the response should look like:
Â
{"result":"Success", "Message":"Login Successfully","token":"bdiiNcGvrkYoPoA9"}
Â
set token as shell variableÂ
Â
TOKEN="token"
 Â
token pulled - now we can use that token to place a call.
Engineering note: token should be stored as a variable curl can send the server response to stdin where it can be accessed by the rest of the program. In this example I simply write in the appropriate values.
Â
curl -k -X POST -d "method=dial&number=$DIAL&dontmodify=1&callerid=$CNUM&token=$TOKEN" https://$CPVER/call.cgi? --header "Access-Control-Allow-Credentials:true" --header "X-Requested-By:FonalityClickToDial" -vv
Â
be sure to replace the 1(XXX)XXX+XXXX with the actual phone number digits and replace the token with your actual token
Â
if everything was correct the server should respond and phones should be ringing.
Â
{"result":"Success", "Message":"Placing call now"}
Â
Â