remove baresip for now, use ices2

This commit is contained in:
rdl technix 2021-09-03 19:08:48 +02:00
parent 3409fb8ab8
commit 333146a182
10 changed files with 123 additions and 20 deletions

View file

@ -9,8 +9,10 @@ import { Transform, Readable } from 'streamx'
import fastifyStatic from 'fastify-static'
import fastifyCors from 'fastify-cors'
import fastifySSE from 'fastify-sse-v2'
import fastifyProxy from 'fastify-http-proxy'
import { Darkice } from './darkice.mjs'
//import { Darkice } from './darkice.mjs'
import { Darkice } from './ices2.mjs'
import { Baresip } from './baresip.mjs'
import { AlsaMeter } from './lib/ffmpeg-meter.mjs'
import { ConnectivityCheck } from './lib/is-online.mjs'
@ -26,7 +28,9 @@ function deviceToFFMPEG (device) {
export async function run (config = {}) {
const app = fastify()
const darkice = new Darkice()
const baresip = new Baresip()
const baresip = new Baresip({
destination: 901
})
const isOnline = new ConnectivityCheck()
const meter = new AlsaMeter({
@ -57,10 +61,18 @@ export async function run (config = {}) {
// const state = new StateContainer(reducer, INITIAL_STATE)
// state.ingestActionStream(actions)
app.register(fastifyStatic, {
root: p.join(__dirname, '..', 'frontend', 'dist'),
prefix: '/'
})
if (config.dev) {
app.register(fastifyProxy, {
upstream: 'http://localhost:3000',
prefix: '/'
})
} else {
app.register(fastifyStatic, {
root: p.join(__dirname, '..', 'frontend', 'dist'),
prefix: '/'
})
}
app.register(fastifyCors, {
origin: '*'