[asterisk-bugs] [Asterisk 0013216]: Incorrect ANSWERTIME when using M option

Asterisk Bug Tracker noreply at bugs.digium.com
Tue Oct 14 15:24:57 CDT 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=13216 
====================================================================== 
Reported By:                ruddy
Assigned To:                Corydon76
====================================================================== 
Project:                    Asterisk
Issue ID:                   13216
Category:                   Applications/app_dial
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     feedback
Asterisk Version:           1.4.21.2 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             2008-07-31 19:10 CDT
Last Modified:              2008-10-14 15:24 CDT
====================================================================== 
Summary:                    Incorrect ANSWERTIME when using M option
Description: 
Here is the situation we have.
When somebody call extension 1000, we start AGI 'agicaller.php'
that will try to call 10 people one after another.
For each person, if the other party answer the channel, with option
M(agicallee.php),
we check if the other person accept the call and if yes, we connect both
parties.
If not, we try the next person and so on.


Now, after looking at app_dial.c, I realize that,
ANSWEREDTIME is not set to 0 when we enter dial application and is setup
only when after the BRIDGE.

So, if somebody reject the call and the agicallee.php macro setup
MACRO_RESULT to CONGESTION, the
DIALSTATUS is set to ANSWERED but ANSWEREDTIME is not reset and have the
same value as the last Dial that was made by that call.

I think :
1. Everytime, we enter dial_exec_full, we should reset ANSWEREDTIME to 0
2. Setup ANSWEREDTIME for every situation where the call was answered, not
only when it was bridge.
   Because the agicallee.php can take 5 minutes to execute and set
MACRO_RESULT to CONGESTION after all.


I hope I was enough clear in my explanations.
Thanks.

====================================================================== 

---------------------------------------------------------------------- 
 (0093642) ruddy (reporter) - 2008-10-14 15:24
 http://bugs.digium.com/view.php?id=13216#c93642 
---------------------------------------------------------------------- 
Here is the issue.
On the app_dial.c source code, to setup the channel variable ANSWEREDTIME,
we do the difference between endtime and answer_time. Also ANSWEREDTIME is
setup only and only after the call were actually bridge (ie after
ast_bridge_call).

I will give you two situations so you can understand what the issues are.

Situation 1 : If I have an agi script where the user is asked to enter the
number he wish to dial, then we dial that number, bridge the call A and
after the conversation we register the ANSWEREDTIME in the database. Then
the user is asked to enter another number. If this second call fails, the
ANSWEREDTIME on the user channel is still stucks to the call A answered
time. So, we have BUSY as DIALRESULT and ANSWEREDTIME != 0.
So, what I suggest is to reset ANSWEREDTIME to 0 or empty string everytime
we enter the Dial cmd. So, ANSWEREDTIME is really the last call
ANSWEREDTIME.


Situation 2 : For situation 1, we can have a walk around by checking the
DIALSTATUS. So, if the DIALSTATUS != ANSWER, then we just ignore the
ANSWEREDTIME. But this workaround becomes ineffective if we use the M
option in the dial. This M option will be use to execute an AGI script to
the callee so he can accept or reject the call. That can take up to 2
minutes to the callee to do so. First, in this case, we don't have any
variable to get the CONVERSATIONTIME which is the ANSWEREDTIME minus the
time the callee takes to accept the call. Second, if the user dial CALL A
who was accepted, we have DIALRESULT=ANSWER and ANSWEREDTIME=40minutes,
then if the user dial CALL B who is rejected, we have the exact same
variables at the output ie DIALRESULT=ANSWER (because the call was answered
but rejected by the callee) and ANSWEREDTIME=40minutes (because it was not
reset between dials).


Suggestion :
What I suggest is 
- add a variable CONVERSATIONTIME or BILLABLETIME that will be different
from ANSWEREDTIME, specially when we use the M option
- everytime we enter the Dial command, reset ANSWEREDTIME to 0 or empty
string.


I hope this is much clear. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2008-10-14 15:24 ruddy          Note Added: 0093642                          
======================================================================




More information about the asterisk-bugs mailing list