1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2008 Alina Friedrichsen
13 local cfg
="$CONFIG_SECTION"
18 config_get cfgt
"$cfg" TYPE
20 if [ "$cfgt" == siproxd
]; then
21 if [ "$varname" == config_file
]; then
23 elif [ "$varname" == if_inbound
]; then
25 elif [ "$varname" == if_outbound
]; then
27 elif [ "$varname" == mask_host
]; then
31 if [ "$((c % 2))" -eq 0 ]; then
32 printf '%s\n' "mask_host = $item" >> /var
/etc
/siproxd.conf
34 printf '%s\n' "masked_host = $item" >> /var
/etc
/siproxd.conf
38 elif [ "$varname" == outbound_domain
]; then
42 if [ "$((c % 3))" -eq 0 ]; then
43 printf '%s\n' "outbound_domain_name = $item" >> /var
/etc
/siproxd.conf
44 elif [ "$((c % 3))" -eq 1 ]; then
45 printf '%s\n' "outbound_domain_host = $item" >> /var
/etc
/siproxd.conf
47 printf '%s\n' "outbound_domain_port = $item" >> /var
/etc
/siproxd.conf
51 elif [ "$varname" == pi_shortdial_entry
]; then
54 printf '%s\n' "pi_shortdial_entry = $item" >> /var
/etc
/siproxd.conf
57 if [ "$varname" == hosts_allow_reg
-o "$varname" == hosts_allow_sip
-o "$varname" == hosts_deny_sip
]; then
58 value
=$
(printf '%s' "$value" |
tr -s '\t ' ',')
60 [ "$varname" == sip_listen_port
] && SIP_LISTEN_PORT
=""
61 [ "$varname" == daemonize
] && DAEMONIZE
=""
62 [ "$varname" == silence_log
] && SILENCE_LOG
=""
63 [ "$varname" == log_calls
] && LOG_CALLS
=""
64 [ "$varname" == user
] && USER
=""
65 [ "$varname" == registration_file
] && REGISTRATION_FILE
=""
66 [ "$varname" == pid_file
] && PID_FILE
=""
67 [ "$varname" == rtp_proxy_enable
] && RTP_PROXY_ENABLE
=""
68 [ "$varname" == rtp_port_low
] && RTP_PORT_LOW
=""
69 [ "$varname" == rtp_port_high
] && RTP_PORT_HIGH
=""
70 [ "$varname" == rtp_timeout
] && RTP_TIMEOUT
=""
71 [ "$varname" == default_expires
] && DEFAULT_EXPIRES
=""
72 [ "$varname" == debug_level
] && DEBUG_LEVEL
=""
73 [ "$varname" == debug_port
] && DEBUG_PORT
=""
74 printf '%s\n' "$varname = $value" >> /var
/etc
/siproxd.conf
80 > /var
/etc
/siproxd.conf
81 mkdir
-p /var
/lib
/siproxd
82 chmod 777 /var
/lib
/siproxd
83 mkdir
-p /var
/run
/siproxd
84 chmod 777 /var
/run
/siproxd
85 CONFIG_FILE
=/var
/etc
/siproxd.conf
91 REGISTRATION_FILE
=/var
/lib
/siproxd
/siproxd_registrations
92 PID_FILE
=/var
/run
/siproxd
/siproxd.pid
98 DEBUG_LEVEL
=0x00000000
101 [ -n "$SIP_LISTEN_PORT" ] && printf '%s\n' "sip_listen_port = $SIP_LISTEN_PORT" >> /var
/etc
/siproxd.conf
102 [ -n "$DAEMONIZE" ] && printf '%s\n' "daemonize = $DAEMONIZE" >> /var
/etc
/siproxd.conf
103 [ -n "$SILENCE_LOG" ] && printf '%s\n' "silence_log = $SILENCE_LOG" >> /var
/etc
/siproxd.conf
104 [ -n "$LOG_CALLS" ] && printf '%s\n' "log_calls = $LOG_CALLS" >> /var
/etc
/siproxd.conf
105 [ -n "$USER" ] && printf '%s\n' "user = $USER" >> /var
/etc
/siproxd.conf
106 [ -n "$REGISTRATION_FILE" ] && printf '%s\n' "registration_file = $REGISTRATION_FILE" >> /var
/etc
/siproxd.conf
107 [ -n "$PID_FILE" ] && printf '%s\n' "pid_file = $PID_FILE" >> /var
/etc
/siproxd.conf
108 [ -n "$RTP_PROXY_ENABLE" ] && printf '%s\n' "rtp_proxy_enable = $RTP_PROXY_ENABLE" >> /var
/etc
/siproxd.conf
109 [ -n "$RTP_PORT_LOW" ] && printf '%s\n' "rtp_port_low = $RTP_PORT_LOW" >> /var
/etc
/siproxd.conf
110 [ -n "$RTP_PORT_HIGH" ] && printf '%s\n' "rtp_port_high = $RTP_PORT_HIGH" >> /var
/etc
/siproxd.conf
111 [ -n "$RTP_TIMEOUT" ] && printf '%s\n' "rtp_timeout = $RTP_TIMEOUT" >> /var
/etc
/siproxd.conf
112 [ -n "$DEFAULT_EXPIRES" ] && printf '%s\n' "default_expires = $DEFAULT_EXPIRES" >> /var
/etc
/siproxd.conf
113 [ -n "$DEBUG_LEVEL" ] && printf '%s\n' "debug_level = $DEBUG_LEVEL" >> /var
/etc
/siproxd.conf
114 [ -n "$DEBUG_PORT" ] && printf '%s\n' "debug_port = $DEBUG_PORT" >> /var
/etc
/siproxd.conf
118 config_load
/var
/state
/network
119 if [ -n "$IF_INBOUND" ]; then
120 config_get IF_INBOUND
"$IF_INBOUND" ifname
121 printf '%s\n' "if_inbound = $IF_INBOUND" >> /var
/etc
/siproxd.conf
123 if [ -n "$IF_OUTBOUND" ]; then
124 config_get IF_OUTBOUND
"$IF_OUTBOUND" ifname
125 printf '%s\n' "if_outbound = $IF_OUTBOUND" >> /var
/etc
/siproxd.conf
127 /usr
/sbin
/siproxd
--config "$CONFIG_FILE"