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

@oatlas/tapi

v1.0.7

Published

Ocean Telephony Api Library for js

Readme

Ocean Telephony API for JavaScript (@oatlas/tapi)

npm version npm downloads codecov build License: MIT

| Quickstart | API Docs | Wiki | Discussions | | ------------------------------------------------------------------------------- | ---------------------------------------------------------- | ------------------------------------------------------------------------ | ---------------------------------------------- |

Table of Contents

  1. About
  2. Features
  3. Supported Providers
  4. Quick Start
  5. Installation
  6. Documentation
  7. Examples
  8. Architecture
  9. Contributing
  10. Security
  11. License

About

Ocean Telephony API (@oatlas/tapi) is a unified, provider-agnostic JavaScript library for integrating Computer Telephony Integration (CTI) capabilities into web and Node.js applications.

Built with the same quality standards as the Ocean Authentication Library (OAL), @oatlas/tapi enables developers to:

  • 📞 Manage calls (make, receive, transfer, conference)
  • 🎤 Control devices (phones, headsets, mobile devices)
  • 👤 Handle presence (status, availability, DND)
  • 📋 Track history (CDR, call logs, recording URLs)
  • 🔔 Handle events (real-time call notifications)
  • 🔄 Multi-provider support (Karel, RingCentral, Avaya, FreePBX, MS Teams)

The @oatlas/tapi package provides a common, unified telephony API used by platform-specific packages:


Features

Core Capabilities

Multi-Provider Support

  • Karel PBX (REST API + WebSocket)
  • RingCentral Cloud (Official SDK)
  • Avaya Enterprise (TSAPI/JTAPI)
  • FreePBX Open Source (AMI)
  • Microsoft Teams (Graph API)

Call Management

  • Originate calls
  • Answer incoming calls
  • Transfer (blind & attended)
  • Conference (multi-party)
  • Hold/Resume
  • Mute/Unmute
  • Recording

Device Management

  • List devices
  • Set active device
  • Monitor device state

User Management

  • Get user info
  • Set presence/status
  • Monitor presence changes

Call History

  • Retrieve CDR (Call Detail Records)
  • Search call logs
  • Access recording URLs

Real-Time Events

  • Incoming calls
  • Call state changes
  • Device changes
  • Presence updates
  • Connection status

Enterprise Features

  • Auto-reconnect with exponential backoff
  • Error recovery
  • Connection pooling
  • Event aggregation
  • Comprehensive logging
  • Full TypeScript support

Supported Providers

| Provider | Status | Type | Authentication | Real-Time | |----------|--------|------|-----------------|-----------| | Karel | ✅ Complete | On-Premise PBX | REST API Token | WebSocket | | RingCentral | ✅ Complete | Cloud PBX | OAuth 2.0 SDK | Subscriptions | | MS Teams | ✅ Complete | UC Platform | Azure AD (Graph API) | Webhooks | | Avaya | 🔄 In Progress | Enterprise PBX | TSAPI/JTAPI | Various | | FreePBX | 🔄 In Progress | Open Source | AMI | Polling |


Quick Start

Installation

npm install @oatlas/tapi
npm install @oatlas/tapi-browser  # For browser
# or
npm install @oatlas/tapi-node     # For Node.js

Basic Usage

import { TapiManager, TapiEventType } from '@oatlas/tapi';

// Initialize with provider config
const manager = new TapiManager({
  provider: 'karel',
  apiUrl: 'https://pbx.example.com/api',
  username: '[email protected]',
  password: 'password',
  enableCallLog: true,
  enableRecording: true
});

// Connect to telephony system
await manager.initialize();

// Listen for incoming calls
manager.on(TapiEventType.CALL_INCOMING, (event) => {
  console.log('Incoming call from:', event.data.from);
  console.log('Called number:', event.data.to);
});

// Make a call
const result = await manager.makeCall('+1-555-123-4567');
if (result.success) {
  console.log('Call made:', result.data.id);
} else {
  console.error('Call failed:', result.error?.message);
}

// Answer incoming call
await manager.answerCall();

// Transfer to another extension
await manager.transferCall({
  targetNumber: '101',
  blind: false  // Attended transfer (consult first)
});

// Listen to errors
manager.onError((error) => {
  console.error('Telephony Error:', error.code, error.message);
});

// Cleanup
await manager.disconnect();

Installation

Via NPM

npm install @oatlas/tapi

Via Yarn

yarn add @oatlas/tapi

Via pnpm

pnpm add @oatlas/tapi

From GitHub

npm install github:OAtlas/ocean-telephony-api-for-js#main

Documentation

Getting Started

API Reference

Provider Guides

Advanced Topics


Examples

Example 1: Basic Call Control

import { TapiManager } from '@oatlas/tapi';

const manager = new TapiManager({
  provider: 'karel',
  apiUrl: 'https://pbx.example.com/api',
  username: '[email protected]',
  password: 'password'
});

await manager.initialize();

// Make call
const call = await manager.makeCall('+1-555-123-4567');
console.log(`Call ID: ${call.data?.id}`);

// Answer call (when incoming)
await manager.answerCall();

// Hold call
await manager.holdCall();

// Resume call
await manager.resumeCall();

// End call
await manager.endCall();

Example 2: Conference Calls

// Create conference
const conference = await manager.createConference({
  participants: ['+1-555-111-1111', '+1-555-222-2222'],
  name: 'Team Meeting',
  recordingEnabled: true,
  maxDuration: 3600  // 1 hour
});

// Add participant
await manager.addParticipant(conference.data!.id, '+1-555-333-3333');

// Remove participant
await manager.removeParticipant(conference.data!.id, 'participant-id');

Example 3: Event Monitoring

// Incoming call
manager.on(TapiEventType.CALL_INCOMING, (event) => {
  console.log('Incoming:', event.data.from);
  // Auto-answer if from specific number
  if (event.data.from === '+1-555-123-4567') {
    manager.answerCall(event.data.id);
  }
});

// Call answered
manager.on(TapiEventType.CALL_ANSWERED, (event) => {
  console.log('Call answered, duration start');
  startTimer();
});

// Call ended
manager.on(TapiEventType.CALL_ENDED, (event) => {
  console.log('Call ended', event.data.endReason);
  saveCallLog(event.data);
});

// Presence changed
manager.on(TapiEventType.PRESENCE_CHANGED, (event) => {
  console.log('Presence:', event.data.presence);
  updateUI(event.data);
});

Example 4: Error Handling & Recovery

manager.onError((error) => {
  switch (error.code) {
    case 'NETWORK_ERROR':
      console.error('Network error:', error.message);
      // App handles auto-reconnect
      break;
    
    case 'CALL_FAILED':
      console.error('Call failed:', error.details);
      showErrorDialog('Unable to make call');
      break;
    
    case 'DEVICE_NOT_FOUND':
      console.warn('Device removed, switching to default');
      break;
  }
});

Example 5: Call Recording

// Start recording call
const call = await manager.makeCall('+1-555-123-4567');

await manager.startRecording(call.data!.id, {
  format: 'mp3',
  quality: 'high'
});

// ... call continues ...

// Stop recording
const stopResult = await manager.stopRecording(call.data!.id);

// Get recording URL from call history
const history = await manager.getCallHistory({ limit: 1 });
const recordingUrl = history.data?.[0].recordingUrl;

Example 6: Multi-Provider Setup

// Karel production
const primaryManager = new TapiManager({
  provider: 'karel',
  apiUrl: 'https://pbx-primary.example.com/api',
  username: '[email protected]',
  password: 'password',
  autoReconnect: true
});

// RingCentral backup
const backupManager = new TapiManager({
  provider: 'ringcentral',
  clientId: 'xxxxx',
  clientSecret: 'xxxxx',
  autoReconnect: true
});

// Failover logic
primaryManager.onError(async (error) => {
  if (error.code === 'CONNECTION_ERROR') {
    console.log('Primary failed, switching to backup...');
    await backupManager.initialize();
  }
});

Architecture

High-Level Design

┌─────────────────────────────────┐
│   Web/Node Application          │
└────────────┬────────────────────┘
             │
    ┌────────▼────────┐
    │   TapiManager   │  (Unified API)
    │  (Main API)     │
    └────────┬────────┘
             │
    ┌────────▼────────┐
    │  TapiAdapter    │  (Abstract Interface)
    │  (Abstract)     │
    └────────┬────────┘
             │
    ┌────────▼───────────────────────┐
    │    Provider Adapters           │
    ├────────────────────────────────┤
    │ • KarelAdapter                 │
    │ • RingCentralAdapter           │
    │ • MSTeamsAdapter               │
    │ • AvayaAdapter                 │
    │ • FreePBXAdapter               │
    └────────┬───────────────────────┘
             │
    ┌────────▼────────────────────────┐
    │   Telephony Systems            │
    ├────────────────────────────────┤
    │ • Karel PBX                    │
    │ • RingCentral Cloud            │
    │ • Avaya Enterprise             │
    │ • FreePBX Server               │
    │ • Microsoft Teams              │
    └────────────────────────────────┘

Adapter Pattern

@oatlas/tapi uses the Adapter Design Pattern to normalize different telephony APIs:

Different APIs          Adapter Pattern         Unified Interface
────────────────────────────────────────────────────────────────
Karel REST API          KarelAdapter      │
  (Different format) ─→ (Conversion)  ────┤
                                           ├─→ TapiManager API
RingCentral SDK         RingCentralAdapter│    (Standard Interface)
  (Different format) ─→ (Conversion)  ────┤
                                           │
MS Teams Graph API      MSTeamsAdapter     │
  (Different format) ─→ (Conversion)  ────┘

Contributing

We welcome contributions! Here's how:

  1. Fork the repository

    git clone https://github.com/OAtlas/ocean-telephony-api-for-js.git
    cd ocean-telephony-api-for-js
  2. Create a feature branch

    git checkout -b feature/amazing-feature
  3. Install dependencies

    npm install
  4. Make your changes

  5. Run tests

    npm run test
    npm run test:coverage
  6. Commit and push

    git commit -m "feat: Add amazing feature"
    git push origin feature/amazing-feature
  7. Create a Pull Request

    • Reference related issues
    • Describe your changes
    • Include any breaking changes

Security

Reporting Security Issues

⚠️ Do not open public GitHub issues for security vulnerabilities.

If you discover a security vulnerability, please email [email protected] with:

  • Description of the vulnerability
  • Steps to reproduce
  • Potential impact
  • Suggested fix (if any)

We will:

  • Acknowledge your report within 48 hours
  • Work with you to understand the issue
  • Develop and test a fix
  • Credit you in the fix release (if desired)

Security Best Practices

  1. Credentials Management

    • Never commit credentials to version control
    • Use environment variables
    • Rotate API keys regularly
  2. Transport Security

    • Always use HTTPS/WSS (encrypted)
    • Validate SSL certificates
    • Use OAuth 2.0 where available
  3. Update Regularly

    npm outdated
    npm update

See SECURITY.md for more details.


Performance

Benchmarks

  • Connection time: < 100ms (average)
  • Call setup latency: < 200ms
  • Memory footprint: < 5MB
  • Event latency: < 50ms (95th percentile)

See PERFORMANCE.md for detailed benchmarks.


FAQ

Q: Which version of Node.js is supported? A: Node.js 14+, with 16+ recommended.

Q: Can I use this in the browser? A: Yes! Use @oatlas/tapi-browser for browser-specific features.

Q: Does it support TypeScript? A: Yes, full TypeScript support with type definitions included.

Q: How do I handle network failures? A: Set autoReconnect: true in config. See Error Handling Guide.

Q: Can I use multiple adapters simultaneously? A: Yes, create multiple TapiManager instances with different configs.

Q: What's the license? A: MIT License. See LICENSE file.

See FAQ.md for more questions.


Changelog

See CHANGELOG.md for version history and breaking changes.


Related Projects


License

Copyright (c) Ocean Corporation. All rights reserved.

Licensed under the MIT License - see LICENSE file for details.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

Code of Conduct

We value and adhere to the Ocean Open Source Code of Conduct.

For more information, see the Code of Conduct FAQ or contact [email protected].


Support


Made with ❤️ by the OAtlas Team