]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-3794 sekil can you test this one
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 2 Feb 2012 01:32:22 +0000 (19:32 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 2 Feb 2012 01:32:29 +0000 (19:32 -0600)
src/mod/endpoints/mod_sofia/sofia_presence.c
src/switch_channel.c

index 3b7391351015bfd79bcde6d1220062051da1d2cd..351f1d87d5b519a7129ac960e1f5c52c5a346bab 100644 (file)
@@ -571,13 +571,15 @@ static int sofia_presence_dialog_callback(void *pArg, int argc, char **argv, cha
        struct dialog_helper *helper = (struct dialog_helper *) pArg;
 
        if (argc == 3) {
-               switch_set_string(helper->status, argv[0]);
-               switch_set_string(helper->rpid, argv[1]);
-               switch_set_string(helper->presence_id, argv[2]);
+               if (!helper->hits) {
+                       switch_set_string(helper->status, argv[0]);
+                       switch_set_string(helper->rpid, argv[1]);
+                       switch_set_string(helper->presence_id, argv[2]);
+               }
                helper->hits++;
        }
 
-       return -1;
+       return 0;
 }
 
 
@@ -856,6 +858,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event)
        char *call_info_state = switch_event_get_header(event, "presence-call-info-state");
        switch_console_callback_match_t *matches;
        struct presence_helper helper = { 0 };                  
+       int hup = 0;
 
        if (!mod_sofia_globals.running) {
                return;
@@ -877,6 +880,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event)
 
        if (status && switch_stristr("CS_HANGUP", status)) {
                status = "Available";
+               hup = 1;
        }
 
        if (rpid) {
@@ -1091,6 +1095,11 @@ static void actual_sofia_presence_event_handler(switch_event_t *event)
                                sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_dialog_callback, &dh);
                                switch_safe_free(sql);
 
+                               
+                               if (hup && dh.hits > 0) {
+                                       goto done;
+                               }
+
 
                                if (zstr(call_id) && (dh.hits && presence_source && (!strcasecmp(presence_source, "register") || switch_stristr("register", status)))) {
                                        goto done;
index df3bedeacfb574b25b9b7a5f1aa3f82c1d98192b..617c7f58b586024fc054542813ee69d8816a6ee1 100644 (file)
@@ -620,10 +620,6 @@ SWITCH_DECLARE(void) switch_channel_perform_presence(switch_channel_t *channel,
        call_info = switch_channel_get_variable(channel, "presence_call_info");
 
        if (switch_event_create(&event, type) == SWITCH_STATUS_SUCCESS) {
-               if (!strcasecmp(status, "CS_HANGUP")) {
-                       switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "refresh", "true");
-               }
-
                switch_channel_event_set_data(channel, event);
                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", "any");
                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", __FILE__);