Add patches to resolve a T38 fax-related deadlock researched by chris@

https://issues.asterisk.org/jira/secure/attachment/46850/fax-deadlock-v2.patch-11.3.0
This commit is contained in:
sthen 2013-03-28 21:25:17 +00:00
parent 24f01ef9d4
commit 11c49af0ad
3 changed files with 71 additions and 1 deletions

View File

@ -1,10 +1,11 @@
# $OpenBSD: Makefile,v 1.174 2013/03/28 20:24:53 sthen Exp $
# $OpenBSD: Makefile,v 1.175 2013/03/28 21:25:17 sthen Exp $
SHARED_ONLY= Yes
COMMENT-main= open source multi-protocol PBX and telephony toolkit
VER= 11.3.0
REVISION-main= 0
DISTNAME= asterisk-${VER:S/beta/-beta/:S/rc/-rc/}
PKGNAME-main= asterisk-${VER}

View File

@ -0,0 +1,36 @@
$OpenBSD: patch-channels_chan_sip_c,v 1.8 2013/03/28 21:25:17 sthen Exp $
https://issues.asterisk.org/jira/secure/attachment/46850/fax-deadlock-v2.patch-11.3.0
--- channels/chan_sip.c.orig Wed Mar 27 17:34:40 2013
+++ channels/chan_sip.c Thu Mar 28 21:05:05 2013
@@ -8402,8 +8402,6 @@ static struct ast_frame *sip_read(struct ast_channel *
ast_channel_unlock(ast);
if (ast_exists_extension(ast, target_context, "fax", 1,
S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, NULL))) {
- ast_channel_lock(ast);
- sip_pvt_lock(p);
ast_verb(2, "Redirecting '%s' to fax extension due to CNG detection\n", ast_channel_name(ast));
pbx_builtin_setvar_helper(ast, "FAXEXTEN", ast_channel_exten(ast));
if (ast_async_goto(ast, target_context, "fax", 1)) {
@@ -8412,10 +8410,10 @@ static struct ast_frame *sip_read(struct ast_channel *
ast_frfree(fr);
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");
}
+ ast_channel_lock(ast);
+ sip_pvt_lock(p);
}
}
@@ -10656,6 +10654,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_r
ast_channel_unlock(p->owner);
if (ast_exists_extension(p->owner, target_context, "fax", 1,
S_COR(ast_channel_caller(p->owner)->id.number.valid, ast_channel_caller(p->owner)->id.number.str, NULL))) {
+ ast_log(LOG_WARNING, "Usage of 'faxdetect=[yes|t38]' setting in sip.conf is not recommended. Please consider Set(FAXOPT(faxdetect)=[yes|t38]) instead.\n");
ast_verb(2, "Redirecting '%s' to fax extension due to peer T.38 re-INVITE\n", ast_channel_name(p->owner));
pbx_builtin_setvar_helper(p->owner, "FAXEXTEN", ast_channel_exten(p->owner));
if (ast_async_goto(p->owner, target_context, "fax", 1)) {

View File

@ -0,0 +1,33 @@
$OpenBSD: patch-res_res_fax_c,v 1.1 2013/03/28 21:25:17 sthen Exp $
https://issues.asterisk.org/jira/secure/attachment/46850/fax-deadlock-v2.patch-11.3.0
--- res/res_fax.c.orig Mon Dec 10 16:55:05 2012
+++ res/res_fax.c Thu Mar 28 21:05:05 2013
@@ -3387,10 +3387,13 @@ static struct ast_frame *fax_detect_framehook(struct a
switch (result) {
case 'f':
case 't':
+ if (!strcmp(ast_channel_exten(chan), "fax")) {
+ ast_debug(1, "Already in a fax extension, not redirecting\n");
+ break;
+ }
ast_channel_unlock(chan);
if (ast_exists_extension(chan, target_context, "fax", 1,
S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) {
- ast_channel_lock(chan);
ast_verb(2, "Redirecting '%s' to fax extension due to %s detection\n",
ast_channel_name(chan), (result == 'f') ? "CNG" : "T38");
pbx_builtin_setvar_helper(chan, "FAXEXTEN", ast_channel_exten(chan));
@@ -3400,10 +3403,10 @@ static struct ast_frame *fax_detect_framehook(struct a
ast_frfree(f);
f = &ast_null_frame;
} else {
- ast_channel_lock(chan);
ast_log(LOG_NOTICE, "FAX %s detected but no fax extension in context (%s)\n",
(result == 'f') ? "CNG" : "T38", target_context);
}
+ ast_channel_lock(chan);
}
ast_framehook_detach(chan, details->faxdetect_id);
details->faxdetect_id = -1;