[Asterisk-cvs] asterisk/channels chan_agent.c,1.158,1.159

kpfleming kpfleming
Thu Oct 13 20:51:37 CDT 2005


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv24121/channels

Modified Files:
	chan_agent.c 
Log Message:
support sending text through agent channels (issue #5295)


Index: chan_agent.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_agent.c,v
retrieving revision 1.158
retrieving revision 1.159
diff -u -d -r1.158 -r1.159
--- chan_agent.c	13 Oct 2005 21:59:25 -0000	1.158
+++ chan_agent.c	14 Oct 2005 00:46:13 -0000	1.159
@@ -244,6 +244,7 @@
 static struct ast_frame *agent_read(struct ast_channel *ast);
 static int agent_write(struct ast_channel *ast, struct ast_frame *f);
 static int agent_sendhtml(struct ast_channel *ast, int subclass, const char *data, int datalen);
+static int agent_sendtext(struct ast_channel *ast, const char *text);
 static int agent_indicate(struct ast_channel *ast, int condition);
 static int agent_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
 static struct ast_channel *agent_bridgedchannel(struct ast_channel *chan, struct ast_channel *bridge);
@@ -261,6 +262,7 @@
 	.read = agent_read,
 	.write = agent_write,
 	.send_html = agent_sendhtml,
+	.send_text = agent_sendtext,
 	.exception = agent_read,
 	.indicate = agent_indicate,
 	.fixup = agent_fixup,
@@ -558,6 +560,17 @@
 	return res;
 }
 
+static int agent_sendtext(struct ast_channel *ast, const char *text)
+{
+	struct agent_pvt *p = ast->tech_pvt;
+	int res = -1;
+	ast_mutex_lock(&p->lock);
+	if (p->chan) 
+		res = ast_sendtext(p->chan, text);
+	ast_mutex_unlock(&p->lock);
+	return res;
+}
+
 static int agent_write(struct ast_channel *ast, struct ast_frame *f)
 {
 	struct agent_pvt *p = ast->tech_pvt;




More information about the svn-commits mailing list