]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-3794 reset the version to 0 on re-subscribe
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 20 Jan 2012 19:00:37 +0000 (13:00 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 20 Jan 2012 19:00:42 +0000 (13:00 -0600)
src/mod/endpoints/mod_sofia/sofia_presence.c

index 3bdcb8fa57f3c2c4590b26c970e54e0552d380e7..c8d00aff034d68e9fdd2082205712fe251ee7424 100644 (file)
@@ -812,7 +812,7 @@ static void do_dialog_probe(sofia_profile_t *profile, switch_event_t *event)
 
                sql = switch_mprintf("update sip_subscriptions set version=version+1 "
                                                         "where expires > -1 and hostname='%q' "
-                                                        "and sub_to_user='%q' and sub_to_host='%q' " "and (event='dialog') and "
+                                                        "and sub_to_user='%q' and sub_to_host='%q' " "and (event!='fuck-dialog') and "
                                                         "call_id='%q'",
                                                         mod_sofia_globals.hostname, probe_euser, probe_host, sub_call_id);
 
@@ -1115,7 +1115,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event)
                                        sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_sub_callback, &helper);
                                        switch_safe_free(sql);
                                        
-                                       sql = switch_mprintf("update sip_subscriptions set version=version+1 where event='dialog' and sub_to_user='%q' "
+                                       sql = switch_mprintf("update sip_subscriptions set version=version+1 where event!='fuck-dialog' and sub_to_user='%q' "
                                                                                 "and (sub_to_host='%q' or presence_hosts like '%%%q%%') "
                                                                                 "and (profile_name = '%q' or presence_hosts != sub_to_host)",
                                                                                 euser, host, host, profile->name);
@@ -2067,6 +2067,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
                port = argv[27];
        }
 
+
        if (!zstr(presence_id) && strchr(presence_id, '@')) {
                char *p;
                 
@@ -2494,8 +2495,6 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
                }
        }
 
-       
-
        send_presence_notify(profile, full_to, full_from, contact, expires, call_id, event, ip, port, ct, pl, NULL);
 
        switch_safe_free(free_me);
@@ -2957,7 +2956,7 @@ void sofia_presence_handle_sip_i_subscribe(int status,
                sstr = switch_mprintf("active;expires=%ld", exp_delta);
                
                sql = switch_mprintf("update sip_subscriptions "
-                                                        "set expires=%ld "
+                                                        "set expires=%ld,version=0 "
                                                         "where call_id='%q'",
                                                         (long) switch_epoch_time_now(NULL) + exp_delta,
                                                         call_id);