Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Feed
openwrt-telephony
Commits
da26f984
Commit
da26f984
authored
Nov 17, 2021
by
Hemlata
Committed by
Yalu Zhang
Nov 17, 2021
Browse files
asterisk: update cw.sh and dnd.sh as UCI config has restructured
parent
d921046a
Changes
2
Hide whitespace changes
Inline
Side-by-side
net/asterisk/files/iopsys/lib/voice/cw.sh
View file @
da26f984
...
...
@@ -3,15 +3,51 @@
.
/lib/voice/utils.sh
if
[
$2
!=
'?'
]
;
then
for
tel_line
in
`
uci show
$VOICE_UCI_CONFIG
|
grep
telline |
grep
$1
|
cut
-d
.
-f
2
`
;
do
sed
-i
"/
\[
$tel_line
\]
/,/^
\[
/ s/
\(
callwaiting=
\)
[0-9]/
\1
$2
/"
$ASTERISK_CONF_DIR
/chan_telephony.conf
uci
set
asterisk.
$tel_line
.callwaiting_enabled
=
"
$2
"
uci commit asterisk
done
for
tel_line
in
`
uci show
$VOICE_UCI_CONFIG
|
grep
incoming_map |
grep
line |
cut
-d
"'"
-f
2
`
;
do
for
provider
in
`
uci show
$VOICE_UCI_CONFIG
|
grep
$tel_line
|
grep
provider|
cut
-d
"'"
-f
2
`
;
do
if
[
$1
==
"
$provider
"
]
;
then
mapname
=
`
uci show
$VOICE_UCI_CONFIG
|
grep
incoming_map |
grep
$tel_line
|
cut
-d
'.'
-f
2
`
groupname
=
`
uci show
$VOICE_UCI_CONFIG
|
grep
$mapname
|
grep
extension |
cut
-d
"'"
-f
2
`
extensioname
=
`
uci show
$VOICE_UCI_CONFIG
|
grep
$groupname
|
grep
extensions |
cut
-d
"'"
-f
2
`
if
[
-z
"
$extensioname
"
]
;
then
sed
-i
"s/callwaiting=[0-9]/callwaiting=
$2
/g"
$ASTERISK_CONF_DIR
/chan_telephony.conf
setname
=
`
uci show
$VOICE_UCI_CONFIG
|grep
$tel_line
|
grep
calling_features |
cut
-d
"'"
-f
2
`
for
item
in
$setname
;
do
echo
"item"
$item
uci
set
asterisk.
$item
.call_waiting_enable
=
"
$2
"
uci commit asterisk
done
else
for
extname
in
${
extensioname
//,/
}
do
sed
-i
"/
\[
$extname
\]
/,/^
\[
/ s/
\(
callwaiting=
\)
[0-9]/
\1
$2
/"
$ASTERISK_CONF_DIR
/chan_telephony.conf
setname
=
`
uci show
$VOICE_UCI_CONFIG
|
grep
$tel_line
|
grep
calling_features |
cut
-d
"'"
-f
2
`
done
fi
fi
done
done
else
for
tel_line
in
`
uci show
$VOICE_UCI_CONFIG
|
grep
telline |
grep
$1
|
cut
-d
.
-f
2
`
;
do
status
=
`
sed
-n
"/
\[
$tel_line
\]
/,/^
\[
/ s/callwaiting=
\(
[0-9]
\)
/
\1
/p"
$ASTERISK_CONF_DIR
/chan_telephony.conf
`
echo
$status
exit
0
done
for
tel_line
in
`
uci show
$VOICE_UCI_CONFIG
|
grep
incoming_map |
grep
line |
cut
-d
"'"
-f
2
`
;
do
sip_provider
=
`
uci show
$VOICE_UCI_CONFIG
|
grep
$tel_line
|
grep
provider|
cut
-d
"'"
-f
2
`
if
[
"
$sip_provider
"
==
$1
]
;
then
mapname
=
`
uci show
$VOICE_UCI_CONFIG
|
grep
incoming_map |
grep
$tel_line
|
cut
-d
'.'
-f
2
`
groupname
=
`
uci show
$VOICE_UCI_CONFIG
|
grep
$mapname
|
grep
extension |
cut
-d
"'"
-f
2
`
extensioname
=
`
uci show
$VOICE_UCI_CONFIG
|
grep
$groupname
|
grep
extensions |
cut
-d
"'"
-f
2
`
if
[
-z
"
$extensioname
"
]
;
then
extensionname
=
`
uci show
$VOICE_UCI_CONFIG
|
grep
=
extension|
cut
-d
'='
-f
1|cut
-d
'.'
-f
2
`
for
item
in
$extensionname
;
do
status
=
`
sed
-n
"/
\[
$item
\]
/,/^
\[
/ s/callwaiting=
\(
[0-9]
\)
/
\1
/p"
$ASTERISK_CONF_DIR
/chan_telephony.conf
`
echo
$status
exit
0
done
else
for
extname
in
${
extensioname
//,/
}
;
do
status
=
`
sed
-n
"/
\[
$extname
\]
/,/^
\[
/ s/callwaiting=
\(
[0-9]
\)
/
\1
/p"
$ASTERISK_CONF_DIR
/chan_telephony.conf
`
echo
$status
exit
0
done
fi
fi
done
fi
net/asterisk/files/iopsys/lib/voice/dnd.sh
View file @
da26f984
...
...
@@ -4,11 +4,23 @@
if
[
$2
!=
'?'
]
;
then
for
tel_line
in
`
uci show
$VOICE_UCI_CONFIG
|
grep
outgoing_map |
grep
line |
cut
-d
"'"
-f
2
`
;
do
for
provider
in
`
uci show
$VOICE_UCI_CONFIG
|
grep
$tel_
line
|
grep
provider|
cut
-d
"'"
-f
2
`
;
do
for
provider
in
`
uci show
$VOICE_UCI_CONFIG
|
grep
line |
grep
provider|
cut
-d
"'"
-f
2
`
;
do
if
[
$1
==
"
$provider
"
]
;
then
mapname
=
`
uci show
$VOICE_UCI_CONFIG
|
grep
outgoing_map |
grep
$tel_line
|
cut
-d
'.'
-f
2
`
extensionname
=
`
uci show
$VOICE_UCI_CONFIG
|
grep
$mapname
|
grep
extension |
cut
-d
"'"
-f
2
`
sed
-i
"/
\[
$extensionname
\]
/,/^
\[
/ s/
\(
do_not_disturb=
\)
[0-9]/
\1
$2
/"
$ASTERISK_CONF_DIR
/chan_telephony.conf
groupname
=
`
uci show
$VOICE_UCI_CONFIG
|
grep
$mapname
|
grep
extension |
cut
-d
"'"
-f
2
`
extensioname
=
`
uci show
$VOICE_UCI_CONFIG
|
grep
$groupname
|
grep
extensions |
cut
-d
"'"
-f
2
`
if
[
-z
"
$extensioname
"
]
;
then
sed
-i
"s/do_not_disturb=[0-9]/do_not_disturb=
$2
/g"
$ASTERISK_CONF_DIR
/chan_telephony.conf
setname
=
`
uci show
$VOICE_UCI_CONFIG
|
grep
$tel_line
|
grep
calling_features |
cut
-d
"'"
-f
2
`
uci
set
asterisk.
$setname
.dnd_enable
=
"
$2
"
uci commit asterisk
else
for
extname
in
${
extensioname
//,/
}
do
sed
-i
"/
\[
$extname
\]
/,/^
\[
/ s/
\(
do_not_disturb=
\)
[0-9]/
\1
$2
/"
$ASTERISK_CONF_DIR
/chan_telephony.conf
setname
=
`
uci show
$VOICE_UCI_CONFIG
|
grep
$tel_line
|
grep
calling_features |
cut
-d
"'"
-f
2
`
done
fi
fi
done
done
...
...
@@ -17,11 +29,24 @@ else
for
provider
in
`
uci show
$VOICE_UCI_CONFIG
|
grep
$tel_line
|
grep
provider|
cut
-d
"'"
-f
2
`
;
do
if
[
$1
==
"
$provider
"
]
;
then
mapname
=
`
uci show
$VOICE_UCI_CONFIG
|
grep
outgoing_map |
grep
$tel_line
|
cut
-d
'.'
-f
2
`
extensionname
=
`
uci show
$VOICE_UCI_CONFIG
|
grep
$mapname
|
grep
extension |
cut
-d
"'"
-f
2
`
status
=
`
sed
-n
"/
\[
$extensionname
\]
/,/^
\[
/ s/do_not_disturb=
\(
[0-9]
\)
/
\1
/p"
$ASTERISK_CONF_DIR
/chan_telephony.conf
`
echo
$status
exit
0
groupname
=
`
uci show
$VOICE_UCI_CONFIG
|
grep
$mapname
|
grep
extension |
cut
-d
"'"
-f
2
`
extensionname
=
`
uci show
$VOICE_UCI_CONFIG
|
grep
$groupname
|
grep
extensions |
cut
-d
"'"
-f
2
`
if
[
-z
"
$extensionname
"
]
;
then
extensionname
=
`
uci show
$VOICE_UCI_CONFIG
|
grep
=
extension|
cut
-d
'='
-f
1|cut
-d
'.'
-f
2
`
for
item
in
$extensionname
;
do
status
=
`
sed
-n
"/
\[
$item
\]
/,/^
\[
/ s/do_not_disturb=
\(
[0-9]
\)
/
\1
/p"
$ASTERISK_CONF_DIR
/chan_telephony.conf
`
echo
$status
exit
0
done
else
for
item
in
${
extensionname
//,/
}
do
status
=
`
sed
-n
"/
\[
$item
\]
/,/^
\[
/ s/do_not_disturb=
\(
[0-9]
\)
/
\1
/p"
$ASTERISK_CONF_DIR
/chan_telephony.conf
`
echo
$status
exit
0
done
fi
fi
done
done
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment