[asterisk-commits] mjordan: trunk r412697 - in /trunk: ./ apps/app_sms.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Apr 18 20:31:32 CDT 2014


Author: mjordan
Date: Fri Apr 18 20:31:27 2014
New Revision: 412697

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=412697
Log:
app_sms: Fix uninitialized values; hangup channel when REL is sent successfully

This patch fixes two issues in app_sms:
(1) Firstly, the 'flags' field on the stack in sms_exec() is uninitialised,
    causing it to use the wrong protocol in some cases. This patch correctly
    initializes the flags fields.

(2) Secondly, when disconnect supervision is not working or
    inbanddisconnect=yes is set in chan_dahdi.conf, app_sms was failing to
    terminate the call after it sent the REL(ease) message and the peer stopped
    talking to it. This patch fixes the code to handle the 'bad stop bit'
    message more gracefully in that case, and hang up the call.

Review: https://reviewboard.asterisk.org/r/1392/

ASTERISK-18331 #close
Reported by: David Woodhouse
patches:
  asterisk-fix-sms.patch uploaded by David Woodhouse (License 5754)
........

Merged revisions 412655 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 412656 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 412657 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/apps/app_sms.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Modified: trunk/apps/app_sms.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_sms.c?view=diff&rev=412697&r1=412696&r2=412697
==============================================================================
--- trunk/apps/app_sms.c (original)
+++ trunk/apps/app_sms.c Fri Apr 18 20:31:27 2014
@@ -216,6 +216,7 @@
 typedef struct sms_s {
 	unsigned char hangup;        /*!< we are done... */
 	unsigned char err;           /*!< set for any errors */
+	unsigned char sent_rel:1;     /*!< have sent REL message... */
 	unsigned char smsc:1;        /*!< we are SMSC */
 	unsigned char rx:1;          /*!< this is a received message */
 	char queue[30];              /*!< queue name */
@@ -1465,6 +1466,7 @@
 		} else {
 			h->omsg[0] = 0x94;              /* SMS_REL */
 			h->omsg[1] = 0;
+			h->sent_rel = 1;
 		}
 	}
 	sms_messagetx(h);
@@ -1802,8 +1804,12 @@
 				h->iphasep -= 80;
 				if (h->ibitn++ == 9) {      /* end of byte */
 					if (!bit) {             /* bad stop bit */
-						ast_log(LOG_NOTICE, "bad stop bit\n");
-						h->ierr = 0xFF;     /* unknown error */
+						if (h->sent_rel) {
+							h->hangup = 1;
+						} else {
+							ast_log(LOG_NOTICE, "Bad stop bit\n");
+							h->ierr = 0xFF;     /* unknown error */
+						}
 					} else {
 						if (h->ibytep < sizeof(h->imsg)) {
 							h->imsg[h->ibytep] = h->ibytev;
@@ -1865,7 +1871,7 @@
 	int res = -1;
 	sms_t h = { 0 };
 	/* argument parsing support */
-	struct ast_flags flags;
+	struct ast_flags flags = { 0 };
 	char *parse, *sms_opts[OPTION_ARG_ARRAY_SIZE] = { 0, };
 	char *p;
 	AST_DECLARE_APP_ARGS(sms_args,




More information about the asterisk-commits mailing list