Summary:ASTERISK-01101: AbsoluteTimeout takes into account ringing time
Reporter:lancey (lancey)Labels:
Date Opened:2004-02-25 16:56:56.000-0600Date Closed:2008-01-15 14:46:10.000-0600
Versions:Frequency of
Environment:Attachments:( 0) calldurlimit.patch
( 1) calldurlimit.patch
Description:When you set AbsoluteTimeout, then Dial and the phone is picked up, you are allowed to talk for (AbsoluteTimeout - RingingTime) seconds. If you do not pick up the phone, it does not limit the duration.


exten => 2000,1,AbsoluteTimeout(10)
exten => 2000,2,Dial(SIP/2000)

I got these in the CDRs:
duration | billsec |
10       |      3  |  (i picked up 7 seconds after ringing started)
10       |      1  |
... and so on
Comments:By: lancey (lancey) 2004-02-27 12:34:19.000-0600

This happens with at least SIP to SIP and SIP to IAX2 calls.

By: lancey (lancey) 2004-02-28 20:00:58.000-0600

Is there any relevant information I can provide, or something else I could do to help get this bug resolved?

By: zoa (zoa) 2004-03-05 12:27:35.000-0600

This also happens with ZAP calls.

If this is not a bug, i think there should at least be an option to set the maxtimeout of a call itself , without the ringing time.

Right now this poses problems with prepay solutions, for example lets say a client has 10 seconds left for 1 specific destination, but the setup time is 10 seconds (simbox).

This will result in the client being able to call, it will start ringing and on pickup it will close the line immediately.

However, as i will only bill the actual call seconds, the client can keep calling and calling and calling, and for each of those 0 second calls i need to pay a setup cost to the carrier, but cant charge the client for it.

By: zoa (zoa) 2004-03-05 12:28:30.000-0600

that was a real life example btw, it actually happened.
(imagine the client calling an 150$/minute number... i'd be not very happy with that).

By: zoa (zoa) 2004-03-05 12:45:54.000-0600

in channel.c

void ast_channel_setwhentohangup(struct ast_channel *chan, time_t offset)
time_t myt;
chan-> whentohangup = myt + offset;
chan -> whentohangup = 0;

and is called from:

By: Mark Spencer (markster) 2004-03-05 13:24:40.000-0600

Absolute timeout's behavior is correct for what it was designed to do.  It would be possible to add an option to app_dial to support setting the timeout to a value when ANSWER is detected.

Your timeout not taking place when a channel is calling is a whole other issue.  I'd like to ssh in to your system to take a look at that preferably, but i know where it's coming from.

By: Mark Spencer (markster) 2004-03-05 13:43:16.000-0600

I believe I fixed the part about not getting absolute timeout if the call isn'ta nswered.  If not, feel free to reopen, or just find me on irc (kram, irc.freenode.net, #asterisk)

By: zoa (zoa) 2004-03-05 18:54:16.000-0600

lets add a little patch :)

By: zoa (zoa) 2004-03-05 18:54:22.000-0600

lets add a little patch :)

By: lancey (lancey) 2004-03-05 18:58:22.000-0600

This patch adds new functionality to app_dial - it can now limit the real duration of a call, useful for prepaid solutions. It now DOES NOT take into account any call setup or ringing time.
The limit is set via S(xx) in transfer options of Dial command. See 'show application dial' for more help.
Hope this helps anyone and get finally merged in Asterisk.

By: lancey (lancey) 2004-03-05 19:27:16.000-0600

I've added a new patch, with 2 typos corrected.
This one is also built against the current CVS, the previous one was by mistake built against 1.0-STABLE.
Hope this one is final.

By: lancey (lancey) 2004-03-05 20:10:43.000-0600

This feature of the Dial command also works for native bridged calls - it limits them proper.
Tested with:
SIP-SIP (native and non-native)
SIP-IAX (non-native)

By: Mark Spencer (markster) 2004-03-06 12:59:08.000-0600

I've added the patch in, but it didn't apply cleanly and had some minor issues with it.  please be sure it works properly.

By: lancey (lancey) 2004-03-06 13:48:42.000-0600

markster it is just fine. Works as expected.
I'm happy it's in CVS!

By: Digium Subversion (svnbot) 2008-01-15 14:46:03.000-0600

Repository: asterisk
Revision: 2349

U   trunk/channel.c

r2349 | markster | 2008-01-15 14:46:02 -0600 (Tue, 15 Jan 2008) | 2 lines

Consider whentohangup in timeout (bug ASTERISK-1101)



By: Digium Subversion (svnbot) 2008-01-15 14:46:03.000-0600

Repository: asterisk
Revision: 2350

U   branches/v1-0_stable/channel.c

r2350 | markster | 2008-01-15 14:46:03 -0600 (Tue, 15 Jan 2008) | 2 lines

Keep in mind the absolute timeout in ast_waitfor (bug ASTERISK-1101)



By: Digium Subversion (svnbot) 2008-01-15 14:46:10.000-0600

Repository: asterisk
Revision: 2357

U   trunk/apps/app_dial.c

r2357 | markster | 2008-01-15 14:46:09 -0600 (Tue, 15 Jan 2008) | 2 lines

Add absolute timeout option to dial that applies when call is up (bug ASTERISK-1101)