aboutsummaryrefslogtreecommitdiffstats
path: root/channel.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-10-04 23:28:57 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-10-04 23:28:57 +0000
commit01e127d11225f757af4ae92d59c68e58752f9727 (patch)
tree80c6dd781f33a51a5d3e19044bcd1c2d866bf681 /channel.c
parent024f2617d8262e60fa1ee1a6496b079557fe72be (diff)
support call duration limits on inbound OSP calls (issue #5346)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6721 f38db490-d61c-443f-a65b-d21fe96a405b
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)
{