Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
openwrt-telephony
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Feed
openwrt-telephony
Commits
8fe717c2
Commit
8fe717c2
authored
10 months ago
by
George Yang (IOPSYS)
Committed by
George Yang
9 months ago
Browse files
Options
Downloads
Patches
Plain Diff
config_asterisk.sh: Improve code structure
No logic changes
parent
61cb5232
No related branches found
Branches containing commit
No related tags found
1 merge request
!173
CLIR and SIP line selection
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
net/asterisk/files/iopsys/lib/voice/config_asterisk.sh
+44
-29
44 additions, 29 deletions
net/asterisk/files/iopsys/lib/voice/config_asterisk.sh
with
44 additions
and
29 deletions
net/asterisk/files/iopsys/lib/voice/config_asterisk.sh
+
44
−
29
View file @
8fe717c2
...
...
@@ -783,12 +783,12 @@ configure_opening_hours_profile() {
config_foreach configure_opening_timespan timespan
$1
if
[
"
$invert
"
==
"0"
]
;
then
echo
"exten => s,n,Goto(closed)"
>>
$WORK_DIR
/macros
echo
"exten => s,n,Goto(closed)"
>>
$WORK_DIR
/macros
fi
echo
"exten => s,n(open),Set(OPEN=1)"
>>
$WORK_DIR
/macros
echo
"exten => s,n(open),Set(OPEN=1)"
>>
$WORK_DIR
/macros
echo
"exten => s,n,Return()"
>>
$WORK_DIR
/macros
echo
"exten => s,n(closed),Set(OPEN=0)"
>>
$WORK_DIR
/macros
echo
""
>>
$WORK_DIR
/macros
echo
"exten => s,n(closed),Set(OPEN=0)"
>>
$WORK_DIR
/macros
echo
""
>>
$WORK_DIR
/macros
}
configure_extensions
()
{
...
...
@@ -852,6 +852,10 @@ configure_extensions() {
echo
""
>>
$WORK_DIR
/extensions.conf
}
configure_extensions_outgoing_map
()
{
config_foreach get_line_contexts extension
}
configure_voicemail_incoming
()
{
local
line
=
$1
local
boxnumber
=
$2
...
...
@@ -1090,35 +1094,39 @@ get_map_line() {
done
}
get_line_
provider
s
()
{
get_line_
context
s
()
{
local
extension
=
$1
local
lines
local
line
local
providers
local
context
local
feature
local
provider
local
enabled
local
user
lines
=
$(
config_foreach get_map_line outgoing_map
$extension
|
sort
-u
| xargs
)
local
lines
=
$(
config_foreach get_map_line outgoing_map
$extension
|
sort
-u
| xargs
)
for
line
in
$lines
;
do
if
[
-z
"
$calling_features
"
]
;
then
config_get calling_features
$line
calling_features
fi
config_get provider
$line
provider
[
-z
"
$provider
"
]
||
[
"
$provider
"
=
"-"
]
&&
continue
[
-z
"
$features
"
]
&&
{
config_get feature
$line
calling_features
}
[
-z
"
$context
"
]
&&
{
config_get provider
$line
provider
config_get enabled
$provider
enable
[
"
$enabled
"
=
"1"
]
||
continue
[
-n
"
$provider
"
]
&&
[
"
$provider
"
!=
"-"
]
&&
{
config_get enabled
$provider
enable
config_get user
$provider
user
config_get user
$provider
user
[
-n
"
$user
"
]
||
continue
[
"
$enabled
"
=
"1"
]
&&
[
-n
"
$user
"
]
&&
{
context
=
$provider
}
}
}
providers
=
"
${
providers
:+
${
providers
}
}${
provider
}
"
[
-n
"
$feature
"
]
&&
[
-n
"
$context
"
]
&&
break
done
line_providers
=
"
${
providers
:-
local_extensions
}
"
[
-n
"
$context
"
]
&&
line_contexts
=
"
${
line_contexts
:+
${
line_contexts
}
}
$extension
:
$context
"
[
-n
"
$feature
"
]
&&
line_features
=
"
${
line_features
:+
${
line_features
}
}
$extension
:
$feature
"
}
get_prefixinfo
()
{
...
...
@@ -1667,13 +1675,14 @@ get_incomingmap_extensions() {
# Configure settings for individual line in chan_telephony.conf
configure_tel_line
()
{
local
extension
=
$1
local
name
local
context
local
enabled
local
autodial
local
autodial_timeout
local
dialtone_timeout
local
offhook_nu_timeout
local
offhook_silence_timeout
local
line_providers
local
calling_features
local
caller_id
local
caller_id_enable
...
...
@@ -1681,18 +1690,16 @@ configure_tel_line() {
local
anonymous_call_enable
config_get enabled
$extension
enable
"1"
config_get name
$extension
name
config_get autodial
$extension
autodial
config_get autodial_timeout
$extension
autodial_timeout
"60000"
config_get dialtone_timeout
$extension
dialtone_timeout
"20000"
config_get offhook_nu_timeout
$extension
offhook_nu_timeout
"60000"
config_get offhook_silence_timeout
$extension
offhook_silence_timeout
"180000"
cp
$TEMPLATE_DIR
/tel_line
$WORK_DIR
/tel_line
#configure the settings of sip context
get_line_providers
$extension
ast_conf_replace_esc
"|CONTEXT|"
"
${
line_providers
%% *
}
"
$WORK_DIR
/tel_line
context
=
$(
echo
"
$line_contexts
"
| xargs
-n1
|
grep
"
$extension
:"
|
cut
-d
:
-f2
)
calling_features
=
$(
echo
"
$line_features
"
| xargs
-n1
|
grep
"
$extension
:"
|
cut
-d
:
-f2
)
if
[
-n
"
$calling_features
"
]
;
then
config_get caller_id
$extension
extension_number
...
...
@@ -1701,14 +1708,16 @@ configure_tel_line() {
config_get caller_name_enable
$calling_features
caller_name_enable
fi
cp
$TEMPLATE_DIR
/tel_line
$WORK_DIR
/tel_line
ast_conf_replace_esc
"|CONTEXT|"
"
${
context
:-
local_extensions
}
"
$WORK_DIR
/tel_line
ast_conf_replace_esc
"|CALLERIDENABLE|"
"
$caller_id_enable
"
$WORK_DIR
/tel_line
ast_conf_replace_esc
"|CALLERNAMEENABLE|"
"
$caller_name_enable
"
$WORK_DIR
/tel_line
ast_conf_replace_esc
"|ANONYMOUSCALLENABLE|"
"
$anonymous_call_enable
"
$WORK_DIR
/tel_line
ast_conf_replace_esc
"|CALLERID|"
"
$caller_id
"
$WORK_DIR
/tel_line
ast_conf_replace_esc
"|SECTION|"
"
$extension
"
$WORK_DIR
/tel_line
ast_conf_replace_esc
"|ENABLED|"
"
$enabled
"
$WORK_DIR
/tel_line
ast_conf_replace_esc
"|DIALTONE_EXTENSION_HINT|"
"
$
1
"
$WORK_DIR
/tel_line
ast_conf_replace_esc
"|DIALTONE_EXTENSION_HINT|"
"
$
extension
"
$WORK_DIR
/tel_line
ast_conf_replace_esc
"|AUTODIAL|"
"
$autodial
"
$WORK_DIR
/tel_line
ast_conf_replace_esc
"|AUTODIAL_TIMEOUT|"
"
$autodial_timeout
"
$WORK_DIR
/tel_line
ast_conf_replace_esc
"|DIALTONE_TIMEOUT|"
"
$dialtone_timeout
"
$WORK_DIR
/tel_line
...
...
@@ -1717,6 +1726,8 @@ configure_tel_line() {
ast_conf_replace_esc
"|DTMFRELAY|"
"
$dtmfmode
"
$WORK_DIR
/tel_line
ast_conf_replace_esc
"|LINE_NAME|"
"
$LINENAME
"
$WORK_DIR
/tel_line
echo
>>
$WORK_DIR
/chan_telephony.conf
echo
"; Configuration for line '
$name
'"
>>
$WORK_DIR
/chan_telephony.conf
cat
$WORK_DIR
/tel_line
>>
$WORK_DIR
/chan_telephony.conf
}
...
...
@@ -1937,6 +1948,9 @@ configure_emergency_numbers() {
}
generate_asterisk_config_files
()
{
local
line_contexts
local
line_features
WORK_DIR
=
$(
mktemp
-p
/tmp
-d
)
mkdir
-p
$ASTERISK_CONF_DIR
...
...
@@ -2008,6 +2022,7 @@ generate_asterisk_config_files() {
# Dialplan
echo
"Configuring extenstions"
configure_extensions
configure_extensions_outgoing_map
# SIP Provider
echo
"Configuring global SIP options"
...
...
This diff is collapsed.
Click to expand it.
George Yang (IOPSYS)
@georgeyang
mentioned in commit
051f3697
·
1 month ago
mentioned in commit
051f3697
mentioned in commit 051f36977299fe2cf6d839a5ead7cfb5b612b759
Toggle commit list
George Yang (IOPSYS)
@georgeyang
mentioned in commit
7fe0df01
·
1 month ago
mentioned in commit
7fe0df01
mentioned in commit 7fe0df01b5b2315c4644e6f865539c21c0c6601e
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment