Configure onPhoneCallCreate and onPhoneCallUpdate

onPhoneCallCreate

When a call originates from a Freshcaller number or is being received to a Freshcaller number, the onPhoneCallCreate event is triggered.

Subscribe to the onPhoneCallCreate event and register the callback by using the following sample manifest.json content.

manifest.json
"events": {
  "onPhoneCallCreate": {
    "handler": "onPhoneCallCreateCallback"
  }
}

Define the corresponding callback by using the following sample server.js content:

server.js
exports = {
  onPhoneCallCreateCallback: function(payload) {
    console.log("Logging arguments from onPhoneCallCreate event: " + JSON.stringify(payload));
  }
}

Attributes of the data object

  • actorobject

    Information pertaining to the entity that created the call object.

  • associationsobject

    All objects related to the call object.

  • phone_callobject

    Details pertaining to the call that triggered the onPhoneCallCreate event.

onPhoneCallUpdate

When a call connection is established or lost, when a call’s status changes (transferred to an agent, an agent barges into a call, the call becomes a conference call, and so on), and when additional information such as call recording information, bill duration, call cost, call notes is associated with a call, the onPhoneCallUpdate event is triggered.

Subscribe to the onPhoneCallUpdate event and register the callback by using the following sample manifest.json content.

manifest.json
"events": {
  "onPhoneCallUpdate": {
    "handler": "onPhoneCallUpdateCallback"
  }
}

Define the corresponding callback by using the following sample server.js content:

server.js
exports = {
  onPhoneCallUpdateCallback: function(payload) {
    console.log("Logging arguments from onPhoneCallUpdate event: " + JSON.stringify(payload));
  }
}

Attributes of the data object

  • actorobject

    Information pertaining to the entity that created the call object.

  • associationsobject

    All objects related to the phone call object.

  • changesobject

    Changes that triggered the onPhoneCallUpdate event, specified as a JSON object of the following format:

    {
    <call.attribute that changed>: [“New value”, “Old value”]
    }

    For onPhoneCallUpdate, this value is an empty object.

  • phone_callobject

    Details pertaining to the call that triggered the onPhoneCallUpdate event.