DT Client API Overview

Dynamics Telephony Client includes an API that can be used for such use cases as:

  • Trigger a CRM workflow based on outcome/disposition chosen for an outbound call
  • Display a particular Form in CRM based on the queue the customer called in on
  • Auto-populate a field in the From with the queue name
  • Change the CRM form based on the outcome/disposition chosen for an outbound call
  • Auto-promote a lead to an opportunity based on the outcome/disposition chosen for an outbound call
  • Control the wrap time / end of wrap from Javascript in the CRM form
  • Allow a CRM form to set the Outcome in Dynamics Telephony.

For a quick get-started with a simple API walk-through, see here

The following can be used by javascript running in any DT call tab. Any data refers to the call currently (or most recently) active in that call tab. All method calls are pre-pended with “DynamicsTelephony.”  For example to register for DT events:

// Create a Callback Function to be triggered 
// on call events
var fn = function (evtData) {
var oCall = DynamicsTelephony.parseEventArgs(evtData)
/*  
   TODO: implement your code here
*/
};

// Register for events...
DynamicsTelephony.RegisterForEvents(fn);

Or to get the details of the current call:

var oCall = DynamicsTelephony.GetCallDetails();
Dynamics Telephony Methods
DynamicsTelephony.RegisterForEvents(fnEventHandler)

Registers to receive telephony callbacks from DT in the function “fnEventHandler”. “fnEventHandler” should have the format:

var fn = function (evtData) {};

Where the evtData is the event payload passed from DT which can be objectified using the method “parseEventArgs()” below.

DynamicsTelephony.parseEventArgs(e)

Convert an events payload (evtData in the above EG)  into a javascript object with the following properties:

  • state – The current state of the call
  • stateTime – The Datetime this state occurred
  • type – always “phonecall” at present
  • id – the guid of the CRM phonecall for this call
  • direction – one of  inbound, outbound, clicktocall, transfer or ccOutbound
  • phone – The phone number associated with the current call
  • outcome – No Answer, Voice Mail, etc. Any configured outcome
  • fromType – agent, lead, contact, account, case etc…
  • fromId – ID for above
  • toType – agent, lead, contact, account, case etc…
  • toId – ID for above
  • dtCallId – ID to link to dialerCalls table to get attempts, for example
  • isCallback – true or false, indicating where the call is a callback.
  • retryDatetime – The retry date/time of the call (Format “YYYY-MM-DDTHH:MM:SSZ”)
  • dnis – ^The number the customer originally dialed
  • queueDn – ^The phone number of the queue in the Contact Center
  • agentId – ^The agent ID in the Contact Center
  • extension – ^When available, the agents phone number that the call is on.

^When Available

DynamicsTelephony.GetCallDetails()
Returns data on the current call,  in an object the same as described in parseEventArgs() above.
DynamicsTelephony.dial(number)

Dials the “number” passed on the current call tab.

DynamicsTelephony.holdresume()

Holds / Resumes the call on the current call tab.

DynamicsTelephony.transferBlind(number)

Blind transfers the call on the current call tab to the “number” provided.

DynamicsTelephony.transferConsult(number)

Consult transfers the call on the current call tab to the “number” provided.

DynamicsTelephony.transferComplete(callTab)

Completes the transfer of the call on the current call tab to the call on the call tab provided. The current call tab must have a call in the active (not held) state and the call on the provided call tab must be on hold for successful transfer.

DynamicsTelephony.conference(callTab)

Conferences the call on the call tab provided to the call  on the current call tab. The current call tab must have a call in the active (not held) state and the call on the provided call tab must be on hold for successful conference.

DynamicsTelephony.answer()

Answer the call on the current call tab.

DynamicsTelephony.release()

Release / Hang-up  the call on the current call tab.

DynamicsTelephony.agentReady()

Put the agent in ready state.

DynamicsTelephony.agentNotReady()

Put the agent in not ready state.

DynamicsTelephony.playWaveFile(filename)

Plays the file “filename” into the call on the current call tab.

DynamicsTelephony.sendDTMF(digit)

Sends the DTMF tone(s) in “digit” into the call on the current call tab. “digit” can be one or more of the following: 0123456789*#

DynamicsTelephony.logThis(text)

Sends the text to the Dynamics Telephony log file. Useful for debugging. Please remove when in production.

DynamicsTelephony.setOutcome(outcome_name)

Sets the outcome in Dynamics Telephony as if the agent had clicked on it in the outcome list in Dynamics Telephony. The outcome_name is the same as the defined outcome name – case-sensitive.

DynamicsTelephony.setCallEnd()

Fast-forwards Dynamics Telephony to the end of the call. This is the same as if the agent clicks FFWD during Wrap time. If the windows are set to auto-close, then the window will close.

Telephony Events

The event handler is triggered for each of the following telephony state changes:

  • preview – DT or CC Dialer call presented to agent and preview timer started
  • incoming – Inbound call or CC Dialer call presenting to agent
  • ringing – An outbound call is dialed and waiting for the customer to answer
  • talk – the call is active
  • idle – The call has been released, wrap timer may be running
  • end – The wrap time has expired or agent has manually moved on to the next call

The event payload contains the same data as returned from DynamicsTelephony.GetCallDetails() and this can be parsed to a javascript object using:

var oCall = DynamicsTelephony.parseEventArgs(evtData);

 

See here for code samples.