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
This commit is contained in:
Kevin P. Fleming
2005-10-04 23:28:57 +00:00
parent f387421905
commit b7c31babb0
4 changed files with 133 additions and 89 deletions

View File

@@ -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)
{