Home Reference Source

src/Sippo.js

import {Session} from './session/Session';

/**
 * Factory method for session creation
 * @param {string} issuer The authorization token issuer identifier
 * @param {string} token The authorization token from the given issuer
 * @param {Object} config Session configuration
 * @param {string} config.wacUri The address where the WAC is available
 * @param {string} config.applicationToken A token for the application
 * @param {string} config.deviceId string which identifies the device this session belongs to
 * @return {Promise<Session>} A promise of a new SippoJS session
 */
export function createSession(issuer, token, config) {
	const session = Session.withOAuth2(issuer, token, config);
	return Promise.resolve(session);
}

/**
 * Factory method for session creation
 * @param {string} token The authorization token
 * @param {Object} config Session configuration
 * @param {string} config.wacUri The address where the WAC is available
 * @param {string} config.applicationToken A token for the application
 * @param {string} config.deviceId string which identifies the device this session belongs to
 * @return {Promise<Session>} A promise of a new SippoJS session
 */
export function recoverSession(token, config) {
	const session = Session.withSessionToken(token, config);
	return Promise.resolve(session);
}

/**
 * Allows obtaining the available providers enabled in the specified WAC instance
 * @param {string} wacUri The address where the WAC is available
 * @return {Promise<ProviderInfo[]>} A promise with an array with information for each provider
 */
export function getAuthProviders(wacUri) {
	return window.fetch(`${wacUri}/sapi/oauth2/providers`).then(response => response.json());
}

export {StreamRecorder} from './media/StreamRecorder';
export {StreamRecorderStatus} from './media/StreamRecorderStatus';
export {InstantMessageType} from './instant-messages/InstantMessageType';
export {DataPipeStatus} from './datapipe/DataPipeStatus';
export {DataPipeType} from './datapipe/DataPipeType';

export {CallStatus} from './calls/CallStatus';
export {CallDirection} from './calls/CallDirection';
export {CallEndReason} from './calls/CallEndReason';

export {Conference} from './conferences/Conference';
export {ConferenceManager} from './conferences/ConferenceManager';
export {ConferenceStatus} from './conferences/ConferenceStatus';
export {ConferenceEndReason} from './conferences/ConferenceEndReason';

export {ChatType} from './chat/ChatType';
export {ChatParticipantState} from './chat/ChatParticipantState';
export {ChatParticipantRole} from './chat/ChatParticipantRole';
export {ChatMessageDirection} from './chat/ChatMessageDirection';
export {ChatMessageStatus} from './chat/ChatMessageStatus';
export {ChatMessageType} from './chat/ChatMessageType';
export {FileUploadStatus} from './file-sharing/FileUploadStatus';

export {PresenceActivity} from './contacts/PresenceActivity';
export {PresenceMood} from './contacts/PresenceMood';

export {SessionError} from './session/SessionError';
export {SessionStatus} from './session/SessionStatus';

export {ManagedStream} from './media/ManagedStream';
export {LocalMediaHandler} from './media/LocalMediaHandler';