[Freeswitch-svn] [commit] r6774 - in freeswitch/trunk: conf/autoload_configs libs/curl/lib src/mod/applications/mod_voicemail src/mod/endpoints/mod_sofia

Freeswitch SVN anthm at freeswitch.org
Thu Dec 13 19:00:57 EST 2007


Author: anthm
Date: Thu Dec 13 19:00:57 2007
New Revision: 6774

Modified:
   freeswitch/trunk/conf/autoload_configs/console.conf.xml
   freeswitch/trunk/libs/curl/lib/config.h.in
   freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c

Log:
sip is fun

Modified: freeswitch/trunk/conf/autoload_configs/console.conf.xml
==============================================================================
--- freeswitch/trunk/conf/autoload_configs/console.conf.xml	(original)
+++ freeswitch/trunk/conf/autoload_configs/console.conf.xml	Thu Dec 13 19:00:57 2007
@@ -6,7 +6,7 @@
 	 name can be a file name, function name or 'all' 
 	 value is one or more of debug,info,notice,warning,err,crit,alert,all
     -->
-    <map name="all" value="info,notice,warning,err,crit,alert"/>
+    <map name="all" value="debug,info,notice,warning,err,crit,alert"/>
   </mappings>
   <settings>
     <!-- comment or set to false for no color logging -->

Modified: freeswitch/trunk/libs/curl/lib/config.h.in
==============================================================================
--- freeswitch/trunk/libs/curl/lib/config.h.in	(original)
+++ freeswitch/trunk/libs/curl/lib/config.h.in	Thu Dec 13 19:00:57 2007
@@ -621,16 +621,16 @@
 /* Define to the function return type for send. */
 #undef SEND_TYPE_RETV
 
-/* The size of `curl_off_t', as computed by sizeof. */
+/* The size of a `curl_off_t', as computed by sizeof. */
 #undef SIZEOF_CURL_OFF_T
 
-/* The size of `long', as computed by sizeof. */
+/* The size of a `long', as computed by sizeof. */
 #undef SIZEOF_LONG
 
-/* The size of `size_t', as computed by sizeof. */
+/* The size of a `size_t', as computed by sizeof. */
 #undef SIZEOF_SIZE_T
 
-/* The size of `time_t', as computed by sizeof. */
+/* The size of a `time_t', as computed by sizeof. */
 #undef SIZEOF_TIME_T
 
 /* Define to 1 if you have the ANSI C header files. */
@@ -685,7 +685,7 @@
 /* type to use in place of in_addr_t if not defined */
 #undef in_addr_t
 
-/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* Define to `unsigned' if <sys/types.h> does not define. */
 #undef size_t
 
 /* type to use in place of socklen_t if not defined */

Modified: freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c	Thu Dec 13 19:00:57 2007
@@ -1361,6 +1361,8 @@
                 listen_callback_t cbt;
                 char sql[256];
                 int cur_message, total_messages;
+                switch_event_t *event;
+                
                 message_count(profile, myid, domain_name, myfolder, &total_new_messages, &total_saved_messages, 
                               &total_new_urgent_messages, &total_saved_urgent_messages);
                 memset(&cbt, 0, sizeof(cbt));
@@ -1402,6 +1404,26 @@
                 switch_snprintf(sql, sizeof(sql), "delete from voicemail_data where user='%s' and domain='%s' and flags='delete'", myid, domain_name);
                 vm_execute_sql(profile, sql, profile->mutex);
                 vm_check_state = VM_CHECK_FOLDER_SUMMARY;
+
+                
+                message_count(profile, id, domain_name, myfolder, &total_new_messages, &total_saved_messages,
+                              &total_new_urgent_messages, &total_saved_urgent_messages);
+
+                if (switch_event_create(&event, SWITCH_EVENT_MESSAGE_WAITING) == SWITCH_STATUS_SUCCESS) {
+                    char *mwi_id;
+                    const char *yn = "no";
+                    if (total_new_messages || total_saved_messages || total_new_urgent_messages || total_saved_urgent_messages) {
+                        yn = "yes";
+                    }
+                    mwi_id = switch_mprintf("%s@%s", myid, domain_name);
+                    switch_assert(mwi_id);
+                    switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Messages-Waiting", "%s", yn);
+                    switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Message-Account", mwi_id);
+                    switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Voice-Message", "%d/%d (%d/%d)", 
+                                            total_new_messages, total_saved_messages, total_new_urgent_messages, total_saved_urgent_messages);
+                    switch_event_fire(&event);
+                    switch_safe_free(mwi_id);
+                } 
             }
             break;
         case VM_CHECK_CONFIG:
@@ -1907,8 +1929,12 @@
                       &total_new_urgent_messages, &total_saved_urgent_messages);
 
         if (switch_event_create(&event, SWITCH_EVENT_MESSAGE_WAITING) == SWITCH_STATUS_SUCCESS) {
+            const char *yn = "no";
+            if (total_new_messages || total_saved_messages || total_new_urgent_messages || total_saved_urgent_messages) {
+                yn = "yes";
+            }
             mwi_id = switch_mprintf("%s@%s", id, domain_name);
-            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Messages-Waiting", "yes");
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Messages-Waiting", "%s", yn);
             switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Message-Account", mwi_id);
             switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Voice-Message", "%d/%d (%d/%d)", 
                                     total_new_messages, total_saved_messages, total_new_urgent_messages, total_saved_urgent_messages);
@@ -2163,7 +2189,11 @@
                               &total_new_urgent_messages, &total_saved_urgent_messages);
                 if (total_new_messages || total_saved_messages) {
                     if (switch_event_create(&new_event, SWITCH_EVENT_MESSAGE_WAITING) == SWITCH_STATUS_SUCCESS) {
-                        switch_event_add_header(new_event, SWITCH_STACK_BOTTOM, "MWI-Messages-Waiting", "yes");
+                        const char *yn = "no";
+                        if (total_new_messages || total_saved_messages || total_new_urgent_messages || total_saved_urgent_messages) {
+                            yn = "yes";
+                        }
+                        switch_event_add_header(new_event, SWITCH_STACK_BOTTOM, "MWI-Messages-Waiting", "%s", yn);
                         switch_event_add_header(new_event, SWITCH_STACK_BOTTOM, "MWI-Message-Account", account);
                         switch_event_add_header(new_event, SWITCH_STACK_BOTTOM, "MWI-Voice-Message", "%d/%d (%d/%d)", 
                                                 total_new_messages, total_saved_messages, total_new_urgent_messages, total_saved_urgent_messages);

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	Thu Dec 13 19:00:57 2007
@@ -1736,7 +1736,7 @@
 			switch_odbc_handle_exec(profile->master_odbc, reg_sql, NULL);
 		}
 
-		if (switch_odbc_handle_exec(profile->master_odbc, "select * from sip_subscriptions where sip_user == ''", NULL) != SWITCH_ODBC_SUCCESS) {
+		if (switch_odbc_handle_exec(profile->master_odbc, "delete from sip_subscriptions where sip_user != ''", NULL) != SWITCH_ODBC_SUCCESS) {
 			switch_odbc_handle_exec(profile->master_odbc, "DROP TABLE sip_subscriptions", NULL);
 			switch_odbc_handle_exec(profile->master_odbc, sub_sql, NULL);
 		}
@@ -1754,7 +1754,7 @@
 		}
 
 		switch_core_db_test_reactive(profile->master_db, "select sip_user from sip_registrations", "DROP TABLE sip_registrations", reg_sql);
-		switch_core_db_test_reactive(profile->master_db, "select * from sip_subscriptions where sip_user == ''", "DROP TABLE sip_subscriptions", sub_sql);
+		switch_core_db_test_reactive(profile->master_db, "delete * from sip_subscriptions where sip_user != ''", "DROP TABLE sip_subscriptions", sub_sql);
 		switch_core_db_test_reactive(profile->master_db, "select * from sip_authentication", "DROP TABLE sip_authentication", auth_sql);
 
 	}

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c	Thu Dec 13 19:00:57 2007
@@ -647,7 +647,7 @@
 	nua_handle_t *nh;
 	int expire_sec = atoi(expires);
 	int *total = (int *) pArg;
-
+	
 	if (!(profile = sofia_glue_find_profile(sub_to_host))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find profile for host %s\n", sub_to_host);
 		return 0;
@@ -673,7 +673,7 @@
 	switch_safe_free(exp);
 
 	sofia_glue_release_profile(profile);
-	*total++;
+	(*total)++;
 	return 0;
 }
 
@@ -689,27 +689,32 @@
 	sofia_profile_t *profile = NULL;
 	char *id = NULL;
 	nua_handle_t *nh;
-
+	char *contact;
+	
 	if (!(profile = sofia_glue_find_profile(sub_to_host))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find profile for host %s\n", sub_to_host);
 		return 0;
 	}
 
 	id = switch_mprintf("sip:%s@%s", sub_to_user, sub_to_host);
+
+	contact = sofia_glue_get_url_from_contact(argv[3], 0);
 	
 	nh = nua_handle(profile->nua, NULL,
+					NUTAG_URL(contact),
 					SIPTAG_FROM_STR(id),
-					SIPTAG_TO_STR(id), SIPTAG_CONTACT_STR(profile->url), TAG_END());
-	
+					SIPTAG_TO_STR(id),
+					SIPTAG_CONTACT_STR(profile->url),
+					TAG_END());
 	
 	nua_notify(nh,
 			   NUTAG_NEWSUB(1),
 			   SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR("application/simple-message-summary"), SIPTAG_PAYLOAD_STR(body), TAG_END());
 
 	switch_safe_free(id);
-
+	
 	sofia_glue_release_profile(profile);
-
+	
 	return 0;
 }
 



More information about the Freeswitch-svn mailing list