[asterisk-commits] file: branch file/ari-spy r402451 - /team/file/ari-spy/res/res_stasis_snoop.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Nov 4 14:55:39 CST 2013


Author: file
Date: Mon Nov  4 14:55:37 2013
New Revision: 402451

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=402451
Log:
Add a fixup callback.

Modified:
    team/file/ari-spy/res/res_stasis_snoop.c

Modified: team/file/ari-spy/res/res_stasis_snoop.c
URL: http://svnview.digium.com/svn/asterisk/team/file/ari-spy/res/res_stasis_snoop.c?view=diff&rev=402451&r1=402450&r2=402451
==============================================================================
--- team/file/ari-spy/res/res_stasis_snoop.c (original)
+++ team/file/ari-spy/res/res_stasis_snoop.c Mon Nov  4 14:55:37 2013
@@ -157,6 +157,21 @@
 	return 0;
 }
 
+static int snoop_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
+{
+	struct stasis_app_snoop *snoop = ast_channel_tech_pvt(oldchan);
+
+	if (snoop->chan != oldchan) {
+		return -1;
+	}
+
+	ast_channel_unref(snoop->chan);
+	ast_channel_ref(newchan);
+	snoop->chan = newchan;
+
+	return 0;
+}
+
 /*! \brief Channel interface declaration */
 static struct ast_channel_tech snoop_tech = {
 	.type = "Snoop",
@@ -164,6 +179,7 @@
 	.write = snoop_write,
 	.read = snoop_read,
 	.hangup = snoop_hangup,
+	.fixup = snoop_fixup,
 };
 
 /*! \brief Thread used for running the Stasis application */




More information about the asterisk-commits mailing list