Official Mumble VoIP Forums

Set PTT with Terminal or Script

Ice/DBus, Web-Interfaces, Management tools
Hi,

is it possible to set the PTT and get the status if someone is talking for example on terminal or with script?

Background: We would like to connect two or more amateur radio repeaters.
We don't want to use VOX because there is too much delay and we have the possibility to get the information if someone is talking on the repeater.

If someone ist talking on repeater 1 I get a high level on gpio or rs232 and the mumble client should set the PTT and send the audio. On the other side repeater 2 see that someone is talking on mumble. So mumble should set a gpio to high and repeater 2 goes on air.

Thank you very much.

Stephan
Hi,

thank you to hacst who helped me to find a solution.

Stephan

Code: Select all

apt-get install build-essential pkg-config qt5-default libqt5svg5-dev \
                libboost-dev libasound2-dev libssl-dev \
                libspeechd-dev libzeroc-ice-dev libpulse-dev \
                libcap-dev libprotobuf-dev protobuf-compiler \
                libogg-dev libavahi-compat-libdnssd-dev libsndfile1-dev \
                libg15daemon-client-dev libxi-dev qttools5-dev-tools mesa-common-dev


on raspberry pi2 i had to extend the swap file

Code: Select all

sudo su -c 'echo "CONF_SWAPSIZE=2048" > /etc/dphys-swapfile'
sudo dphys-swapfile setup
sudo dphys-swapfile swapon
get mumble source

Code: Select all

git clone https://github.com/mumble-voip/mumble.git
git submodule init
git submodule update
add this line in main.pro

Code: Select all

LIBS = -lwiringPi -lwiringPiDev
new public slot in MainWindow.h
add it in public slots:

Code: Select all

void onGpioPoll();
MainWindow.cpp

Code: Select all

#include <wiringPi.h>
MainWindow.cpp

Code: Select all

void MainWindow::onGpioPoll() {

 static bool pttGpioPrevState = false;
 static bool pttGpioState = false;
 if (digitalRead(25)==1) {
        pttGpioState=true;
 }

if (digitalRead(25)==0) {
        pttGpioState=false;
 }

if (pttGpioState != pttGpioPrevState) {
   on_PushToTalk_triggered(pttGpioState, QVariant());
   pttGpioPrevState = pttGpioState;
 }

 QList<ClientUser *> talkingUsers = ClientUser::getTalking();
 // For someone else to be talking we have to be connected to the
 //server and there must be at least one person talking that isn't ourselves
 static bool pttPrev = false; 
 const bool someoneElseTalking = g.sh && !(talkingUsers.empty() ||
 (talkingUsers.size() == 1 && g.uiSession ==
 talkingUsers.first()->uiSession));

 if (someoneElseTalking) {
        if(!pttPrev){
                digitalWrite(10, 1);
                pttPrev=true;
        }
 }

if(!someoneElseTalking){
        if (pttPrev){
                digitalWrite(10, 0);
                pttPrev=false;
         }
}

}
add the following in MainWindow.cpp in MainWindow::MainWindow(QWidget *p)

Code: Select all

   
QTimer *gpioPollingTimer = new QTimer(this);
connect(gpioPollingTimer, SIGNAL(timeout()), this, SLOT(onGpioPoll()));
gpioPollingTimer->start(100); // 100ms polling Intervall
main.cpp

Code: Select all

#include <wiringPi.h>
main.cpp in the int main(int argc, char **argv) function

Code: Select all

wiringPiSetupSys();
pinMode(10,OUTPUT);
pinMode(25,INPUT);

Compiling from mumble directory

Code: Select all

qmake -recursive main.pro CONFIG+="no-g15 no-server" LIBS+="-lwiringPi"
make
you also need a small shell scrip to set gpio pins.
this worked for me:

create file gpio.sh

Code: Select all


#!/bin/sh
echo "10" > /sys/class/gpio/export
echo "25" > /sys/class/gpio/export
echo "in" > /sys/class/gpio/gpio25/direction
echo "out" > /sys/class/gpio/gpio10/direction
chmod 666 /sys/class/gpio/gpio10/value
chown pi /sys/class/gpio/gpio25/value
chmod 666 /sys/class/gpio/gpio10/direction
chown pi /sys/class/gpio/gpio25/direction
I start the script in /etc/rc.local automatically.
Otherwise you have to start it manually as root after every reboot

sudo ./gpio.sh


Please see to find the correct gpio pin.
http://raspberrypiguide.de/howtos/raspb ... io-how-to/

It is GPIO10 and GPIO25 or Wiring 12 and Wiring 6.

73
Stephan, DL4STE
Hello, did the code work?? do you have it compiled? how i can get a copy of it? i would like to try on a radio-LINK

thanks
Yes it is working. We use it on the 2m repeater DB0FFL
I have a compiled version for Raspberry 2.

Stephan, DL4STE
Stephan, can you give me some clues on this?? i have a little knowledge about linux and C++, tell me if i'm right, do you built the environment to compile mumble? then you modified the files MainWindow.cpp MainWindow.h and main.cpp and after that did you compile the code? let me know if you can share the modified files and help me compiling under Pi 2.

thanks
Another question, on the INPUT pin what do you connect? i can see that the OUTPUT is to activate the TX on the repeaters but i don't know if using only for radio link i need to take out from the code.
I did the following steps

you need to install some development packages:

Code: Select all

apt-get install build-essential pkg-config qt4-dev-tools libqt4-dev libspeex1 \
                libspeex-dev libboost-dev libasound2-dev libssl-dev g++ \
                libspeechd-dev libzeroc-ice-dev ice-slice libpulse-dev slice2cpp \
                libcap-dev libspeexdsp-dev libprotobuf-dev protobuf-compiler \
                libogg-dev libavahi-compat-libdnssd-dev libsndfile1-dev \
                libg15daemon-client-dev libxi-dev 
for more information please see http://wiki.mumble.info/wiki/BuildingLinux

Code: Select all

git clone https://github.com/mumble-voip/mumble.git
you have to edit the source files as shown above.

on the raspberry 2 I compiled with the following commands

Code: Select all

qmake -recursive main.pro CONFIG+="qt4-legacy-compat no-g15 no-server" LIBS+="-lwiringPi"
make
If you have any further questions don't hesitate to contact me.

The solution is great. We have many users on the repeater with mumble. Our next step is to connect two or more repeater.
Nice, i will try!! just another question, the INPUT PIN 25 where it goes?? i know the output is for put the repeater on TX and send the audio but the input pin? i don't get it. thanks
With the input pin you can set the mumble PTT in direction repeater receiver to mumble.
You do not have to use the mumble vox. So you can reduce the delay.
Hello,

I have post the same question few month ago.

I complete the request if someone feels the soul to develop.

In the left column we would like to add a section "radio bridge".

1. generality

In this section on the right window, you can enable or disable the PTT feature.

If enabled, you must be able to choose between a GPIO for raspberry or Send a message to a COM port or a sinusoidal signal on the left or right channel of the sound card.


2. How to PTT

For the GPIO should be able to choose the number of GPIO.

For the COM port should be selected COM port and send the message for transmission of activation and the message to stop transmission.

For sinusoidal no particular things set apart which will be sent to the maximum level that can go out the sound card (1v ridge to ridge).


3. Secondary functions


a) TOT
Then we should have a TOT function (stop talker) which limits the time the relay is transmitting.


b) delays
There should be minimal delay before activating the transmission, to avoid tripping intenpestifs (value set in the window, but by default 500ms).

Finally, it should have a minimum time after the end of discution that the relay does not stop intenpestivement (value set in the window, but by default 500ms).


Thank you in advance if the soul of a friendly developer wants to contribute to our efforts.
Several team of amateur radio or CB enthusiasts create parallel communication networks thanks to that, but we do not have enough developers.