[asterisk-dev] Patch to app_queue to add annoucements to the caller
Tristan
tristan at telemaque.fr
Tue Jul 4 06:15:23 MST 2006
Hi, here is a patch against 1.2.9.1 to add annoucements to the caller...
This patch is currently in beta here
Please provide comments on the code or the way I did it as it is my
first patch for asterisk...
I'm looking for your answers and any way to improve my codings ;)
Thanks a lot,
Tristan
----------------------------------------------------------------------------------------------------------------
diff -rdbU3 asterisk-1.2.9.1/apps/app_queue.c
asterisk-current-1.2.9.1/apps/app_queue.c
--- asterisk-1.2.9.1/apps/app_queue.c 2006-06-04 05:43:35.000000000 +0200
+++ asterisk-current-1.2.9.1/apps/app_queue.c 2006-07-04
14:59:56.000000000 +0200
@@ -353,6 +354,9 @@
char sound_thanks[80]; /*!< Sound file: "Thank you for
your patience." (def. queue-thankyou) */
char sound_reporthold[80]; /*!< Sound file: "Hold time"
(def. queue-reporthold) */
char sound_periodicannounce[80];/*!< Sound file: Custom
announce, no default */
+ char sound_callerannounce[80];/*!< Sound file: Custom announce for
caller, no default */
+
+
int count; /*!< How many entries */
int maxlen; /*!< Max number of entries */
@@ -607,6 +611,9 @@
ast_copy_string(q->sound_lessthan, "queue-less-than",
sizeof(q->sound_lessthan));
ast_copy_string(q->sound_reporthold, "queue-reporthold",
sizeof(q->sound_reporthold));
ast_copy_string(q->sound_periodicannounce,
"queue-periodic-announce", sizeof(q->sound_periodicannounce));
+ ast_copy_string(q->sound_callerannounce, "queue-callerannounce",
sizeof(q->sound_callerannounce));
+
+
}
static void clear_queue(struct ast_call_queue *q)
@@ -750,6 +757,8 @@
ast_copy_string(q->sound_lessthan, val,
sizeof(q->sound_lessthan));
} else if (!strcasecmp(param, "queue-thankyou")) {
ast_copy_string(q->sound_thanks, val,
sizeof(q->sound_thanks));
+ } else if (!strcasecmp(param, "queue-callerannounce")) {
+ ast_copy_string(q->sound_callerannounce, val,
sizeof(q->sound_callerannounce));
} else if (!strcasecmp(param, "queue-reporthold")) {
ast_copy_string(q->sound_reporthold, val,
sizeof(q->sound_reporthold));
} else if (!strcasecmp(param, "announce-frequency")) {
@@ -2343,6 +2352,15 @@
}
/* Stop music on hold */
ast_moh_stop(qe->chan);
+
+ /* Play the announcement to the caller */
+
+ if (play_file(qe->chan, qe->parent->sound_callerannounce))
+ ast_log(LOG_WARNING, "Announcement file '%s' is
unavailable, continuing anyway...\n", qe->parent->sound_callerannounce);
+
+ /* End of play for the annoucement of the caller */
+
+
/* If appropriate, log that we have a destination channel */
if (qe->chan->cdr)
ast_cdr_setdestchan(qe->chan->cdr, peer->name);
@@ -2382,6 +2400,7 @@
ast_log(LOG_DEBUG, "app_queue:
sendurl=%s.\n", url);
ast_channel_sendurl(peer, url);
}
+
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",
More information about the asterisk-dev
mailing list