1.0.10 • Published 3 years ago

callcorp-connection v1.0.10

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

CallCorp Connection

Constructors

constructor


new CallCorpConnection(config: Object, realTimeEventCallback: function, updateHsmStateCallback: function, deleteHsmStateCallback: function, alterCallback: function, isACD?: boolean)


Creates an instance of CallCorpConnection

Parameters

  • config: Object {
    channels: Arraystring - List of channels to support.
    Available Channels are: 1) Call 2) EMail 2) SMS 2) Chat 2) FacebookMessenger 2) WhatsApp 2) Voicemail 2) Callback

    locale: string - Time locale you would like dates to be formatted in.
    realTimeEventCallback: function - A Callback function that will be invoked any time real time events occur.
    updateHsmStateCallback: function - A Callback function that will be invoked any time HSMs are added or state changes occur.
    deleteHsmStateCallback: function - A Callback function that will be invoked any time an HSM is removed.
    alertCallback: function - A Callback function that will be invoked any time alert events come over the websocket.
    isACD: boolean - Default true - Indicates if this is PBX only (false) or ACD (true)
    }

Returns CallCorpConnection

Methods

setLocation


setLocation(locationCode: string)


Sets the environment the instance will be running in. Needs to be done before Login.

Parameters

  • locationCode: String

Returns void

login


login(loginObject: Object)


Attempts to log the user in based on the credentials provided

Parameters

  • loginObject: Object {
    ProviderType: string - Type of authentication
    UniqueID: string - Username
    Password: string
    MFAToken: string - Optional MFAToken
    }

Returns Object {
nextStep: string - The next step in the login process.
Potential next steps are: 1) SelectMfaOption 2) SubmitMfaCode 2) SelectCallCenter 2) JoinOrInitializeSession 2) Success 2) AcdLogin 2) SelectProfile

Data: Object - Optional data that varies based on the next step
}

attemptAutoLogin


attemptAutoLogin()


Attempts to auto log the user in based on stored credentials already in local storage

Parameters

none

Returns void - throws an error if proper credentials do not exist in local storage

selectMfaOption


selectMfaOption(selectedMfaOption: Object)


The MFA option chosen between email and texting if available

Parameters

  • selectedMfaOption: Object {
    value: string - Phone number or email address to send code to.
    }

Returns Object {
nextStep: string - 'SubmitMfaCode'
}

resendMFACode


resendMFACode()


Resend the MFA code to the option selected

Parameters

none

Returns Object {
nextStep: string - 'SubmitMfaCode'
}

submitMfaCode


submitMfaCode(mfaCode: string)


Submit the MFA code received through the selected method

Parameters

  • mfaCode: string - MFA code received through the selected method

Returns Object {
nextStep: string - The next step in the login process.
Potential next steps are: 1) SelectCallCenter 2) JoinOrInitializeSession 2) SelectProfile 2) AcdLogin 2) Success

Data: Object - Optional data that varies based on the next step
}

selectCallCenter


selectCallCenter(securityContextId: string, autoLogin?: boolean)


The company to log into

Parameters

  • securityContextId: string - The Security Context Id associated with the selected company
  • autoLogin: boolean - Optional flag to indicate we are auto logging in

Returns Object {
nextStep: string - 'JoinOrInitializeSession'
}

initializeSession


initializeSession(stationSettings: Object)


Initialize the HSMs needed for a session to start

Parameters

  • stationSettings: Object {
    PBXDeviceType: string - Type of phone for the station
    Potential devices are:
    1) SoftPhone 2) SIP 2) PSTN

    }

Returns Object {
nextStep: string - 'Success' or 'AcdLogin' }

joinSession


joinSession(maxAttempts: Integer)


Join a session that has been initialized by a third party

Parameters

  • stationSettings: Object {
    maxAttempts: Integer - Max attempts to join the session

Returns Object {
nextStep: string - 'Success' or 'AcdLogin' }

acdLogin


acdLogin(profileId?: String)


Login to the ACD with a profileId

Parameters

  • stationSettings: Object {
    profileId: String - Optional ProfileId from the selected profile. If only one profile it will automatically select it, if not you must provide a ProfileId

Returns Object {
nextStep: string - 'Success' or 'SelectProfile',
Data: Object - Optional data that varies based on the next step
}

dialOutbound


dialOutbound(type: String, toNumber: String, fromNumber: String, fromQueue?: String, emergencyAddress?: Object)


Perform a WebRTC outbound phone call

Parameters

  • type: String - Can be either Dial (Conference call), DialPrivate (warm transfer), or TransferTo (cold transfer),
  • toNumber: String - Number to dial,
  • fromNumber: String - Number to call from,
  • fromQueue: String - Optional queue to dial from (only for ACD)
  • emergencyAddress: Object - Optional Emergency address object {
    Address: Object {
    CallerName: String - Name of the person or company calling AddressLine1: String - Address line 1
    AddressLine2: String - Address line 2
    City: String - City
    State: String - Two character state code
    Zipcode: String - Five digit zipcode
    PlusFour: String - Optional four extra digits associated with zipcode
    }
    }

Returns void

sendEvent


sendEvent(target: String, eventName: String, context?: Object)


Send an event through the websocket

Parameters

  • target: String - An HSM Id or SessionId
  • eventName: String - An Event Name, Potential event names are:
    1) DoMute 2) DoUnmute 2) HangUpAll
    2) Hold
    2) Restore
    2) Transfer
    2) HangUp
  • context: Object - Optional Custom data sent with the event

Returns Object - Event Response

apiRequest


apiRequest(verb: String, path: String, body?: Object)


Api request into CallCorp made on behalf of the current selected company

Parameters

  • verb: String - GET, POST, DELETE, PUT
  • path: String - API Uri path
  • body: Object - Optional body for the reqeust

Returns Object - API Response

logOut


logOut()


Logout of the ACD and Company and clear all data

Parameters

none

Returns void

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago