aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authormnicholson <mnicholson@f38db490-d61c-443f-a65b-d21fe96a405b>2011-06-10 19:22:48 +0000
committermnicholson <mnicholson@f38db490-d61c-443f-a65b-d21fe96a405b>2011-06-10 19:22:48 +0000
commit5d51450aa480550934ce53afad8d5757d4f31a0d (patch)
treedf72ecbb7cbd155e60f5b7825828111d9b2c2972 /channels
parent75c5da7d90fc94df051d00792e9ec0b8a07b03bb (diff)
Merged revisions 323040 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r323040 | mnicholson | 2011-06-10 14:20:41 -0500 (Fri, 10 Jun 2011) | 5 lines Unlock the sip channel during fax detection like chan_dahdi does to prevent a deadlock with ast_autoservice_stop. (closes issue ASTERISK-17798) tested by mnicholson ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@323041 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 30125bb2c..cb9b8b26a 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -7275,12 +7275,19 @@ static struct ast_frame *sip_read(struct ast_channel *ast)
/* If we detect a CNG tone and fax detection is enabled then send us off to the fax extension */
if (faxdetected && ast_test_flag(&p->flags[1], SIP_PAGE2_FAX_DETECT_CNG)) {
- ast_channel_lock(ast);
if (strcmp(ast->exten, "fax")) {
const char *target_context = S_OR(ast->macrocontext, ast->context);
+ /* We need to unlock 'ast' here because
+ * ast_exists_extension has the potential to start and
+ * stop an autoservice on the channel. Such action is
+ * prone to deadlock if the channel is locked.
+ */
+ sip_pvt_unlock(p);
ast_channel_unlock(ast);
if (ast_exists_extension(ast, target_context, "fax", 1,
S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, NULL))) {
+ ast_channel_lock(ast);
+ sip_pvt_lock(p);
ast_verbose(VERBOSE_PREFIX_2 "Redirecting '%s' to fax extension due to CNG detection\n", ast->name);
pbx_builtin_setvar_helper(ast, "FAXEXTEN", ast->exten);
if (ast_async_goto(ast, target_context, "fax", 1)) {
@@ -7288,10 +7295,10 @@ static struct ast_frame *sip_read(struct ast_channel *ast)
}
fr = &ast_null_frame;
} else {
+ ast_channel_lock(ast);
+ sip_pvt_lock(p);
ast_log(LOG_NOTICE, "FAX CNG detected but no fax extension\n");
}
- } else {
- ast_channel_unlock(ast);
}
}