[Home]

Summary:ASTERISK-01076: [patch][post 1.4] Add Pre Acknowledgement Message to AgentCallbackLogin
Reporter:damin (damin)Labels:
Date Opened:2004-02-22 22:59:02.000-0600Date Closed:2006-08-18 15:33:53
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Channels/chan_agent
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) agentack.diff
( 1) agent-preack-announce.gsm
( 2) agent-preack-announce.patch.txt
( 3) agents.conf.sample-patch.txt
( 4) chan_agent.c-09182004.patch.txt
( 5) sounds-txt.patch.txt
( 6) bt.txt
( 7) bug-1082-8135.diff
( 8) trunk_ackagent.diff
Description:AgentCallbackLogin has no ability to play a message to the Agent when they pick up the call. It calls them and then silently sits there waiting for the agent to press "#". This patch adds a new configuration directive to the agents.conf file allowing the user to specify a file to be played to the agent before they acknowledge the call.

****** ADDITIONAL INFORMATION ******

This is my first patch. It can/should be refined and reviewd by qualified individuals before being committed to CVS.

Things that might be considered as additions to this patch;

1. Adding a 1 second sleep before the file is played to the agent. This plays it immediately upon pickup, so before the phone is to your ear, the first 1/2 second of the file has already been played.

2. Allowing the playback to be interrupted by DTMF so the agent can go "Yeah.. Yeah.. #" and take the call sooner. Right now, the entire file has to play before DTMF detection begins.

3. Potentially expanding this to allow per-queue preack announcements.

4. We need a decent recording of Allison saying "Please press pound to accept this call, or simply hang up"
Comments:By: damin (damin) 2004-02-24 23:30:51.000-0600

I found an unintended side effect of my patch. The Caller that is listening to Music On Hold in the call queue will experience a dropout of the Music On Hold while the agent-preack-announce file is played. I'm looking into how to solve this problem. The caller should never hear an interruption until the Agent actually acknowledges the call.

By: twisted (twisted) 2004-04-18 10:54:46

Can we get an update on the progress of this?

By: damin (damin) 2004-04-18 12:15:10

Here is my suggestion. This patch will most likely never be production ready with my programming skills, as to fix the MOH dropout requires re-architecting the PreAck playback routine to use a different set of Asterisk functions with potential drastic changes to the chan_agent code. I have a basic idea of how this could be accomplished, and I think I understand the logic behind it and the requirements to get it done, but not in any reasonable timeframe. Also, I have deferred working on this particular patch given that the ICD Queueing system appears to be a much more intelligent method for handling call queues and agents.

I would suggest that this patch be defferred until a later date. It works fine for my purposes now, despite the annoying MOH dropout, and if ICD becomes the defacto queueing application my code will be irrelevant anyway. So go ahead and close it, don't add it to CVS and we'll just re-visit it later.

By: twisted (twisted) 2004-04-18 12:54:43

Closed per damin - Will revisit later.

By: damin (damin) 2004-08-01 18:30:05

Updated patch for RC1 code.

By: damin (damin) 2004-08-01 18:32:15

Patch has been updated and uploaded.

By: damin (damin) 2004-08-02 00:37:38

Cause Twisted said it's not lame!

By: twisted (twisted) 2004-08-02 21:29:26

It's very not lame..   Just needs a little tweaking ;)

By: damin (damin) 2004-08-03 16:11:43

Just some house-cleaning. I uploaded patches to the agents.conf.sample and sounds.txt file w/ a recording of Allison saying "Please press # to accept this call, or * to hang up".

I'll try to work with this a little more over the next few weeks. I think this is really a post 1.0 feature though so I'm in no hurry.

By: ltropiano (ltropiano) 2004-08-28 11:42:01

I'd like to see this in 1.0... but, I may be the only one :)

We have a need for it right now, but would like the Additional Cavaets addressed as mentioned above.

By: jmls (jmls) 2004-09-20 02:25:15

I'm running CVS as of 18 September, and have a strange "twist" to this: * calls them and then silently sits there waiting for the agent to press "#". After the # is pressed, the announcement is played ..

Is there any way of removing the need to press "#" ? This only occurs on zap channels ...

By: umaro (umaro) 2004-09-20 10:44:37

Added code to make prompt interruptable, and to make it pass the digit that is pressed to interrupt the prompt.

By: Anthony Minessale (anthm) 2004-09-20 23:25:22

see agentack.diff

This is a new implementation of this idea

in agents.conf
[agents]
acksound=demo-congrats
ackwait=120

ackwait is a certian # of frames to wait before playing the file
(100-120 is about 2.5-3 seconds)
acksound is ,of course, the file to play to the agent.

This patch takes atvantage of the fact that while the agent channel awaits
the # key to be pressed it is reading frames the whole time.  What I did
was open a stream obj to the desired file and, if necessary, build a frame
translation path from the file's format to the dialed channel.

after each frame is read from this channel waiting for you to press #
I take 1 frame from the file and translate it to your format and play it
to you.... a poor man's generator of sorts.

Since the previous patch calls ast_streamfile in the chan_agent's read
function I can only assume this causes a large blocking fiasco since
agent_read is designed to produce exactly 1 frame not to grab a channel
and deliver a whole file full of frames which would explain the "moh droupout"

Please test and let me know how it works or if there are any bugs.

By: damin (damin) 2004-09-21 00:25:23

Thanks for the patch. Now.. given the three patches that are up here, how about some guidance. Do we install this patch alongside or instead of the other patches attached to this bugnote? We'll get to test this on a test server at Astricon in our room!

By: Anthony Minessale (anthm) 2004-09-21 07:37:15

agentack.diff is a self-contained solution
it is not related at all to the other patches and should
be applied to a standard CVS chan_agent.c
make sure you have the latest version of the patch
look at the date of the patch in this bug tracker.

edited on: 09-21-04 09:24

By: rwjblue (rwjblue) 2004-09-24 17:49:16

Did initial testing on agentack.diff.  Seems to work as advertised.  My only question/concern is that I need the ability to play a message to the agent based on both the initial dialed number and an account code I have received from the caller via IVR.  I want to use it as the poor mans CTI.  The reason behind all of this is that my agents must answer the phone with a certain greeting depending on those things.  Is there a way to do this?  Or should I just go fly a kite?

By: Mark Spencer (markster) 2004-10-12 23:29:53

I'm thinking about how to more generally solve this problem so we don't have to keep coming back to this.  We have "Macro" support in Dial already, so after an answer you can actually execute a few things before bridging the call.  If we extended that somehow, then we could allow the local channel to be used, right?  Just a thought.

By: twisted (twisted) 2004-10-27 17:02:16

So, where do we stand on this?  I agree this is indeed a much needed feature for the preack, so which route are we headed towards?

--Houskeeping

By: twisted (twisted) 2004-11-14 21:20:51.000-0600

It's been a month without real activity..   I'm going to suspect that the interest is lost again?  Closing.  Please re-open if we are going to continue working on this one.

--Houskeeping

By: damin (damin) 2005-12-01 17:50:23.000-0600

I've been asked by a couple of people to update this code for 1.2. Anthm's patch for 1.0 is a much more intelligent way to handle the issue, and I'd like to update it for 1.2 and have it reviewed. The patch MOSTLY applies to chan_agent, but has the following failures.

[root@gw1 channels]# more chan_agent.c.rej                    
***************
*** 344,359 ****
               if (p->ackcall) {
                       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);
                       f = &null_frame;
-               }
         else {
                       p->acknowledged = 1;
                       f = &answer_frame;
         }
       }
       if (f && (f->frametype == AST_FRAME_DTMF) && (f->subclass == '#')) {
               if (!p->acknowledged) {
                       if (option_verbose > 2)
                               ast_verbose(VERBOSE_PREFIX_3 "%s acknowledged\n", p->chan->name);
--- 358,384 ----
               if (p->ackcall) {
                       if (option_verbose > 2)
                               ast_verbose(VERBOSE_PREFIX_3 "%s answered, waiting for '#' to acknowledge\n", p->chan->name);
+                       p->framecount = 1;
                       /* Don't pass answer along */
                       ast_frfree(f);
                       f = &null_frame;
+               }
         else {
                       p->acknowledged = 1;
                       f = &answer_frame;
         }
       }
+
       if (f && (f->frametype == AST_FRAME_DTMF) && (f->subclass == '#')) {
+               if(p && p->chan && p->chan->stream) {
+                       ast_closestream(p->chan->stream);
+                       p->chan->stream = NULL;
+               }
+               if(p && p->trans) {
+                       ast_translator_free_path(p->trans);
+                       p->trans = NULL;
+               }
+
               if (!p->acknowledged) {
                       if (option_verbose > 2)
                               ast_verbose(VERBOSE_PREFIX_3 "%s acknowledged\n", p->chan->name);

By: Joshua C. Colp (jcolp) 2005-12-01 18:16:38.000-0600

Updated to latest 1.2 svn trunk per request of Damin

By: Steve Hanselman (shanselman) 2005-12-28 04:10:40.000-0600

It's shame that the pre-ack isn't added to the queue rather than the agent?
Then you could let agents know which queue the call is from?

By: Steve Hanselman (shanselman) 2005-12-28 04:52:05.000-0600

I'm just starting to look through the code, but is the queue name available to chan_agent when agent_call is invoked?

If it were then we could check for a file named "queuename"-"acksound" and if found, play it, otherwise play "acksound"?  Or simply have acksound live in the queue structure?



By: Jason Parker (jparker) 2006-01-17 20:52:57.000-0600

I'm going to try to spend some time on this over the next few days...

By: Jason Parker (jparker) 2006-01-18 13:04:37.000-0600

Somebody try this, and see if you can get the per queue acksound working now...

I've never touched agents before, so this attempt may have failed miserably.  I couldn't actually get it working at all (I couldn't get the previous patch working either), but the code should work (as long as the previous patch worked).

Just set an acksound= in queues.conf for a queue, and see if it plays that instead of the per agent acksound.

I used a channel variable, because you don't want agents to have to have queues loaded, and vice versa.

By: Jason Parker (jparker) 2006-01-18 16:46:09.000-0600

I went ahead and created a branch for this at http://svn.digium.com/svn/asterisk/team/north/bug_1082/

By: Steve Hanselman (shanselman) 2006-01-23 09:33:46.000-0600

I'm just about to check this, but I'll have to manually patch my tree as it's a fair few versions away from the current SVN unless you have a current version?

By: Jason Parker (jparker) 2006-01-23 10:34:18.000-0600

I just updated the branch for this bug at http://svn.digium.com/svn/asterisk/team/north/bug_1082/, to current svn trunk.  Check that out, and you're good to go.

By: Steve Hanselman (shanselman) 2006-01-26 05:08:25.000-0600

Ok, I've done some testing and it's not working, still looking into why (no sound is playd).

I've added debug, I can see that the variable is set in app_queue so no issues, there, bu tthe code never reaches the generator part in chan_agent (gets into agent_call but must bail out on the first "if")

More when I know more - unless you do!?

By: Steve Hanselman (shanselman) 2006-01-26 05:45:38.000-0600

Just had two crashes, not sure whether they relate to this patch, might just be coincidence, I'll attach the backtrace just in case.

By: Steve Hanselman (shanselman) 2006-01-26 05:57:06.000-0600

It gets as far as the place call to agent, that performs a return so it's never going to reach the generator section, am I missing something very basic in the design of the code?

My loginchan has a value as I'm using agentlogin, seems that the code would only work if it was empty.

By: Jason Parker (jparker) 2006-01-27 18:56:07.000-0600

Nope, you just described the exact issues I was having when I tested it.  I could never get it to actually hit that part of the code.

Since I've never used agents, and it isn't (afaik) related to this bug...I don't know what more I can do for now.

By: Steve Hanselman (shanselman) 2006-01-31 07:27:41.000-0600

I must be missing something as it looks to me that the best place to put the preack message is before the wait for the hash?

By: Steve Hanselman (shanselman) 2006-02-28 02:38:46.000-0600

I'll do some work on this next week, to properly support callbacks unless somebody else already has?

By: damin (damin) 2006-02-28 12:56:00.000-0600

Feel free. This, like so many other things, moved along as people have time to make adjustments and devote some time to it.

By: Serge Vecher (serge-v) 2006-05-01 15:02:42

shanselman: did you have a chance to work on this issue?

By: Serge Vecher (serge-v) 2006-05-09 13:17:04

bj: is there anything useful here for your current work?

By: BJ Weschke (bweschke) 2006-05-09 23:57:09

preack'ing a queue announcement would be a nice thing to do, no doubt. Alot of my time is going to go towards trying to resolve channel locking issues with the combo of app_queue / chan_agent callback / and mixmonitor in the next few days. I'll try and get back to this soon. Pls remind me if a week goes by and I don't get to it.

By: Serge Vecher (serge-v) 2006-05-19 13:23:49

bweschke: ping, as requested.

By: Serge Vecher (serge-v) 2006-06-12 20:17:11

ping me, baby, one more time

By: Serge Vecher (serge-v) 2006-07-07 15:43:39

I guess this is post 1.4 now ...

By: Jason Ayers (frisbeedude) 2006-07-11 15:13:41

I have been able to successfully get the preack working in v1.2 with some small changes to previous patches that were here, but I have the following issues as a result:
1) If the agent does not acknowledge (accept) the call, and if they are not automatically logged out of the queue as a result, it is not counted as an answered call by that agent and the call will immediately roll back to them instead of going to the next agent in the queue.
2) The announcement file seems to occassionaly start before the agent answers, meaning they may get the message in the middle of playback (although it will repeat).

I am new at this whole "patch" thing, but I believe I could upload a diff of what I have if it would be helpful to anyone else.  I am definitely interested in this feature, although it would be helpful to have the above side effects addressed if possible.

Thanks for your help.



By: Serge Vecher (serge-v) 2006-07-11 15:20:28

frisbeedude: thanks for working on this. There are a couple of things that need to be addressed before you post the patch.
1. Since new feature development is done against the trunk, that's what the patch needs to be against. Read on here http://www.asterisk.org/developers/Patch_Howto
2. You need to get a disclaimer on file. Read on here http://bugs.digium.com/main_page.php
3. When you are ready, post the patch and mention your disclaimer status, so somebody can look it over and help you with those problems.

By: Patrick Baker (patbaker82) 2006-08-18 14:41:18

I've accomplished the same thing here, except using a macro.

IE, incoming call forwards to queue.  The agent's telephone number, for example, is 9000@agent-list

the agent list context can point to a patternmatch

exten=>_XXXX,1,Dial(Local/2632@context,16,mtM(screen))

which calls the screen macro

[macro-screen]
exten=>s,1,wait(.25)
exten=>s,2,Read(ACCEPT|screen-callee-options|1)
exten=>s,3,Gotoif($[${ACCEPT} = 1] ?50)
exten=>s,4,Gotoif($[${ACCEPT} = 2] ?30)
exten=>s,5,Gotoif($[${ACCEPT} = 3] ?40)
exten=>s,6,Gotoif($[${ACCEPT} = 4] ?30:30)
exten=>s,30,SetVar(MACRO_RESULT=CONTINUE)
exten=>s,40,Read(TEXTEN|custom/screen-exten|)
exten=>s,41,Gotoif($[${LEN(${TEXTEN})} = 3]?42:45)
exten=>s,42,SetVar(MACRO_RESULT=GOTO:from-internal^${TEXTEN}^1)
exten=>s,45,Gotoif($[${TEXTEN} = 0] ?46:4)
exten=>s,46,SetVar(MACRO_RESULT=CONTINUE)
exten=>s,50,Playback(after-the-tone)
exten=>s,51,Playback(connected)
exten=>s,52,Playback(beep)

By: Jason Parker (jparker) 2006-08-18 15:33:48

This bug has sat open for over two and a half years.  Everybody who has worked on it, appears to have lost interest.  There has been very little test results reported.  There is also now an example of a way to do it via a macro and chan_local.

With the pending removal of AgentCallbackLogin after 1.4 and all of the reasons listed above, I am closing this bug.  If you feel this bug should be reopened, and you have a very good reason, please contact myself or another bug marshal.

Thank you to everyone who has worked on this bug.  It was definitely "interesting", to say the very least.