asterisk-ami

n8n community node for Asterisk/FreePBX AMI actions such as Originate and Hangup.

Package Information

Released: 3 mo ago
Downloads: 192 weekly / 192 monthly
Latest Version: 0.1.0
Author: Exaland

Documentation

n8n-nodes-asterisk-ami

Module n8n sans worker SIP. Il utilise directement l'interface Asterisk Manager Interface (AMI) de FreePBX/Asterisk.

Avec AMI, n8n ne fait pas SIP/RTP. Asterisk lance les appels, gère les trunks, l'audio, les codecs et l'authentification SIP.

Fonctions

  • Originate Call
  • Hangup Channel
  • AMI Command
  • Custom AMI Action

Installation locale

cd n8n-nodes-asterisk-ami
npm install
npm run build
npm link

# Dans ton environnement n8n
npm link n8n-nodes-asterisk-ami
n8n start

Ou copie le dossier dans un environnement n8n custom Docker et installe-le comme package npm local.

Activer AMI dans FreePBX

Dans FreePBX :

Settings > Asterisk Manager Users
Add Manager

Exemple :

Username: n8nami
Secret: mot-de-passe-fort
Permit: IP_DE_N8N/255.255.255.255
Read: system,call,log,verbose,command,agent,user,config,dtmf,reporting,cdr,dialplan,originate
Write: system,call,log,verbose,command,agent,user,config,dtmf,reporting,cdr,dialplan,originate

Vérifie que le port AMI est ouvert seulement pour l'IP de n8n :

ufw allow from IP_DE_N8N to any port 5038 proto tcp

Ne pas exposer AMI publiquement sans restriction IP.

Credentials n8n

Crée un credential Asterisk AMI API :

Host: 178.105.206.0
Port: 5038
Username: n8nami
Password: ton secret AMI
TLS: false

Exemple : appeler une extension interne

Operation: Originate Call

Channel: PJSIP/4000
Context: from-internal
Extension: 6000
Priority: 1
Caller ID: "Exaland" <4000>
Async: true

Ce scénario fait sonner l'extension 4000, puis l'envoie vers 6000.

Exemple : appeler un numéro externe via le dialplan FreePBX

Méthode recommandée : originate depuis une extension autorisée, puis composer le numéro dans from-internal.

Channel: Local/00442037692699@from-internal
Context: from-internal
Extension: 6000
Priority: 1
Caller ID: "Exaland" <4000>
Async: true

Alternative selon ton trunk :

Channel: PJSIP/00442037692699@NOM_DU_TRUNK
Context: from-internal
Extension: s
Priority: 1
Async: true

Le format exact dépend de tes trunks FreePBX.

Voir les appels actifs

Operation: AMI Command

core show channels concise

Raccrocher

Operation: Hangup Channel

Channel: PJSIP/4000-00000012

Tu peux obtenir le nom du channel avec core show channels concise.

Notes importantes

  • Ce module ne diffuse pas directement un fichier audio. Pour jouer un message, fais-le côté Asterisk : dialplan, IVR, announcement, AGI/ARI, ou Local/...@context.
  • Pour de l'audio dynamique/IA, la bonne suite est AMI pour origination + ARI/ExternalMedia côté Asterisk.
  • AMI est beaucoup plus stable que réimplémenter SIP dans Node.

Discussion