Jump to content
Mumble forums

Set PTT with Terminal or Script


stephensworld
 Share

Recommended Posts

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

Link to comment
Share on other sites

  • 2 weeks later...

Hi,


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


Stephan

 

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

 

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

 

get mumble source

git clone https://github.com/mumble-voip/mumble.git
git submodule init
git submodule update

 

add this line in main.pro

LIBS = -lwiringPi -lwiringPiDev

 

new public slot in MainWindow.h

add it in public slots:

void onGpioPoll();

 

MainWindow.cpp

#include <wiringPi.h>

 

MainWindow.cpp

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)

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

 

main.cpp

#include <wiringPi.h>

 

main.cpp in the int main(int argc, char **argv) function

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

 


Compiling from mumble directory

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


#!/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/raspberry-pi-gpio-how-to/


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


73

Stephan, DL4STE

Edited by stephensworld
Link to comment
Share on other sites

  • 1 month later...

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

Link to comment
Share on other sites

I did the following steps


you need to install some development packages:

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

 

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

 

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.

Edited by stephensworld
Link to comment
Share on other sites

  • 1 month later...

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.

Link to comment
Share on other sites

  • 1 month later...

Could I contact you for some private conversations about your work?

 

I did the following steps


you need to install some development packages:

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

 

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

 

qmake -recursive main.pro CONFIG+="qt4-legacy-compat no-g15 no-server"
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.

Grandp-G

Here from the beginning.

Link to comment
Share on other sites

  • 1 month later...
  • 10 months later...

Can you past your MainWindow.cpp on pastebin?

I'm having trouble with where to put

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

did you have to edit the UI and add a timer in?

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...

Good day,


I found this topic while searching for information for my project.

'stephensworld' finished the issue where i was looking for.

I turned my Raspberry into an programming environment as described here.

I can't get the job done because i think I'm missing some information about editing the source files.

When i start compiling, there are errors.

Perhaps it has to to with versions because this topic is 1.5 years old, or I'm doing something wrong with the editing part of the source files. I'm not a programmer so i just follow the steps written by 'stephensworld'.

I did not succeed. Can someone rewrite the steps so it will match with the current software versions?

Otherwise is there an option to get a compiled version of Mumble client for Raspberry (with PTT signaling on GPIO interface).


Best regards,

Alex

Link to comment
Share on other sites

Hi,

Is it possible someone with knowledge rewrites this handout?

It is not clear where to made the changes exactly (right place in source). When i try to compile i get much errors.

I'm not a programmer so i can just follow the steps written by 'Stephensworld'.

This post is 1,5 years old so i think it is not usable for current versions of mumble. Is it?

I hope someone can help to make a Mumble PTT radio (GPIO port signal) for Rasbian (Pi2 and 3)

Perhaps there is a compiled version available somewhere. One i can install on Raspbery Pi2/3.


Best regards,

Alex

Link to comment
Share on other sites

Mine is a bit different on the the functions but here is some code blocks you can find to get it working

MainWindow.cpp

void MainWindow::setupGui()  {
updateWindowTitle();
setCentralWidget(qtvUsers);
setAcceptDrops(true);
QTimer *gpioPollingTimer = new QTimer(this);
connect(gpioPollingTimer, SIGNAL(timeout()), this, SLOT(onGpioPoll()));
gpioPollingTimer->start(100); // 100ms polling Intervall

void MainWindow::destroyUserInformation() {
UserInformation *ui = static_cast<UserInformation *>(sender());
QMap<unsigned int, UserInformation *>::iterator i;
for (i=qmUserInformations.begin(); i != qmUserInformations.end(); ++i) {
	if (i.value() == ui) {
		qmUserInformations.erase(i);
		return;
	}
}
}
void MainWindow::onGpioPoll() {

static bool pttGpioPrevState = false;
static bool pttGpioState = false;

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){
               system("echo 1 > /tty/pttctrl");
               pttPrev=true;
       }
}

if(!someoneElseTalking){
       if (pttPrev){
               system("echo 0 > /tty/pttctrl");
               pttPrev=false;
        }
}

}

Link to comment
Share on other sites

Thank you very much Hamie,


Can you tell me something about 'main.cpp'?

Where to place these parts exactly?


#include

.....

wiringPiSetupSys();

pinMode(10,OUTPUT);

pinMode(25,INPUT);


In the source, #include statements are between " " instead of < >

Link to comment
Share on other sites

I want to run the Mumble client (with PTT signaling) on a Raspberry Pi3 (or a Pi2, if a Pi3 is not supported yet)

@Hamie, do you have it working on a Pi3?

Do you have a working image i can get?

I'm afraid i will not succeed because all the information i can find to do the job is outdated.

Mumble has renewed a few times and all the (PTT) modifications i can find are more then 2 years old.

I'm not a programmer, just a technician so i hope someone can help me to accomplish.

At this moment i'm stranded with errors while compiling. I don't know where to place the code of my previous message. I get errors like this:

main.cpp:46:9: error: expected constructor, destructor, or type conversion before ‘(’ token pinMode (10,OUTPUT);

Link to comment
Share on other sites

  • 4 weeks later...

Hi,


I think it also works with the latest source from github.


I had to install:

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

 

Compiling with qt5 instead if qt4

qmake -recursive main.pro CONFIG+="no-g15 no-server" LIBS+="-lwiringPi"
make

 

Here you can find the edited source code with ptt including a binary in mumble/releases

http://ul.to/mk59svl0



Here you can find only a binary with ptt mod

http://ul.to/11ybvumz


If you use the binary you should install mumble with apt-get install mumble.

So you should have all dependencies.


Stephan

Link to comment
Share on other sites

  • 8 months later...
If you have any problems. Please contact me.

Skype dl4ste

Hello Stephensworld, i send a mp with more details to your skype acount, i already put your hack in a clone github, but i cant compile it for rpi3b and the actual version from this topic have problems with raspbian strech recently updated (lib modules).


This is the github, can any compile it? Already have the hacks for io pins.


https://github.com/hostfer/mumbleptt

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...