FGCom (before 3.0)

From FlightGear wiki
Revision as of 08:22, 4 November 2008 by Codeman (talk | contribs) (Added server installation)
Jump to navigation Jump to search
Cleanup.png This article may require cleanup to meet the quality standards of the wiki. Please improve this article if you can.

FGCom is an addon for FlightGear. With FGCom (and the infrastructure behind), FlightGear gets a realtime voice communication system which could be used for ATC. The current version of fgcom is airport based - that means radio frequencies are based towards the location of the tower. Further version will fix this for a more realistic radio implementation (see Development)

Status

  • 31 October, 2008:

The latest SVN release at this time is the r149 which does not compile due to a constant that is not defined (STL_STRING). Such constant appears at line 57 in the file src/fgcom_init.cpp which is: #include STL_STRING

I guess that such constant must point to the STL library include file but I am not sure. I revert to the r148 SVN version which successfully compiles.

Command to get such version is: svn co -r148 svn://svn.dfn.de:/fgcom/trunk fgcom-r148

  • 19 June, 2008: Currently the server is down due to hardware problems. It is unknown when the service comes back becuase he currently has no time to fix the problems.
  • 22 November 2007: Due to heavy development at this time there may be some differences between the information on the web pages and the installation. Please follow the discussions on the FlightGear development list!

Client installation

Before you start, make sure that your speakers and mic are working and tested to sensible volumes.

Linux

Fetch FGCom (a copy of a working iaxclient is inside)

svn checkout svn://svn.dfn.de:/fgcom/trunk fgcom

Optional: edit iaxclient/lib/Makefile

To use oss emulation (recommended and the default for now)

USE_PA_OSS=1
USE_PA_ALSA=0
USE_PA_JACK=0
AUDIO_ALSA=0

To use native alsa (WARNING: PTT won't work)

USE_PA_OSS=0
USE_PA_ALSA=0
USE_PA_JACK=0
AUDIO_ALSA=1

To use portaudio alsa (WARNING: only if your card natively supports 8000Hz sample rate)

USE_PA_OSS=0
USE_PA_ALSA=1
USE_PA_JACK=0
AUDIO_ALSA=0

Edit fgcom/src/Makefile and check the pathes for PLIB_PREFIX and OPENAL_PREFIX.

Compile iaxclient and fgcom. To do so, do the following:

cd fgcom/src && make

Install

make install

and you should be ready for a quick test...

Using

Testing

quick test

   $ fgcom -f910      

will give the following output--

fgcom - a communication radio based on VoIP with IAX/Asterisk

(c)2007 by H. Wirtz <wirtz@dfn.de>

Version 1.1.0 build 42

Using iaxclient library Version SVN 42

Reading list of airports...done.

Initializing IAX client as guest:xxxxxxxxxxx@fgcom1.parasitstudio.de

Call 0 accepted

Echo-Box

Call 0 answered

speak into the mic and your words will be echoed back with a short delay.

type ctrl-C to exit this test

Configuration

Or if it didn't work perfectly first time

   fgcom --help

returns the following useful info

fgcom - a communication radio based on VoIP with IAX/Asterisk

(c)2007 by H. Wirtz <wirtz@dfn.de>

Version 1.1.0 build 42

Using iaxclient library Version SVN 42

fgcom: unrecognized option `--help'

Usage: fgcom [-u user] -w [password] [[-s voipserver] [-p port]] | [[-a airport] [-f frequency]] [-d]

Account options

FGCom starts with a guest account unless you use -U and -P!

--user          | -U     username for VoIP account (default: 'guest')
--password      | -P     password for VoIP account (default: 'guest')
--voipserver    | -s     voip server to ceonnect to (default 'localhost')
--port          | -p     where we should listen to FG(default '16661')

ATC mode options

--airport       | -a     airport-id (ICAO) for ATC-mode
--frequency     | -f     frequency for ATC-mode

Audio options

--mic           | -i     mic input level (0.0 - 1.0)
--speaker       | -o     speaker output level (0.0 - 1.0)
--mic-boost     | -b     enable mic boost
--list-audio    | -l     list audio devices
--set-audio-in  | -r     use <devicename> as audio input
--set-audio-out | -k     use <devicename> as audio output

Misc options

--debug         | -d     show debugging information

Mode 1: client for COM1 of flightgear:

$ fgcom

- connects fgcom to fgfs at localhost:16661

$ fgcom -sother.host.tld -p23456

- connects fgcom to fgfs at other.host.tld:23456

Mode 2: client for an ATC at <airport> on <frequency>:

$ fgcom -aKSFO -d120.500

- sets up fgcom for an ATC radio at KSFO 120.500 MHz

Registration

To make full use of FGCOM you will need an account!

Please email wirtz <at> dfn <dot> de (replace with @ and .) and login details will be sent to you shortly. Accounts will not be made until Autumn 2008. But you can test without an account (by default the used account is guest, password guest) with restricted frequency use. As guest you can only use the following frequencies:

  • 911.000 MHz (ATC-Help)
  • 910.000 MHz (Echo-Box)
  • 123.450 MHz (Air2Air 1)
  • 122.750 Mhz (Air2Air 2)

Server installation

For running a FGCOM server you need Asterisk and depending on the amount of users much bandwith and CPU power. Because of putting pilots and ATCs in a VoIP conference the server-admin has to assure that there is enough network and cpu power to avoid drop-outs of the voice stream.

Prerequirements

Install Asterisk on top of your favorite distribution. Please refer to installation manuals (e.g. [[1]]) you can find on the net. You do not need H.323 or SIP because the fgcom client uses IAX2 as VoIP signaling protocol. Only if you think about connecting external VoIP applications to FGCOM you should consider to activate H.323 or SIP (but this is not the scope of this small howto).

For now we want to use /etc/asterisk as the base configuration directory.

Setting up the radio frequencies

The radio frequencies are "simple" Conferences and realized due to the Asterisk application MeetMe().

Part 1: General configuration

First you have to set up the general configuration of the system. Put the following at the top of your "extensions.conf" file:

 [general]
 static=yes
 writeprotect=yes
 ;
 [globals]
 ;
 [macro-com]
 exten => s,1,Answer()
 exten => s,n,MeetMe(${MACRO_EXTEN},qd)
 exten => s,n,Hangup()
 ;
 [macro-echo]
 exten => s,1,Answer()
 exten => s,n,Echo()
 exten => s,n,Hangup()
 ;
 [guest]
 ; ATC-Help
 exten => 01-ZZZZ-911.000,1,Macro(com)
 exten => 012525252591100,1,Dial(Local/01-ZZZZ-911.000)
 exten => 01-ZZZZ-910.000,1,Macro(echo)
 exten => 012525252591000,1,Dial(Local/01-ZZZZ-910.000)
 ;
 [default]
 include => guest
 ;
 ; Code:
 ; 01 - FlightGear
 ; 02 - Microsoft Flight-Simulator
 ; 03 - ...
 ;
 ; Air2Air
 exten => 01-ZZZZ-123.450,1,Macro(com)
 exten => 012525252512345,1,Dial(Local/01-ZZZZ-123.450)
 exten => 01-ZZZZ-122.750,1,Macro(com)
 exten => 012525252512275,1,Dial(Local/01-ZZZZ-122.750)

Part 2: Adding your favorite (all?) frequencies

For this you have simply to create an extension for every touple of airport/frequency in extensions.conf. The following is an example for Berlin-Tempelhof (EDDI). The information comes from the file "apt.dat.gz" of your FlightGear installation.

 ; EDDI ATIS 126.020 - Berlin Tempelhof
 exten => 01-EDDI-126.020,1,Macro(com)
 exten => 010403030812602,1,Dial(Local/01-EDDI-126.020)
 ;
 ; EDDI BERLIN DEP 120.620 - Berlin Tempelhof
 exten => 01-EDDI-120.620,1,Macro(com)
 exten => 010403030812062,1,Dial(Local/01-EDDI-120.620)
 ;
 ; EDDI BERLIN DIRECTOR 121.120 - Berlin Tempelhof
 exten => 01-EDDI-121.120,1,Macro(com)
 exten => 010403030812112,1,Dial(Local/01-EDDI-121.120)
 ;
 ; EDDI BERLIN ARR 126.420 - Berlin Tempelhof
 exten => 01-EDDI-126.420,1,Macro(com)
 exten => 010403030812642,1,Dial(Local/01-EDDI-126.420)
 ;
 ; EDDI GND 121.950 - Berlin Tempelhof
 exten => 01-EDDI-121.950,1,Macro(com)
 exten => 010403030812195,1,Dial(Local/01-EDDI-121.950)
 ;
 ; EDDI TWR 119.570 - Berlin Tempelhof
 exten => 01-EDDI-119.570,1,Macro(com)
 exten => 010403030811957,1,Dial(Local/01-EDDI-119.570)
 ;
 ; EDDI BERLIN DIRECTOR 136.100 - Berlin Tempelhof
 exten => 01-EDDI-136.100,1,Macro(com)
 exten => 010403030813610,1,Dial(Local/01-EDDI-136.100)
 ;
 ; EDDI TWR 118.100 - Berlin Tempelhof
 exten => 01-EDDI-118.100,1,Macro(com)
 exten => 010403030811810,1,Dial(Local/01-EDDI-118.100)
 ;
 ; EDDI BERLIN DEP 119.500 - Berlin Tempelhof
 exten => 01-EDDI-119.500,1,Macro(com)
 exten => 010403030811950,1,Dial(Local/01-EDDI-119.500)
 ;
 ; EDDI BERLIN ARR 119.620 - Berlin Tempelhof
 exten => 01-EDDI-119.620,1,Macro(com)
 exten => 010403030811962,1,Dial(Local/01-EDDI-119.620)

What does the above mean? There are two lines (three with the comment) for each frequency: The first one sets up an extension named "01-EDDI-119.500". Yes, for VoIP you can use textual extensions but be careful if you want to setup your Asterisk-Server with POTS (=Plain old telephone service). Therefor you need the second line which is the same as above but without dashes and the letters in the decimal representation of the ASCII Code. The second line does only a "rewrite" of the numerical representation to the textual one.

For setting up all airports you can write your own simple script. But this maybe also not needed in further versions of FGCOM.

After editing the extensions.conf file you have to reload the extensions file (e.g. "asterisk -rx extensions reload").

You can add further nice goodies to your extensions.conf: MorseCode() for morsing the code of the VOR (MorseCode() will only work in Asterisk >= 1.4), Recording of metar data and playing this recording back when using the frequency of the metar information, ...

Setting up user accounts

The user accounts are located in the file iax.conf (and perhaps also in sip.conf, but this is not necessary). The top of the file should look like this:

 [general]
 bandwith=low
 disallow=lpc10
 jitterbuffer=yes
 forcejitterbuffer=no
 tos=lowdelay
 autokill=yes
 disallow=all
 allow=alaw
 allow=gsm
 allow=ilbc
 allow=g726
 allow=ulaw
 language=en
 maxauthreq=10
 context=guest
 ;
 [guest]
 type=user
 username=guest
 context=guest
 qualify=yes
 callerid=Guest IAX User
 host=dynamic
 ;

You may want to disallow more codecs or want to allow additional codecs (such as speex). But have in mind that the internal mixing of the conferences are done in "ulaw". But "ulaw" needs about 80 kBit/s because it does no compression. So you have to think about what's better for you: less bandwidth (per user) and more CPU usage or more bandwidth (per user) and less CPU usage... you should also consider the "sound" of some codecs may not have the 'real radio sound'.

For each user you have to add a bunch of lines to your iax.conf file:

 [<USERNAME>]
 type=user
 username=<USERNAME>
 secret=<PASSWORD>
 context=default
 host=dynamic
 nat=yes
 notransfer=yes

You just have to fill in the <USERNAME> and <PASSWORD>. After each change you have to reload the configuration (e.g. "asterisk -rx reload chan_iax2.so"). Perhaps you want to write scripts for automatic configuration and so on. But be warned: Further versions of fgcom may use the multiplayer servers for getting usernames and position data and you have to change your scripts.

Problems?

If you have problems you can contact me via email at "dcoredump AT gmail.com".

External links

Development

TODO

See also