Modified: freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen_protocol.cpp (16150 => 16151)
--- freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen_protocol.cpp 2010-01-05 11:33:17 UTC (rev 16150)
+++ freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen_protocol.cpp 2010-01-05 12:04:32 UTC (rev 16151)
@@ -496,7 +496,6 @@
{
usleep(10000); /* 10msec */
time(&tech_pvt->gsmopen_serial_synced_timestamp);
- WARNINGA("CUCU = %ld \n", GSMOPEN_P_LOG, tech_pvt->gsmopen_serial_synced_timestamp);
return 0;
}
int gsmopen_serial_read_AT(private_t * tech_pvt, int look_for_ack, int timeout_usec, int timeout_sec, const char *expected_string, int expect_crlf)
@@ -1405,7 +1404,7 @@
memset(sms_body, '\0', sizeof(sms_body));
if (strncmp(tech_pvt->line_array.result[i], "+CMGR", 5) == 0) { /* we are reading the "header" of an SMS */
-#if 0
+#if 1
char content[512];
char content2[512];
@@ -1422,16 +1421,16 @@
if (tech_pvt->line_array.result[i][c] == ',' && tech_pvt->line_array.result[i][c - 1] != '\\' && inside_quote == 0) {
if (inside_comma) {
inside_comma = 0;
- //NOTICA("inside_comma=%d, inside_quote=%d, we're at=%s\n", GSMOPEN_P_LOG, inside_comma, inside_quote, &tech_pvt->line_array.result[i][c]);
+ NOTICA("inside_comma=%d, inside_quote=%d, we're at=%s\n", GSMOPEN_P_LOG, inside_comma, inside_quote, &tech_pvt->line_array.result[i][c]);
} else {
inside_comma = 1;
- //NOTICA("inside_comma=%d, inside_quote=%d, we're at=%s\n", GSMOPEN_P_LOG, inside_comma, inside_quote, &tech_pvt->line_array.result[i][c]);
+ NOTICA("inside_comma=%d, inside_quote=%d, we're at=%s\n", GSMOPEN_P_LOG, inside_comma, inside_quote, &tech_pvt->line_array.result[i][c]);
}
}
if (tech_pvt->line_array.result[i][c] == '"' && tech_pvt->line_array.result[i][c - 1] != '\\') {
if (inside_quote) {
inside_quote = 0;
- //ERRORA("END_CONTENT inside_comma=%d, inside_quote=%d, we're at=%s\n", GSMOPEN_P_LOG, inside_comma, inside_quote, &tech_pvt->line_array.result[i][c]);
+ NOTICA("END_CONTENT inside_comma=%d, inside_quote=%d, we're at=%s\n", GSMOPEN_P_LOG, inside_comma, inside_quote, &tech_pvt->line_array.result[i][c]);
DEBUGA_GSMOPEN("%d content=%s\n", GSMOPEN_P_LOG, which_field, content);
//strncat(tech_pvt->sms_message, "---", ((sizeof(tech_pvt->sms_message) - strlen(tech_pvt->sms_message)) - 1));
@@ -1440,11 +1439,16 @@
memset(content2, '\0', sizeof(content2));
if (which_field == 1) {
- err = ucs2_to_utf8(tech_pvt, content, content2, sizeof(content2));
+ //FIXME why this? err = ucs2_to_utf8(tech_pvt, content, content2, sizeof(content2));
+ //err = ucs2_to_utf8(tech_pvt, content, content2, sizeof(content2));
+ err = 0;
+ strncpy(content2, content, sizeof(content2));
} else {
err = 0;
strncpy(content2, content, sizeof(content2));
}
+ DEBUGA_GSMOPEN("%d content2=%s\n", GSMOPEN_P_LOG, which_field, content2);
+ DEBUGA_GSMOPEN("%d content=%s\n", GSMOPEN_P_LOG, which_field, content2);
//strncat(tech_pvt->sms_message, "---", ((sizeof(tech_pvt->sms_message) - strlen(tech_pvt->sms_message)) - 1));
//if (!err)
@@ -1454,16 +1458,18 @@
d = 0;
if (which_field == 1) {
strncpy(tech_pvt->sms_sender, content2, sizeof(tech_pvt->sms_sender));
+ DEBUGA_GSMOPEN("%d content=%s\n", GSMOPEN_P_LOG, which_field, content2);
} else if (which_field == 2) {
strncpy(tech_pvt->sms_date, content2, sizeof(tech_pvt->sms_date));
+ DEBUGA_GSMOPEN("%d content=%s\n", GSMOPEN_P_LOG, which_field, content2);
} else if (which_field > 2) {
WARNINGA("WHY which_field is > 2 ? (which_field is %d)\n", GSMOPEN_P_LOG, which_field);
}
which_field++;
} else {
inside_quote = 1;
- //WARNINGA("START_CONTENT inside_comma=%d, inside_quote=%d, we're at=%s\n", GSMOPEN_P_LOG, inside_comma, inside_quote, &tech_pvt->line_array.result[i][c]);
+ WARNINGA("START_CONTENT inside_comma=%d, inside_quote=%d, we're at=%s\n", GSMOPEN_P_LOG, inside_comma, inside_quote, &tech_pvt->line_array.result[i][c]);
}
}
if (inside_quote && tech_pvt->line_array.result[i][c] != '"') {
@@ -1479,7 +1485,6 @@
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]);
- strncpy(tech_pvt->sms_body, tech_pvt->line_array.result[i], sizeof(tech_pvt->sms_body));
strncpy(tech_pvt->sms_message, tech_pvt->line_array.result[i], sizeof(tech_pvt->sms_message));
char content3[1000];
@@ -1489,8 +1494,11 @@
WARNINGA("sms_message=%s\n", GSMOPEN_P_LOG, tech_pvt->sms_message);
ucs2_to_utf8(tech_pvt, tech_pvt->sms_message, content3, sizeof(content3));
WARNINGA("content3=%s\n", GSMOPEN_P_LOG, content3);
+ strncpy(tech_pvt->sms_body, content3, sizeof(tech_pvt->sms_body));
//sleep(10);
//cicopet
+ sms_incoming(tech_pvt);
+ WARNINGA("2 content3=%s\n", GSMOPEN_P_LOG, content3);
SMSMessageRef sms;
char content2[1000];
//MessageType messagetype;