Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
asterisk
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
Voice
asterisk
Commits
783122ec
Commit
783122ec
authored
6 years ago
by
Joshua C. Colp
Committed by
Gerrit Code Review
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge "res_musiconhold: Remove redundant option parsing"
parents
b0db1843
825ea9dd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
res/res_musiconhold.c
+19
-43
19 additions, 43 deletions
res/res_musiconhold.c
with
19 additions
and
43 deletions
res/res_musiconhold.c
+
19
−
43
View file @
783122ec
...
...
@@ -1088,6 +1088,9 @@ static void moh_parse_options(struct ast_variable *var, struct mohclass *mohclas
ast_copy_string
(
mohclass
->
dir
,
var
->
value
,
sizeof
(
mohclass
->
dir
));
}
else
if
(
!
strcasecmp
(
var
->
name
,
"application"
))
{
ast_copy_string
(
mohclass
->
args
,
var
->
value
,
sizeof
(
mohclass
->
args
));
}
else
if
(
!
strcasecmp
(
var
->
name
,
"announcement"
))
{
ast_copy_string
(
mohclass
->
announcement
,
var
->
value
,
sizeof
(
mohclass
->
announcement
));
ast_set_flag
(
mohclass
,
MOH_ANNOUNCEMENT
);
}
else
if
(
!
strcasecmp
(
var
->
name
,
"digit"
)
&&
(
isdigit
(
*
var
->
value
)
||
strchr
(
"*#"
,
*
var
->
value
)))
{
mohclass
->
digit
=
*
var
->
value
;
}
else
if
(
!
strcasecmp
(
var
->
name
,
"random"
))
{
...
...
@@ -1112,6 +1115,22 @@ static void moh_parse_options(struct ast_variable *var, struct mohclass *mohclas
ast_log
(
LOG_WARNING
,
"Unknown format '%s' -- defaulting to SLIN
\n
"
,
var
->
value
);
mohclass
->
format
=
ao2_bump
(
ast_format_slin
);
}
}
else
if
(
!
strcasecmp
(
var
->
name
,
"kill_escalation_delay"
))
{
if
(
sscanf
(
var
->
value
,
"%zu"
,
&
mohclass
->
kill_delay
)
==
1
)
{
mohclass
->
kill_delay
*=
1000
;
}
else
{
ast_log
(
LOG_WARNING
,
"kill_escalation_delay '%s' is invalid. Setting to 100ms
\n
"
,
var
->
value
);
mohclass
->
kill_delay
=
100000
;
}
}
else
if
(
!
strcasecmp
(
var
->
name
,
"kill_method"
))
{
if
(
!
strcasecmp
(
var
->
value
,
"process"
))
{
mohclass
->
kill_method
=
KILL_METHOD_PROCESS
;
}
else
if
(
!
strcasecmp
(
var
->
value
,
"process_group"
))
{
mohclass
->
kill_method
=
KILL_METHOD_PROCESS_GROUP
;
}
else
{
ast_log
(
LOG_WARNING
,
"kill_method '%s' is invalid. Setting to 'process_group'
\n
"
,
var
->
value
);
mohclass
->
kill_method
=
KILL_METHOD_PROCESS_GROUP
;
}
}
}
}
...
...
@@ -1778,49 +1797,6 @@ static int load_moh_classes(int reload)
/* For compatibility with the past, we overwrite any name=name
* with the context [name]. */
ast_copy_string
(
class
->
name
,
cat
,
sizeof
(
class
->
name
));
for
(
var
=
ast_variable_browse
(
cfg
,
cat
);
var
;
var
=
var
->
next
)
{
if
(
!
strcasecmp
(
var
->
name
,
"mode"
))
{
ast_copy_string
(
class
->
mode
,
var
->
value
,
sizeof
(
class
->
mode
));
}
else
if
(
!
strcasecmp
(
var
->
name
,
"directory"
))
{
ast_copy_string
(
class
->
dir
,
var
->
value
,
sizeof
(
class
->
dir
));
}
else
if
(
!
strcasecmp
(
var
->
name
,
"application"
))
{
ast_copy_string
(
class
->
args
,
var
->
value
,
sizeof
(
class
->
args
));
}
else
if
(
!
strcasecmp
(
var
->
name
,
"announcement"
))
{
ast_copy_string
(
class
->
announcement
,
var
->
value
,
sizeof
(
class
->
announcement
));
ast_set_flag
(
class
,
MOH_ANNOUNCEMENT
);
}
else
if
(
!
strcasecmp
(
var
->
name
,
"digit"
)
&&
(
isdigit
(
*
var
->
value
)
||
strchr
(
"*#"
,
*
var
->
value
)))
{
class
->
digit
=
*
var
->
value
;
}
else
if
(
!
strcasecmp
(
var
->
name
,
"random"
))
{
ast_set2_flag
(
class
,
ast_true
(
var
->
value
),
MOH_RANDOMIZE
);
}
else
if
(
!
strcasecmp
(
var
->
name
,
"sort"
)
&&
!
strcasecmp
(
var
->
value
,
"random"
))
{
ast_set_flag
(
class
,
MOH_RANDOMIZE
);
}
else
if
(
!
strcasecmp
(
var
->
name
,
"sort"
)
&&
!
strcasecmp
(
var
->
value
,
"alpha"
))
{
ast_set_flag
(
class
,
MOH_SORTALPHA
);
}
else
if
(
!
strcasecmp
(
var
->
name
,
"format"
))
{
ao2_cleanup
(
class
->
format
);
class
->
format
=
ast_format_cache_get
(
var
->
value
);
if
(
!
class
->
format
)
{
ast_log
(
LOG_WARNING
,
"Unknown format '%s' -- defaulting to SLIN
\n
"
,
var
->
value
);
class
->
format
=
ao2_bump
(
ast_format_slin
);
}
}
else
if
(
!
strcasecmp
(
var
->
name
,
"kill_escalation_delay"
))
{
if
(
sscanf
(
var
->
value
,
"%zu"
,
&
class
->
kill_delay
)
==
1
)
{
class
->
kill_delay
*=
1000
;
}
else
{
ast_log
(
LOG_WARNING
,
"kill_escalation_delay '%s' is invalid. Setting to 100ms
\n
"
,
var
->
value
);
class
->
kill_delay
=
100000
;
}
}
else
if
(
!
strcasecmp
(
var
->
name
,
"kill_method"
))
{
if
(
!
strcasecmp
(
var
->
value
,
"process"
))
{
class
->
kill_method
=
KILL_METHOD_PROCESS
;
}
else
if
(
!
strcasecmp
(
var
->
value
,
"process_group"
)){
class
->
kill_method
=
KILL_METHOD_PROCESS_GROUP
;
}
else
{
ast_log
(
LOG_WARNING
,
"kill_method '%s' is invalid. Setting to 'process_group'
\n
"
,
var
->
value
);
class
->
kill_method
=
KILL_METHOD_PROCESS_GROUP
;
}
}
}
if
(
ast_strlen_zero
(
class
->
dir
))
{
if
(
!
strcasecmp
(
class
->
mode
,
"custom"
))
{
...
...
This diff is collapsed.
Click to expand it.
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