summaryrefslogtreecommitdiff
path: root/net-misc/attendant/attendant-0.4.4.ebuild
blob: 241749ee3b6b7b08d26d36b328def7265284f8ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
EAPI=8

inherit cmake

DESCRIPTION="Attendant in C++: attendant (web and control), attendantd (AudioSocket) and attendant-text"
# USE=speech adds attendant-speech, the local speech engines (Parakeet speech to text, Kokoro
# text to speech) attendantd can use instead of whisper-server and Cartesia.
HOMEPAGE="https://trunkmasters.com/attendant"
SRC_URI="https://www.hedronfire.com/distfiles/${P}.tar.gz"

# The application carries no grant of an open-source license.
LICENSE="all-rights-reserved"
SLOT="0"
KEYWORDS="~amd64"
IUSE="speech"
RESTRICT="mirror bindist"

DEPEND="
	=dev-libs/boost-1.91.0*
	=dev-libs/openssl-3.6.5*
	=dev-db/postgresql-18.6*
	=dev-cpp/nlohmann_json-3.12.0*
	sys-libs/libxcrypt
	speech? (
		=sci-libs/onnxruntime-1.29.0*
		=app-accessibility/espeak-ng-1.52.0*
	)
"
# They run as the existing `attendant` account; attendant-rs mails the owner through sendmail and
# calls Anthropic's API, attendantd calls Cartesia and Deepgram, over HTTPS with the system trust
# store.
RDEPEND="${DEPEND}
	virtual/mta
	app-misc/ca-certificates
	speech? (
		net-misc/curl
		sci-ml/kokoro-82m-onnx
		sci-ml/parakeet-tdt-v2-onnx
	)
"
BDEPEND="
	=dev-cpp/catch-3.15.3*
"

src_configure() {
	# The project refuses in-source builds and requires an absolute build root.
	export ATTENDANT_BUILD_ROOT="${WORKDIR}/build"
	local mycmakeargs=( -DATTENDANT_SANITIZER=none -DATTENDANT_SPEECH=$(usex speech) )
	cmake_src_configure
}

src_test() {
	# The parity suites need root, PostgreSQL and the Rust reference binaries; they run outside
	# the Portage sandbox (README, "Build and test").
	cmake_src_test -R "^(unit|attendantd_unit$(usev speech '|speech_unit'))\$"
}

src_install() {
	cmake_src_install
	newinitd "${ED}"/usr/share/attendant/openrc/attendant.initd attendant
	newconfd "${ED}"/usr/share/attendant/openrc/attendant.confd attendant
	newinitd "${ED}"/usr/share/attendant/openrc/attendantd.initd attendantd
	newconfd "${ED}"/usr/share/attendant/openrc/attendantd.confd attendantd
	if use speech; then
		newinitd "${ED}"/usr/share/attendant/openrc/attendant-speech.initd attendant-speech
		newconfd "${ED}"/usr/share/attendant/openrc/attendant-speech.confd attendant-speech
	fi
}

pkg_postinst() {
	elog "attendant (attendant-rs until 0.3.0) runs as attendant on /run/attendant/http.socket and"
	elog "serves its pages from /srv/attendant/public (the source repository). Its settings are"
	elog "/etc/conf.d/attendant, with the ATTENDANT_RS_* names of attendant-rs's conf.d renamed"
	elog "ATTENDANT_* (the old names are still read when the new ones are unset)."
	elog "attendantd runs as attendant on 127.0.0.1:9093 and needs attendant. An existing"
	elog "/etc/init.d/attendantd and the conf.d files are kept (CONFIG_PROTECT)."
	if use speech; then
		elog "attendant-speech (USE=speech) serves Parakeet and Kokoro on 127.0.0.1:8125; it is not"
		elog "started or added to a runlevel by the package. attendantd uses it when a claim names"
		elog "the tts provider \"local\", or an stt provider whisper with the url http://127.0.0.1:8125."
	fi
	elog "0.4.1: the whisper provider's stt_config keys barge_in_frames and barge_in_resume (unset,"
	elog "attendantd stops a reply at the caller's first sound, as before) make the caller's speech"
	elog "hold a reply, and only words stop it; Kokoro says phone numbers and codes digit by digit."
	elog "0.4.2: a transfer asks Asterisk for the phone's DEVICE_STATE first (AMI Getvar, the AMI user"
	elog "needs call or reporting write); UNAVAILABLE, INVALID or BUSY keep the caller with the AI."
	elog "0.4.3: a transfer is said before the call moves: AMI Setvar of AI_TRANSFER_TO on the channel,"
	elog "attendantd hangs up after the answer, and [ai-switchboard] must go on to [ai-transfer] when"
	elog "AI_TRANSFER_TO is set (the dialplan before attendant 0.4.3; attendantd before attendant)."
	elog "0.4.4: no built-in ATTENDANT_OWNER_DID_DEFAULT (the number texts go from when a tenant has"
	elog "none). Set it in /etc/conf.d/attendant and /etc/conf.d/attendantd before restarting."
}