Home Reference Source

src/conferences/ConferenceInvite.ts

import {MediaTypes} from '../types';

/**
 * 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;

	/** @ignore */
	public constructor(id: string, from: string, mediaTypes: MediaTypes, context: object = {}) {
		/** @private */
		this.id = id;
		/** @private */
		this.from = from;
		/** @private */
		this.mediaTypes = mediaTypes;
		/** @private */
		this.context = context;
	}

	/**
	 * @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;
	}
}