npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

callcorp-connection

v1.0.10

Published

A connection to the CallCorp server side state machines.

Readme

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: Array[string] - List of channels to support.
      Available Channels are:
    1. Call
    2. EMail
    3. SMS
    4. Chat
    5. FacebookMessenger
    6. WhatsApp
    7. Voicemail
    8. 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
  3. SelectCallCenter
  4. JoinOrInitializeSession
  5. Success
  6. AcdLogin
  7. 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
  3. SelectProfile
  4. AcdLogin
  5. 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
    3. 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
    3. HangUpAll
    4. Hold
    5. Restore
    6. Transfer
    7. 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