[Freeswitch-trunk] [commit] r3722 - in freeswitch/trunk/src/mod/endpoints: mod_dingaling mod_sofia

Freeswitch SVN anthm at freeswitch.org
Tue Dec 19 13:04:08 EST 2006


Author: anthm
Date: Tue Dec 19 13:04:07 2006
New Revision: 3722

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c

Log:
xmas presence

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	Tue Dec 19 13:04:07 2006
@@ -312,17 +312,25 @@
             switch_core_db_t *db;
             char *errmsg;
             char *to = switch_event_get_header(event, "to");
+            char *f_host = NULL;
+            if (to) {
+                if ((f_host = strchr(to, '@'))) {
+                    f_host++;
+                }
+            }
 
-            if (to && (sql = switch_mprintf("select * from subscriptions where sub_to='%q'", to))) {
-                if (!(db = switch_core_db_open_file(profile->dbname))) {
-                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
-                    return;
+            if (f_host && (profile = switch_core_hash_find(globals.profile_hash, f_host))) {
+                if (to && (sql = switch_mprintf("select * from subscriptions where sub_to='%q'", to))) {
+                    if (!(db = switch_core_db_open_file(profile->dbname))) {
+                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
+                        return;
+                    }
+                    switch_mutex_lock(profile->mutex);
+                    switch_core_db_exec(db, sql, sin_callback, profile, &errmsg);
+                    switch_mutex_unlock(profile->mutex);
+                    switch_core_db_close(db);
+                    switch_safe_free(sql);
                 }
-                switch_mutex_lock(profile->mutex);
-                switch_core_db_exec(db, sql, sin_callback, profile, &errmsg);
-                switch_mutex_unlock(profile->mutex);
-                switch_core_db_close(db);
-                switch_safe_free(sql);
             }
         }
         return;

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	Tue Dec 19 13:04:07 2006
@@ -5346,7 +5346,7 @@
                 *host++ = '\0';
             }
             if (user && host && 
-                (sql = switch_mprintf("select user,host,'Registered','unknown','' from sip_registrations where user='%q' and host='%q'", user, host))) {
+                (sql = switch_mprintf("select user,host,status,rpid,'' from sip_registrations where user='%q' and host='%q'", user, host))) {
                 switch_mutex_lock(profile->ireg_mutex);
                 switch_core_db_exec(db, sql, resub_callback, profile, &errmsg);
                 switch_mutex_unlock(profile->ireg_mutex);



More information about the Freeswitch-trunk mailing list