mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-10 14:51:09 +00:00
support sending text through agent channels (issue #5295)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6787 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1831,7 +1831,7 @@ char *ast_recvtext(struct ast_channel *chan, int timeout)
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ast_sendtext(struct ast_channel *chan, char *text)
|
int ast_sendtext(struct ast_channel *chan, const char *text)
|
||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
/* Stop if we're a zombie or need a soft hangup */
|
/* Stop if we're a zombie or need a soft hangup */
|
||||||
|
@@ -244,6 +244,7 @@ static int agent_answer(struct ast_channel *ast);
|
|||||||
static struct ast_frame *agent_read(struct ast_channel *ast);
|
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_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_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_indicate(struct ast_channel *ast, int condition);
|
||||||
static int agent_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
|
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);
|
static struct ast_channel *agent_bridgedchannel(struct ast_channel *chan, struct ast_channel *bridge);
|
||||||
@@ -261,6 +262,7 @@ static const struct ast_channel_tech agent_tech = {
|
|||||||
.read = agent_read,
|
.read = agent_read,
|
||||||
.write = agent_write,
|
.write = agent_write,
|
||||||
.send_html = agent_sendhtml,
|
.send_html = agent_sendhtml,
|
||||||
|
.send_text = agent_sendtext,
|
||||||
.exception = agent_read,
|
.exception = agent_read,
|
||||||
.indicate = agent_indicate,
|
.indicate = agent_indicate,
|
||||||
.fixup = agent_fixup,
|
.fixup = agent_fixup,
|
||||||
@@ -558,6 +560,17 @@ static int agent_sendhtml(struct ast_channel *ast, int subclass, const char *dat
|
|||||||
return res;
|
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)
|
static int agent_write(struct ast_channel *ast, struct ast_frame *f)
|
||||||
{
|
{
|
||||||
struct agent_pvt *p = ast->tech_pvt;
|
struct agent_pvt *p = ast->tech_pvt;
|
||||||
|
@@ -722,7 +722,7 @@ int ast_set_write_format(struct ast_channel *chan, int format);
|
|||||||
* Write text to a display on a channel
|
* Write text to a display on a channel
|
||||||
* Returns 0 on success, -1 on failure
|
* Returns 0 on success, -1 on failure
|
||||||
*/
|
*/
|
||||||
int ast_sendtext(struct ast_channel *chan, char *text);
|
int ast_sendtext(struct ast_channel *chan, const char *text);
|
||||||
|
|
||||||
/*! Receives a text character from a channel */
|
/*! Receives a text character from a channel */
|
||||||
/*!
|
/*!
|
||||||
|
Reference in New Issue
Block a user