summaryrefslogtreecommitdiff
path: root/addons/chan_ooh323.c
diff options
context:
space:
mode:
authorAlexandr Anikin <may@telecom-service.ru>2012-06-19 23:36:43 +0000
committerAlexandr Anikin <may@telecom-service.ru>2012-06-19 23:36:43 +0000
commit2428e19436fad0829539187b50d27d36f277cc01 (patch)
treec96d2dd4250519691a8d3d766a114cf913c28ecd /addons/chan_ooh323.c
parentf080be134edec9e9fd7dc9175170db6fd946a010 (diff)
check rtptimeouts in ooh323 channels as per config file
(rtp voice, video, udptl except rtcp) (closes issue ASTERISK-19179) Reported by: TSAREGORODTSEV Yury Patches: 19179-ooh323-ast10.patch ........ Merged revisions 369091 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369092 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'addons/chan_ooh323.c')
-rw-r--r--addons/chan_ooh323.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/addons/chan_ooh323.c b/addons/chan_ooh323.c
index bf3991f68..06113cb42 100644
--- a/addons/chan_ooh323.c
+++ b/addons/chan_ooh323.c
@@ -1152,6 +1152,8 @@ static int ooh323_write(struct ast_channel *ast, struct ast_frame *f)
if (p) {
ast_mutex_lock(&p->lock);
+ p->lastrtptx = time(NULL);
+
if (f->frametype == AST_FRAME_MODEM) {
ast_debug(1, "Send UDPTL %d/%d len %d for %s\n",
f->frametype, f->subclass.integer, f->datalen, ast_channel_name(ast));
@@ -3735,6 +3737,24 @@ static void *do_monitor(void *data)
h323_next = h323->next;
/* TODO: Need to add rtptimeout keepalive support */
+
+ if (h323->rtp && h323->rtptimeout && h323->lastrtptx &&
+ h323->lastrtptx + h323->rtptimeout < t) {
+ ast_rtp_instance_sendcng(h323->rtp, 0);
+ h323->lastrtptx = time(NULL);
+ }
+
+ if (h323->rtp && h323->owner && h323->rtptimeout &&
+ h323->lastrtprx &&
+ h323->lastrtprx + h323->rtptimeout < t) {
+ if (!ast_channel_trylock(h323->owner)) {
+ ast_softhangup_nolock(h323->owner, AST_SOFTHANGUP_DEV);
+ ast_log(LOG_NOTICE, "Disconnecting call '%s' for lack of RTP activity in %ld seconds\n", h323->owner->name, (long) (t - h323->lastrtprx));
+ ast_channel_unlock(h323->owner);
+ }
+
+ }
+
if (ast_test_flag(h323, H323_NEEDDESTROY)) {
ooh323_destroy (h323);
} /* else if (ast_test_flag(h323, H323_NEEDSTART) && h323->owner) {
@@ -4610,12 +4630,14 @@ struct ast_frame *ooh323_rtp_read(struct ast_channel *ast, struct ooh323_pvt *p)
switch (ast_channel_fdno(ast)) {
case 0:
f = ast_rtp_instance_read(p->rtp, 0); /* RTP Audio */
+ p->lastrtprx = time(NULL);
break;
case 1:
f = ast_rtp_instance_read(p->rtp, 1); /* RTCP Control Channel */
break;
case 2:
f = ast_rtp_instance_read(p->vrtp, 0); /* RTP Video */
+ p->lastrtprx = time(NULL);
break;
case 3:
f = ast_rtp_instance_read(p->vrtp, 1); /* RTCP Control Channel for video */
@@ -4626,6 +4648,7 @@ struct ast_frame *ooh323_rtp_read(struct ast_channel *ast, struct ooh323_pvt *p)
ast_debug(1, "Got UDPTL %d/%d len %d for %s\n",
f->frametype, f->subclass.integer, f->datalen, ast_channel_name(ast));
}
+ p->lastrtprx = time(NULL);
break;
default: