mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-13 20:50:41 +00:00
update
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3380 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
ee4118ab86
commit
6013035a6c
@ -149,6 +149,17 @@ struct ldl_session {
|
||||
};
|
||||
|
||||
|
||||
static void lowercase(char *str)
|
||||
{
|
||||
size_t x = 0;
|
||||
|
||||
if (str) {
|
||||
for (x = 0; x < strlen(str); x++) {
|
||||
str[x] = (char)tolower((int)str[x]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static char *cut_path(char *in)
|
||||
{
|
||||
char *p, *ret = in;
|
||||
@ -682,7 +693,6 @@ static int on_presence(void *user_data, ikspak *pak)
|
||||
char id[1024];
|
||||
char *resource;
|
||||
struct ldl_buffer *buffer;
|
||||
size_t x;
|
||||
ldl_signal_t signal;
|
||||
|
||||
|
||||
@ -696,8 +706,6 @@ static int on_presence(void *user_data, ikspak *pak)
|
||||
status = type;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!apr_hash_get(handle->sub_hash, from, APR_HASH_KEY_STRING)) {
|
||||
iks *msg;
|
||||
apr_hash_set(handle->sub_hash, apr_pstrdup(handle->pool, from), APR_HASH_KEY_STRING, &marker);
|
||||
@ -706,16 +714,12 @@ static int on_presence(void *user_data, ikspak *pak)
|
||||
}
|
||||
|
||||
apr_cpystrn(id, from, sizeof(id));
|
||||
lowercase(id);
|
||||
|
||||
if ((resource = strchr(id, '/'))) {
|
||||
*resource++ = '\0';
|
||||
}
|
||||
|
||||
if (resource) {
|
||||
for (x = 0; x < strlen(resource); x++) {
|
||||
resource[x] = (char)tolower((int)resource[x]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (resource && strstr(resource, "talk") && (buffer = apr_hash_get(handle->probe_hash, id, APR_HASH_KEY_STRING))) {
|
||||
apr_cpystrn(buffer->buf, from, buffer->len);
|
||||
fflush(stderr);
|
||||
@ -861,8 +865,10 @@ static int on_commands(void *user_data, ikspak *pak)
|
||||
if (!strcasecmp(iks_name(tag), "bind")) {
|
||||
char *jid = iks_find_cdata(tag, "jid");
|
||||
char *resource = strchr(jid, '/');
|
||||
//iks *iq, *x;
|
||||
handle->acc->resource = apr_pstrdup(handle->pool, resource);
|
||||
if (resource) {
|
||||
resource++;
|
||||
handle->acc->resource = apr_pstrdup(handle->pool, resource);
|
||||
}
|
||||
handle->login = apr_pstrdup(handle->pool, jid);
|
||||
#if 0
|
||||
if ((iq = iks_new("iq"))) {
|
||||
@ -1582,6 +1588,11 @@ void *ldl_handle_get_private(ldl_handle_t *handle)
|
||||
return handle->private_info;
|
||||
}
|
||||
|
||||
void *ldl_handle_get_login(ldl_handle_t *handle)
|
||||
{
|
||||
return handle->login;
|
||||
}
|
||||
|
||||
void ldl_handle_send_presence(ldl_handle_t *handle, char *from, char *to, char *type, char *rpid, char *message)
|
||||
{
|
||||
do_presence(handle, from, to, type, rpid, message);
|
||||
@ -1747,7 +1758,7 @@ unsigned int ldl_session_candidates(ldl_session_t *session,
|
||||
char *ldl_handle_probe(ldl_handle_t *handle, char *id, char *from, char *buf, unsigned int len)
|
||||
{
|
||||
iks *pres, *msg;
|
||||
char *lid = NULL;
|
||||
char *lid = NULL, *low_id = NULL;
|
||||
struct ldl_buffer buffer;
|
||||
apr_time_t started;
|
||||
unsigned int elapsed;
|
||||
@ -1762,13 +1773,14 @@ char *ldl_handle_probe(ldl_handle_t *handle, char *id, char *from, char *buf, un
|
||||
iks_insert_attrib(pres, "type", "probe");
|
||||
iks_insert_attrib(pres, "from", from);
|
||||
iks_insert_attrib(pres, "to", id);
|
||||
|
||||
|
||||
|
||||
apr_hash_set(handle->probe_hash, id, APR_HASH_KEY_STRING, &buffer);
|
||||
msg = iks_make_s10n (IKS_TYPE_SUBSCRIBE, id, notice);
|
||||
iks_insert_attrib(pres, "from", from);
|
||||
iks_insert_attrib(msg, "from", from);
|
||||
apr_queue_push(handle->queue, msg);
|
||||
msg = iks_make_s10n (IKS_TYPE_SUBSCRIBED, id, notice);
|
||||
iks_insert_attrib(msg, "from", from);
|
||||
apr_queue_push(handle->queue, msg);
|
||||
apr_queue_push(handle->queue, pres);
|
||||
|
||||
@ -1793,7 +1805,12 @@ char *ldl_handle_probe(ldl_handle_t *handle, char *id, char *from, char *buf, un
|
||||
ldl_yield(1000);
|
||||
}
|
||||
|
||||
apr_hash_set(handle->probe_hash, id, APR_HASH_KEY_STRING, NULL);
|
||||
if ((low_id = strdup(id))) {
|
||||
lowercase(id);
|
||||
apr_hash_set(handle->probe_hash, low_id, APR_HASH_KEY_STRING, NULL);
|
||||
free(low_id);
|
||||
}
|
||||
|
||||
return lid;
|
||||
}
|
||||
|
||||
|
@ -355,6 +355,13 @@ unsigned int ldl_session_terminate(ldl_session_t *session);
|
||||
*/
|
||||
void *ldl_handle_get_private(ldl_handle_t *handle);
|
||||
|
||||
/*!
|
||||
\brief Get the full login of a connection handle
|
||||
\param handle the conection handle
|
||||
\return the requested data
|
||||
*/
|
||||
void *ldl_handle_get_login(ldl_handle_t *handle);
|
||||
|
||||
/*!
|
||||
\brief Send a message to a session
|
||||
\param session the session handle
|
||||
|
@ -124,5 +124,5 @@
|
||||
/* Define to rpl_malloc if the replacement function should be used. */
|
||||
#undef malloc
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
/* Define to `unsigned' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
||||
|
@ -1504,7 +1504,7 @@ static switch_status_t channel_outgoing_channel(switch_core_session_t *session,
|
||||
snprintf(ubuf, sizeof(ubuf), "%s/talk", outbound_profile->caller_id_number);
|
||||
user = ubuf;
|
||||
} else {
|
||||
user = mdl_profile->login;
|
||||
user = ldl_handle_get_login(mdl_profile->handle);
|
||||
}
|
||||
|
||||
if (!ldl_handle_ready(mdl_profile->handle)) {
|
||||
@ -2174,7 +2174,9 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
||||
char *hint;
|
||||
|
||||
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 : ldl_handle_get_login(profile->handle),
|
||||
from, "", profile->auto_reply);
|
||||
}
|
||||
|
||||
if (strchr(to, '+')) {
|
||||
@ -2207,7 +2209,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
||||
break;
|
||||
case LDL_SIGNAL_LOGIN_SUCCESS:
|
||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, DL_EVENT_LOGIN_SUCCESS) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", profile->login);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", ldl_handle_get_login(profile->handle));
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
if (profile->user_flags & LDL_FLAG_COMPONENT) {
|
||||
@ -2217,13 +2219,13 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
||||
break;
|
||||
case LDL_SIGNAL_LOGIN_FAILURE:
|
||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, DL_EVENT_LOGIN_FAILURE) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", profile->login);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", ldl_handle_get_login(profile->handle));
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
break;
|
||||
case LDL_SIGNAL_CONNECTED:
|
||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, DL_EVENT_CONNECTED) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", profile->login);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", ldl_handle_get_login(profile->handle));
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
break;
|
||||
@ -2317,7 +2319,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
||||
}
|
||||
|
||||
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", ldl_handle_get_login(profile->handle));
|
||||
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, "to", "%s", to);
|
||||
@ -2531,7 +2533,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
||||
ldl_session_get_id(dlsession), cid_name, cid_num, exten);
|
||||
|
||||
if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
|
||||
profile->login,
|
||||
ldl_handle_get_login(profile->handle),
|
||||
profile->dialplan,
|
||||
cid_name,
|
||||
cid_num,
|
||||
|
@ -4478,8 +4478,8 @@ static void *SWITCH_THREAD_FUNC profile_thread_run(switch_thread_t *thread, void
|
||||
TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ALLOW("NOTIFY")),
|
||||
TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ALLOW("SUBSCRIBE")),
|
||||
TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ENABLEMESSAGE(1)),
|
||||
TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ALLOW_EVENTS("presence")),
|
||||
TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ALLOW_EVENTS("presence.winfo")),
|
||||
//TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ALLOW_EVENTS("presence")),
|
||||
//TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ALLOW_EVENTS("presence.winfo")),
|
||||
SIPTAG_SUPPORTED_STR("100rel, precondition"),
|
||||
SIPTAG_USER_AGENT_STR(SOFIA_USER_AGENT),
|
||||
TAG_END());
|
||||
|
Loading…
x
Reference in New Issue
Block a user