Skip to content

Commit

Permalink
chore: updated bundle with lastest changes
Browse files Browse the repository at this point in the history
  • Loading branch information
yoryer committed Jan 14, 2022
1 parent 6b4a02a commit 504c10c
Show file tree
Hide file tree
Showing 23 changed files with 855 additions and 222 deletions.
1 change: 1 addition & 0 deletions dist/BRANCH
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dev
1 change: 1 addition & 0 deletions dist/COMMITHASH
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6b4a02a27cad54715b89b49d16a63d9f929fc919
1 change: 1 addition & 0 deletions dist/LASTCOMMITDATETIME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2021-11-23T16:03:03-03:00
1 change: 1 addition & 0 deletions dist/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v0.5.2-127-g6b4a02a
2 changes: 2 additions & 0 deletions dist/toky-sdk-alpha.js

Large diffs are not rendered by default.

86 changes: 86 additions & 0 deletions dist/types/src/client.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/// <reference types="node" />
import { UserAgent, Session, Registerer, URI } from 'sip.js';
import { Channel } from 'pusher-js';
import { EventEmitter } from 'events';
import { IAccount, IMediaSpec, IIceServer, IClient, IClientSetting } from './interfaces';
import { SessionUA } from './session';
export declare class Client extends EventEmitter implements IClient {
/** Related to Toky Settings */
_accessToken: string;
_account: IAccount;
_companyId: string;
_tokyDomain: string;
_connectionCountry: string;
_appName: string;
_tokyIceServers: IIceServer[];
_tokyChannel: Channel;
_transportLib: 'sip.js' | 'jsSIP';
_userAgent: UserAgent;
_userAgentSession: Session;
_registerer: Registerer;
_currentSession: SessionUA;
_activeSession: boolean;
/** Related to States */
acceptInboundCalls: boolean;
isRegistering: boolean;
isRegistered: boolean;
isTransportConnecting: boolean;
isTransportConnected: boolean;
_reconnectionAttempts: number;
_reconnectionDelay: number;
_attemptingReconnection: boolean;
_shouldBeConnected: boolean;
subscription: any;
serverUri: URI;
constructor({ accessToken, account, transportLib, media, }: {
accessToken: string;
account: IAccount;
transportLib: 'sip.js' | 'jsSIP';
media: IMediaSpec;
});
/**
* Toky Client .init() is were we get the Toky Phone Params to establish communication with the Toky Phone System
*
* @returns {IClientSetting} - Returns data related to the Agent Settings
*/
init(): Promise<IClientSetting>;
/**
* Handlers for event listeners
*/
private sessionTerminatedHandler;
private onInvite;
private attemptReconnection;
private onDisconnect;
private onConnect;
private register;
private onOnline;
private prepateActiveSession;
private onOffline;
/**
* Internal method to build the Toky SIP URI
*
* @param {string} phoneNumber - Phone Number to create the Toky SIP URI
* @returns {URI} - Returns a builded Toky SIP URI
*/
private outboundCallURI;
/**
* Method for Access Token Refresh after expiration
*
* @param {string} accessToken - new Access Token provided by Toky API
*
* @returns {void}
*/
refreshAccessToken(accessToken: string): void;
/**
* Main Start Call method that establish a call and returns an ISession
*
* @param {Object} callData - Object with call data params
* @param {string} callData.phoneNumber - Phone Number to call
* @param {string} callData.callerId - Caller Id to use for the call
*/
startCall({ phoneNumber, callerId, }: {
phoneNumber: string;
callerId: string;
}): void;
}
//# sourceMappingURL=client.d.ts.map
1 change: 1 addition & 0 deletions dist/types/src/client.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 72 additions & 0 deletions dist/types/src/constants.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
export declare enum ClientStatus {
INVITE = "invite",
INVITE_REJECTED = "invite_rejected",
REGISTERING = "registering",
CONNECTING = "connecting",
ONLINE = "online",
OFFLINE = "offline",
UNREGISTERED = "unregistered",
REGISTRATION_FAILED = "registration_failed",
REGISTERED = "registered",
DEFAULT = "default",
READY = "ready",
DISCONNECTED = "disconnected",
SESSION_UPDATED = "session_updated"
}
export declare enum SessionStatus {
TRYING = "trying",
RINGING = "ringing",
CONNECTED = "connected",
REJECTED = "rejected",
HOLD = "hold",
UNHOLD = "unhold",
HOLD_NOT_AVAILABLE = "hold_not_available",
MUTED = "muted",
UNMUTED = "unmuted",
RECORDING = "recording",
NOT_RECORDING = "not_recording",
RECORDING_NOT_AVAILABLE = "recording_not_available",
/**
* @remarks
* TRANSFER_FAILED indicates that the server rejects the transfer for some reason
* one of the reasons can be, transferred agent doesn't exists
*/
TRANSFER_FAILED = "transfer_failed",
TRANSFER_BLIND_INIT = "transfer_blind_init",
TRANSFER_WARM_INIT = "transfer_warm_init",
TRANSFER_WARM_ANSWERED = "transfer_warm_answered",
TRANSFER_WARM_NOT_ANSWERED = "transfer_warm_not_answered",
TRANSFER_WARM_COMPLETED = "transfer_warm_completed",
TRANSFER_WARM_NOT_COMPLETED = "transfer_warm_not_completed",
TRANSFER_WARM_CANCELED = "transfer_warm_canceled",
FAILED = "failed",
BYE = "bye"
}
export declare enum TransferEnum {
AGENT = "agent",
GROUP = "group",
NUMBER = "number"
}
export declare enum TransferOptionsEnum {
BLIND = "blind",
WARM = "warm"
}
export declare enum CallDirectionEnum {
INBOUND = "inbound",
OUTBOUND = "outbound"
}
export declare enum NotRecordingReasons {
FEATURE = "call-recording-paused",
SETTINGS = "outbound-calls-settings"
}
export declare enum MediaStatus {
READY = "ready",
UPDATED = "updated",
ERROR = "error",
UNSUPPORTED = "unsupported",
PERMISSION_GRANTED = "permission_granted",
PERMISSION_REVOKED = "permission_revoked",
INPUT_UPDATED = "input_updated",
OUTPUT_UPDATED = "output_updated"
}
//# sourceMappingURL=constants.d.ts.map
1 change: 1 addition & 0 deletions dist/types/src/constants.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions dist/types/src/helpers.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export declare const isSafari: boolean;
export declare const isFirefox: boolean;
export declare const isChrome: boolean;
export declare const isProduction: boolean;
export declare const isDevelopment: boolean;
/**
* A minor variation of https://stackoverflow.com/questions/5916900/how-can-you-detect-the-version-of-a-browser
* returns name but in lower case
*/
export declare const browserSpecs: any;
export declare function appendMediaElements(): void;
export declare function stopAudio(sound: HTMLAudioElement): void;
export declare function eqSet<T>(a: Set<T>, b: Set<T>): boolean;
export declare function getAudio(id: string): HTMLAudioElement;
export declare function toKebabCase(str: string): string;
export declare function getUserAgentKey(isFromPstn: boolean, userAgent: string): string;
//# sourceMappingURL=helpers.d.ts.map
1 change: 1 addition & 0 deletions dist/types/src/helpers.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions dist/types/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Client } from './client';
import { ClientStatus, SessionStatus, TransferEnum, TransferOptionsEnum, MediaStatus } from './constants';
declare const _default: {
TokyClient: typeof Client;
TokyMedia: import("./media").MediaSingleton;
ClientStatus: typeof ClientStatus;
SessionStatus: typeof SessionStatus;
TransferEnum: typeof TransferEnum;
TransferOptionsEnum: typeof TransferOptionsEnum;
MediaStatus: typeof MediaStatus;
};
export default _default;
//# sourceMappingURL=index.d.ts.map
1 change: 1 addition & 0 deletions dist/types/src/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

111 changes: 111 additions & 0 deletions dist/types/src/interfaces.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import { URI } from 'sip.js';
import { SessionStatus, ClientStatus } from './constants';
export interface IAccount {
/** Agent id registered in Toky */
user: string;
type: 'agent';
sipUsername?: string;
/** Option to accept inbound calls */
acceptInboundCalls?: boolean;
/** Recording permissions */
callRecordingEnabled: boolean;
}
export interface IClientSetting {
connectionCountry: string;
sipUsername: string;
callRecordingEnabled: boolean;
}
export interface IMediaSpec {
/** Url of the ring audio that would be used */
ringAudio: string;
errorAudio: string;
incomingRingAudio: string;
}
export interface IIceServer {
urls: string[];
username?: string;
credential?: string;
}
export interface IClient {
init: () => Promise<{
connectionCountry: string;
}>;
startCall: (options: {
phoneNumber: string;
callerId: string;
}) => void;
on: (event: ClientStatus, listener: () => void) => void;
}
export interface IGetConnection {
pc: RTCPeerConnection;
localStream: MediaStream;
}
export declare interface ISession {
callId: string;
callRecordingEnabled: boolean;
mute: () => void;
hold?: () => void;
record?: () => void;
endCall: () => void;
getConnection: () => IGetConnection;
on: (event: SessionStatus, listener: () => void) => void;
}
export interface ICallData {
/**
* URI Data can be Agent SIP Username, in an outbound call
* can be the URI generated for the Invitation
*/
uri: string | URI;
/** Type of user involved in the call */
type: 'agent' | 'anon' | 'contact';
/**
* Applicable for outbound calls or maybe inbound calls
* with phone data
*/
phone?: string;
/** Transferred Types Blind or Warm */
transferredType?: 'blind' | 'warm';
/**
* Applicable for Transferred calls, cause by a rejected blind transferred
* or an Invite from a Warm transferred that requires to establish the call
* inmediately
*/
cause?: 'rejected';
action?: 'establish';
}
export interface ICallDataEvent {
remoteUserId: string | URI;
remoteUserType: 'agent' | 'anon' | 'contact';
remoteUserLocation?: string;
remoteUserName?: string;
did?: string;
ivrId?: string;
ivrOptionPressed?: string;
userAgent?: string;
transferredType?: 'blind' | 'warm';
transferredBy?: string;
}
export interface ISettings {
agentId: string;
accessToken: string;
sipUsername: string;
companyId: string;
callRecordingEnabled?: boolean;
}
export interface HTMLMediaElementExp extends HTMLMediaElement {
setSinkId: any;
}
export interface IDeviceList {
id: string;
name: string;
kind: string;
}
export interface ISource {
/** Url of the ring audio that would be used */
remoteSource: HTMLAudioElement;
localSource: HTMLAudioElement;
ringAudio: HTMLAudioElement;
errorAudio: HTMLAudioElement;
incomingRingAudio: HTMLAudioElement;
}
//# sourceMappingURL=interfaces.d.ts.map
1 change: 1 addition & 0 deletions dist/types/src/interfaces.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions dist/types/src/media.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/// <reference types="node" />
import { EventEmitter } from 'events';
import { IDeviceList, ISource } from './interfaces';
export declare class MediaSingleton extends EventEmitter {
_devicesInfoRaw: MediaDeviceInfo[];
_deviceList: IDeviceList[];
_localStream: MediaStream;
_source: ISource;
hasMediaPermissions: boolean;
init(): Promise<void>;
set source(media: ISource);
get source(): ISource;
private enumerateDevices;
private getDeviceList;
private closeStream;
private gotStream;
private gotDevices;
private handleError;
get devices(): IDeviceList[];
get inputs(): IDeviceList[];
get outputs(): IDeviceList[];
private getDeviceById;
private getInputDeviceById;
private getOutputDeviceById;
setOutputDevice(id: string): Promise<{
success: boolean;
message?: any;
}>;
setInputDevice(id: string, connection?: any): Promise<any>;
get defaultInputDevice(): IDeviceList;
get defaultOutputDevice(): IDeviceList;
get selectedInputDevice(): IDeviceList;
get selectedOutputDevice(): IDeviceList;
}
export declare const Media: MediaSingleton;
//# sourceMappingURL=media.d.ts.map
1 change: 1 addition & 0 deletions dist/types/src/media.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 504c10c

Please sign in to comment.