[asterisk-commits] mmichelson: branch group/CCSS_Monitor_Restructure r244556 - /team/group/CCSS_...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Feb 3 13:45:35 CST 2010


Author: mmichelson
Date: Wed Feb  3 13:45:31 2010
New Revision: 244556

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=244556
Log:
Several fixes regarding SIP monitoring

* Fixed problem where PUBLISH dialogs were not being destroyed. Calling
  sip_scheddestroy was the key here.

* Fixed faulty logic in the cc_epa_destructor.

* Moved REF_DEBUG define and comment higher than it was previously. You
  have to define it earlier because one of chan_sip's included files
  also includes astobj2.h.

* Removed a NOTICE that I accidentally left in earlier.


Modified:
    team/group/CCSS_Monitor_Restructure/channels/chan_sip.c

Modified: team/group/CCSS_Monitor_Restructure/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS_Monitor_Restructure/channels/chan_sip.c?view=diff&rev=244556&r1=244555&r2=244556
==============================================================================
--- team/group/CCSS_Monitor_Restructure/channels/chan_sip.c (original)
+++ team/group/CCSS_Monitor_Restructure/channels/chan_sip.c Wed Feb  3 13:45:31 2010
@@ -216,7 +216,18 @@
 
 #include "asterisk/network.h"
 #include "asterisk/paths.h"	/* need ast_config_AST_SYSTEM_NAME */
-
+/*
+   Uncomment the define below,  if you are having refcount related memory leaks.
+   With this uncommented, this module will generate a file, /tmp/refs, which contains
+   a history of the ao2_ref() calls. To be useful, all calls to ao2_* functions should
+   be modified to ao2_t_* calls, and include a tag describing what is happening with
+   enough detail, to make pairing up a reference count increment with its corresponding decrement.
+   The refcounter program in utils/ can be invaluable in highlighting objects that are not
+   balanced, along with the complete history for that object.
+   In normal operation, the macros defined will throw away the tags, so they do not
+   affect the speed of the program at all. They can be considered to be documentation.
+*/
+/* #define  REF_DEBUG 1 */
 #include "asterisk/lock.h"
 #include "asterisk/channel.h"
 #include "asterisk/config.h"
@@ -241,18 +252,6 @@
 #include "asterisk/file.h"
 #include "asterisk/astobj.h"
 #include "asterisk/test.h"
-/*
-   Uncomment the define below,  if you are having refcount related memory leaks.
-   With this uncommented, this module will generate a file, /tmp/refs, which contains
-   a history of the ao2_ref() calls. To be useful, all calls to ao2_* functions should
-   be modified to ao2_t_* calls, and include a tag describing what is happening with
-   enough detail, to make pairing up a reference count increment with its corresponding decrement.
-   The refcounter program in utils/ can be invaluable in highlighting objects that are not
-   balanced, along with the complete history for that object.
-   In normal operation, the macros defined will throw away the tags, so they do not
-   affect the speed of the program at all. They can be considered to be documentation.
-*/
-/* #define  REF_DEBUG 1 */
 #include "asterisk/astobj2.h"
 #include "asterisk/dnsmgr.h"
 #include "asterisk/devicestate.h"
@@ -1832,19 +1831,6 @@
 
 static void cc_handle_publish_error(struct sip_pvt *pvt, const int resp, struct sip_request *req, struct sip_epa_entry *epa_entry);
 
-static void cc_epa_destructor(void *instance_data)
-{
-	struct cc_epa_entry *cc_entry = instance_data;
-	ast_free(cc_entry);
-}
-
-static const struct epa_static_data cc_epa_static_data  = {
-	.event = CALL_COMPLETION,
-	.name = "call-completion",
-	.handle_error = cc_handle_publish_error,
-	.destructor = cc_epa_destructor,
-};
-
 struct sip_epa_entry {
 	/* When we are going to send a publish, we need to
 	 * know the type of PUBLISH to send.
@@ -1876,6 +1862,20 @@
 	 * require its own instance-specific data.
 	 */
 	void *instance_data;
+};
+
+static void cc_epa_destructor(void *data)
+{
+	struct sip_epa_entry *epa_entry = data;
+	struct cc_epa_entry *cc_entry = epa_entry->instance_data;
+	ast_free(cc_entry);
+}
+
+static const struct epa_static_data cc_epa_static_data  = {
+	.event = CALL_COMPLETION,
+	.name = "call-completion",
+	.handle_error = cc_handle_publish_error,
+	.destructor = cc_epa_destructor,
 };
 
 static const struct epa_static_data *find_static_data(const char * const event_package)
@@ -3766,7 +3766,6 @@
 			ao2_ref(monitor_instance, -1);
 			return -1;
 		}
-		ast_log(LOG_NOTICE, "Created EPA entry......\n");
 		cc_entry->core_id = monitor->core_id;
 		monitor_instance->suspension_entry->instance_data = cc_entry;
 		publish_type = SIP_PUBLISH_INITIAL;
@@ -12563,6 +12562,7 @@
 
 	transmit_invite(pvt, SIP_PUBLISH, FALSE, 2, explicit_uri);
 	sip_pvt_unlock(pvt);
+	sip_scheddestroy(pvt, DEFAULT_TRANS_TIMEOUT);
 	dialog_unref(pvt, "Done with the sip_pvt allocated for transmitting PUBLISH");
 	return 0;
 }




More information about the asterisk-commits mailing list