/
CTLive: log inspection

CTLive: log inspection

CTLive

CTLive is the central component of the chat solution, managing all communications between various channels (web, WhatsApp, social media) and agents (both human and virtual).

It efficiently organizes individual instant messages from social channels into cohesive sessions.

Operating in multi-tenant mode, CTLive ensures that most logs include the tenant name when applicable.

A connection to Redis and MongoDB is required for its functionality.

Format

Logs present the function name within square brackets (CT7PROTOCOL), followed by the tenant name (TENANT1) and a specific message related to that function.

[CT7PROTOCOL] [TENANT1] newContact url:https://server1/ctLiveService/contact

Use Cases

New Contact

When an incoming message is received, a new contact can be created if none exists. The generated ContactID is displayed, along with the tenant name to facilitate troubleshooting and a UUID. You can search for this ContactID in the complete log to obtain relevant information regarding the same contact.

The following logs illustrate how this process works, including the CTI Webhook that is called, with the returned response (in this instance, accepted).

ctlive | 2025-02-27T17:19:20.129613061Z [socketIO] newContact. Generate UUID [CHAT_AGM_abbba71e-67b2-4f9c-ab68-dcf3f95bd32c] ctlive | 2025-02-27T17:19:20.130344604Z [REDIS] Set contact [CHAT_AGM_abbba71e-67b2-4f9c-ab68-dcf3f95bd32c] in redis db: ,OK,,1 ctlive | 2025-02-27T17:19:20.130843858Z [CT7PROTOCOL] [AGM] newContact url:https://server1/ctLiveService/contact ctlive | 2025-02-27T17:19:22.156214484Z [CT7PROTOCOL] newContact response:{"chat":true,"cbn":true,"video":true,"cbl":true,"call":true} ctlive | 2025-02-27T17:19:22.156318681Z newContact accepted:{"chat":true,"cbn":true,"video":true,"cbl":true,"call":true}

End Contact

The endContact tag indicates that a contact termination request has been received on a socketIO channel, along with the contactID. It is not clear from this log whether the request originated from the customer or the agent.

ctlive | 2025-02-27T14:25:35.874036430Z [socketIO] [endContact] from client with room [CHAT_AGM_2b24cc95-2d1b-4efe-a5a4-441d1e2ce024] ctlive | 2025-02-27T14:25:35.874053466Z [retrieveContactByChatID] [REDIS] Get contact for chat [CHAT_AGM_2b24cc95-2d1b-4efe-a5a4-441d1e2ce024] ctlive | 2025-02-27T14:25:35.874064518Z [socketIO] [endContact] Contact [CHAT_AGM_2b24cc95-2d1b-4efe-a5a4-441d1e2ce024] not yet ended ctlive | 2025-02-27T14:25:35.874066650Z [getIMChannelServiceMessage] [DOMAIN] [AGM] [chatClosedSuccess] ctlive | 2025-02-27T14:25:35.894892767Z [socketIO] [evaluateSendEndSuccessMessage] Service message from room [CHAT_AGM_2b24cc95-2d1b-4efe-a5a4-441d1e2ce024] with id [5c637aa3-2499-428b-9eb8-192114cb890f] type [chatClosedSuccess]

Save Transcript

Upon the termination of a contact, its transcript is saved in MongoDB for persistence. The following logs demonstrate a successful case, highlighting that messages, delivery, and seen reports are retrieved from Redis before being saved in MongoDB.

Agent Login

Agents log into CTLive by providing a JWT signed with a shared secret, which is configured through CTLiveMGR's general settings. Upon successful validation of the JWT, a session ID, “ab4e7aff-8627-434a-a2ef-7e200363197e," is returned. This session ID is then used to authenticate all subsequent requests.

Join Contact

The joinContact method is triggered when an agent initiates a chat with a customer, effectively entering the chat room. This process signifies a successful flow, with the session ID used to identify the agent who has previously logged into CTLive.

Exceptions

If you encounter exceptions in the logs similar to the one below, it is probable that a bug has arisen due to an unhandled error.

In this instance, the function getTranscriptByChatID fails because the contact ID CHAT_AGM_eb8c3ff1-a80a-4efa-a167-f9358ef65c9b is not found in the database.