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:

call.cgi API

 

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"}

 

 

Return to Documentation Home I Return to Sangoma Support