[asterisk-commits] branch bweschke/queue_improvements r16426 - /team/bweschke/queue_improvements...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Mar 29 21:28:43 MST 2006


Author: bweschke
Date: Wed Mar 29 22:28:41 2006
New Revision: 16426

URL: http://svn.digium.com/view/asterisk?rev=16426&view=rev
Log:
 It compiles cleanly, so it's GOTTA work! 


Modified:
    team/bweschke/queue_improvements/apps/app_queue.c

Modified: team/bweschke/queue_improvements/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/queue_improvements/apps/app_queue.c?rev=16426&r1=16425&r2=16426&view=diff
==============================================================================
--- team/bweschke/queue_improvements/apps/app_queue.c (original)
+++ team/bweschke/queue_improvements/apps/app_queue.c Wed Mar 29 22:28:41 2006
@@ -129,7 +129,7 @@
 static char *synopsis = "Queue a call for a call queue";
 
 static char *descrip =
-"  Queue(queuename[|options[|URL][|announceoverride][|timeout]]):\n"
+"  Queue(queuename[|options[|URL][|announceoverride][|timeout][|AGI]):\n"
 "Queues an incoming call in a particular call queue as defined in queues.conf.\n"
 "This application will return to the dialplan if the queue does not exist, or\n"
 "any of the join options cause the caller to not enter the queue.\n"
@@ -148,6 +148,8 @@
 "up by another user.\n"
 "  The optional URL will be sent to the called party if the channel supports\n"
 "it.\n"
+"  The optional AGI parameter will setup an AGI script to be executed on the \n"
+"calling party's channel once they are connected to a queue member.\n"
 "  The timeout will cause the queue to fail out after a specified number of\n"
 "seconds, checked between each queues.conf 'timeout' and 'retry' cycle.\n"
 "  This application sets the following channel variable upon completion:\n"
@@ -2013,7 +2015,7 @@
 	return 0;
 }
 
-static int try_calling(struct queue_ent *qe, const char *options, char *announceoverride, const char *url, int *go_on)
+static int try_calling(struct queue_ent *qe, const char *options, char *announceoverride, const char *url, int *go_on, const char *agi)
 {
 	struct member *cur;
 	struct callattempt *outgoing=NULL; /* the queue we are building */
@@ -2027,6 +2029,7 @@
 	struct ast_channel *which;
 	struct callattempt *lpeer;
 	struct member *member;
+	struct ast_app *app;
 	int res = 0, bridge = 0;
 	int numbusies = 0;
 	int x=0;
@@ -2036,6 +2039,8 @@
 	time_t now = time(NULL);
 	struct ast_bridge_config bridge_config;
 	char nondataquality = 1;
+	char *agiexec = NULL;
+	int ret = 0;
 
 	memset(&bridge_config, 0, sizeof(bridge_config));
 	time(&now);
@@ -2254,6 +2259,16 @@
 	 			ast_log(LOG_DEBUG, "app_queue: sendurl=%s.\n", url);
  			ast_channel_sendurl(peer, url);
  		}
+		if (!ast_strlen_zero(agi)) {
+			if (option_debug)
+				ast_log(LOG_DEBUG, "app_queue: agi=%s.\n", agi);
+			app = pbx_findapp("agi");
+			if (app) {
+				agiexec = ast_strdupa(agi);
+				ret = pbx_exec(qe->chan, app, agiexec, 1);
+			} else 
+				ast_log(LOG_WARNING, "Asked to execute an AGI on this channel, but could not find application (agi)!\n");
+		}
 		ast_queue_log(queuename, qe->chan->uniqueid, peer->name, "CONNECT", "%ld", (long)time(NULL) - qe->start);
 		if (qe->parent->eventwhencalled)
 			manager_event(EVENT_FLAG_AGENT, "AgentConnect",
@@ -2862,6 +2877,7 @@
 		 AST_APP_ARG(url);
 		 AST_APP_ARG(announceoverride);
 		 AST_APP_ARG(queuetimeoutstr);
+		 AST_APP_ARG(agi);
 	);
 	
 	/* Our queue entry */
@@ -3010,7 +3026,7 @@
 				}
 
 				/* Try calling all queue members for 'timeout' seconds */
-				res = try_calling(&qe, args.options, args.announceoverride, args.url, &go_on);
+				res = try_calling(&qe, args.options, args.announceoverride, args.url, &go_on, args.agi);
 
 				if (res) {
 					if (res < 0) {



More information about the asterisk-commits mailing list