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

voip-click-to-call

v1.0.0

Published

Outil npm pour générer un système click-to-call VoIP compatible Asterisk et FreeSWITCH

Readme

voip-click-to-call

Outil npm pour générer un système click-to-call VoIP compatible avec Asterisk et FreeSWITCH.

Installation

npm install -g voip-click-to-call

Ou en local dans votre projet :

npm install voip-click-to-call

Utilisation

1. Créer un fichier de configuration

Créez un fichier voip-config.yaml dans votre projet avec la configuration de votre serveur VoIP :

voip:
  type: asterisk  # ou 'freeswitch'
  host: localhost
  port: 5038
  username: admin
  password: secret
  protocol: ami  # 'ami', 'ari' pour Asterisk, 'esl' pour FreeSWITCH

backend:
  port: 3000
  websocketPort: 3001

frontend:
  apiUrl: http://localhost:3000
  wsUrl: ws://localhost:3001

2. Générer le frontend et backend

voip-click-to-call generate

Ou avec des options :

voip-click-to-call generate --framework react --config voip-config.yaml

Le générateur vous demandera :

  • Le framework frontend (React, Vue.js, ou Vanilla JS)
  • Le répertoire de sortie

3. Installer les dépendances

cd voip-click-to-call
cd backend && npm install
cd ../frontend && npm install

4. Démarrer les serveurs

Backend :

cd backend
npm start

Frontend :

cd frontend
npm start

Fonctionnalités

Détection automatique des numéros

Le système détecte automatiquement tous les numéros de téléphone sur votre page web et les transforme en liens cliquables. Deux méthodes sont supportées :

  1. Détection par regex : Analyse automatique du contenu texte de la page
  2. Attributs HTML : Utilisation de l'attribut data-phone sur les éléments HTML

Exemple avec attribut :

<span data-phone="0123456789">Contactez-nous</span>

Support des serveurs VoIP

  • Asterisk : Support AMI (Asterisk Manager Interface) et ARI (Asterisk REST Interface)
  • FreeSWITCH : Support ESL (Event Socket Library)

Frameworks frontend supportés

  • React
  • Vue.js
  • Vanilla JavaScript

Configuration

Asterisk AMI

voip:
  type: asterisk
  host: localhost
  port: 5038
  username: admin
  password: secret
  protocol: ami

Asterisk ARI

voip:
  type: asterisk
  host: localhost
  port: 8088
  username: asterisk
  password: asterisk
  protocol: ari

FreeSWITCH ESL

voip:
  type: freeswitch
  host: localhost
  port: 8021
  password: ClueCon
  protocol: esl

API

POST /api/call

Initie un appel téléphonique.

Body :

{
  "phoneNumber": "0123456789",
  "fromNumber": "1000"  // optionnel
}

Response :

{
  "success": true,
  "message": "Appel initié de 1000 vers 0123456789",
  "callId": "1234567890.123",
  "phoneNumber": "0123456789",
  "fromNumber": "1000"
}

GET /api/health

Vérifie l'état du serveur et de la connexion VoIP.

Response :

{
  "status": "ok",
  "voipConnected": true
}

GET /api/config

Retourne la configuration pour le frontend.

WebSocket

Le serveur WebSocket envoie des événements en temps réel :

{
  "type": "call_initiated",
  "phoneNumber": "0123456789",
  "fromNumber": "1000",
  "callId": "1234567890.123",
  "timestamp": "2024-01-01T12:00:00.000Z"
}
{
  "type": "call_status",
  "phoneNumber": "0123456789",
  "status": "completed",  // ou "failed"
  "timestamp": "2024-01-01T12:00:05.000Z"
}

Développement

Structure du projet généré

voip-click-to-call/
├── backend/
│   ├── src/
│   │   ├── server.js
│   │   └── connectors/
│   │       ├── asterisk.js
│   │       └── freeswitch.js
│   ├── voip-config.yaml
│   └── package.json
└── frontend/
    ├── src/
    │   ├── App.js (ou App.vue, app.js)
    │   ├── config.js
    │   └── phone-detector.js
    └── package.json

Publication sur npm

Pour publier ce package sur npm :

  1. Créez un compte sur npmjs.com
  2. Connectez-vous via la CLI : npm login
  3. Vérifiez que le nom du package est disponible
  4. Publiez : npm publish

Le package inclut automatiquement :

  • Tous les fichiers dans src/
  • Tous les templates dans templates/
  • Le fichier config.example.yaml
  • Le README.md

Licence

MIT