Modified: freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen_protocol.cpp (16152 => 16153)
--- freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen_protocol.cpp 2010-01-05 14:04:56 UTC (rev 16152)
+++ freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen_protocol.cpp 2010-01-05 15:44:53 UTC (rev 16153)
@@ -346,10 +346,13 @@
if (res) {
DEBUGA_GSMOPEN("AT+CMGF? failed, continue\n", GSMOPEN_P_LOG);
}
- res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CMGF=1"); //TODO: support phones that only accept pdu mode
+ res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CMGF=0");
if (res) {
- ERRORA("Error setting SMS sending mode to PDU on the cellphone\n", GSMOPEN_P_LOG);
- return RESULT_FAILURE;
+ ERRORA("Error setting SMS sending mode to PDU on the cellphone, falling back to TEXT mode. Continuing\n", GSMOPEN_P_LOG);
+ res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CMGF=1");
+ if (res) {
+ ERRORA("Error setting SMS sending mode to TEXT on the cellphone, let's hope is TEXT by default. Continuing\n", GSMOPEN_P_LOG);
+ }
}
/* what is the Charset of SMSs? */
res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CSCS?");
@@ -1485,6 +1488,7 @@
else {
DEBUGA_GSMOPEN("body=%s\n", GSMOPEN_P_LOG, sms_body);
DEBUGA_GSMOPEN("tech_pvt->line_array.result[i]=%s\n", GSMOPEN_P_LOG, tech_pvt->line_array.result[i]);
+ if (tech_pvt->sms_cnmi_not_supported) {
strncpy(tech_pvt->sms_message, tech_pvt->line_array.result[i], sizeof(tech_pvt->sms_message));
char content3[1000];
@@ -1499,6 +1503,7 @@
//cicopet
sms_incoming(tech_pvt);
WARNINGA("2 content3=%s\n", GSMOPEN_P_LOG, content3);
+ }else{
SMSMessageRef sms;
char content2[1000];
//MessageType messagetype;
@@ -1506,7 +1511,6 @@
//Timestamp servicecentretimestamp;
//Address sender_recipient_address;
-#ifdef NOTDEF_GSMLIB
sms = SMSMessage::decode(tech_pvt->line_array.result[i]); // dataCodingScheme = 8 , text=ciao 123 belè новости לק ראת ﺎﻠﺠﻤﻋﺓ 人大
NOTICA("SMS=\n%s\n", GSMOPEN_P_LOG, sms->toString().c_str());
@@ -1544,9 +1548,8 @@
//servicecentretimestamp = sms->serviceCentreTimestamp();
//sender_recipient_address = sms->address();
-#endif //NOTDEF_GSMLIB
+ }
-
#if 0
//strncat(tech_pvt->sms_message, "---", ((sizeof(tech_pvt->sms_message) - strlen(tech_pvt->sms_message)) - 1));
//strncat(tech_pvt->sms_message, tech_pvt->line_array.result[i], ((sizeof(tech_pvt->sms_message) - strlen(tech_pvt->sms_message)) - 1));
@@ -3292,7 +3295,7 @@
res = gsmopen_serial_write_AT_ack(p, "AT+MMGL=\"HEADER ONLY\"");
if (res) {
WARNINGA
- ("%s does not get %s from the phone, probably a long msg is incoming. If it does not go away, and you cannot correctly receive SMSs from this interface, please manually clean all messages from the cellphone/SIM. Continuing.\n",
+ ("%s does not get %s from the phone. If your phone is not Motorola, please contact the gsmopen developers. Else, if your phone IS a Motorola, probably a long msg is incoming. If this happens repeatedly, and you cannot correctly receive SMSs from this interface, please manually clean all messages from the cellphone/SIM. Continuing.\n",
GSMOPEN_P_LOG, "AT+MMGL=\"HEADER ONLY\"", "OK");
} else {
usleep(1000);