]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
update
authorAnthony Minessale <anthony.minessale@gmail.com>
Wed, 15 Nov 2006 20:21:29 +0000 (20:21 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Wed, 15 Nov 2006 20:21:29 +0000 (20:21 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3380 d0543943-73ff-0310-b7d9-9358b9ac24b2

libs/libdingaling/src/libdingaling.c
libs/libdingaling/src/libdingaling.h
src/include/switch_am_config.h.in
src/mod/endpoints/mod_dingaling/mod_dingaling.c
src/mod/endpoints/mod_sofia/mod_sofia.c

index 42a5b01f5ef22aa3ad6ae49951ee7e3adcbc36c1..f0a0d75e3e6f45d4382175137e650e3ad87ead19 100644 (file)
@@ -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;
 }
 
index c09dd45173d6742cca33c7915e9669590bfe23a0..d3d1f1d386a761fda9c7205bf009098dc98f3875 100644 (file)
@@ -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
index 3e1a92ccaf65c2286357c9d425fa5f513a7ad27a..c2a949cebefad34dbeedbfa1536589dd6bd88616 100644 (file)
 /* 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
index 4c5ef5a0bbeb16845e5c95529d723798e3691edc..a7051eaae7e7eb8278eb121779f2b72ca0b30b04 100644 (file)
@@ -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,
index 148ca2fbc71921622b74fdc776548272902be166..2242b691279f000305b602d8f349bf7da440858b 100644 (file)
@@ -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());