Add video support to chan_agent.

More ideas for developing better video support in Asterisk?

Join the asterisk-video mailing list to help out in the 
Asterisk Video Task Force!


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@35365 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Olle Johansson
2006-06-21 20:11:09 +00:00
parent a256bcb080
commit d29e2a58da

View File

@@ -263,6 +263,7 @@ static const struct ast_channel_tech agent_tech = {
.answer = agent_answer,
.read = agent_read,
.write = agent_write,
.write_video = agent_write,
.send_html = agent_sendhtml,
.send_text = agent_sendtext,
.exception = agent_read,
@@ -503,7 +504,8 @@ static struct ast_frame *agent_read(struct ast_channel *ast)
}
break;
case AST_FRAME_VOICE:
/* don't pass voice until the call is acknowledged */
case AST_FRAME_VIDEO:
/* don't pass voice or video until the call is acknowledged */
if (!p->acknowledged) {
ast_frfree(f);
f = &ast_null_frame;
@@ -554,16 +556,20 @@ static int agent_write(struct ast_channel *ast, struct ast_frame *f)
int res = -1;
CHECK_FORMATS(ast, p);
ast_mutex_lock(&p->lock);
if (p->chan) {
if (!p->chan)
res = 0;
else {
if ((f->frametype != AST_FRAME_VOICE) ||
(f->frametype != AST_FRAME_VIDEO) ||
(f->subclass == p->chan->writeformat)) {
res = ast_write(p->chan, f);
} else {
ast_log(LOG_DEBUG, "Dropping one incompatible voice frame on '%s' to '%s'\n", ast->name, p->chan->name);
ast_log(LOG_DEBUG, "Dropping one incompatible %s frame on '%s' to '%s'\n",
f->frametype == AST_FRAME_VOICE ? "audio" : "video",
ast->name, p->chan->name);
res = 0;
}
} else
res = 0;
}
CLEANUP(ast, p);
ast_mutex_unlock(&p->lock);
return res;