Enablex provides a Click2Call application to connect the caller and callee to a Virtual Room hosted on the EnableX server. The client application communicates with Click2Call through Dialer SDK and Click2Call uses call state events to communicate with the client application. 

Dialer SDK

The Dialer SDK is a wrapper/library consisting of methods to communicate with the Click2Call application through Socket events. This makes Dialer SDK an interface between the client application and Click2Call which is responsible for provisioning voice calls on EnableX rooms hence Dialer SDK is your point of contact to integrate EnableX voice services in your client application. The client application can call the Dialer methods to perform the following tasks: 

  • Initiate an outbound call
  • Accept / Reject an inbound call
  • Disconnect an ongoing call
  • Cancel an outgoing call
  • Hold / Resume a call    

Dialer SDK Methods

Dialer.init()

This method initiates a socket connection to click2call application which in turn would provide all the voice services requested by client application by invoking other dialer APIs.

socketParams = { 
                 host : //clicktocallapp host 
                 transport: “websockets” 
                 reconnect : true 
                 secure : true 
                 rejectUnauthorized : false 
}  
dialer.init(socketParams); 

Dialer.login()

This method allows the users/agents to log in with their authorized credentials and room details.

Users are individual clients who log in from a browser or mobile application and can make or receive a One-to-One call on a subscribed number.

Agents are customer service representatives/sales or service representatives of an organization who log in from a browser or mobile application with the subscribed number and the room id to make/receive a call.

login_data = { 
               'name': // user or agent name, 
               'rooms': // ‘room id' of the virtual room hosted on EnableX server 
               'phone':'919999999999' // virtual number as subscribed on EnableX 
               ‘type’ : “user” or “agent” // type of user 
};  
dialer.login(login_data); 

Dialer.connectCall()

This Method allows the user/agent to initiate a One-to-One call to an external number.  

call_data = { 
              from : // virtual number as subscribed on Enable  
              to : // Destination Number to be called 
              room : // room id of the virtual room hosted on EnableX server 
} 
dialer.connectCall(call_data) 
Response Event from Click2Call to the client application
{ 
  'voice_id': // voice id generated for the outbound call 
  'phone':  // from number 
  'to':  // to Number 
  'room': // room id of the virtual room hosted on EnableX server 
  'state': 'initiated | connected | room_connected' 
} 

Dialer.acceptCall(voice_id) 

This method allows the user/agent to accept an incoming call.

Parameter:

voice_id: Voice id of the incoming call as received from Click2Call in response to connectCall()  

Response Event from Click2Call to the client application
{ 
  'voice_id': //voice id of the inbound call 
  'phone':  // from number 
  'to':  // to Number 
  'room': // room id of the virtual room hosted on EnableX server 
  'state': incoming | connected | room_connected' 
} 

Dialer.cancelCall(voice_id)

This method allows the user/agent to cancel an outgoing call that was initiated but not connected. 

Parameter:

voice_id: Voice id of the outgoing call as received from Click2Call in response to connectCall() 

Response Event from Click2Call to the client application
{ 
  'voice_id': //voice id of the outbound call 
  'phone':  // from number 
  'to':  // to Number 
  'room': // room id of the virtual room hosted on EnableX server 
  'state': ‘initiated | disconnected' 
} 

Dialer.rejectCall(voice_id) 

This method allows the user/agent to reject an incoming call. 

Parameter:

voice_id: Voice id of the incoming call as received from Click2Call in response to connectCall() 

Response Event from Click2Call to the client application
{ 
  'voice_id': //voice id of the inbound call 
  'phone':  // from Number 
  'to':  // to Number 
  'room': // room id of the virtual room hosted on EnableX server 
  'state': incoming | disconnected 
} 

Dialer.holdCall(voice_id) 

This method allows the user/agent to put an ongoing call on hold. 

Parameter:

voice_id: Voice id of the ongoing call as received from Click2Call in response to connectCall() 

Response Event from Click2Call to the client application
{ 
  'voice_id': //voice id of the ongoing call 
  'phone':  // from number 
  'to':  // to Number 
  'room': // room id of the virtual room hosted on EnableX server 
  'state': ‘hold_success | hold_failed' 
} 

Dialer.resumeCall(voice_id)

This method allows the user/agent to resume a call that has been put on hold. 

Parameter:

voice_id: Voice id of the call on hold, as received from Click2Call in response to connectCall()

Response Event from Click2Call to the client application
{ 
  'voice_id': //voice id of the call on hold 
  'phone':  // from number 
  'to':  // to Number 
  'room': // room id of the virtual room hosted on EnableX server 
  'state': ‘resume_success | resume_failed' 
} 

Dialer.disconnectCall(voice_id) 

This method allows the user/agent to reject an incoming call. 

Parameter:

voice_id: Voice id of the incoming call as received from Click2Call in response to connectCall()

Response Event from Click2Call to the client application
{ 
  'voice_id': //voice id the inbound call 
  'phone':  // from number 
  'to':  // to Number 
  'room': // room id of the virtual room hosted on EnableX server 
  'state': ‘disconnected' 
} 

Refer to the complete Click2Call Sample Code for API implementation details.