aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_agent.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-08-23 02:11:44 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-08-23 02:11:44 +0000
commit8cc13118264be0df91001b9ce8c6b9ff39e629cb (patch)
tree37fdbe42b4027f010b1f07f3320213f61dc3d50b /channels/chan_agent.c
parent9664c9e891397a4a476bcb7e64eee2fcf33e4799 (diff)
Handle timing file descriptor properly with agents
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1409 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_agent.c')
-rwxr-xr-xchannels/chan_agent.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index 404862ee2..2893046c8 100755
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -128,11 +128,18 @@ static struct agent_pvt {
} \
} while(0)
+/* Cleanup moves all the relevant FD's from the 2nd to the first, but retains things
+ properly for a timingfd XXX This might need more work if agents were logged in as agents or other
+ totally impractical combinations XXX */
+
#define CLEANUP(ast, p) do { \
int x; \
if (p->chan) { \
- for (x=0;x<AST_MAX_FDS;x++) \
- ast->fds[x] = p->chan->fds[x]; \
+ for (x=0;x<AST_MAX_FDS;x++) {\
+ if (x != AST_MAX_FDS - 2) \
+ ast->fds[x] = p->chan->fds[x]; \
+ } \
+ ast->fds[AST_MAX_FDS - 3] = p->chan->fds[AST_MAX_FDS - 2]; \
} \
} while(0)
@@ -247,7 +254,10 @@ static struct ast_frame *agent_read(struct ast_channel *ast)
CHECK_FORMATS(ast, p);
if (p->chan) {
p->chan->exception = ast->exception;
- p->chan->fdno = ast->fdno;
+ if (ast->fdno == AST_MAX_FDS - 3)
+ p->chan->fdno = AST_MAX_FDS - 2;
+ else
+ p->chan->fdno = ast->fdno;
f = ast_read(p->chan);
} else
f = &null_frame;