]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
presence but no presents
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 2 Jun 2008 20:06:07 +0000 (20:06 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 2 Jun 2008 20:06:07 +0000 (20:06 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8741 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/sofia_presence.c
src/mod/endpoints/mod_sofia/sofia_reg.c

index fefed6f28fa081fa939e4af8d6c5d1589b488b3c..0e17b12b7ee73ab25b20cdaac590eb87a736a464 100644 (file)
@@ -888,7 +888,14 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
                const char *clean_to_user = NULL;
                const char *clean_from_user = NULL;
                const char *p_to_user = switch_str_nil(switch_event_get_header(helper->event, "to-user"));
-               
+#if 0
+               char *buf;
+               switch_event_serialize(helper->event, &buf, SWITCH_FALSE);
+               switch_assert(buf);
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "CHANNEL_DATA:\n%s\n", buf);
+               free(buf);
+#endif
+
                if (is_dialog) {
                        SWITCH_STANDARD_STREAM(stream);
                }
@@ -923,12 +930,6 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
                        if (!strcasecmp(state, "cs_hangup")) {
                                astate = "terminated";
                        } else if (switch_strlen_zero(astate)) {
-                               //char *buf;
-                               //switch_event_serialize(helper->event, &buf, SWITCH_FALSE);
-                               //switch_assert(buf);
-                               //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "CHANNEL_DATA:\n%s\n", buf);
-                               //free(buf);
-
                                astate = switch_str_nil(switch_event_get_header(helper->event, "answer-state"));
                                if (switch_strlen_zero(astate)) {
                                        if (is_dialog) {
@@ -1065,11 +1066,11 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
                prpid = translate_rpid(rpid);
                pl = gen_pidf(user_agent, clean_id, profile->url, open, rpid, prpid, status, &ct);
        }
-
+       
        switch_snprintf(exp, sizeof(exp), "active;expires=%ld", (long) exptime);
        nua_handle_bind(nh, &mod_sofia_globals.keep_private);
        nua_notify(nh, SIPTAG_SUBSCRIPTION_STATE_STR(exp), SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR(ct), SIPTAG_PAYLOAD_STR(pl), TAG_END());
-
+       
   end:
 
        switch_safe_free(id);
index 39b13a4b89f78d3584297e7c51ea2fe67e87fe4c..425317643fd811e1f3111e47b80fa0b569ba7195 100644 (file)
@@ -616,12 +616,14 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
                                                          "Register:\nFrom:    [%s@%s]\nContact: [%s]\nExpires: [%ld]\n", to_user, to_host, contact_str, (long) exptime);
                }
 
-               if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
+               if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) {
                        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", "sip");
                        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", profile->url);
                        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "%s", rpid);
                        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, to_host);
+                       switch_event_add_header(event, SWITCH_STACK_BOTTOM, "to", "%s@%s", to_user, to_host);
                        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Registered");
+                       switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_subtype", "probe");
                        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
                        switch_event_fire(&event);
                }
@@ -665,12 +667,6 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
        }
 
 
-       if (switch_event_create(&event, SWITCH_EVENT_ROSTER) == SWITCH_STATUS_SUCCESS) {
-               switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", "sip");
-               switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, to_host);
-               switch_event_fire(&event);
-       }
-
        if (regtype == REG_REGISTER) {
                char exp_param[128] = "";
                s_event = NULL;