Child pages
  • Service - Click-to-call(en)
Skip to end of metadata
Go to start of metadata

Description

This API make a call between an Endpoint/Extension and a Destination phone number.

Diagram Operation

You can Integrate the Click-to-Call API using our Cloud Services as well as your own Asterisk based PBX with our local connector installed.

Cloud Integration

This integration is the better way when you have a Cloud System and/or have no access to your PBX IP Address or just don't want open it to the internet.

Primary Server

http://ast.opens.com.br

Secondary Server

http://ast2.opens.com.br

Integração Local

When you have a local network and a single system, maybe you prefer point your API to the local PBX IP Address.

Your Local Asterisk PBX

http://YOUR_SERVER_IP:3000

Endpoint to this Request

/callMake a new call

Authentication

The Authentication is through your TOKEN. If you is not a Q-Manager user yet, you can get yours with our Customer Success Team.

Yu can send the token on the Request in two different ways: in the Body as a key of the JSON object or in the Header.

In the Body you will send as a key/value like other parameters. The special key name for the it is token:

{
	"token": String,
}

 

In the Header as an Authorization:

Authorization: Bearer YOUR_TOKEN

 

Request

The Request can be POST, as an JSON Object in the Body, or GET, with url parameters.

For the POST Request you need keep the content-type Header set to application/json.

 

The parameters are:

POST /call HTTP/1.1
Authorization: Bearer YourTokenComesHere
Accept: application/json
User-Agent: Http/2.2
Host: ast.opens.com.br
 
{
	"token": String,
	"from": String,
	"to": Number,
	"timeout": Number(seconds)(optional),
	"force_from": (yes|no)(optional),
	"returnurl": String(optional)
}

 

Method POST with the Token in BODY:

curl http://ast.opens.com.br/call -H "content-type: application/json" -d '{"token":"5d104f0c46bd400cca89818333eff3b3","from":"1105","to":"4899991010"}'

Method POST with Token in HEADER:

curl http://ast.opens.com.br/call -H "content-type: application/json" -H "Authorization: Bearer 5d104f0c46bd400cca89818333eff3b3" -d '{"from":"1105","to":"4899991010"}'

 

Method GET:

curl http://ast.opens.com.br/call? -d 'token=5d104f0c46bd400cca89818333eff3b3&from=1105&to=4899991010'

 

where:

ItemTypeOptionDescription
ast.opens.com.br/callStringrequired

The API address. In case you have a SNEP Server installed into your company, you need to do a Register into Opens Cloud enabling this service.

fromStringrequiredThe Agent Code ou Extension that are requesting the call.
toStringrequiredNumber to be called.
returnurlStringoptionalCallback URL to get back the call status. After the hangup the system will return it status in JSON format in the Body of the request using POST method.
timeoutInt(in seconds)optionalThis parameter indicate the time to try to connect with the number from, by default this time is 12 seconds. If the number from don't get the call, the API will return a event called lost-call to the callback url (returnurl).
force_fromyes | nooptional

By default the call is realized differentiating a manual call from the click-to-call call adding 0000 prefix on the from key, changing the source of the call inside the asterisk to 0000XXXX, where XXXX is the original caller.

This parameter fix the source of request to the exact number, not adding 0000 as prefix.

 

Request Reply

{
	"status":"OK",
	"callstatus":"Trying",
	"message":"Call in Progress",
	"callid":"201612261540101048991613166"
}

 

Call Status Reply

If you informed the returnurl parameter, you will receive a API reply in the end of the call, like this:

{
	"event":"hangup",
	"action":"click-to-call",
	"calldate":"2016-07-01T15:01:29.983Z",
	"uniqueid":"1496241417.2867",
	"linkedid":"1496241414.2864",
	"callid":"1444447015_20151010_0016__4839548031",
	"from":"1105",
	"to":"4839548031",
	"mainchannel":"Local/[email protected]",
	"route":"local",
	"audio_file":"14673852852016070112014891613166",
	"audio_url":"http://192.168.10.252/snep/arquivos/load.php?",
	"billsec":"0",
	"callflow":{
		"1496241417.2867":{
			"event":"Newchannel",
			"privilege":"call,all",
			"channel":"Khomp/B0C0-0.0",
			"channelstate":"1",
			"channelstatedesc":"Rsrvd",
			"calleridnum":"<unknown>",
			"calleridname":"<unknown>",
			"connectedlinenum":"<unknown>",
			"connectedlinename":"<unknown>",
			"language":"en",
			"accountcode":"",
			"context":"default",
			"exten":"4839548031",
			"priority":"1",
			"uniqueid":"1496241417.2867",
			"linkedid":"1496241414.2864"
		}
	},
	"customer":[{
		"phone":"4839548031"
	}],
	"owner":[{
		"endpoint":"1105"
	}],
	"request":{
		"returnurl":"http://demo.opens.com.br/post2/"
	},
	"hangupdate":"2016-07-01T15:01:46.340Z",
	"duration":"16"
}

Where:

FieldDescription

event

 The Event type. In this case, "hangup", the call end.

action

The source for this call. In this case, "click-to-call", made from other system.
callidUnique ID for the call. Used for call status and billing.
uniqueidInternal ID for the main channel for this call.
linkedidInternal ID for the linked channel for this call.
audio_fileAudio filename for the recorded call.

audio_url

URL for the Audio Filename. This path need be completed by audio_url + audio_file
billsecConversation time for the call (in seconds).

duration

Call duration time (in seconds).

customer

Destination data

owner

The Caller data

owner.endpoint

The caller endpoint/extention.
callflowThe complete call flow inside of the PBX
hangupdateEnd call Date and time