tweeks
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3164 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
af23ce4853
commit
776919d5fd
|
@ -815,16 +815,22 @@ static void conference_loop(conference_member_t *member)
|
||||||
switch_event_t *event;
|
switch_event_t *event;
|
||||||
|
|
||||||
if (switch_core_session_dequeue_event(member->session, &event) == SWITCH_STATUS_SUCCESS) {
|
if (switch_core_session_dequeue_event(member->session, &event) == SWITCH_STATUS_SUCCESS) {
|
||||||
char *p;
|
|
||||||
char *from = switch_event_get_header(event, "from");
|
char *from = switch_event_get_header(event, "from");
|
||||||
char *to = switch_event_get_header(event, "to");
|
char *to = switch_event_get_header(event, "to");
|
||||||
char *proto = switch_event_get_header(event, "proto");
|
char *proto = switch_event_get_header(event, "proto");
|
||||||
char *subject = switch_event_get_header(event, "subject");
|
char *subject = switch_event_get_header(event, "subject");
|
||||||
|
char *hint = switch_event_get_header(event, "hint");
|
||||||
char *body = switch_event_get_body(event);
|
char *body = switch_event_get_body(event);
|
||||||
if ((p = strchr(to, '+'))) {
|
char *p, *freeme = NULL;
|
||||||
to = ++p;
|
|
||||||
|
if ((p = strchr(to, '+')) &&
|
||||||
|
strncmp(to, CONF_CHAT_PROTO, strlen(CONF_CHAT_PROTO))) {
|
||||||
|
freeme = switch_mprintf("%s+%s@%s", CONF_CHAT_PROTO, member->conference->name, member->conference->domain);
|
||||||
|
to = freeme;
|
||||||
}
|
}
|
||||||
chat_send(proto, from, to, subject, body, "");
|
|
||||||
|
chat_send(proto, from, to, subject, body, hint);
|
||||||
|
switch_safe_free(freeme);
|
||||||
switch_event_destroy(&event);
|
switch_event_destroy(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3100,6 +3106,10 @@ static switch_status_t chat_send(char *proto, char *from, char *to, char *subjec
|
||||||
conference_obj_t *conference = NULL;
|
conference_obj_t *conference = NULL;
|
||||||
switch_stream_handle_t stream = {0};
|
switch_stream_handle_t stream = {0};
|
||||||
|
|
||||||
|
if ((p = strchr(to, '+'))) {
|
||||||
|
to = ++p;
|
||||||
|
}
|
||||||
|
|
||||||
if (!body) {
|
if (!body) {
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -3108,6 +3118,7 @@ static switch_status_t chat_send(char *proto, char *from, char *to, char *subjec
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invaid Chat Interface [%s]!\n", proto);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invaid Chat Interface [%s]!\n", proto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((p = strchr(to, '@'))) {
|
if ((p = strchr(to, '@'))) {
|
||||||
switch_copy_string(name, to, ++p-to);
|
switch_copy_string(name, to, ++p-to);
|
||||||
} else {
|
} else {
|
||||||
|
@ -3115,7 +3126,7 @@ static switch_status_t chat_send(char *proto, char *from, char *to, char *subjec
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, name))) {
|
if (!(conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, name))) {
|
||||||
ci->chat_send(CONF_CHAT_PROTO, to, from, "", "Sorry, We're Closed", "");
|
ci->chat_send(CONF_CHAT_PROTO, to, hint ? hint : from, "", "Sorry, We're Closed", NULL);
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3124,13 +3135,14 @@ static switch_status_t chat_send(char *proto, char *from, char *to, char *subjec
|
||||||
if (strstr(body, "list")) {
|
if (strstr(body, "list")) {
|
||||||
conference_list_pretty(conference, &stream);
|
conference_list_pretty(conference, &stream);
|
||||||
} else {
|
} else {
|
||||||
stream.write_function(&stream, "The only command we have is so far is 'list' Get coding or go press PayPal!!\n");
|
stream.write_function(&stream, "The only command we have so far is 'list'.\nGet coding or go press PayPal!!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
ci->chat_send(CONF_CHAT_PROTO, to, from, "", stream.data, "");
|
ci->chat_send(CONF_CHAT_PROTO, to, from, "", stream.data, NULL);
|
||||||
switch_safe_free(stream.data);
|
switch_safe_free(stream.data);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2147,6 +2147,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
||||||
switch_chat_interface_t *ci;
|
switch_chat_interface_t *ci;
|
||||||
char *proto = MDL_CHAT_PROTO;
|
char *proto = MDL_CHAT_PROTO;
|
||||||
char *pproto = NULL, *ffrom = NULL;
|
char *pproto = NULL, *ffrom = NULL;
|
||||||
|
char *hint;
|
||||||
|
|
||||||
if (profile->auto_reply) {
|
if (profile->auto_reply) {
|
||||||
ldl_handle_send_msg(handle, (profile->user_flags & LDL_FLAG_COMPONENT) ? to : profile->login, from, "", profile->auto_reply);
|
ldl_handle_send_msg(handle, (profile->user_flags & LDL_FLAG_COMPONENT) ? to : profile->login, from, "", profile->auto_reply);
|
||||||
|
@ -2159,18 +2160,19 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
||||||
}
|
}
|
||||||
proto = pproto;
|
proto = pproto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hint = from;
|
||||||
|
|
||||||
if (strchr(from, '/') && (ffrom = strdup(from))) {
|
if (strchr(from, '/') && (ffrom = strdup(from))) {
|
||||||
char *p;
|
char *p;
|
||||||
if ((p = strchr(ffrom, '/'))) {
|
if ((p = strchr(ffrom, '/'))) {
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
}
|
}
|
||||||
from = ffrom;
|
from = ffrom;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ci = switch_loadable_module_get_chat_interface(proto))) {
|
if ((ci = switch_loadable_module_get_chat_interface(proto))) {
|
||||||
ci->chat_send(MDL_CHAT_PROTO, from, to, subject, msg, "");
|
ci->chat_send(MDL_CHAT_PROTO, from, to, subject, msg, hint);
|
||||||
} else {
|
} else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invaid Chat Interface [%s]!\n", proto);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invaid Chat Interface [%s]!\n", proto);
|
||||||
}
|
}
|
||||||
|
@ -2280,17 +2282,19 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
||||||
}
|
}
|
||||||
|
|
||||||
if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
|
if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
|
||||||
char *p, *freeme = NULL;
|
char *hint = NULL, *p, *freeme = NULL;
|
||||||
|
|
||||||
|
hint = from;
|
||||||
if (strchr(from, '/')) {
|
if (strchr(from, '/')) {
|
||||||
freeme = strdup(from);
|
freeme = strdup(from);
|
||||||
p = strchr(freeme, '/');
|
p = strchr(freeme, '/');
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
from = freeme;
|
from = freeme;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO);
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO);
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", profile->login);
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", profile->login);
|
||||||
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "hint", "%s", hint);
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", from);
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", from);
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "to", "%s", to);
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "to", "%s", to);
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "subject", "%s", subject);
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "subject", "%s", subject);
|
||||||
|
|
Loading…
Reference in New Issue