[Asterisk-Dev] $50 BOUNTY RE: [Asterisk-Users] Agents / ackcall
Greg Boehnlein
damin at nacs.net
Sat Feb 21 12:01:23 MST 2004
On Sat, 21 Feb 2004, Greg Boehnlein wrote:
> On Sat, 21 Feb 2004, Greg Boehnlein wrote:
>
> > Hey there.. I hate cross posting, but can someone point out why this is
> > not working, and/or/why it is such a bad idea? All I am trying to
> > accomplish is getting a GSM file to be announced to an agent via
> > AgentCallbackLogin BEFORE they press the "#" key.
> >
> > $50 via PayPal to the first person that makes this work and adds an option
> > to "queues.conf" to configure the file that is played! ;)
>
> After looking at the source code a bit, I realized that this is not a
> clear cut, easy thing to accomplish. I was under the impression that
> chan_agent played the actual "announce = " gsm file to the user, but that
> is incorrect. app_queue calls chan_agent to establish the connection and
> once it returnes, the announcement is played.
>
> So, chan_agent does need to be modified, similar to the way that I've done
> it already, to play the announcement AFTER the channel has connected, and
> before the agent presses "#".
>
> It seems like a more reasonable method to define a "preack-announce"
> message in the "agents.conf" file rather than place this in the
> queues.conf file, as it is possible that agents could be used outside of
> the queue structure.
>
> Any takers?
I got it to work, with a hardcoded gsm filename. The bounty is STILL up
for grabs if someone can expand the patch to allow for a configureable
preack-announce message in agents.conf! :)
--- asterisk/channels/chan_agent.c.gjb 2004-02-21 13:55:35.000000000 -0500
+++ asterisk/channels/chan_agent.c 2004-02-21 13:52:59.000000000 -0500
@@ -281,7 +281,8 @@
}
static struct ast_frame *agent_read(struct ast_channel *ast)
{
- struct agent_pvt *p = ast->pvt->pvt;
+ int res = -1;
+ struct agent_pvt *p = ast->pvt->pvt;
struct ast_frame *f = NULL;
static struct ast_frame null_frame = { AST_FRAME_NULL, };
static struct ast_frame answer_frame = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER };
@@ -308,9 +309,22 @@
}
}
if (f && (f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_ANSWER)) {
+
/* TC */
if (p->ackcall) {
- if (option_verbose > 2)
+ ast_stopstream(p->chan);
+ res = ast_streamfile(p->chan, "all-your-base", p->chan->language);
+ if (!res)
+ res = ast_waitstream(p->chan, "");
+ else
+ {
+
+ ast_verbose(VERBOSE_PREFIX_3 "ast_streamfile failed on %s\n", p->chan->name);
+ res = 0;
+ }
+ ast_stopstream(p->chan);
+
+ if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "%s answered, waiting for '#' to acknowledge\n", p->chan->name);
/* Don't pass answer along */
ast_frfree(f);
--
Vice President of N2Net, a New Age Consulting Service, Inc. Company
http://www.n2net.net Where everything clicks into place!
KP-216-121-ST
More information about the asterisk-dev
mailing list