2
|
1 #!/bin/bash
|
|
2
|
|
3 # intercom
|
|
4 #
|
|
5 # Copyright (C) DFS Deutsche Flugsicherung (2004, 2005).
|
|
6 # All Rights Reserved.
|
|
7 # Author: Andre Adrian
|
|
8 #
|
|
9 # Voice-over-IP Intercom start skript for Linux with ALSA and OSS
|
|
10 #
|
|
11 # Version 0.4
|
|
12 #
|
|
13
|
|
14 echo "usage: intercom [OPTIONS] [Partner1-IP [Partner2-IP ...]]"
|
|
15 echo " -a value set ambient (background) noise to value decibel"
|
|
16 # echo " -b value set Acoustic Echo Suppression to value decibel"
|
|
17 echo " -e enable 2040Hz Sinustone for VHF transmitter"
|
|
18 echo " -f Number Number of 20ms Frames in RTP packet"
|
|
19 echo " -k use Packet Loss Concealment (PLC)"
|
|
20 echo " -l use hardware AEC and Line-in for microphone"
|
|
21 echo " -m use hardware AEC and Mic-in for microphone"
|
|
22 echo " -p Number RTP Portnumber (default is 5004)"
|
|
23 echo " -t Telephone conference (everybody with everybody else)"
|
|
24 echo " -s Percent simulated packet loss"
|
|
25 echo " -w visualize vector w"
|
|
26 echo " -I use iLBC codec (default), can do PLC"
|
|
27 echo " -A use G.711 A-law codec"
|
|
28 echo " -U use G.711 u-law codec"
|
|
29 echo " -6 use G.726 32kbps codec"
|
|
30 echo " -G use GSM codec"
|
|
31 echo " -S use Wideband Speex codec, can do PLC"
|
|
32
|
|
33 # disable screen saver
|
|
34 xset s off
|
|
35 xset -dpms
|
|
36
|
|
37 # delete old process
|
|
38 killall -9 intercomd 2>/dev/null
|
|
39 killall -9 intercomd1 2>/dev/null
|
|
40
|
|
41 # configure audio mixer (AC97 compatible)
|
|
42 # check your mixer hardware with:
|
|
43 # cat /dev/sndstat
|
|
44 #
|
|
45 # hardware AEC test was successful with on-board sound mixers:
|
|
46 # Analog Devices AD1985, ICEnsemble ICE1232, Realtek ALC650 and ALC655,
|
|
47 # SigmaTel STAC9750/51
|
|
48 #
|
|
49 # hardware AEC test was successful with PCI sound cards:
|
|
50 # Soundblaster PCI128
|
|
51 #
|
|
52 # hardware AEC test failed with PCI sound cards:
|
|
53 # Soundblaster Audigy 2, C-Media 8738
|
|
54
|
|
55 # set playback volume
|
|
56 amixer -q sset 'PCM',0 70%
|
|
57 amixer -q sset 'Master',0 70%
|
|
58
|
|
59 # use only PCM for playback
|
|
60 amixer -q set 'Master',0 unmute
|
|
61 amixer -q set 'PCM',0 unmute
|
|
62 amixer -q set 'Mic',0 mute
|
|
63 amixer -q set 'Line',0 mute
|
|
64 amixer -q set 'CD',0 mute
|
|
65 amixer -q set 'Aux',0 mute
|
|
66
|
|
67 # enable recording
|
|
68 amixer -q cset iface=MIXER,name='Capture Switch' 1
|
|
69 EXEC=intercomd
|
|
70 WOPTION=320
|
|
71 WSTART=0
|
|
72
|
|
73 # handle all options
|
|
74 for argv in $* ;do
|
|
75 # echo $argv
|
|
76 case $argv in
|
|
77 ("-l")
|
|
78 # for Hardware AEC and Line-In Capture
|
|
79 amixer -q set 'Capture',0 0%-,100%-
|
|
80 amixer -q cset iface=MIXER,name='Capture Source' 4,5
|
|
81 ;;
|
|
82 ("-m")
|
|
83 # for Hardware AEC and Mic-In Capture
|
|
84 amixer -q set 'Capture',0 0%-,100%-
|
|
85 amixer -q cset iface=MIXER,name='Capture Source' 0,5
|
|
86 ;;
|
|
87 ("-9")
|
|
88 # other EXEC because of EFR G.729 link mismatch (same functionnames)
|
|
89 EXEC=intercomd2
|
|
90 ;;
|
|
91 ("-S")
|
|
92 # other EXEC because Speex is Wideband codec
|
|
93 EXEC=intercomd1
|
|
94 WOPTION=640
|
|
95 ;;
|
|
96 ("-w")
|
|
97 # start wdisplay.tcl
|
|
98 WSTART=1
|
|
99 ;;
|
|
100 esac
|
|
101 done
|
|
102
|
|
103 # start wdisplay
|
|
104 if test $WSTART -eq 1 ;then
|
|
105 /usr/local/bin/wdisplay.tcl $WOPTION &
|
|
106 sleep 1
|
|
107 fi
|
|
108
|
|
109 # start audio/network daemon
|
|
110 /usr/local/bin/$EXEC $* &
|
|
111 sleep 1
|
|
112
|
|
113 # give audio/network daemon realtime process prio
|
|
114 # enable this if you don't use hardware AEC
|
|
115 # (setpriority is in RPM package rtstools)
|
|
116 # sudo /usr/sbin/setpriority `pidof $EXEC` fifo 1
|
|
117
|
|
118 # To make sudo work without password add as superuser with the program
|
|
119 # visudo:
|
|
120 # %users ALL=(root) NOPASSWD: /usr/sbin/setpriority
|
|
121
|
|
122 # start graphical user interface
|
|
123 # /usr/local/bin/intercom.tcl $* -geometry 800x600 &
|
|
124 /usr/local/bin/intercom.tcl $* &
|
|
125
|