The Generic Event
  • 07 Oct 2022
  • 3 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

The Generic Event

  • Dark
    Light
  • PDF

Article Summary

The Generic Event attempts to cover the majority of use cases where a 3rd party application needs call events at all 3 levels. The 3 levels are:

  • Level 1: The first leg into Callable, known as the 'A Leg' in the telecoms world
  • Level 2: The outbound leg(s) to a PBX or other endpoint such as a gateway or sip device.
  • Level 3: The customer PBX or device (if integrated with callable)

By having the 3 levels of events, 3rd parties can act on the entire lifecycle of the call meaning they can build applications for reporting, live call control, and screen popping at an extension level.

Level 1 - Leg A

The ingress leg, or Leg A is the first leg of the call. This may be an outbound call from a PBX or SIP device, or it may be an inbound call from the PSTN to an IVR. Calls always contain Leg A, without fail, always! With that in mind, lets look at what a generic event looks like for Leg A

 {  
   "accountId":"9539ee93-64c8-802b-360b-c6f2f7cf2507",
   "accountName":"Test Account",
   "parentCallSid":"e5bc544c-2186-47e8-8784-6182cf8190cb",
   "callSid":"e5bc544c-2186-47e8-8784-6182cf8190cb",
   "childSid": null,
   "type" : "voice",   
   "event":"call",
   "status":"in-progress",
   "from":"441234567890",
   "to":"441234567891",
   "extension": null,
   "meta" : {
    "key1" : "value"
   },
   "timestamp":1623163324316
}
FieldTypeDescriptionValues
accountIdUUIDThe account identifier9539ee93-64c8-802b-360b-c6f2f7cf2507
accountNameStringName of accountTest Account
parentCallSidUUIDThe current call leg identifiere5bc544c-2186-47e8-8784-6182cf8190cb
callSidUUIDThe current call leg identifier - Same as parentCallSid as this is an A Lege5bc544c-2186-47e8-8784-6182cf8190cb
typeStringType of eventvoice
eventStringThe actual call eventcall
statusStringThe status of the calltrying, in-progress, completed, failed
fromStringE164 formatted number or URI441234567890 or user@mydomain.connect.callable.io
toStringE164 formatted number or URI441234567890 or user@mydomain.connect.callable.io
metaKeyValue MapMap of Strings or "Call Tags"{ "key" : "value" }
timestampNumberMilliseconds since epoch1623163324316

Level 2 - B Legs

Some calls may never have a B Leg such as IVR, Announcements and Features. However some calls could have 1 or many B Legs, or sometimes we call these OutDial legs. In the telecoms world, no matter how many OutDial legs there are in addition to the A Leg, these are always called 'B'.

B Legs in callable outdial legs to PBXs, PSTNS, WebRTC, Sip Devices or MS Teams.

Lets see what a B Leg looks like, for brevity we will omit any fields which reoccur:

 {  
   "accountId":"9539ee93-64c8-802b-360b-c6f2f7cf2507",
   "accountName":"Test Account",
   "parentCallSid":"e5bc544c-2186-47e8-8784-6182cf8190cb",
   "callSid":"85cb3194-76e2-43e1-ad56-59556af617b9",
   "childSid": null,
   "type" : "voice",   
   "event":"call",
   "status":"in-progress",
   "from":"441234567890",
   "to":"441234567891",
   "extension": null,
   "meta" : {
    "key1" : "value"
   },
   "timestamp":1623163324316
}
FieldTypeDescriptionValues
parentCallSidUUIDThe parent call leg identifier (A Leg)e5bc544c-2186-47e8-8784-6182cf8190cb
callSidUUIDThe current call leg identifier85cb3194-76e2-43e1-ad56-59556af617b9
statusStringThe status of the calltrying ringing, in-progress, completed, failed

Level 2 - Recording Events

Recording events are tied to B Legs and there are 3 key events - start, end & transcoded

 {  
   "accountId":"9539ee93-64c8-802b-360b-c6f2f7cf2507",
   "accountName":"Test Account",
   "parentCallSid":"e5bc544c-2186-47e8-8784-6182cf8190cb",
   "callSid":"85cb3194-76e2-43e1-ad56-59556af617b9",
   "childSid": null,
   "type" : "voice",   
   "event":"record",
   "status":"in-progress",
   "from":"441234567890",
   "to":"441234567891",
   "extension": null,
   "meta" : {
    "key1" : "value"
   },
   "timestamp":1623163324316
}
FieldTypeDescriptionValues
eventStringThe event related to this callrecord
statusStringThe status of the recordingstart, end, trancoded

Level 3 - PBX Events

Level 3 events are where we extend our reach into 3rd party applications. These are predominatley PBXs but can be any 3rd party software which generates an event which can be related to the the ongoing call such as IOT (Internet of things). A crude example such as the heart rate of call center staff handling complaints could be mapped, allowing you to recieve these events within the context of a call.

For now, lets stick with simple PBX phone events, such as connected and disconnectd

To enable PBX events, you will need a integrated PBX. Curently we provide integrations for Avaya R9, Avaya R11 and 3CX with more to come.

Please read the specific documentation on how to enable the individual PBX listeners.

Avaya Listener
3CX PBX Listener

Once the listener is mapping events, lets see what a Level 3 event looks like;

 {  
   "accountId":"9539ee93-64c8-802b-360b-c6f2f7cf2507",
   "accountName":"Test Account",
   "parentCallSid":"e5bc544c-2186-47e8-8784-6182cf8190cb",
   "callSid":"85cb3194-76e2-43e1-ad56-59556af617b9",
   "childSid": "ea707e77-18c1-4ad8-9072-6c396ee3fdd5",
   "type" : "voice",   
   "event":"phone",
   "status":"connected",
   "from":"441234567890",
   "to":"441234567891",
   "extension": "201",
   "meta" : {
    "key1" : "value"
   },
   "timestamp":1623163324316
}
FieldTypeDescriptionValues
eventStringThe level 3 eventphone , extension
statusStringThe status of eventconnected, disconnected, parked
extensionStringThe extension number of device201
parentCallSidUUIDThe A Leg identifiere5bc544c-2186-47e8-8784-6182cf8190cb
callSidUUIDThe B leg identifier85cb3194-76e2-43e1-ad56-59556af617b9
childSidString/UUIDThe PBX Identifierea707e77-18c1-4ad8-9072-6c396ee3fdd5