summaryrefslogtreecommitdiff
path: root/res/res_fax_spandsp.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2014-09-18 16:24:48 +0000
committerMark Michelson <mmichelson@digium.com>2014-09-18 16:24:48 +0000
commit389db2b720571a035d4bbee12a139003eeb7612d (patch)
treeea6e31171e4a273602f1c68cfc13f9346b924196 /res/res_fax_spandsp.c
parent79eac1ffcaa419a2c21c43dc9f1c26dda92594f9 (diff)
res_fax_spandsp: Properly handle cleanup before starting FAXes.
If faxing fails at a very early stage, then it is possible for us to pass a NULL t30 state pointer to spandsp, which spandsp is none too pleased with. This patch ensures that we pass the correct pointer to spandsp in the situation where we have not yet set our local t30 state pointer. ASTERISK-24301 #close Reported by Matt Jordan Patches: ASTERISK-24301-fax.diff Uploaded by Mark Michelson (License #5049) ........ Merged revisions 423360 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 423365 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 423372 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@423380 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_fax_spandsp.c')
-rw-r--r--res/res_fax_spandsp.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/res/res_fax_spandsp.c b/res/res_fax_spandsp.c
index 698530a13..b56de939f 100644
--- a/res/res_fax_spandsp.c
+++ b/res/res_fax_spandsp.c
@@ -180,8 +180,25 @@ static void set_ecm(t30_state_t *t30_state, struct ast_fax_session_details *deta
static void session_destroy(struct spandsp_pvt *p)
{
struct ast_frame *f;
+ t30_state_t *t30_to_terminate;
- t30_terminate(p->t30_state);
+ if (p->t30_state) {
+ t30_to_terminate = p->t30_state;
+ } else if (p->ist38) {
+#if SPANDSP_RELEASE_DATE >= 20080725
+ t30_to_terminate = &p->t38_state.t30;
+#else
+ t30_to_terminate = &p->t38_state.t30_state;
+#endif
+ } else {
+#if SPANDSP_RELEASE_DATE >= 20080725
+ t30_to_terminate = &p->fax_state.t30;
+#else
+ t30_to_terminate = &p->fax_state.t30_state;
+#endif
+ }
+
+ t30_terminate(t30_to_terminate);
p->isdone = 1;
ast_timer_close(p->timer);