Skip to content

Commit

Permalink
fix(calling-docs): CallingClient and Voicemail api doc update (#3130)
Browse files Browse the repository at this point in the history
  • Loading branch information
BhargavSatya authored Oct 11, 2023
1 parent 513f171 commit cd8e041
Show file tree
Hide file tree
Showing 18 changed files with 891 additions and 189 deletions.
2 changes: 1 addition & 1 deletion docs/samples/calling/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ async function getMediaDevices() {
populateSourceDevices(camera);
});

const microphones = await callingClient.mediaEngine.Media .getMicrophones();
const microphones = await callingClient.mediaEngine.Media.getMicrophones();
microphones.forEach((microphone) => {
populateSourceDevices(microphone);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/calling/src/CallHistory/CallHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {Eventing} from '../Events/impl';
*
* This code snippet demonstrates how to create an instance of `CallHistory` using webex and logger.
*
* Example
* @example
* ```javascript
* const callHistory = createCallHistoryClient(webex, logger);
* ```
Expand Down
2 changes: 1 addition & 1 deletion packages/calling/src/CallHistory/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface ICallHistory extends Eventing<CallHistoryEventTypes> {
* @param sort - Sort the records in ascending or descending order.
* @param sortBy - Sort the records by start time or end time.
*
* Example
* @example
* ```javascript
* const callHistoryResponse = await callHistory.getCallHistoryData(days, limit, sort, sortBy);
* ```
Expand Down
19 changes: 10 additions & 9 deletions packages/calling/src/CallSettings/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ export type CallSettingResponse = {
* These APIs return promises that resolve to a `CallSettingResponse` object, which contains a status code, data, and message.
* The data field within this response object holds the `callSetting` object, which can take on different types depending on the specific API called.
*
* Example
* @example
* ```json
* {
* statusCode: 200,
Expand All @@ -282,14 +282,15 @@ export interface ICallSettings {
/**
* This API is used to fetch the call waiting setting.
*
* Example
* @example
* ```javascript
* const callWaitingResponse = await callSettings.getCallWaitingSetting();
* ```
*
* The callWaitingResponse object will have callSetting object with the properties as mentioned in `ToggleSetting`.
*
* Example - ToggleSetting
* @example
* ToggleSetting:
* ```json
* {
* statusCode: 200,
Expand All @@ -308,7 +309,7 @@ export interface ICallSettings {
/**
* This API is used to fetch the do not disturb(DND) status.
*
* Example
* @example
* ```javascript
* const dndResponse = await callSettings.getDoNotDisturbSetting();
* ```
Expand All @@ -334,7 +335,7 @@ export interface ICallSettings {
/**
* This API is used to set DND to true or false based on parameter received.
*
* Example
* @example
* ```javascript
* const dndResponse = await callSettings.setDoNotDisturbSetting(true|false);
* ```
Expand All @@ -344,7 +345,7 @@ export interface ICallSettings {
/**
* This API is used to fetch the call forward setting.
*
* Example
* @example
* ```javascript
* const callForwardResponse = await callSettings.getCallForwardSetting();
* ```
Expand All @@ -365,7 +366,7 @@ export interface ICallSettings {

/**
* This API is used to fetch the voicemail.
* Example
* @example
* ```javascript
* const voicemailResponse = await callSettings.getVoicemailSetting();
* ```
Expand All @@ -377,7 +378,7 @@ export interface ICallSettings {
/**
* This API is used to set voicemail.
*
* Example
* @example
* ```javascript
* const voicemailResponse = await callSettings.setVoicemailSetting();
* ```
Expand All @@ -392,7 +393,7 @@ export interface ICallSettings {
* @param directoryNumber - Directory number for which the call forward always setting is to be fetched.
* This parameter is only required for Cloud Connected Unified Communications(CCUC): https://www.cisco.com/c/en/us/products/unified-communications/webex-cloud-connected-uc/index.html backend.
*
* Example
* @example
* ```javascript
* const callForwardAlwaysResponse = await callSettings.setVoicemailSetting();
* ```
Expand Down
38 changes: 28 additions & 10 deletions packages/calling/src/CallingClient/CallingClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,16 @@ import {METRIC_EVENT, REG_ACTION, METRIC_TYPE, IMetricManager} from '../Metrics/
import {getMetricManager} from '../Metrics';

/**
* The `CallingClient` module provides a set of APIs for line registration and calling functionalities within the SDK.
*
* The following code snippet demonstrates how to create an instance of `CallingClient` using a `webex` instance and `callingConfig`:
*
* @example
* ```javascript
* const callingClient = createClient(webex, callingConfig);
* ```
*/

export class CallingClient extends Eventing<CallingClientEventTypes> implements ICallingClient {
private sdkConnector: ISDKConnector;

Expand All @@ -70,8 +78,7 @@ export class CallingClient extends Eventing<CallingClientEventTypes> implements
private lineDict: Record<string, ILine> = {};

/**
* @param webex - A webex instance.
* @param config - Config to start the CallingClient with.
* @ignore
*/
constructor(webex: WebexSDK, config?: CallingClientConfig) {
super();
Expand Down Expand Up @@ -107,6 +114,19 @@ export class CallingClient extends Eventing<CallingClientEventTypes> implements
}

// async calls required to run after constructor

/**
* Initializes the `CallingClient` by performing the following steps:
*
* 1. Retrieves list of servers.
* 2. Creates a line.
* 3. Sets up network change detection.
*
* This method should be called once to initialize the `callingClient`.
*
* @returns A promise that resolves when the initialization is complete.
* @ignore
*/
public async init() {
await this.getMobiusServers();
await this.createLine();
Expand Down Expand Up @@ -345,23 +365,20 @@ export class CallingClient extends Eventing<CallingClientEventTypes> implements

/**
* To get the current log Level.
*
* @returns - Log level.
* @ignore
*/
public getLoggingLevel(): LOGGER {
return log.getLogLevel();
}

/**
*
* To return the `sdkConnector` instance that was used during sdk initialisation.
* @ignore
*/
public getSDKConnector(): ISDKConnector {
return this.sdkConnector;
}

/**
*
*/
private registerSessionsListener() {
this.sdkConnector.registerListener<CallSessionEvent>(
MOBIUS_EVENT_KEYS.CALL_SESSION_EVENT_INCLUSIVE,
Expand Down Expand Up @@ -406,9 +423,8 @@ export class CallingClient extends Eventing<CallingClientEventTypes> implements
}

/**
* Retrieves details of all the line objects belonging to a User
* Retrieves details of all the Line objects belonging to a User
* NOTE: currently multiple lines are not supported
* so this API will return a single line object
*/
public getLines(): Record<string, ILine> {
return this.lineDict;
Expand Down Expand Up @@ -437,6 +453,7 @@ export class CallingClient extends Eventing<CallingClientEventTypes> implements
public getConnectedCall(): ICall | undefined {
let connectCall;
const calls = this.callManager.getActiveCalls();

Object.keys(calls).forEach((correlationId) => {
if (calls[correlationId].isConnected() && !calls[correlationId].isHeld()) {
connectCall = calls[correlationId];
Expand All @@ -448,6 +465,7 @@ export class CallingClient extends Eventing<CallingClientEventTypes> implements
}

/**
* Create the `CallingClient` instance using the `webex` object and callingSdk `config`
* @param webex - A webex instance.
* @param config - Config to start the CallingClient with.
*/
Expand Down
25 changes: 25 additions & 0 deletions packages/calling/src/CallingClient/calling/CallerId/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,31 @@ export type scimResponseBody = {
Resources: Array<ResourceType>;
};

/**
* Represents the interface for fetching caller ID details.
*/
export interface ICallerId {
/**
* Fetches caller ID details based on the provided caller ID information.
*
* This method takes a {@link CallerIdInfo} object as input and performs caller ID
* resolution in the background, returning a {@link DisplayInformation} object
* containing intermediate name and number.
*
* @param callerId - Caller ID data passed to the method.
*
* @remarks
* The `fetchCallerDetails` method is the main entrypoint for retrieving
* caller ID information. It initiates the caller ID resolution process
* based on the provided {@link CallerIdInfo} and returns the result as
* {@link DisplayInformation}.
*
* @example
* ```typescript
* const callerIdInfo: CallerIdInfo = { callerIdData };
* const displayInfo = callerIdInstance.fetchCallerDetails(callerIdInfo);
* console.log(`Name: ${displayInfo.name}, Number: ${displayInfo.number}`);
* ```
*/
fetchCallerDetails: (callerId: CallerIdInfo) => DisplayInformation;
}
14 changes: 4 additions & 10 deletions packages/calling/src/CallingClient/calling/call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,7 @@ export class Call extends Eventing<CallEventTypes> implements ICall {
}

/**
* @param activeUrl
* @param webex -.
* @param destination -.
* @param direction -.
* @param deviceId -.
* @param serverCb
* @param deleteCb
* @param indicator - Service Indicator.
* @ignore
*/
constructor(
activeUrl: string,
Expand Down Expand Up @@ -1972,8 +1965,9 @@ export class Call extends Eventing<CallEventTypes> implements ICall {
};

/**
* @param settings
* @param settings.localAudioTrack
* Answers the call with the provided local audio stream.
*
* @param localAudioStream - The local audio stream for the call.
*/
public async answer(localAudioStream: LocalMicrophoneStream) {
const localAudioTrack = localAudioStream.outputStream.getAudioTracks()[0];
Expand Down
11 changes: 0 additions & 11 deletions packages/calling/src/CallingClient/calling/callManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,17 +405,6 @@ export class CallManager extends Eventing<CallEventTypes> implements ICallManage
}
}

/**
* @param correlationId -.
*/
public endCall = (correlationId: CorrelationId) => {
const call = this.getCall(correlationId);

if (call) {
call.end();
}
};

/**
* @param correlationId -.
*/
Expand Down
Loading

0 comments on commit cd8e041

Please sign in to comment.