src/conferences/ConferenceInvite.ts
import {MediaTypes} from '../types';
export interface InviteFromDetails {
contactName: string;
displayName: string;
username: string;
}
/**
* This class allows access to the details of incoming Conference invitation.
* This class must not be directly instantiated. Instead,
* instances of this class are obtained by calling the {@link Conference#getInvite}
*/
export class ConferenceInvite {
private id: string;
private from: string;
private mediaTypes: MediaTypes;
private context: object;
private fromDetails: InviteFromDetails;
/** @ignore */
public constructor(
id: string,
from: string,
mediaTypes: MediaTypes,
context: object = {},
fromDetails: InviteFromDetails,
) {
/** @private */
this.id = id;
/** @private */
this.from = from;
/** @private */
this.mediaTypes = mediaTypes;
/** @private */
this.context = context;
/** @private */
this.fromDetails = fromDetails;
}
/**
* @desc Obtains the ID of the incoming invitation
* @returns {string}
*/
public getId(): string {
return this.id;
}
/**
* @desc Obtains the "gateway" of the caller. This can be a user's gateway or pstn number.
* @returns {string}
*/
public getFrom(): string {
return this.from;
}
/**
* @desc Obtains the mediaTypes for this conference invite.
* This allow us to guess if we are invited with audio & video, or only with audio and video
* @returns {MediaTypes}
*/
public getMediaTypes(): MediaTypes {
return this.mediaTypes;
}
/**
* @desc Obtains the context for this conference invite.
* The context is created by the user placing the invite and it will usually contain extra information
* about the caller
* @returns {object}
*/
public getContext(): object {
return this.context;
}
/**
* @desc Provides the resolved information of the caller.
* It returns contactName, displayName and username. If it doesn't exist, it can return the empty field.
* @returns {InviteFromDetails}
*/
public getCallerInfo(): InviteFromDetails {
return this.fromDetails;
}
}