timeout_in_msec = (timeout_sec * 1000) + (timeout_usec ? (timeout_usec / 1000) : 0);
if (timeout_in_msec != 100)
- ERRORA("TIMEOUT=%d\n", GSMOPEN_P_LOG, timeout_in_msec);
+ DEBUGA_GSMOPEN("TIMEOUT=%d\n", GSMOPEN_P_LOG, timeout_in_msec);
if (!running || !tech_pvt->running) {
return -1;
tech_pvt->line_array.result[i], tech_pvt->callid_name, tech_pvt->callid_number);
}
- if ((strncmp(tech_pvt->line_array.result[i], "+CMS ERROR:", 11) == 0)) {
- ERRORA("Received: \"%s\", what was this error about?\n", GSMOPEN_P_LOG);
- }
if ((strcmp(tech_pvt->line_array.result[i], "+CMS ERROR: 500") == 0)) {
- ERRORA("Received: \"%s\", maybe this account ran OUT OF CREDIT?\n", GSMOPEN_P_LOG);
+ ERRORA("Received: \"%s\", generic error, maybe this account ran OUT OF CREDIT?\n", GSMOPEN_P_LOG, tech_pvt->line_array.result[i]);
+ } else if ((strncmp(tech_pvt->line_array.result[i], "+CMS ERROR:", 11) == 0)) {
+ ERRORA("Received: \"%s\", what was this error about?\n", GSMOPEN_P_LOG, tech_pvt->line_array.result[i]);
}
if ((strcmp(tech_pvt->line_array.result[i], "BUSY") == 0)) {
tech_pvt->phone_callflow = CALLFLOW_CALL_LINEBUSY;
return -1;
}
- at_result = gsmopen_serial_read_AT(tech_pvt, 1, 500000, 5, NULL, 1); // 5.5 sec timeout
+ at_result = gsmopen_serial_read_AT(tech_pvt, 1, 500000, 20, NULL, 1); // 20.5 sec timeout
UNLOCKA(tech_pvt->controldev_lock);
POPPA_UNLOCKA(tech_pvt->controldev_lock);
if (hint == NULL || !strlen(hint)) { //FIXME FIXME FIXME
hint = from;
}
+ if (subject == NULL || !strlen(subject)) { //FIXME FIXME FIXME
+ subject = "SIMPLE MESSAGE";
+ }
if (to && (user = strdup(to))) {
if ((host = strchr(user, '@'))) {
*host++ = '\0';
//switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "chatname", tech_pvt->chatmessages[which].chatname);
//switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "id", tech_pvt->chatmessages[which].id);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "subject", "SIMPLE MESSAGE");
+/* mod_sms begin */
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to", tech_pvt->name);
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "hint", tech_pvt->name);
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_proto", GSMOPEN_CHAT_PROTO);
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_user", tech_pvt->sms_sender);
+ //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_host", "from_host");
+ //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_full", "from_full");
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_user", tech_pvt->name);
+ //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_host", "to_host");
+/* mod_sms end */
switch_event_add_body(event, "%s\n", tech_pvt->sms_body);
+ //switch_core_chat_send(GSMOPEN_CHAT_PROTO, event); /* mod_sms */
+ switch_core_chat_send("GLOBAL", event); /* mod_sms */
if (session) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "during-call", "true");
if (switch_core_session_queue_event(session, &event) != SWITCH_STATUS_SUCCESS) {