GithubHelp home page GithubHelp logo

garzj / wa-ah-announce Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 155 KB

A whatsapp bot, forwarding audios to an Allen & Heath device setting presets with TCP signals.

TypeScript 98.87% JavaScript 1.13%

wa-ah-announce's Introduction

wa-ah-announce

This application forwards audio announcements received per WhatsApp to an Allen & Heath AHM device letting the user pick a room to play them.

It uses VLC to transmit a RTP stream, while using the AHM TCP protocol on port 51325 to load presets.

Setup

  • install VLC, Node and Git
  • git clone
    cd wa-ah-announce
    yarn
    yarn build
    

Configuration

The app is configured via environment variables listed in this file. Here is an example .env file:

# application
AH_HOST=69.42.0.1
AH_PORT=51325
AH_USER=31
AH_PASSWORD=supersecurepassword
DATA_DIR=./data
MAX_AUDIO_FILES=100
AUDIO_START_DELAY=3000

# whatsapp
WA_SKIP_HISTORY=false
WA_ADMIN=1234567890
# (pairing codes don't work with a custom browser name)
USE_PAIRING_CODE=false
PAIRING_CODE_NO=1234567890

# should not contain any special characters (optional)
BROWSER_NAME="Announcements Bot"

Stream using RTP (Windows)

CVLC_COMMAND='"C:\Program Files\VideoLAN\VLC\vlc.exe" -I dummy --dummy-quiet'
# the audio file will be specified between these parts
CVLC_ARGS="--sout '#transcode{vcodec=mp2v,vb=800,acodec=mpga,ab=128,channels=2,samplerate=48000,scodec=none}:rtp{dst=192.168.2.8,port=5004,mux=ts,sap,name=Announcement}' --no-sout-all --sout-keep"

Play audio on speaker (Windows)

First, get the id of the Speaker (using powershell):

$AudioDeviceName="15-16"
Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Enum\SWD\MMDEVAPI\*" | Where-Object {($_.FriendlyName -Match $AudioDeviceName) -and ($_.PSChildName -Match "0\.0\.0")} | Select-Object -Property FriendlyName,PSChildName

Copy the PSChildName from the output and use like this here:

CVLC_COMMAND='"C:\Program Files\VideoLAN\VLC\vlc.exe" -I dummy --dummy-quiet --no-one-instance --mmdevice-audio-device {0.0.0.00000000}.{some-guid} --play-and-exit'

Run the app

yarn start

Or use a tool like pm2 to run it in background mode.

Usage

Login to a whatsapp account via the QR code and send it !help for a list of commands.

wa-ah-announce's People

Contributors

garzj avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.