This commit is contained in:
Kyan Wanschers 2025-02-14 16:14:19 +01:00
parent ff2aa4235b
commit d7eda16e9d
5 changed files with 1293 additions and 0 deletions

136
.gitignore vendored Normal file
View file

@ -0,0 +1,136 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
.cache
# vitepress build output
**/.vitepress/dist
# vitepress cache directory
**/.vitepress/cache
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

43
001565c56961-local.cfg Normal file
View file

@ -0,0 +1,43 @@
#!version:1.0.0.1
action_url.setup_completed = http://10.42.0.1/?event=setup_completed&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.log_on = http://10.42.0.1/?event=registered&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.log_off = http://10.42.0.1/?event=unregistered&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.register_failed = http://10.42.0.1/?event=register_failed&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.incoming_call = http://10.42.0.1/?event=incoming_call&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.off_hook = http://10.42.0.1/?event=off_hook&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.on_hook = http://10.42.0.1/?event=on_hook&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.outgoing_call = http://10.42.0.1/?event=outgoing_call&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.call_established = http://10.42.0.1/?event=call_established&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.call_terminated = http://10.42.0.1/?event=call_terminated&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.dnd_on = http://10.42.0.1/?event=dnd_on&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.dnd_off = http://10.42.0.1/?event=dnd_off&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.always_fwd_on = http://10.42.0.1/?event=always_fwd_on&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.always_fwd_off = http://10.42.0.1/?event=always_fwd_off&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.busy_fwd_on = http://10.42.0.1/?event=busy_fwd_on&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.busy_fwd_off = http://10.42.0.1/?event=busy_fwd_off&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.no_answer_fwd_on = http://10.42.0.1/?event=no_answer_fwd_on&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.no_answer_fwd_off = http://10.42.0.1/?event=no_answer_fwd_off&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.transfer_call = http://10.42.0.1/?event=transfer_call&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.blind_transfer_call = http://10.42.0.1/?event=blind_transfer_call&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.attended_transfer_call = http://10.42.0.1/?event=attended_transfer_call&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.hold = http://10.42.0.1/?event=hold&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.unhold = http://10.42.0.1/?event=unhold&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.mute = http://10.42.0.1/?event=mute&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.unmute = http://10.42.0.1/?event=unmute&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.missed_call = http://10.42.0.1/?event=unmute&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.ip_change = http://10.42.0.1/?event=ip_change&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.reject_incoming_call = http://10.42.0.1/?event=reject_incoming_call&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.answer_new_incoming_call = http://10.42.0.1/?event=answer_new_incoming_call&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.busy_to_idle = http://10.42.0.1/?event=busy_to_idle&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.idle_to_busy = http://10.42.0.1/?event=idle_to_busy&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.forward_incoming_call = http://10.42.0.1/?event=forward_incoming_call&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.transfer_finished = http://10.42.0.1/?event=transfer_finished&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.transfer_failed = http://10.42.0.1/?event=transfer_failed&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.setup_autop_finish = http://10.42.0.1/?event=setup_autop_finish&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.call_waiting_on = http://10.42.0.1/?event=call_waiting_on&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.call_waiting_off = http://10.42.0.1/?event=call_waiting_off&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.call_remote_canceled = http://10.42.0.1/?event=call_remote_canceled&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.cancel_callout = http://10.42.0.1/?event=cancel_callout&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.remote_busy = http://10.42.0.1/?event=remote_busy&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.headset = http://10.42.0.1/?event=headset&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber
action_url.handfree = http://10.42.0.1/?event=handfree&mac=$mac&ip=$ip&model=$model&firmware=$firmware&active_url=$active_url&active_user=$active_user&active_host=$active_host&local=$local&remote=$remote&display_local=$display_local&display_remote=$display_remote&call_id=$call_id&callerID=$callerID&calledNumber=$calledNumber

60
index.js Normal file
View file

@ -0,0 +1,60 @@
// Require the framework and instantiate it
import axios from 'axios';
let yealinkbaseurl = "http://10.42.0.186/cgi-bin/ConfigManApp.com"
function send_request(params) {
axios.get(yealinkbaseurl, {
auth: {
username: "admin",
password: "admin"
},
params: params, // Query parameters
})
}
// ESM
import Fastify from 'fastify'
const fastify = Fastify({
logger: true
})
import mqtt from 'mqtt';
const client = mqtt.connect("mqtt://127.0.0.1");
client.on("connect", () => {
client.subscribe("bitlair/telefoon/dial", (err) => {
});
client.subscribe("bitlair/telefoon/key", (err) => {
});
});
client.on('message', function (topic, message) {
// message is Buffer
switch (topic) {
case "bitlair/telefoon/dial":
console.log("Dialing "+message)
send_request({"number": message, "outgoing_uri": 'URI'})
break
case "bitlair/telefoon/key":
console.log("Pressing "+message)
send_request({"key": message})
break
default:
break
}
})
// Declare a route
fastify.get('/', function (request, reply) {
reply.send({ hello: 'world' })
//client.send(request.)
client.publish("bitlair/telefoon/"+request.query.event, JSON.stringify(request.query));
})
// Run the server!
fastify.listen({ port: 80, host: '0.0.0.0' }, function (err, address) {
if (err) {
fastify.log.error(err)
process.exit(1)
}
// Server is now listening on ${address}
})

1037
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

17
package.json Normal file
View file

@ -0,0 +1,17 @@
{
"name": "yealink-bridge",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"type": "module",
"dependencies": {
"axios": "^1.7.9",
"fastify": "^5.2.1",
"mqtt": "^5.10.3"
}
}