CreateBlogSupport
Log inSign up
Home
Webex Calling
  • Guides
  • Webex Calling Beta
  • Webex Cloud Calling
  • Broadworks Calling
  • UCM Calling
  • AI Assistant for Developers
  • Beta Program
  • Webex Status API

Webex Calling

Call History

This article explains the call history feature available in the calling SDK.

The calling SDK consists of various modules which are created at the time of its initialization — CallHistoryClient is one of those modules designed to facilitate the retrieving, managing, and interacting with callHistory records.

Refer to the Getting Started documentation to understand how a calling instance is created and different modules are instantiated.

anchorInstantiating the CallHistoryClient

anchor

The CallHistoryClient is implemented as the CallHistory class in the SDK and there are two ways of instantiating it.

To instantiate just the CallHistoryClient, use the createCallHistoryClient method:

const callHistory = createCallHistoryClient(webex, logger);

If the CallHistoryClient is initialized through the calling instantiation:

const callHistory = calling.callHistory;

anchorCore Methods

anchor

This client provides APIs to fetch call history data, update missed calls status, and delete call history records.

Fetch Call History

The getCallHistoryData() method retrieves the callHistory records for a user based on specified parameters.

const callHistoryResponse = await callHistory.getCallHistoryData(  
  numberOfDays,  
  limit,  
  sort,  
  sortBy  
);

This method accepts folowing input parameters:

Parameters
NameDescriptionValuesRequired
daysNumber of days to fetch the callHistory datanumber (default: 7)No
limitNumber of records to be fetchednumber (default: 50)No
sortSort the records in ascending or descending orderstring (default: DESC)No
sortBySort the records by startTime or endTimestring (default: END_TIME)No
Returns

Promise resolving to a JanusResponseEvent object with the following structure: Promise<JanusResponseEvent>

Here's an example of a response for the getCallHistoryData() method:

JanusResponseEvent
{  
  statusCode: number;  
  data: {  
    userSessions: UserSession[];  
    error?: string;  
  };  
  message: string | null;  
}
UserSession
{
  id: string;
  sessionId: string;
  disposition: Disposition;
  startTime: string;
  endTime: string;
  url: string;
  durationSeconds: number;
  joinedDurationSeconds: number;
  participantCount: number;
  isDeleted: boolean;
  isPMR: boolean;
  correlationIds: string[];
  links: {
    locusUrl?: string;
    conversationUrl?: string;
    callbackAddress: string;
  };
  self: {
    id: string;
    name?: string;
    phoneNumber?: string;
    cucmDN?: string;
    ucmLineNumber?: number;
  };
  durationSecs: number;
  other: {
    ownerId?: string;
    id: string;
    name?: string;
    sipUrl?: string;
    primaryDisplayString?: string;
    secondaryDisplayString?: string;
    isPrivate: boolean;
    callbackAddress: string;
    phoneNumber?: string;
    contact?: string;
    email?: string;
  };
  sessionType: 'SPARK' || 'WEBEXCALLING',;
  direction: string;
  callingSpecifics?: {
    redirectionDetails: {
      phoneNumber?: string;
      sipUrl?: string;
      name?: string;
      reason: string;
      userId?: string;
      isPrivate: boolean;
    };
  };
}
Update Missed Calls

The updateMissedCalls() method updates the read state of user missed calls based on the specified parameters.

const updateMissedCallsResponse = await callHistory.updateMissedCalls(endTimeSessionIds);

This method accepts the following input parameters:

Parameters
NameDescriptionValuesRequired
endTimeSessionIdsAn array of objects containing endTime and sessionId of missed callHistory records.EndTimeSessionId[]Yes
EndTimeSessionId
[
  {
    "endTime": "2024-05-22T08:50:48.603Z",
    "sessionId": "d74d19cc-6aa7-f341-6012-aec433cc6f8d"
  }
]
Returns

Promise resolving to an UpdateMissedCallsResponse object with the following structure: Promise<UpdateMissedCallsResponse>

Here's an example of a response for the updateMissedCalls() method:

UpdateMissedCallsResponse
{
  statusCode: number;
  data: {
    readStatusMessage?: string;
    error?: string;
  };
  message: string | null;
}
Delete Call History Records

The deleteCallHistoryRecords() method deletes callHistory records based on the specified parameters.

const deleteCallHistoryRecordsResponse = await callHistory.deleteCallHistoryRecords(deleteSessionIds);

It accepts the following input parameters:

Parameters
NameDescriptionValuesRequired
deleteSessionIdsAn array of objects containing endTime and sessionId of the callHistory records to be deleted.EndTimeSessionId[]Yes

The EndTimeSessionId structure is the same as used in the updateMissedCalls method.

Returns

Promise resolving to a DeleteCallHistoryRecordsResponse object with the following structure: Promise<DeleteCallHistoryRecordsResponse>

Here's an example of a response for the deleteCallHistoryRecords() method:

DeleteCallHistoryRecordsResponse
{
  statusCode: number;
  data: {
    deleteStatusMessage?: string;
    error?: string;
  };
  message: string | null;
}

anchorEvent Handling

anchor

The CallHistoryClient emits following events that you can listen for to receive real-time updates about callHistory.

callHistory:user_recent_sessions

Emitted when new call history session data is available and received. Event payload is of type CallSessionEvent.

CallSessionEvent
{  
  id: string;  
  data: {  
    userSessions: {  
      userSessions: UserSession[];  
      statusCode: number;  
    };  
    eventType: string;  
  };  
  timestamp: number;  
  trackingId: string;  
}
callHistory:user_viewed_sessions

Emitted when call history sessions are marked as viewed/read. Event payload is of type CallSessionViewedEvent.

CallSessionViewedEvent
{  
  id: string;  
  data: {  
    userReadSessions: {  
      userReadSessions: UserReadSessions[];  
      statusCode: number;  
    };  
    eventType: string;  
  };  
  timestamp: number;  
  trackingId: string;  
}
callHistory:user_sessions_deleted

Emitted when call history sessions are deleted. Event payload is of type CallSessionDeletedEvent

CallSessionDeletedEvent
{  
  id: string;  
  data: {  
    deletedSessions: string[];  
    eventType: string;  
  };  
  timestamp: number;  
  trackingId: string;  
}
Listen for Call History Events

You can subscribe to callHistory events using the on() method:

callHistory.on('callHistory:user_recent_sessions', (sessionData: CallSessionEvent) => {  
  console.log('Users recent session data : ', sessionData.data.userSessions.userSessions[0]);  
});

callHistory.on('callHistory:user_viewed_sessions', (event: CallSessionViewedEvent) => {  
  console.log('User viewed sessions: ', event.data.userReadSessions.userReadSessions);  
}); 

callHistory.on('callHistory:user_sessions_deleted', (event: CallSessionDeletedEvent) => {  
  console.log('User deleted sessions: ', event.data.deletedSessions);  
});
In This Article
  • Instantiating the CallHistoryClient
  • Core Methods
  • Event Handling

Connect

Support

Developer Community

Developer Events

Contact Sales

Handy Links

Webex Ambassadors

Webex App Hub

Resources

Open Source Bot Starter Kits

Download Webex

DevNet Learning Labs

Terms of Service

Privacy Policy

Cookie Policy

Trademarks

© 2025 Cisco and/or its affiliates. All rights reserved.