[Asterisk-Users] Agents / ackcall

Greg Boehnlein damin at NACS.NET
Sat Feb 21 13:19:59 MST 2004


On Sat, 21 Feb 2004, Matthew B Marlowe wrote:

> I wish I knew how to code, but I don't.  If you ever get this working
> I'm highly interested.  You can probably send a patch to
> http://bugs.digium.com I'd assume.

1. Record an "agent-preack-announce.gsm" file and slap it into 
/var/lib/asterisk/sounds/
2. Apply this patch to chan_agent.c

--- 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);




More information about the asterisk-users mailing list