[Freeswitch-svn] [commit] r11921 - freeswitch/trunk/src/mod/endpoints/mod_sofia

FreeSWITCH SVN mrene at freeswitch.org
Thu Feb 12 06:46:15 PST 2009


Author: mrene
Date: Thu Feb 12 08:46:14 2009
New Revision: 11921

Log:
Cleanup missing flags hack

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h	Thu Feb 12 08:46:14 2009
@@ -174,6 +174,9 @@
 	PFLAG_CALLID_AS_UUID,
 	PFLAG_UUID_AS_CALLID,
 	PFLAG_SCROOGE,
+	PFLAG_MANAGE_SHARED_APPEARANCE,
+	PFLAG_DISABLE_SRV,
+	PFLAG_DISABLE_NAPTR,
 
 	/* No new flags below this line */
 	PFLAG_MAX
@@ -451,9 +454,6 @@
 	sofia_media_options_t media_options;
 	uint32_t force_subscription_expires;
 	switch_rtp_bug_flag_t auto_rtp_bugs;
-	char manage_shared_appearance;  /* pflags was all full up - MTK */
-	char disable_srv;
-	char disable_naptr;
 };
 
 struct private_object {

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	Thu Feb 12 08:46:14 2009
@@ -101,7 +101,7 @@
 	 * *and* for Linksys, I believe they use "sa" as their magic appearance agent name for those blind notifies, so
 	 * we'll probably have to change to match
 	*/
-	if (profile->manage_shared_appearance) {
+	if (sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) {
 		
 		if (sip->sip_request->rq_url->url_user && !strncmp(sip->sip_request->rq_url->url_user, "sla-agent", sizeof("sla-agent"))) {
 			int sub_state;
@@ -728,8 +728,8 @@
 							  TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), NUTAG_CERTIFICATE_DIR(profile->tls_cert_dir)), 
 							  TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), TPTAG_TLS_VERSION(profile->tls_version)), 
 							  TAG_IF(!strchr(profile->sipip, ':'), NTATAG_UDP_MTU(65535)), 
- 							  TAG_IF(profile->disable_srv, NTATAG_USE_SRV(0)),
- 							  TAG_IF(profile->disable_naptr, NTATAG_USE_NAPTR(0)),
+ 							  TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_SRV), NTATAG_USE_SRV(0)),
+ 							  TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_NAPTR), NTATAG_USE_NAPTR(0)),
 							  NTATAG_DEFAULT_PROXY(profile->outbound_proxy),
 							  NTATAG_SERVER_RPORT(profile->rport_level), 
 							  TAG_IF(tportlog, TPTAG_LOG(1)), 
@@ -762,9 +762,9 @@
 				   TAG_IF(profile->pres_type, NUTAG_ALLOW("SUBSCRIBE")),
 				   TAG_IF(profile->pres_type, NUTAG_ENABLEMESSAGE(1)),
 				   TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("presence")),
-				   TAG_IF((profile->pres_type || profile->manage_shared_appearance), NUTAG_ALLOW_EVENTS("dialog")),
+				   TAG_IF((profile->pres_type || sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)), NUTAG_ALLOW_EVENTS("dialog")),
 				   TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("call-info")),
-				   TAG_IF((profile->pres_type || profile->manage_shared_appearance), NUTAG_ALLOW_EVENTS("sla")),
+				   TAG_IF((profile->pres_type || sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)), NUTAG_ALLOW_EVENTS("sla")),
 				   TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("include-session-description")),
 				   TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("presence.winfo")),
 				   TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("message-summary")),
@@ -1807,9 +1807,6 @@
 				sofia_set_pflag(profile, PFLAG_STUN_ENABLED);
 				sofia_set_pflag(profile, PFLAG_DISABLE_100REL);
 				profile->auto_restart = 1;
-				profile->manage_shared_appearance = 0; /* Initialize default */
-				profile->disable_srv = 0;
-				profile->disable_naptr = 0;
 
 				for (param = switch_xml_child(settings, "param"); param; param = param->next) {
 					char *var = (char *) switch_xml_attr_soft(param, "name");
@@ -2027,16 +2024,16 @@
 						} 
 					} else if (!strcasecmp(var, "manage-shared-appearance")) {
 						if (switch_true(val)) {
-							profile->manage_shared_appearance = 1;
+							sofia_set_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE);
 							profile->sla_contact = switch_core_sprintf(profile->pool, "sip:sla-agent@%s", profile->sipip);
 						}
 					} else if (!strcasecmp(var, "disable-srv")) {
 						if (switch_true(val)) {
-							profile->disable_srv = 1;
+							sofia_set_pflag(profile, PFLAG_DISABLE_SRV);
 						}
 					} else if (!strcasecmp(var, "disable-naptr")) {
 						if (switch_true(val)) {
-							profile->disable_naptr = 1;
+							sofia_set_pflag(profile, PFLAG_DISABLE_NAPTR);
 						}
 					} else if (!strcasecmp(var, "unregister-on-options-fail")) {
 						if (switch_true(val)) {

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 Feb 12 08:46:14 2009
@@ -3127,7 +3127,7 @@
 		}
 		free(test_sql);
 
-		if (profile->manage_shared_appearance) {
+		if (sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) {
 			test_sql = switch_mprintf("delete from sip_shared_appearance_subscriptions where contact_str='' or hostname='%q'", mod_sofia_globals.hostname);
 			if (switch_odbc_handle_exec(profile->master_odbc, test_sql, NULL) != SWITCH_ODBC_SUCCESS) {
 				switch_odbc_handle_exec(profile->master_odbc, "DROP TABLE sip_shared_appearance_subscriptions", NULL);
@@ -3167,7 +3167,7 @@
 		switch_core_db_test_reactive(profile->master_db, test_sql, "DROP TABLE sip_authentication", auth_sql);
 		free(test_sql);
 
-		if(profile->manage_shared_appearance) {
+		if(sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) {
 			test_sql = switch_mprintf("delete from sip_shared_appearance_subscriptions where contact_str = '' or hostname='%q'", mod_sofia_globals.hostname);
 			switch_core_db_test_reactive(profile->master_db, test_sql, "DROP TABLE sip_shared_appearance_subscriptions", shared_appearance_sql);
 			free(test_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 Feb 12 08:46:14 2009
@@ -1516,7 +1516,7 @@
 
 
 		/* the following could be refactored back to the calling event handler in sofia.c XXX MTK */
-		if (profile->manage_shared_appearance) {
+		if (sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) {
 			if (sip->sip_request->rq_url->url_user && !strncmp(sip->sip_request->rq_url->url_user, "sla-agent", sizeof("sla-agent"))) {
 				/* only fire this on <200 to try to avoid resubscribes. probably better ways to do this? */
 				if (status < 200) {
@@ -1784,7 +1784,7 @@
 	}
 
 	/* the following could possibly be refactored back towards the calling event handler in sofia.c XXX MTK */
-	if (profile->manage_shared_appearance) {
+	if (sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) {
 		if (!strcasecmp(o->o_type, "dialog") && msg_params_find(o->o_params, "sla")) {
 			sofia_sla_handle_sip_r_subscribe(nua, profile, nh, sip, tags);
 			return;
@@ -1835,7 +1835,7 @@
 		char *event_type;
 
 		/* the following could instead be refactored back to the calling event handler in sofia.c XXX MTK */
-		if (profile->manage_shared_appearance) {
+		if (sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) {
 			/* also it probably is unsafe to dereference so many things in a row without testing XXX MTK */
 			if (sip->sip_request->rq_url->url_user && !strncmp(sip->sip_request->rq_url->url_user, "sla-agent", sizeof("sla-agent"))) {
 				sofia_sla_handle_sip_i_publish(nua, profile, nh, sip, tags);

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c	Thu Feb 12 08:46:14 2009
@@ -1102,7 +1102,7 @@
 			switch_event_fire(&s_event);
 		}
 
-		if (profile->manage_shared_appearance) {
+		if (sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) {
 			sofia_sla_handle_register(nua, profile, sip);
 		}
 



More information about the Freeswitch-svn mailing list