[Freeswitch-svn] [commit] r3380 - in freeswitch/trunk: libs/libdingaling/src src/include src/mod/endpoints/mod_dingaling src/mod/endpoints/mod_sofia
Freeswitch SVN
anthm at freeswitch.org
Wed Nov 15 15:21:30 EST 2006
Author: anthm
Date: Wed Nov 15 15:21:29 2006
New Revision: 3380
Modified:
freeswitch/trunk/libs/libdingaling/src/libdingaling.c
freeswitch/trunk/libs/libdingaling/src/libdingaling.h
freeswitch/trunk/src/include/switch_am_config.h.in
freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
Log:
update
Modified: freeswitch/trunk/libs/libdingaling/src/libdingaling.c
==============================================================================
--- freeswitch/trunk/libs/libdingaling/src/libdingaling.c (original)
+++ freeswitch/trunk/libs/libdingaling/src/libdingaling.c Wed Nov 15 15:21:29 2006
@@ -149,6 +149,17 @@
};
+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 @@
char id[1024];
char *resource;
struct ldl_buffer *buffer;
- size_t x;
ldl_signal_t signal;
@@ -696,8 +706,6 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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;
}
Modified: freeswitch/trunk/libs/libdingaling/src/libdingaling.h
==============================================================================
--- freeswitch/trunk/libs/libdingaling/src/libdingaling.h (original)
+++ freeswitch/trunk/libs/libdingaling/src/libdingaling.h Wed Nov 15 15:21:29 2006
@@ -356,6 +356,13 @@
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
\param subject optional subject
Modified: freeswitch/trunk/src/include/switch_am_config.h.in
==============================================================================
--- freeswitch/trunk/src/include/switch_am_config.h.in (original)
+++ freeswitch/trunk/src/include/switch_am_config.h.in Wed Nov 15 15:21:29 2006
@@ -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
Modified: freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c Wed Nov 15 15:21:29 2006
@@ -1504,7 +1504,7 @@
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 @@
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 @@
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 @@
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 @@
}
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 @@
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,
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Wed Nov 15 15:21:29 2006
@@ -4478,8 +4478,8 @@
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());
More information about the Freeswitch-svn
mailing list