blob: 20ebc7a5ee93e7868dd838afbbe9e70bb3e7a595 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#!/bin/sh
linphone_socket=/tmp/linphonec-$(id -u)
warn() { printf '%s\n' "$0" "${*:-something is wrong.}" >&2; }
die() { warn "$@"; exit 1; }
init()
{
out=$(linphonecsh init -CD 2>&1)
[ -z "$out" ] && return
case "$out" in
*'running linphonec has been found'*)
printf '%s\n' "$out" >&2
return 1 ;;
'')
return 0 ;;
*)
die "Error: unexpected output from linphonecsh: $out" ;;
esac
}
wait_for_linphone_socket()
{
for n in $(seq 1 50); do
test -e ${linphone_socket} && break
sleep 0.1
done
}
getip()
{
upnpc -s|sed -ne 's/^ExternalIPAddress = //p'
}
generic()
{
linphonecsh generic "$*"
}
atexit()
{
if [ "$kill_linphonec" ]; then
linphonecsh exit
fi
}
init
trap atexit EXIT
wait_for_linphone_socket
if ip=$(getip); then
generic nat $ip
generic firewall nat
fi
generic friend list
|