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
b3a97a85
Commit
b3a97a85
authored
6 years ago
by
George Joseph
Committed by
Gerrit Code Review
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge "func_periodic_hook.c: Cleanup module resources on failure."
parents
4f3b7e08
c6c3a636
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
funcs/func_periodic_hook.c
+15
-10
15 additions, 10 deletions
funcs/func_periodic_hook.c
with
15 additions
and
10 deletions
funcs/func_periodic_hook.c
+
15
−
10
View file @
b3a97a85
...
...
@@ -446,7 +446,8 @@ static int unload_module(void)
{
ast_context_destroy
(
NULL
,
AST_MODULE
);
return
ast_custom_function_unregister
(
&
hook_function
);
ast_custom_function_unregister
(
&
hook_function
);
return
0
;
}
static
int
load_module
(
void
)
...
...
@@ -461,32 +462,36 @@ static int load_module(void)
/*
* Based on a handy recipe from the Asterisk Cookbook.
*/
ast_add_extension
(
context_name
,
1
,
exten_name
,
1
,
""
,
""
,
res
=
ast_add_extension
(
context_name
,
1
,
exten_name
,
1
,
""
,
""
,
"Set"
,
"EncodedChannel=${CUT(HOOK_CHANNEL,-,1-2)}"
,
NULL
,
AST_MODULE
);
ast_add_extension
(
context_name
,
1
,
exten_name
,
2
,
""
,
""
,
res
|=
ast_add_extension
(
context_name
,
1
,
exten_name
,
2
,
""
,
""
,
"Set"
,
"GROUP_NAME=${EncodedChannel}${HOOK_ID}"
,
NULL
,
AST_MODULE
);
ast_add_extension
(
context_name
,
1
,
exten_name
,
3
,
""
,
""
,
res
|=
ast_add_extension
(
context_name
,
1
,
exten_name
,
3
,
""
,
""
,
"Set"
,
"GROUP(periodic-hook)=${GROUP_NAME}"
,
NULL
,
AST_MODULE
);
ast_add_extension
(
context_name
,
1
,
exten_name
,
4
,
""
,
""
,
"ExecIf"
,
res
|=
ast_add_extension
(
context_name
,
1
,
exten_name
,
4
,
""
,
""
,
"ExecIf"
,
"$[${GROUP_COUNT(${GROUP_NAME}@periodic-hook)} > 1]?Hangup()"
,
NULL
,
AST_MODULE
);
ast_add_extension
(
context_name
,
1
,
exten_name
,
5
,
""
,
""
,
res
|=
ast_add_extension
(
context_name
,
1
,
exten_name
,
5
,
""
,
""
,
"Set"
,
"ChannelToSpy=${URIDECODE(${EncodedChannel})}"
,
NULL
,
AST_MODULE
);
ast_add_extension
(
context_name
,
1
,
exten_name
,
6
,
""
,
""
,
res
|=
ast_add_extension
(
context_name
,
1
,
exten_name
,
6
,
""
,
""
,
"ChanSpy"
,
"${ChannelToSpy},qEB"
,
NULL
,
AST_MODULE
);
res
=
ast_add_extension
(
context_name
,
1
,
beep_exten
,
1
,
""
,
""
,
res
|
=
ast_add_extension
(
context_name
,
1
,
beep_exten
,
1
,
""
,
""
,
"Answer"
,
""
,
NULL
,
AST_MODULE
);
res
|=
ast_add_extension
(
context_name
,
1
,
beep_exten
,
2
,
""
,
""
,
"Playback"
,
"beep"
,
NULL
,
AST_MODULE
);
res
=
ast_custom_function_register_escalating
(
&
hook_function
,
AST_CFE_BOTH
);
res
|
=
ast_custom_function_register_escalating
(
&
hook_function
,
AST_CFE_BOTH
);
return
res
?
AST_MODULE_LOAD_DECLINE
:
AST_MODULE_LOAD_SUCCESS
;
if
(
res
)
{
unload_module
();
return
AST_MODULE_LOAD_DECLINE
;
}
return
AST_MODULE_LOAD_SUCCESS
;
}
int
AST_OPTIONAL_API_NAME
(
ast_beep_start
)(
struct
ast_channel
*
chan
,
...
...
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