--- chan_mobile.orig.c 2007-12-14 19:20:03.000000000 -0800 +++ chan_mobile.c 2007-12-15 21:33:40.000000000 -0800 @@ -120,6 +120,7 @@ bdaddr_t addr; /* adddress of adapter */ unsigned int inuse:1; /* are we in use ? */ unsigned int alignment_detection:1; /* do alignment detection on this adpater? */ + unsigned int disablesms:1; /* disable sms functionality */ int sco_socket; AST_LIST_ENTRY(adapter_pvt) entry; }; @@ -1390,13 +1391,19 @@ } break; case MBL_STATE_INIT4: - if (strstr(buf, "OK")) { - rfcomm_write(pvt, "AT+CMGF=1\r"); - pvt->state++; + if (strstr(buf, "OK")) { + if (!pvt->adapter->disablesms) { + pvt->has_sms = 0; + pvt->state = MBL_STATE_PREIDLE; + } else { + rfcomm_write(pvt, "AT+CMGF=1\r"); + pvt->state++; + } } break; case MBL_STATE_INIT5: if (strstr(buf, "ERROR")) { /* No SMS Support ! */ + pvt->has_sms = 0; pvt->state = MBL_STATE_PREIDLE; } else if (strstr(buf, "OK")) { rfcomm_write(pvt, "AT+CNMI=2,1,0,1,0\r"); @@ -1867,7 +1874,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, *disablesms; struct mbl_pvt *pvt; struct adapter_pvt *adapter; uint16_t vs; @@ -1892,6 +1899,7 @@ address = ast_variable_retrieve(cfg, cat, "address"); master = ast_variable_retrieve(cfg, cat, "forcemaster"); aligndetect = ast_variable_retrieve(cfg, cat, "alignmentdetection"); + disablesms = ast_variable_retrieve(cfg, cat, "disablesms"); ast_debug(1, "Loading adapter %s %s.\n", id, address); if (!ast_strlen_zero(id) && !ast_strlen_zero(address)) { if ((adapter = ast_calloc(1, sizeof(*adapter)))) { @@ -1901,6 +1909,10 @@ if (*aligndetect == 'Y' || *aligndetect == 'y') adapter->alignment_detection = 1; } + if (!ast_strlen_zero(disablesms)) { + if (*disablesms == 'Y' || *disablesms == 'y') + adapter->disablesms = 1; + } adapter->dev_id = hci_devid(address); adapter->hci_socket = hci_open_dev(adapter->dev_id); if (adapter->dev_id < 0 || adapter->hci_socket < 0) {