diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 3864639d20e4d097ac1787b43b58f990f985bf21..fb0a0d3c42f9cbeecfa5de6d7dcab306475f5ed4 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -217,6 +217,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include <regex.h> #include <inttypes.h> +#define REF_DEBUG 1 #include "asterisk/network.h" #include "asterisk/paths.h" /* need ast_config_AST_SYSTEM_NAME */ /* diff --git a/channels/sip/dialplan_functions.c b/channels/sip/dialplan_functions.c index 2f6b160f43bd6767ef2e5cd5af1767cfe40da108..3500a423a6d34850d9cdcb841b28f748190fe84a 100644 --- a/channels/sip/dialplan_functions.c +++ b/channels/sip/dialplan_functions.c @@ -353,7 +353,7 @@ AST_TEST_DEFINE(test_sip_rtpqos_1) goto done; } ast_channel_tech_set(chan, &sip_tech); - ast_channel_tech_pvt_set(chan, p); + ast_channel_tech_pvt_set(chan, dialog_ref(p, "Give the owner channel a reference to the dialog")); p->owner = chan; varstr = ast_str_create(16); @@ -397,8 +397,9 @@ done: ast_free(varstr); ast_free(buffer); - /* This unref will take care of destroying the channel, RTP instance, and SIP pvt */ + /* This unlink and unref will take care of destroying the channel, RTP instance, and SIP pvt */ if (p) { + dialog_unlink_all(p); dialog_unref(p, "Destroy test object"); } ast_rtp_engine_unregister(&test_engine);