[Asterisk-Users] patch to add distinctive ringing to queues

Louis-David Mitterrand vindex at apartia.org
Thu Apr 7 08:18:01 MST 2005


Please find attached a patch I made to app_queue.c to add distinctive
ringing support. So the following works:

exten => 2131,1,SetVar(ALERT_INFO=<Internal>)
exten => 2131,2,Queue(standard|r)

I took code in app_dial.c and lightly adapted it. 

I hope this gets included in * as it is really useful. I faxed my
disclaimer earlier.

Cheers,


PS: I am unable to create an account on the BTS (no password is ever
sent and no, my spam filter didn't eat it) or login to my previoulsy
created account.

-- 
If you're happy, you're successful.
-------------- next part --------------
--- ./asterisk-1.0.7.dfsg.1/apps/app_queue.c	2005-04-07 17:08:17.000000000 +0200
+++ ./asterisk-1.0.7.dfsg.1+ldm/apps/app_queue.c	2005-04-06 17:10:42.000000000 +0200
@@ -548,6 +548,8 @@
 static int ring_entry(struct queue_ent *qe, struct localuser *tmp, int *busies)
 {
 	int res;
+	struct ast_var_t *current, *newvar;
+	struct varshead *headp, *newheadp;
 	if (qe->parent->wrapuptime && (time(NULL) - tmp->lastcall < qe->parent->wrapuptime)) {
 		ast_log(LOG_DEBUG, "Wrapuptime not yet expired for %s/%s\n", tmp->tech, tmp->numsubst);
 		if (qe->chan->cdr)
@@ -568,6 +570,26 @@
 		(*busies)++;
 		return 0;
 	}
+	/* If creating a SIP channel, look for a variable called */
+	/* VXML_URL in the calling channel and copy it to the    */
+	/* new channel.                                          */
+
+	/* Check for ALERT_INFO in the SetVar list.  This is for   */
+	/* SIP distinctive ring as per the RFC.  For Cisco 7960s,  */
+	/* SetVar(ALERT_INFO=<x>) where x is an integer value 1-5. */
+	/* However, the RFC says it should be a URL.  -km-         */
+	headp=&qe->chan->varshead;
+	AST_LIST_TRAVERSE(headp,current,entries) {
+		if (!strcasecmp(ast_var_name(current),"VXML_URL") ||
+			!strcasecmp(ast_var_name(current), "ALERT_INFO") ||
+			!strcasecmp(ast_var_name(current), "OSPTOKEN") ||
+			!strcasecmp(ast_var_name(current), "OSPHANDLE"))
+		{
+			newvar=ast_var_assign(ast_var_name(current),ast_var_value(current));
+			newheadp=&tmp->chan->varshead;
+			AST_LIST_INSERT_HEAD(newheadp,newvar,entries);
+		}
+	}
 	tmp->chan->appl = "AppQueue";
 	tmp->chan->data = "(Outgoing Line)";
 	tmp->chan->whentohangup = 0;


More information about the asterisk-users mailing list