USB to TTL Serial Adapter <> Asterisk 20.8.1?

Hi Guy’s,

Completely new to Asterisk and only have a very basic grasp of how its working based on watching throughput of the CLI and reading some VERY long help files :smile:

What I am trying to do may not even be possible so this may well be a VERY short thread.

In short Asterisk is running as part of a package that controls channel selection via DTMF tones to an RF Device connected to a Raspberry Pi4 running the package including Asterisk.

I am wondering if I can send the commands direct to asterisk using a touch screen (Nextion) connected to the same Raspberry Pi via a USB to TTL Serial Adapter? I have created many Nextion screens in the past so I am happy with that side of the process but no idea if this is even possible with Asterisk.
Thanks

You’'d need to send them to the driver for the RF device, not to Asterisk.

Whilst you could probably get Asterisk to call itself, and send DTMF tones, based on CLI commands, the whole arrangement would be very contorted.

1 Like

Thanks David, but I have not explained it very well.
Okay so what ‘normally’ happens is an rf transmitter sends DTMF tones to a close by RF receiver, that RF receiver is hard wired to the USB ports of a raspberry pi running Python.
The RF Receiver having received the DTMF tomes interprets them as anything from 0 to 9, A,B,C,D or *. It then passes what it received to the raspberry pi package (which includes asterisk) which in turn uses it’s internet link to connect to a similar system anywhere in the world, also linked to the internet.
So for example, my system has the unique ID 12345. I send 23456 via dumf and so my system links to the other system with the unique code 23456.
If I use my computer to ssh into my raspberry pi using <pi IP Address : 12345>, I can use commands from my computer desktop to connect to 23456 without any DTMF tones being sent from my RF Transmitter.
So what I am wondering is if I can do a similar thing by using a Nextion TFT screen linked to the pi via ttyUSB0 rather than using a computer and a ssh connection.

On Wednesday 10 July 2024 at 12:08:32, iCoder via Asterisk Community wrote:

Okay so what ‘normally’ happens is an rf transmitter sends DTMF tones to a
close by RF receiver, that RF receiver is hard wired to the USB ports of a
raspberry pi running Python. The RF Receiver having received the DTMF
tomes interprets them as anything from 0 to 9, A,B,C,D or *. It then
passes what it received to the raspberry pi package (which includes
asterisk) which in turn uses it’s internet link to connect to a similar
system anywhere in the world, also linked to the internet.

It is not at all clear to me from the above description what Asterisk is
actually doing in this setup.

If I use my computer to ssh into my raspberry pi using <pi IP Address :
12345>, I can use commands from my computer desktop to connect to 23456
without any DTMF tones being sent from my RF Transmitter.

Okay, so the DTMF part of the question seems irrelevant…?

So what I am wondering is if I can do a similar thing by using a Nextion TFT
screen linked to the pi via ttyUSB0 rather than using a computer and a ssh
connection.

I suspect that the answer is yes, but this really does not seem like an
Asterisk question now.

Antony.


The Electronic Frontier Foundation was founded this day in 1990.

                                               Please reply to the list;
                                                     please *don't* CC me.

I think, even with the replacement for init, it is possible to have system startup run an arbitrary program on as serial line. However this is a LInux question, not an Asterisk one.

If you’re wanting to let you change something like Allstar nodes from a display; you can directly do that from command line. You don’t need to worry about how the RF module does it. You just need to have your display gather the number and then pipe it to command line.

1 Like

I have been following your suggested line of ‘attack’ for the past couple of days. I can certainly get my display to send data to the pi via ttyUSB0 and I can monitor that data using ‘screen’ but obviously ‘screen /dev/ttyUSB0’ is just a dumb terminal and doesn’t actually pipe it to the command line. Is there a feature within asterisk that I can explore that will allow the Asterisk CLI to monitor input from a port?

This is just standard input and output redirection in Linux, and nothing really to do with Asterisk. Something like:

/usr/sbin/asterisk -r </dev/ttyUSB0 >/dev/ttyUBS0 2>&1 would be pretty close

This can be run from inittab, or its modern equivalents, so it is automatically started at the same time as login is started. It’s probably better to run it through agetty, though.

I think the standard startup script for Asterisk actually attaches it to /dev/tty9, in console mode, so you might tweak it to use your serial line, instead.

If starting this from another terminal, you will probably have to use setsid to break the connection with that originating terminal. When started by start up scripts, there is no initial controlling terminal.

1 Like