aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-08-06 13:54:07 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-08-06 13:54:07 +0000
commit8683ec2ed35111da3e2db01bd9cfb207094c188c (patch)
tree14825e9cb33bac200b34799f1af89d43ed2cf007 /res
parent55a3f3c257aed4d81badbf4ef980f3e9cc0f589a (diff)
Keep track of timelimit across entries to ast_channel_bridge (bug #2222)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3582 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rwxr-xr-xres/res_features.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/res/res_features.c b/res/res_features.c
index f9a3025df..67042062c 100755
--- a/res/res_features.c
+++ b/res/res_features.c
@@ -262,9 +262,11 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast
struct ast_channel *who;
char newext[256], *ptr;
int res;
+ int diff;
struct ast_option_header *aoh;
struct ast_channel *transferer;
struct ast_channel *transferee;
+ struct timeval start, end;
char *transferer_real_context;
int allowdisconnect_in,allowdisconnect_out,allowredirect_in,allowredirect_out;
@@ -291,7 +293,23 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast
peer->cdr = NULL;
}
for (;;) {
- res = ast_channel_bridge(chan,peer,config,&f, &who);
+ if (config->timelimit)
+ gettimeofday(&start, NULL);
+ res = ast_channel_bridge(chan,peer,config,&f, &who);
+ if (config->timelimit) {
+ /* Update time limit for next pass */
+ gettimeofday(&end, NULL);
+ diff = (end.tv_sec - start.tv_sec) * 1000;
+ diff += (end.tv_usec - start.tv_usec) / 1000;
+ config->timelimit -= diff;
+ if (config->timelimit <=0) {
+ /* We ran out of time */
+ config->timelimit = 0;
+ who = chan;
+ f = NULL;
+ res = 0;
+ }
+ }
if (res < 0) {
ast_log(LOG_WARNING, "Bridge failed on channels %s and %s\n", chan->name, peer->name);
return -1;