[asterisk-commits] mnicholson: trunk r209993 - in /trunk: addons/ configs/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Aug 3 09:01:44 CDT 2009


Author: mnicholson
Date: Mon Aug  3 09:01:39 2009
New Revision: 209993

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=209993
Log:
Add an 'sms' option to mobile.conf to manually enable or disable SMS support.

(closes issue #15071)
Reported by: ughnz
Patches:
      optional-sms1.diff uploaded by mnicholson (license 96)
Tested by: ughnz, mnicholson

Modified:
    trunk/addons/chan_mobile.c
    trunk/configs/chan_mobile.conf.sample

Modified: trunk/addons/chan_mobile.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/addons/chan_mobile.c?view=diff&rev=209993&r1=209992&r2=209993
==============================================================================
--- trunk/addons/chan_mobile.c (original)
+++ trunk/addons/chan_mobile.c Mon Aug  3 09:01:39 2009
@@ -3082,9 +3082,11 @@
 			ast_debug(1, "[%s] volume level synchronization successful\n", pvt->id);
 
 			/* set the SMS operating mode to text mode */
-			if (hfp_send_cmgf(pvt->hfp, 1) || msg_queue_push(pvt, AT_OK, AT_CMGF)) {
-				ast_debug(1, "[%s] error setting CMGF\n", pvt->id);
-				goto e_return;
+			if (pvt->has_sms) {
+				if (hfp_send_cmgf(pvt->hfp, 1) || msg_queue_push(pvt, AT_OK, AT_CMGF)) {
+					ast_debug(1, "[%s] error setting CMGF\n", pvt->id);
+					goto e_return;
+				}
 			}
 			break;
 		case AT_CMGF:
@@ -3192,10 +3194,12 @@
 			}
 			break;
 		case AT_CMGF:
+			pvt->has_sms = 0;
 			ast_debug(1, "[%s] error setting CMGF\n", pvt->id);
 			ast_debug(1, "[%s] no SMS support\n", pvt->id);
 			break;
 		case AT_CNMI:
+			pvt->has_sms = 0;
 			ast_debug(1, "[%s] error setting CNMI\n", pvt->id);
 			ast_debug(1, "[%s] no SMS support\n", pvt->id);
 			break;
@@ -4157,6 +4161,7 @@
 	pvt->sco_socket = -1;
 	pvt->monitor_thread = AST_PTHREADT_NULL;
 	pvt->ring_sched_id = -1;
+	pvt->has_sms = 1;
 
 	/* setup the smoother */
 	if (!(pvt->smoother = ast_smoother_new(DEVICE_FRAME_SIZE))) {
@@ -4190,6 +4195,8 @@
 		} else if (!strcasecmp(v->name, "group")) {
 			/* group is set to 0 if invalid */
 			pvt->group = atoi(v->value);
+		} else if (!strcasecmp(v->name, "sms")) {
+			pvt->has_sms = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "nocallsetup")) {
 			pvt->no_callsetup = ast_true(v->value);
 
@@ -4197,6 +4204,7 @@
 				ast_debug(1, "Setting nocallsetup mode for device %s.\n", pvt->id);
 		} else if (!strcasecmp(v->name, "blackberry")) {
 			pvt->blackberry = ast_true(v->value);
+			pvt->has_sms = 0;
 		}
 	}
 
@@ -4209,6 +4217,8 @@
 		pvt->hfp->owner = pvt;
 		pvt->hfp->rport = pvt->rfcomm_port;
 		pvt->hfp->nocallsetup = pvt->no_callsetup;
+	} else {
+		pvt->has_sms = 0;
 	}
 
 	AST_RWLIST_WRLOCK(&devices);

Modified: trunk/configs/chan_mobile.conf.sample
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/configs/chan_mobile.conf.sample?view=diff&rev=209993&r1=209992&r2=209993
==============================================================================
--- trunk/configs/chan_mobile.conf.sample (original)
+++ trunk/configs/chan_mobile.conf.sample Mon Aug  3 09:01:39 2009
@@ -38,6 +38,7 @@
 context=incoming-mobile		; dialplan context for incoming calls
 adapter=dlink			; adapter to use
 group=1				; this phone is in channel group 1
+;sms=no				; support SMS, defaults to yes
 ;nocallsetup=yes		; set this only if your phone reports that it supports call progress notification, but does not do it. Motorola L6 for example.
 
 [blackberry]




More information about the asterisk-commits mailing list