The open-source AI receptionist for businesses. Answers every call, books the appointment and hands over to a person when needed. You own the code and the data.
TypeScript ai-receptionistanswering-serviceappointment-bookinglivekitlocal-firstmcpopen-sourceself-hostedsiptelephonytypescriptvoice-agentvoice-ai
import assert from 'node:assert/strict'
import { test } from 'node:test'
import { linkInArgs, navigationTarget, newWindowTarget, pageForLink } from './links.ts'
const server = 'https://app.linedesk.ai'
test('the window keeps the server and the flows it starts; other addresses go out or nowhere', () => {
assert.equal(navigationTarget('https://app.linedesk.ai/#call/1', server), 'app')
assert.equal(navigationTarget('https://checkout.stripe.com/c/pay/x', server), 'app')
assert.equal(navigationTarget('https://accounts.zoho.eu/oauth/v2/auth', server), 'app')
assert.equal(navigationTarget('https://brightwater.myshopify.com/admin/oauth/authorize?x=1', server), 'app')
assert.equal(navigationTarget('https://attacker.myshopify.com/sign-in', server), 'external')
assert.equal(navigationTarget('https://github.com/login/oauth/authorize', server), 'app')
assert.equal(navigationTarget('https://github.com/attacker/repo', server), 'external')
assert.equal(navigationTarget('https://gist.github.com/x', server), 'external')
assert.equal(navigationTarget('https://evil.example/sign-in', server), 'external')
assert.equal(navigationTarget('https://notstripe.com/', server), 'external')
assert.equal(navigationTarget('http://checkout.stripe.com/', server), 'external')
assert.equal(navigationTarget('mailto:[email protected]', server), 'external')
assert.equal(navigationTarget('tel:+15035550100', server), 'external')
assert.equal(navigationTarget('file:///etc/passwd', server), 'block')
assert.equal(navigationTarget('javascript:alert(1)', server), 'block')
assert.equal(navigationTarget('not a url', server), 'block')
})
test('new windows: the server in the app, other sites in the browser', () => {
assert.equal(newWindowTarget('https://app.linedesk.ai/#contacts', server), 'app')
assert.equal(newWindowTarget('https://docs.linedesk.ai/', server), 'external')
assert.equal(newWindowTarget('http://example.com/', server), 'external')
assert.equal(newWindowTarget('file:///tmp/x', server), 'block')
assert.equal(newWindowTarget('linedesk://open/#x', server), 'block')
})
test('links open the start page with their page, nothing else', () => {
assert.equal(pageForLink('linedesk://open/#call/abc', server), 'https://app.linedesk.ai/#call/abc')
assert.equal(pageForLink('linedesk://open#call/abc', server), 'https://app.linedesk.ai/#call/abc')
assert.equal(pageForLink('linedesk://open/?invite=x#y', server), 'https://app.linedesk.ai/?invite=x#y')
assert.equal(pageForLink('https://app.linedesk.ai/#call/abc', server), 'https://app.linedesk.ai/#call/abc')
assert.equal(pageForLink('linedesk://open/api/auth/sign-out', server), null)
assert.equal(pageForLink('linedesk://evil.example/#x', server), null)
assert.equal(pageForLink('https://evil.example/#call/abc', server), null)
assert.equal(pageForLink('https://app.linedesk.ai/v1/actions/x', server), null)
assert.equal(pageForLink('nonsense', server), null)
})
test('a clicked link among the arguments', () => {
assert.equal(linkInArgs(['Linedesk.exe', '--flag', 'linedesk://open/#call/1']), 'linedesk://open/#call/1')
assert.equal(linkInArgs(['Linedesk.exe']), null)
})