gsmopen: mod_sms tweak
This commit is contained in:
parent
117582adca
commit
4101e6b2b7
|
@ -2978,6 +2978,7 @@ int sms_incoming(private_t *tech_pvt)
|
|||
DEBUGA_GSMOPEN("received SMS on interface %s: DATE=%s, SENDER=%s, BODY=%s|\n", GSMOPEN_P_LOG, tech_pvt->name, tech_pvt->sms_date, tech_pvt->sms_sender,
|
||||
tech_pvt->sms_body);
|
||||
|
||||
#ifdef NOTDEF
|
||||
if (!zstr(tech_pvt->session_uuid_str)) {
|
||||
session = switch_core_session_locate(tech_pvt->session_uuid_str);
|
||||
}
|
||||
|
@ -2993,7 +2994,6 @@ int sms_incoming(private_t *tech_pvt)
|
|||
//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);
|
||||
|
@ -3002,10 +3002,7 @@ int sms_incoming(private_t *tech_pvt)
|
|||
//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) {
|
||||
|
@ -3052,6 +3049,38 @@ int sms_incoming(private_t *tech_pvt)
|
|||
if (session) {
|
||||
switch_core_session_rwunlock(session);
|
||||
}
|
||||
#endif //NOTDEF
|
||||
/* mod_sms begin */
|
||||
if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", GSMOPEN_CHAT_PROTO);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", tech_pvt->name);
|
||||
//switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "hint", tech_pvt->chatmessages[which].from_dispname);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", tech_pvt->sms_sender);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "date", tech_pvt->sms_date);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "datacodingscheme", tech_pvt->sms_datacodingscheme);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "servicecentreaddress", tech_pvt->sms_servicecentreaddress);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "messagetype", "%d", tech_pvt->sms_messagetype);
|
||||
//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");
|
||||
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");
|
||||
switch_event_add_body(event, "%s\n", tech_pvt->sms_body);
|
||||
//switch_core_chat_send("GLOBAL", event); /* mod_sms */
|
||||
switch_core_chat_send("GLOBAL", event); /* mod_sms */
|
||||
} else {
|
||||
|
||||
ERRORA("cannot create event on interface %s. WHY?????\n", GSMOPEN_P_LOG, tech_pvt->name);
|
||||
}
|
||||
/* mod_sms end */
|
||||
|
||||
|
||||
//memset(&tech_pvt->chatmessages[which], '\0', sizeof(&tech_pvt->chatmessages[which]) );
|
||||
//memset(tech_pvt->sms_message, '\0', sizeof(tech_pvt->sms_message));
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue