summaryrefslogtreecommitdiff
path: root/channel.c
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2005-10-04 23:28:57 +0000
committerKevin P. Fleming <kpfleming@digium.com>2005-10-04 23:28:57 +0000
commitb7c31babb0dc39339ebce8cc58f3e805f8f262d4 (patch)
tree80c6dd781f33a51a5d3e19044bcd1c2d866bf681 /channel.c
parentf38742190538c10fbcf866b7169826165488b0c6 (diff)
support call duration limits on inbound OSP calls (issue #5346)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6721 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channel.c')
-rwxr-xr-xchannel.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/channel.c b/channel.c
index 9296ed10d..3ffeebaef 100755
--- a/channel.c
+++ b/channel.c
@@ -273,6 +273,31 @@ void ast_channel_setwhentohangup(struct ast_channel *chan, time_t offset)
return;
}
+/*--- ast_channel_cmpwhentohangup: Compare a offset with when to hangup channel */
+int ast_channel_cmpwhentohangup(struct ast_channel *chan, time_t offset)
+{
+ time_t whentohangup;
+
+ if (chan->whentohangup == 0) {
+ if (offset == 0)
+ return (0);
+ else
+ return (-1);
+ } else {
+ if (offset == 0)
+ return (1);
+ else {
+ whentohangup = offset + time (NULL);
+ if (chan->whentohangup < whentohangup)
+ return (1);
+ else if (chan->whentohangup == whentohangup)
+ return (0);
+ else
+ return (-1);
+ }
+ }
+}
+
/*--- ast_channel_register: Register a new telephony channel in Asterisk */
int ast_channel_register(const struct ast_channel_tech *tech)
{