grwlf / asterisk-dongle-setup Goto Github PK
View Code? Open in Web Editor NEWPlayground project aimed at setting up Asterisk server and the GSM stack on Nix.
Playground project aimed at setting up Asterisk server and the GSM stack on Nix.
Hope this saves you an hour or two:
Nix install:
Use non-root user, sudo must be installed.
sh <(curl -L https://nixos.org/nix/install) --daemon
Note: ./run.sh doesnt need sudo in the command
I am running ./run.sh as my non-root user and I am getting the following error:
+ nix-build -A asterisk -o result-asterisk -K
/nix/store/yka01vcbdipz864lrnbyp2bl9bk5w7ag-asterisk+opus-16.19.1
+ nix-build -A asterisk-conf -o result-conf
/nix/store/yrxylb2f8jafp1yycln1q8wg0d33q1ks-asterisk-conf
+ nix-build -A python-scripts -o result-python
/nix/store/041r220sp8pfiv9i0pmymyg0j845zd8q-python-scripts-1.0
+ nix-build -A tg2sip -o result-tg2sip
these 2 derivations will be built:
/nix/store/x8zg1gvjk1fa96v8klc39db7q8z1qaxl-pjsip+opus-2.9.drv
/nix/store/zh3nyjcyj6vdrixd0cf9nkbr4fj9gbfj-tg2sip.drv
building '/nix/store/x8zg1gvjk1fa96v8klc39db7q8z1qaxl-pjsip+opus-2.9.drv'...
unpacking sources
unpacking source archive /nix/store/yhyr53nwzh014h8aw1ickmpsvxiidm3a-source
source root is source
patching sources
applying patch /nix/store/s7rbydn67vcsmqkqz87g873g1p2jrhx8-fix-aarch64.patch
patching file aconfigure
Hunk #1 FAILED at 9174.
1 out of 1 hunk FAILED -- saving rejects to file aconfigure.rej
error: builder for '/nix/store/x8zg1gvjk1fa96v8klc39db7q8z1qaxl-pjsip+opus-2.9.drv' failed with exit code 1;
last 8 log lines:
> unpacking sources
> unpacking source archive /nix/store/yhyr53nwzh014h8aw1ickmpsvxiidm3a-source
> source root is source
> patching sources
> applying patch /nix/store/s7rbydn67vcsmqkqz87g873g1p2jrhx8-fix-aarch64.patch
> patching file aconfigure
> Hunk #1 FAILED at 9174.
> 1 out of 1 hunk FAILED -- saving rejects to file aconfigure.rej
For full logs, run 'nix log /nix/store/x8zg1gvjk1fa96v8klc39db7q8z1qaxl-pjsip+opus-2.9.drv'.
error: 1 dependencies of derivation '/nix/store/zh3nyjcyj6vdrixd0cf9nkbr4fj9gbfj-tg2sip.drv' failed to build
Any help would be appreciated
As part of the compiling I found the following issues:
Folder required to be created: asterisk-dongle-setup/app/robot2
File needs to be renamed: asterisk-dongle-setup/python/ari_test2.py --> asterisk-dongle-setup/python/ari_test.py
Also I had to bump up the ram to 4Gb and created a swap file:
dd if=/dev/zero of=/swapfile1 bs=1024 count=1048576
chown root:root /swapfile1
chmod 0600 /swapfile1
mkswap /swapfile1
swapon /swapfile1
// Edit fstab file
nano /etc/fstab
//Append the following line at the end of file
/swapfile1 none swap sw 0 0
// Check the swap is ready or not
free -m
I am see I am almost there...
When I execute ./run.sh I get an error: "TDLib api settings must be set!"
But I have no idea where what should be. Also "<WS Waiting for socket" repeats, I dont know what the next steps should be
admin@srv-Lit-01:/srv/asterisk-dongle-setup$ ./run.sh
+ nix-build -A sox -o result-sox
/nix/store/w0cakvp7c5mnl3a7fkq7qf8fwf5xgq2a-sox-14.4.2
+ readlink ./result-sox
+ export PATH=/nix/store/w0cakvp7c5mnl3a7fkq7qf8fwf5xgq2a-sox-14.4.2/bin/:/home/admin/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
+ sox --version
sox: SoX v14.4.2
+ nix-build -A asterisk -o result-asterisk -K
/nix/store/yka01vcbdipz864lrnbyp2bl9bk5w7ag-asterisk+opus-16.19.1
+ nix-build -A asterisk-conf -o result-conf
/nix/store/yrxylb2f8jafp1yycln1q8wg0d33q1ks-asterisk-conf
+ nix-build -A python-scripts -o result-python
/nix/store/041r220sp8pfiv9i0pmymyg0j845zd8q-python-scripts-1.0
+ nix-build -A tg2sip -o result-tg2sip
/nix/store/af20qkclgjpjn796yf4zr1npd04ggba8-tg2sip
+ nix-build -A dongle-monitor -o result-dongle-monitor
/nix/store/r697fjcj83cyygvd7bqq1d72zwv3qfx2-dongle-monitor
+ /srv/asterisk-dongle-setup/result-python/bin/telegram_check.py
+ /srv/asterisk-dongle-setup/result-dongle-monitor/bin/dongle-monitor
Going to standby mode
[DEBUG/2022-01-11 13:48:53,889] asyncio: Using selector: EpollSelector
[ INFO/2022-01-11 13:48:53,959] telethon.network.mtprotosender: Connecting to 149.154.175.59:443/TcpFull...
[DEBUG/2022-01-11 13:48:53,960] telethon.network.mtprotosender: Connection attempt 1...
[DEBUG/2022-01-11 13:48:54,281] telethon.network.mtprotosender: Connection success!
[DEBUG/2022-01-11 13:48:54,281] telethon.network.mtprotosender: Starting send loop
[DEBUG/2022-01-11 13:48:54,281] telethon.network.mtprotosender: Starting receive loop
[ INFO/2022-01-11 13:48:54,281] telethon.network.mtprotosender: Connection to 149.154.175.59:443/TcpFull complete!
[DEBUG/2022-01-11 13:48:54,318] telethon.network.mtprotosender: Waiting for messages to send...
[DEBUG/2022-01-11 13:48:54,318] telethon.extensions.messagepacker: Assigned msg_id = [REDACTED] to InvokeWithLayerRequest (7fb135016850)
[DEBUG/2022-01-11 13:48:54,318] telethon.network.mtprotosender: Encrypting 1 message(s) in 80 bytes for sending
[DEBUG/2022-01-11 13:48:54,319] telethon.network.mtprotosender: Encrypted messages put in a queue to be sent
[DEBUG/2022-01-11 13:48:54,319] telethon.network.mtprotosender: Waiting for messages to send...
[DEBUG/2022-01-11 13:48:54,319] telethon.network.mtprotosender: Receiving items from the network...
[DEBUG/2022-01-11 13:48:54,640] telethon.network.mtprotosender: Handling bad salt for message [REDACTED]
[DEBUG/2022-01-11 13:48:54,640] telethon.network.mtprotosender: 1 message(s) will be resent
[DEBUG/2022-01-11 13:48:54,640] telethon.network.mtprotosender: Receiving items from the network...
[DEBUG/2022-01-11 13:48:54,640] telethon.extensions.messagepacker: Assigned msg_id = [REDACTED] to InvokeWithLayerRequest (7fb135016850)
[DEBUG/2022-01-11 13:48:54,641] telethon.network.mtprotosender: Encrypting 1 message(s) in 80 bytes for sending
[DEBUG/2022-01-11 13:48:54,641] telethon.network.mtprotosender: Encrypted messages put in a queue to be sent
[DEBUG/2022-01-11 13:48:54,641] telethon.network.mtprotosender: Waiting for messages to send...
[DEBUG/2022-01-11 13:48:54,641] telethon.extensions.messagepacker: Assigned msg_id = [REDACTED] to MsgsAck (7fb135016970)
[DEBUG/2022-01-11 13:48:54,641] telethon.network.mtprotosender: Encrypting 1 message(s) in 36 bytes for sending
[DEBUG/2022-01-11 13:48:54,641] telethon.network.mtprotosender: Encrypted messages put in a queue to be sent
[DEBUG/2022-01-11 13:48:54,641] telethon.network.mtprotosender: Waiting for messages to send...
[DEBUG/2022-01-11 13:48:54,961] telethon.network.mtprotosender: Handling container
[DEBUG/2022-01-11 13:48:54,961] telethon.network.mtprotosender: Handling new session created
[DEBUG/2022-01-11 13:48:54,962] telethon.network.mtprotosender: Handling acknowledge for [[REDACTED]]
[DEBUG/2022-01-11 13:48:54,962] telethon.network.mtprotosender: Receiving items from the network...
[DEBUG/2022-01-11 13:48:54,968] telethon.network.mtprotosender: Handling RPC result for message [REDACTED]
[DEBUG/2022-01-11 13:48:54,969] telethon.network.mtprotosender: Receiving items from the network...
[DEBUG/2022-01-11 13:48:54,969] telethon.extensions.messagepacker: Assigned msg_id = [REDACTED] to GetUsersRequest (7fb135016850)
[DEBUG/2022-01-11 13:48:54,970] telethon.network.mtprotosender: Encrypting 1 message(s) in 32 bytes for sending
[DEBUG/2022-01-11 13:48:54,970] telethon.network.mtprotosender: Encrypted messages put in a queue to be sent
[DEBUG/2022-01-11 13:48:54,970] telethon.network.mtprotosender: Waiting for messages to send...
[DEBUG/2022-01-11 13:48:54,970] telethon.extensions.messagepacker: Assigned msg_id = [REDACTED] to MsgsAck (7fb135016ca0)
[DEBUG/2022-01-11 13:48:54,970] telethon.network.mtprotosender: Encrypting 1 message(s) in 60 bytes for sending
[DEBUG/2022-01-11 13:48:54,970] telethon.network.mtprotosender: Encrypted messages put in a queue to be sent
[DEBUG/2022-01-11 13:48:54,970] telethon.network.mtprotosender: Waiting for messages to send...
[DEBUG/2022-01-11 13:48:55,305] telethon.network.mtprotosender: Handling RPC result for message [REDACTED]
[DEBUG/2022-01-11 13:48:55,305] telethon.network.mtprotosender: Receiving items from the network...
[DEBUG/2022-01-11 13:48:55,306] telethon.extensions.messagepacker: Assigned msg_id = [REDACTED] to GetDialogsRequest (7fb134fb00a0)
[DEBUG/2022-01-11 13:48:55,306] telethon.network.mtprotosender: Encrypting 1 message(s) in 48 bytes for sending
[DEBUG/2022-01-11 13:48:55,306] telethon.network.mtprotosender: Encrypted messages put in a queue to be sent
[DEBUG/2022-01-11 13:48:55,306] telethon.network.mtprotosender: Waiting for messages to send...
[DEBUG/2022-01-11 13:48:55,306] telethon.extensions.messagepacker: Assigned msg_id = [REDACTED] to MsgsAck (7fb135016c10)
[DEBUG/2022-01-11 13:48:55,306] telethon.network.mtprotosender: Encrypting 1 message(s) in 36 bytes for sending
[DEBUG/2022-01-11 13:48:55,307] telethon.network.mtprotosender: Encrypted messages put in a queue to be sent
[DEBUG/2022-01-11 13:48:55,307] telethon.network.mtprotosender: Waiting for messages to send...
[DEBUG/2022-01-11 13:48:55,662] telethon.network.mtprotosender: Handling RPC result for message [REDACTED]
[DEBUG/2022-01-11 13:48:55,664] telethon.network.mtprotosender: Receiving items from the network...
Dialogs
-1001109067682: Chch Reddit Group
[TELEGRAM channel Info REDACTED]
OK
+ /srv/asterisk-dongle-setup/result-python/bin/dongleman_daemon.py --check
Asterisk-dongleman-daemon script syntax OK
+ /srv/asterisk-dongle-setup/result-python/bin/dongleman_spool.py
+ mkdir /tmp/tg2sip
+ true
+ /srv/asterisk-dongle-setup/result-python/bin/dongleman_daemon.py
+ cp -f /srv/asterisk-dongle-setup/result-tg2sip-conf/etc/settings.ini /tmp/tg2sip/settings.ini
+ cd /tmp/tg2sip
+ /srv/asterisk-dongle-setup/result-tg2sip/bin/gen_db
TDLib api settings must be set!
�]0;admin@srv-Lit-01: /srv/asterisk-dongle-setup�admin@srv-Lit-01:/srv/asterisk-dongle-setup$ Starting dongleman_daemon
<WS Waiting for socket
<WS Waiting for socket
<WS Waiting for socket
<WS Waiting for socket
<WS Waiting for socket
Hello,
I faced with problem that after around in 12hours of idling the dongleman_daemon is hangs and didn't anything until restart daemon. Is it just me or someone else having this problem?
Thank for any advice to help fix this
While compiling tg2sip-conf I get the following error:
admin@srv-Lit-01:/srv/asterisk-dongle-setup$ nix-build -A tg2sip-conf -o result-tg2sip-conf --show-trace
error: 7129136
… while evaluating the attribute 'text' of the derivation 'settings.ini'
at /nix/store/in6ppv9g7zzlziw87b7ajwl07pifairi-nixpkgs-22.05pre344305.32356ce11b8/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:205:7:
204| // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
205| name =
| ^
206| let
Full verbose output log
https://pastebin.com/xQjyvkEd
I dont know this language but looks like the variable is left open
I found there were a couple of missing secrets that are required for the compiling:
What should they contain please?
After everything is compiled, I got an error about saying the Dongleman "Message pool should be a valid directory, got /tmp/dongleman/spool"
/nix/store/041r220sp8pfiv9i0pmymyg0j845zd8q-python-scripts-1.0/bin/.dongleman_daemon.py-wrapped
line 25: SPOOL="/tmp/dongleman/spool"
line 26: assert isspool(SPOOL), f"Message pool should be a valid directory, got {SPOOL}"
I confirmed that the folder /tmp/dongleman/spool existed, after going through the python module (asterisk-dongle-setup/python/lib/dongleman/spool.py), I could see that the python module is already assuming that the /tmp/.
So I commented out line 26 and dealt with the errors:
It wanted the following directories:
sudo mkdir -p '/tmp/dongleman/spool/tmp'
sudo mkdir -p '/tmp/dongleman/spool/queue'
sudo mkdir -p '/tmp/dongleman/spool/attaches'
I hope that that workaround is correct
Faced the error during installation on Raspbian 10 (RaspberryPi 3B+) and didn't find any solution. Here are my steps:
At first I installed nix for ARMv7 from https://hydra.nixos.org/job/nix/master/binaryTarballCross.x86_64-linux.armv7l-linux (tried different version).
Then run installation of asterisk-dongle and got the error:
unpacking source archive /nix/store/mcayf992diwks293vs12iwx1ywgm4ijg-m4-1.4.19.tar.bz2
source root is m4-1.4.19
setting SOURCE_DATE_EPOCH to timestamp 1622228112 of file m4-1.4.19/ChangeLog
patching sources
configuring
configure flags: --disable-dependency-tracking --prefix=/nix/store/zmbbkgnfphpbkiqqmnyzy0vhbqlfc9ra-gnum4-1.4.19 --with-syscmd-shell=/nix/store/cvzil995dqk628n017d02s1zaa6fjh4i-bootstrap-tools/bin/bash
/nix/store/fxppfqrv0vdqqjcilki0ghz177ws2fq5-bootstrap-stage1-stdenv-linux/setup: ./configure: /bin/sh: bad interpreter: No such file or directory
error: builder for '/nix/store/40ay0h3g6r886xrpiplpad760c7h3mnn-gnum4-1.4.19.drv' failed with exit code 126;
last 8 log lines:
> unpacking sources
> unpacking source archive /nix/store/mcayf992diwks293vs12iwx1ywgm4ijg-m4-1.4.19.tar.bz2
> source root is m4-1.4.19
> setting SOURCE_DATE_EPOCH to timestamp 1622228112 of file m4-1.4.19/ChangeLog
> patching sources
> configuring
> configure flags: --disable-dependency-tracking --prefix=/nix/store/zmbbkgnfphpbkiqqmnyzy0vhbqlfc9ra-gnum4-1.4.19 --with-syscmd-shell=/nix/store/cvzil995dqk628n017d02s1zaa6fjh4i-bootstrap-tools/bin/bash
> /nix/store/fxppfqrv0vdqqjcilki0ghz177ws2fq5-bootstrap-stage1-stdenv-linux/setup: ./configure: /bin/sh: bad interpreter: No such file or directory
For full logs, run 'nix log /nix/store/40ay0h3g6r886xrpiplpad760c7h3mnn-gnum4-1.4.19.drv'.
error: 1 dependencies of derivation '/nix/store/g4kbw6bv96mgarbcfqgygq1c0qzxpcr7-autoconf-2.71.drv' failed to build
error: 1 dependencies of derivation '/nix/store/jlhr0jvqvva77mh5hryxqiqn6i58wxvz-autoconf-2.71.drv' failed to build
error: 1 dependencies of derivation '/nix/store/9jvcb43h8plk45pgxfq08lhgghl1fwlz-bison-3.8.2.drv' failed to build
error: 1 dependencies of derivation '/nix/store/rmbvwvva01f3n441p25j8c2fbp54p2zd-gmp-with-cxx-6.2.1.drv' failed to build
error: 1 dependencies of derivation '/nix/store/24gil06rwgm2biij6lw45cqa1rrgvg01-bash-5.1-p16.drv' failed to build
error: 1 dependencies of derivation '/nix/store/bzarwkcy8mkzg2il85ml5w5q0xkkxdg9-bash-5.1-p16.drv' failed to build
error: 1 dependencies of derivation '/nix/store/9ps2925c2fsky80222i38v8qh50y92dw-binutils-2.38.drv' failed to build
error: 1 dependencies of derivation '/nix/store/rrdjfvfy5qc47s755a257w0xsj0105j5-binutils-2.38.drv' failed to build
error: 1 dependencies of derivation '/nix/store/cjm4dz0gvfn5608yij773s259asd4hb6-coreutils-9.1.drv' failed to build
error: 1 dependencies of derivation '/nix/store/x7jrij8bhwa37zbgpcvzsq1q4a4n16ys-gcc-10.3.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/a76636d85xw27y035jb0ii13caxssj3a-gfortran-10.3.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ixv6frfd7j436cps70aavafpqzz6jy4r-glibc-2.34-210.drv' failed to build
error: 1 dependencies of derivation '/nix/store/4b8xyvazkv1p3g0hzgc75jppg5q8jk50-hook.drv' failed to build
building '/nix/store/3cyivbmiz5qsq7hj6a4vpw5hj1wn2bgg-zlib-1.2.12.drv'...
error: 1 dependencies of derivation '/nix/store/w1z9ml11mdv2pmmzn02p61nl506nli91-sox-unstable-2021-05-09.drv' failed to build
Did anyone solve this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.