[asterisk-commits] trunk r28520 - /trunk/channels/chan_local.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri May 19 01:20:01 MST 2006


Author: oej
Date: Fri May 19 03:20:01 2006
New Revision: 28520

URL: http://svn.digium.com/view/asterisk?rev=28520&view=rev
Log:
Adding send_text capability to chan_local

Modified:
    trunk/channels/chan_local.c

Modified: trunk/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_local.c?rev=28520&r1=28519&r2=28520&view=diff
==============================================================================
--- trunk/channels/chan_local.c (original)
+++ trunk/channels/chan_local.c Fri May 19 03:20:01 2006
@@ -76,6 +76,7 @@
 static int local_indicate(struct ast_channel *ast, int condition, const void *data, size_t datalen);
 static int local_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
 static int local_sendhtml(struct ast_channel *ast, int subclass, const char *data, int datalen);
+static int local_sendtext(struct ast_channel *ast, const char *text);
 static int local_devicestate(void *data);
 
 /* PBX interface structure for channel registration */
@@ -95,6 +96,7 @@
 	.indicate = local_indicate,
 	.fixup = local_fixup,
 	.send_html = local_sendhtml,
+	.send_text = local_sendtext,
 	.devicestate = local_devicestate,
 };
 
@@ -319,6 +321,22 @@
 	return res;
 }
 
+static int local_sendtext(struct ast_channel *ast, const char *text)
+{
+	struct local_pvt *p = ast->tech_pvt;
+	int res = -1;
+	struct ast_frame f = { AST_FRAME_TEXT, };
+	int isoutbound;
+
+	ast_mutex_lock(&p->lock);
+	isoutbound = IS_OUTBOUND(ast, p);
+	f.data = (char *) text;
+	f.datalen = strlen(text) + 1;
+	res = local_queue_frame(p, isoutbound, &f, ast);
+	ast_mutex_unlock(&p->lock);
+	return res;
+}
+
 static int local_sendhtml(struct ast_channel *ast, int subclass, const char *data, int datalen)
 {
 	struct local_pvt *p = ast->tech_pvt;



More information about the asterisk-commits mailing list