[asterisk-addons-commits] mnicholson: trunk r725 - /trunk/channels/chan_mobile.c

SVN commits to the Asterisk addons project asterisk-addons-commits at lists.digium.com
Wed Jan 21 12:09:45 CST 2009


Author: mnicholson
Date: Wed Jan 21 12:09:44 2009
New Revision: 725

URL: http://svn.digium.com/svn-view/asterisk-addons?view=rev&rev=725
Log:
Add a 'blackberry' option for devices in chan_mobile to support blackberry
devices' non standard HFP behavior.

(closes issue #13744)
Reported by: ciaranm
Tested by: ciaranm, davidste, mnicholson, jongerenchaos

Modified:
    trunk/channels/chan_mobile.c

Modified: trunk/channels/chan_mobile.c
URL: http://svn.digium.com/svn-view/asterisk-addons/trunk/channels/chan_mobile.c?view=diff&rev=725&r1=724&r2=725
==============================================================================
--- trunk/channels/chan_mobile.c (original)
+++ trunk/channels/chan_mobile.c Wed Jan 21 12:09:44 2009
@@ -160,6 +160,7 @@
 	unsigned int do_alignment_detection:1;
 	unsigned int alignment_detection_triggered:1;
 	unsigned int do_hangup:1;
+	unsigned int blackberry:1;
 	short alignment_samples[4];
 	int alignment_count;
 	char sms_txt[160];
@@ -1350,8 +1351,13 @@
 					pvt->state++;
 					nsmode = 1;
 				} else if (strstr(buf, "OK") && brsf) {
-					rfcomm_write(pvt, "AT+CIND=?\r");
-					pvt->state++;
+					if (pvt->blackberry) {
+						rfcomm_write(pvt, "AT+CMER=3,0,0,1\r");
+						pvt->state = MBL_STATE_INIT3;
+					} else {
+						rfcomm_write(pvt, "AT+CIND=?\r");
+						pvt->state++;
+					}
 				}
 				break;
 			case MBL_STATE_INIT1:
@@ -1396,14 +1402,24 @@
 						monitor = 0;
 					}
 				} else if (strstr(buf, "OK")) {
-					rfcomm_write(pvt, "AT+CMER=3,0,0,1\r");
-					pvt->state++;
+					if (pvt->blackberry) {
+						rfcomm_write(pvt, "AT+CLIP=1\r");
+						pvt->state = MBL_STATE_INIT4;
+					} else {
+						rfcomm_write(pvt, "AT+CMER=3,0,0,1\r");
+						pvt->state++;
+					}
 				}
 				break;
 			case MBL_STATE_INIT3:
 				if (strstr(buf, "OK")) {
-					rfcomm_write(pvt, "AT+CLIP=1\r");
-					pvt->state++;
+					if (pvt->blackberry) {
+						rfcomm_write(pvt, "AT+CIND=?\r");
+						pvt->state = MBL_STATE_INIT1;
+					} else {
+						rfcomm_write(pvt, "AT+CLIP=1\r");
+						pvt->state++;
+					}
 				}
 				break;
 			case MBL_STATE_INIT4:
@@ -1896,7 +1912,7 @@
 	struct ast_config *cfg = NULL;
 	char *cat = NULL;
 	struct ast_variable *var;
-	const char *id, *address, *useadapter, *port, *context, *type, *skip, *group, *master, *nocallsetup, *aligndetect;
+	const char *id, *address, *useadapter, *port, *context, *type, *skip, *group, *master, *nocallsetup, *aligndetect, *blackberry;
 	struct mbl_pvt *pvt;
 	struct adapter_pvt *adapter;
 	uint16_t vs;
@@ -1983,6 +1999,7 @@
 			skip = ast_variable_retrieve(cfg, cat, "dtmfskip");
 			group = ast_variable_retrieve(cfg, cat, "group");
 			nocallsetup = ast_variable_retrieve(cfg, cat, "nocallsetup");
+			blackberry = ast_variable_retrieve(cfg, cat, "blackberry");
 			if (!ast_strlen_zero(address) && !ast_strlen_zero(port) && !ast_strlen_zero(useadapter)) {
 				/* find the adapter */
 				AST_RWLIST_RDLOCK(&adapters);
@@ -2000,6 +2017,10 @@
 						pvt->type = MBL_TYPE_HEADSET;
 					else
 						pvt->type = MBL_TYPE_PHONE;
+
+					if (blackberry)
+						pvt->blackberry = ast_true(blackberry);
+
 					ast_copy_string(pvt->id, cat, sizeof(pvt->id));
 					str2ba(address, &pvt->addr);
 					ast_copy_string(pvt->context, S_OR(context, "default"), sizeof(pvt->context));




More information about the asterisk-addons-commits mailing list