mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
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:
25
channel.c
25
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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user