[asterisk-commits] tilghman: trunk r240421 - in /trunk: apps/ include/asterisk/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 15 15:04:40 CST 2010


Author: tilghman
Date: Fri Jan 15 15:04:34 2010
New Revision: 240421

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=240421
Log:
Add pickup event to AMI.  Also, fix AMI documentation.
(closes issue #16431)
 Reported by: syspert
 Patches: 
       20100112__issue16431.diff.txt uploaded by tilghman (license 14)

Modified:
    trunk/apps/app_directed_pickup.c
    trunk/include/asterisk/manager.h
    trunk/main/features.c

Modified: trunk/apps/app_directed_pickup.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_directed_pickup.c?view=diff&rev=240421&r1=240420&r2=240421
==============================================================================
--- trunk/apps/app_directed_pickup.c (original)
+++ trunk/apps/app_directed_pickup.c Fri Jan 15 15:04:34 2010
@@ -40,6 +40,7 @@
 #include "asterisk/lock.h"
 #include "asterisk/app.h"
 #include "asterisk/features.h"
+#include "asterisk/manager.h"
 #include "asterisk/callerid.h"
 #include "asterisk/cel.h"
 
@@ -94,6 +95,7 @@
 {
 	int res = 0;
 	struct ast_party_connected_line connected_caller;
+	struct ast_channel *chans[2] = { chan, target };
 
 	ast_debug(1, "Call pickup on '%s' by '%s'\n", target->name, chan->name);
 	ast_cel_report_event(target, AST_CEL_PICKUP, NULL, NULL, chan);
@@ -127,6 +129,10 @@
 		ast_log(LOG_WARNING, "Unable to masquerade '%s' into '%s'\n", chan->name, target->name);
 		return -1;
 	}
+
+	/* If you want UniqueIDs, set channelvars in manager.conf to CHANNEL(uniqueid) */
+	ast_manager_event_multichan(EVENT_FLAG_CALL, "Pickup", 2, chans,
+		"Channel: %s\r\nTargetChannel: %s\r\n", chan->name, target->name);
 
 	return res;
 }

Modified: trunk/include/asterisk/manager.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/manager.h?view=diff&rev=240421&r1=240420&r2=240421
==============================================================================
--- trunk/include/asterisk/manager.h (original)
+++ trunk/include/asterisk/manager.h Fri Jan 15 15:04:34 2010
@@ -207,10 +207,10 @@
 	__ast_manager_event_multichan(category, event, nchans, chans, __FILE__, __LINE__, __PRETTY_FUNCTION__, contents , ## __VA_ARGS__);
 
 /*! External routines may send asterisk manager events this way
- * \param chan1 First channel related to this event (or NULL if none are relevant)
- * \param chan2 Second channel related to this event (or NULL if none are relevant)
  * \param category Event category, matches manager authorization
  * \param event Event name
+ * \param chancount Number of channels in chans parameter
+ * \param chans A pointer to an array of channels involved in the event
  * \param contents Format string describing event
  * \since 1.8
 */

Modified: trunk/main/features.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/features.c?view=diff&rev=240421&r1=240420&r2=240421
==============================================================================
--- trunk/main/features.c (original)
+++ trunk/main/features.c Fri Jan 15 15:04:34 2010
@@ -4734,7 +4734,7 @@
 */
 int ast_pickup_call(struct ast_channel *chan)
 {
-	struct ast_channel *cur;
+	struct ast_channel *cur, *chans[2] = { chan, };
 	struct ast_party_connected_line connected_caller;
 	int res;
 	const char *chan_name;
@@ -4748,6 +4748,8 @@
 		return -1;
 	}
 
+	chans[1] = cur;
+
 	ast_channel_lock_both(cur, chan);
 
 	cur_name = ast_strdupa(cur->name);
@@ -4783,6 +4785,10 @@
 	if (!ast_strlen_zero(pickupsound)) {
 		ast_stream_and_wait(cur, pickupsound, "");
 	}
+
+	/* If you want UniqueIDs, set channelvars in manager.conf to CHANNEL(uniqueid) */
+	ast_manager_event_multichan(EVENT_FLAG_CALL, "Pickup", 2, chans,
+		"Channel: %s\r\nTargetChannel: %s\r\n", chan->name, cur->name);
 
 	cur = ast_channel_unref(cur);
 




More information about the asterisk-commits mailing list