VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
mgandikota at nts.net Guest
|
Posted: Wed Oct 15, 2014 1:44 pm Post subject: [asterisk-users] AMI and CDR(answer) |
|
|
Hi All
I am unable to obtain CDR(answer) in AMI.
Tried the following:
$ telnet 127.0.0.1 5038
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Asterisk Call Manager/1.0
Action: Login
ActionID: 1
Username: admin
Secret: secret5
Action: Getvar
Channel: xxx
Variable: CDR(start)
Response: Success
Variable: CDR(start)
Value: 2014-10-15 11:35:37
Action: Getvar
Channel: xxx
Variable: CDR(answer)
Response: Success
Variable: CDR(answer)
Value:
Any help is appreciated.
Thanks
Murthy |
|
Back to top |
|
|
mjordan at digium.com Guest
|
Posted: Wed Oct 15, 2014 2:41 pm Post subject: [asterisk-users] AMI and CDR(answer) |
|
|
On Wed, Oct 15, 2014 at 1:44 PM, Murthy Gandikota <mgandikota@nts.net> wrote:
Quote: | Hi All
I am unable to obtain CDR(answer) in AMI.
Tried the following:
$ telnet 127.0.0.1 5038
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Asterisk Call Manager/1.0
Action: Login
ActionID: 1
Username: admin
Secret: secret5
Action: Getvar
Channel: xxx
Variable: CDR(start)
Response: Success
Variable: CDR(start)
Value: 2014-10-15 11:35:37
Action: Getvar
Channel: xxx
Variable: CDR(answer)
Response: Success
Variable: CDR(answer)
Value:
|
Are you sure the channel is answered?
--
Matthew Jordan
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
mgandikota at nts.net Guest
|
Posted: Wed Oct 15, 2014 3:08 pm Post subject: [asterisk-users] AMI and CDR(answer) |
|
|
Hi Mathew
The channel was answered. I have a small AGI script that would call the
getFullVariable("${CDR(answer)}") method in Java and print a Date/Time
string. When the AMI connection was on, a sound file is being played on.
May be you can help me in a different way. My goal is to obtain the
Date/Time when the caller was answered using "answer()" in the dialplan.
More specifically, when the NewChannelEvent is generated. I know I can
create a dialplan variable with strftime. But I would rather take
advantage of the built-in readonly Asterisk variables before trying that
route.
I am grateful for your response and would appreciate additional help.
Thanks
-----Original Message-----
From: asterisk-users-bounces@lists.digium.com
[mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Matthew
Jordan
Sent: Wednesday, October 15, 2014 12:41 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] AMI and CDR(answer)
On Wed, Oct 15, 2014 at 1:44 PM, Murthy Gandikota <mgandikota@nts.net>
wrote:
Quote: | Hi All
I am unable to obtain CDR(answer) in AMI.
Tried the following:
$ telnet 127.0.0.1 5038
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Asterisk Call Manager/1.0
Action: Login
ActionID: 1
Username: admin
Secret: secret5
Action: Getvar
Channel: xxx
Variable: CDR(start)
Response: Success
Variable: CDR(start)
Value: 2014-10-15 11:35:37
Action: Getvar
Channel: xxx
Variable: CDR(answer)
Response: Success
Variable: CDR(answer)
Value:
|
Are you sure the channel is answered?
--
Matthew Jordan
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
mgandikota at nts.net Guest
|
Posted: Wed Oct 15, 2014 4:32 pm Post subject: [asterisk-users] AMI and CDR(answer) |
|
|
I traced CDR(disposition) which was set to "NO ANSWER". Apparently AMI
works the opposite of AGI in this case.
-----Original Message-----
From: asterisk-users-bounces@lists.digium.com
[mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Murthy
Gandikota
Sent: Wednesday, October 15, 2014 1:08 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] AMI and CDR(answer)
Hi Mathew
The channel was answered. I have a small AGI script that would call the
getFullVariable("${CDR(answer)}") method in Java and print a Date/Time
string. When the AMI connection was on, a sound file is being played on.
May be you can help me in a different way. My goal is to obtain the
Date/Time when the caller was answered using "answer()" in the dialplan.
More specifically, when the NewChannelEvent is generated. I know I can
create a dialplan variable with strftime. But I would rather take
advantage of the built-in readonly Asterisk variables before trying that
route.
I am grateful for your response and would appreciate additional help.
Thanks
-----Original Message-----
From: asterisk-users-bounces@lists.digium.com
[mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Matthew
Jordan
Sent: Wednesday, October 15, 2014 12:41 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] AMI and CDR(answer)
On Wed, Oct 15, 2014 at 1:44 PM, Murthy Gandikota <mgandikota@nts.net>
wrote:
Quote: | Hi All
I am unable to obtain CDR(answer) in AMI.
Tried the following:
$ telnet 127.0.0.1 5038
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Asterisk Call Manager/1.0
Action: Login
ActionID: 1
Username: admin
Secret: secret5
Action: Getvar
Channel: xxx
Variable: CDR(start)
Response: Success
Variable: CDR(start)
Value: 2014-10-15 11:35:37
Action: Getvar
Channel: xxx
Variable: CDR(answer)
Response: Success
Variable: CDR(answer)
Value:
|
Are you sure the channel is answered?
--
Matthew Jordan
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
mgandikota at nts.net Guest
|
Posted: Wed Oct 15, 2014 5:10 pm Post subject: [asterisk-users] AMI and CDR(answer) |
|
|
The CDR(disposition) is changing from context to context. Looks like AGI
and AMI are in agreement. Still, it is a mystery why the helpful
Asterisk folks
haven't given us a built-in variable for when the call was first
answered.
-----Original Message-----
From: asterisk-users-bounces@lists.digium.com
[mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Murthy
Gandikota
Sent: Wednesday, October 15, 2014 2:32 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] AMI and CDR(answer)
I traced CDR(disposition) which was set to "NO ANSWER". Apparently AMI
works the opposite of AGI in this case.
-----Original Message-----
From: asterisk-users-bounces@lists.digium.com
[mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Murthy
Gandikota
Sent: Wednesday, October 15, 2014 1:08 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] AMI and CDR(answer)
Hi Mathew
The channel was answered. I have a small AGI script that would call the
getFullVariable("${CDR(answer)}") method in Java and print a Date/Time
string. When the AMI connection was on, a sound file is being played on.
May be you can help me in a different way. My goal is to obtain the
Date/Time when the caller was answered using "answer()" in the dialplan.
More specifically, when the NewChannelEvent is generated. I know I can
create a dialplan variable with strftime. But I would rather take
advantage of the built-in readonly Asterisk variables before trying that
route.
I am grateful for your response and would appreciate additional help.
Thanks
-----Original Message-----
From: asterisk-users-bounces@lists.digium.com
[mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Matthew
Jordan
Sent: Wednesday, October 15, 2014 12:41 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] AMI and CDR(answer)
On Wed, Oct 15, 2014 at 1:44 PM, Murthy Gandikota <mgandikota@nts.net>
wrote:
Quote: | Hi All
I am unable to obtain CDR(answer) in AMI.
Tried the following:
$ telnet 127.0.0.1 5038
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Asterisk Call Manager/1.0
Action: Login
ActionID: 1
Username: admin
Secret: secret5
Action: Getvar
Channel: xxx
Variable: CDR(start)
Response: Success
Variable: CDR(start)
Value: 2014-10-15 11:35:37
Action: Getvar
Channel: xxx
Variable: CDR(answer)
Response: Success
Variable: CDR(answer)
Value:
|
Are you sure the channel is answered?
--
Matthew Jordan
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
mjordan at digium.com Guest
|
Posted: Wed Oct 15, 2014 5:28 pm Post subject: [asterisk-users] AMI and CDR(answer) |
|
|
On Wed, Oct 15, 2014 at 5:10 PM, Murthy Gandikota <mgandikota@nts.net> wrote:
Quote: | The CDR(disposition) is changing from context to context. Looks like AGI
and AMI are in agreement. Still, it is a mystery why the helpful
Asterisk folks
haven't given us a built-in variable for when the call was first
answered.
|
AMI informs you when a channel is answered via a Newstate event [1].
If you receive such an event and the ChannelState/ChannelStateDesc is
6/Up, then the channel has been answered.
Alternatively, you can query a channel for its Answer time using
either the CDR function, which will return back the CDR's view of the
time the channel was answered. If the channel was not answered, then
not surprisingly, the value is empty. An example output is show below:
Response: Success
Variable: CDR(answer)
Value: 2014-10-15 17:21:29
As for why there isn't a "built-in variable":
(1) For queries, the information is already provided by other
mechanisms, such as the CDR function
(2) If you are monitoring the system, you can get exactly when the
channel was answered via the Newstate event
(3) No one (that I'm aware of) has provided such a patch. Asterisk is
open source. If you'd like to have something, write a patch, and
submit it back to the project. [2]
[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+ManagerEvent_Newstate
[2] https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process
--
Matthew Jordan
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
mgandikota at nts.net Guest
|
Posted: Wed Oct 15, 2014 9:32 pm Post subject: [asterisk-users] AMI and CDR(answer) |
|
|
Thanks, Matthew. I think CDR(answer) is, in the end, not very useful to
me if it changes from context to context. Suppose from AMI we generate a
status
event, what will be the CDR(answer)? I see that sometimes it is returned
as the literal "Production" instead of a Date/Time or a blank value. I
am only puzzled that no one created a patch for the first timestamp when
a call is answered. If I get some free time, I will try to create one.
-----Original Message-----
From: asterisk-users-bounces@lists.digium.com
[mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Matthew
Jordan
Sent: Wednesday, October 15, 2014 3:28 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] AMI and CDR(answer)
On Wed, Oct 15, 2014 at 5:10 PM, Murthy Gandikota <mgandikota@nts.net>
wrote:
Quote: | The CDR(disposition) is changing from context to context. Looks like
| AGI
Quote: | and AMI are in agreement. Still, it is a mystery why the helpful
Asterisk folks
haven't given us a built-in variable for when the call was first
answered.
|
AMI informs you when a channel is answered via a Newstate event [1].
If you receive such an event and the ChannelState/ChannelStateDesc is
6/Up, then the channel has been answered.
Alternatively, you can query a channel for its Answer time using
either the CDR function, which will return back the CDR's view of the
time the channel was answered. If the channel was not answered, then
not surprisingly, the value is empty. An example output is show below:
Response: Success
Variable: CDR(answer)
Value: 2014-10-15 17:21:29
As for why there isn't a "built-in variable":
(1) For queries, the information is already provided by other
mechanisms, such as the CDR function
(2) If you are monitoring the system, you can get exactly when the
channel was answered via the Newstate event
(3) No one (that I'm aware of) has provided such a patch. Asterisk is
open source. If you'd like to have something, write a patch, and
submit it back to the project. [2]
[1]
https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+ManagerEvent_News
tate
[2]
https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process
--
Matthew Jordan
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
mgandikota at nts.net Guest
|
Posted: Thu Oct 16, 2014 11:45 am Post subject: [asterisk-users] AMI and CDR(answer) |
|
|
Suppose we have a dialplan as follows and sip.conf is set to forward the call to [start] context, the CDR(diposition) in [start] context will be "ANSWER" and in [next] will be "NO ANSWER". Right?
[start]
exten = s,1,answer()
same =>n,gotoif($[${SOMEVAR} = SOME_VAL]?next)
same =>n, hangup()
[next]
exten = s,1, VERBOSE(WE ARE HERE)
same =>n,hangup()
From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Matthew Jordan
Sent: Thursday, October 16, 2014 8:55 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] AMI and CDR(answer)
On Wed, Oct 15, 2014 at 9:31 PM, Murthy Gandikota <mgandikota@nts.net (mgandikota@nts.net)> wrote:
Thanks, Matthew. I think CDR(answer) is, in the end, not very useful to
me if it changes from context to context. Suppose from AMI we generate a
status
I'm not sure what you mean by "changes from context to context". The answer time on a CDR is reflective of when the channel was answered. That can be altered if you choose to alter it in the dialplan via ForkCDR, but generally, that time is conveyed from one CDR to another.
A specific example would help here.
Quote: |
event, what will be the CDR(answer)? I see that sometimes it is returned
as the literal "Production" instead of a Date/Time or a blank value. |
I don't know what you mean here either. What version of Asterisk are you using? Can you provide an example where you get said literal back, as well as the dialplan that produces this behavior?
Quote: |
I
am only puzzled that no one created a patch for the first timestamp when
a call is answered. If I get some free time, I will try to create one.
|
--
Matthew Jordan
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org |
|
Back to top |
|
|
mgandikota at nts.net Guest
|
Posted: Thu Oct 16, 2014 12:44 pm Post subject: [asterisk-users] AMI and CDR(answer) |
|
|
Apparently we are calling ResetCDR (not ForkCDR) in the Asterisk 11.5.1 That is causing the CDR(answer) to be erased between context. My bad.
From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Murthy Gandikota
Sent: Thursday, October 16, 2014 9:45 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] AMI and CDR(answer)
Suppose we have a dialplan as follows and sip.conf is set to forward the call to [start] context, the CDR(diposition) in [start] context will be "ANSWER" and in [next] will be "NO ANSWER". Right?
[start]
exten = s,1,answer()
same =>n,gotoif($[${SOMEVAR} = SOME_VAL]?next)
same =>n, hangup()
[next]
exten = s,1, VERBOSE(WE ARE HERE)
same =>n,hangup()
From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Matthew Jordan
Sent: Thursday, October 16, 2014 8:55 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] AMI and CDR(answer)
On Wed, Oct 15, 2014 at 9:31 PM, Murthy Gandikota <mgandikota@nts.net (mgandikota@nts.net)> wrote:
Thanks, Matthew. I think CDR(answer) is, in the end, not very useful to
me if it changes from context to context. Suppose from AMI we generate a
status
I'm not sure what you mean by "changes from context to context". The answer time on a CDR is reflective of when the channel was answered. That can be altered if you choose to alter it in the dialplan via ForkCDR, but generally, that time is conveyed from one CDR to another.
A specific example would help here.
Quote: |
event, what will be the CDR(answer)? I see that sometimes it is returned
as the literal "Production" instead of a Date/Time or a blank value. |
I don't know what you mean here either. What version of Asterisk are you using? Can you provide an example where you get said literal back, as well as the dialplan that produces this behavior?
Quote: |
I
am only puzzled that no one created a patch for the first timestamp when
a call is answered. If I get some free time, I will try to create one.
|
--
Matthew Jordan
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org |
|
Back to top |
|
|
mgandikota at nts.net Guest
|
Posted: Thu Oct 16, 2014 1:24 pm Post subject: [asterisk-users] AMI and CDR(answer) |
|
|
Hi Matthew,
Now that you helped me figure out the root cause of my problem, I am wondering if there is a safe way to store CDR without altering the non-custom fields (the converse of v option).
Thanks
From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Murthy Gandikota
Sent: Thursday, October 16, 2014 10:44 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] AMI and CDR(answer)
Apparently we are calling ResetCDR (not ForkCDR) in the Asterisk 11.5.1 That is causing the CDR(answer) to be erased between context. My bad.
From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Murthy Gandikota
Sent: Thursday, October 16, 2014 9:45 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] AMI and CDR(answer)
Suppose we have a dialplan as follows and sip.conf is set to forward the call to [start] context, the CDR(diposition) in [start] context will be "ANSWER" and in [next] will be "NO ANSWER". Right?
[start]
exten = s,1,answer()
same =>n,gotoif($[${SOMEVAR} = SOME_VAL]?next)
same =>n, hangup()
[next]
exten = s,1, VERBOSE(WE ARE HERE)
same =>n,hangup()
From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Matthew Jordan
Sent: Thursday, October 16, 2014 8:55 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] AMI and CDR(answer)
On Wed, Oct 15, 2014 at 9:31 PM, Murthy Gandikota <mgandikota@nts.net (mgandikota@nts.net)> wrote:
Thanks, Matthew. I think CDR(answer) is, in the end, not very useful to
me if it changes from context to context. Suppose from AMI we generate a
status
I'm not sure what you mean by "changes from context to context". The answer time on a CDR is reflective of when the channel was answered. That can be altered if you choose to alter it in the dialplan via ForkCDR, but generally, that time is conveyed from one CDR to another.
A specific example would help here.
Quote: |
event, what will be the CDR(answer)? I see that sometimes it is returned
as the literal "Production" instead of a Date/Time or a blank value. |
I don't know what you mean here either. What version of Asterisk are you using? Can you provide an example where you get said literal back, as well as the dialplan that produces this behavior?
Quote: |
I
am only puzzled that no one created a patch for the first timestamp when
a call is answered. If I get some free time, I will try to create one.
|
--
Matthew Jordan
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org |
|
Back to top |
|
|
mgandikota at nts.net Guest
|
Posted: Thu Oct 16, 2014 4:13 pm Post subject: [asterisk-users] AMI and CDR(answer) |
|
|
in cdr.c
void ast_cdr_reset(struct ast_cdr *cdr, struct ast_flags *_flags)
{
struct ast_cdr *duplicate;
struct ast_flags flags = { 0 };
if (_flags)
ast_copy_flags(&flags, _flags, AST_FLAGS_ALL);
for ( ; cdr ; cdr = cdr->next) {
/* Detach if post is requested */
if (ast_test_flag(&flags, AST_CDR_FLAG_LOCKED) || !ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
if (ast_test_flag(&flags, AST_CDR_FLAG_POSTED)) {
ast_cdr_end(cdr);
if ((duplicate = ast_cdr_dup_unique_swap(cdr))) {
ast_cdr_detach(duplicate);
}
ast_set_flag(cdr, AST_CDR_FLAG_POSTED);
}
/* enable CDR only */
if (ast_test_flag(&flags, AST_CDR_FLAG_POST_ENABLE)) {
ast_clear_flag(cdr, AST_CDR_FLAG_POST_DISABLED);
continue;
}
/* clear variables */
if (!ast_test_flag(&flags, AST_CDR_FLAG_KEEP_VARS)) {
ast_cdr_free_vars(cdr, 0);
}
/* Reset to initial state */
ast_clear_flag(cdr, AST_FLAGS_ALL);
memset(&cdr->start, 0, sizeof(cdr->start));
memset(&cdr->end, 0, sizeof(cdr->end));
memset(&cdr->answer, 0, sizeof(cdr->answer));
cdr->billsec = 0;
cdr->duration = 0;
ast_cdr_start(cdr);
cdr->disposition = AST_CDR_NOANSWER;
}
}
}
If this line:
memset(&cdr->answer, 0, sizeof(cdr->answer));
is commented away, should work.
From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Murthy Gandikota
Sent: Thursday, October 16, 2014 11:24 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] AMI and CDR(answer)
Hi Matthew,
Now that you helped me figure out the root cause of my problem, I am wondering if there is a safe way to store CDR without altering the non-custom fields (the converse of v option).
Thanks
From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Murthy Gandikota
Sent: Thursday, October 16, 2014 10:44 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] AMI and CDR(answer)
Apparently we are calling ResetCDR (not ForkCDR) in the Asterisk 11.5.1 That is causing the CDR(answer) to be erased between context. My bad.
From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Murthy Gandikota
Sent: Thursday, October 16, 2014 9:45 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] AMI and CDR(answer)
Suppose we have a dialplan as follows and sip.conf is set to forward the call to [start] context, the CDR(diposition) in [start] context will be "ANSWER" and in [next] will be "NO ANSWER". Right?
[start]
exten = s,1,answer()
same =>n,gotoif($[${SOMEVAR} = SOME_VAL]?next)
same =>n, hangup()
[next]
exten = s,1, VERBOSE(WE ARE HERE)
same =>n,hangup()
From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Matthew Jordan
Sent: Thursday, October 16, 2014 8:55 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] AMI and CDR(answer)
On Wed, Oct 15, 2014 at 9:31 PM, Murthy Gandikota <mgandikota@nts.net (mgandikota@nts.net)> wrote:
Thanks, Matthew. I think CDR(answer) is, in the end, not very useful to
me if it changes from context to context. Suppose from AMI we generate a
status
I'm not sure what you mean by "changes from context to context". The answer time on a CDR is reflective of when the channel was answered. That can be altered if you choose to alter it in the dialplan via ForkCDR, but generally, that time is conveyed from one CDR to another.
A specific example would help here.
Quote: |
event, what will be the CDR(answer)? I see that sometimes it is returned
as the literal "Production" instead of a Date/Time or a blank value. |
I don't know what you mean here either. What version of Asterisk are you using? Can you provide an example where you get said literal back, as well as the dialplan that produces this behavior?
Quote: |
I
am only puzzled that no one created a patch for the first timestamp when
a call is answered. If I get some free time, I will try to create one.
|
--
Matthew Jordan
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org |
|
Back to top |
|
|
mjordan at digium.com Guest
|
Posted: Fri Oct 17, 2014 12:46 pm Post subject: [asterisk-users] AMI and CDR(answer) |
|
|
On Thu, Oct 16, 2014 at 4:12 PM, Murthy Gandikota <mgandikota@nts.net (mgandikota@nts.net)> wrote:
Quote: |
in cdr.c
void ast_cdr_reset(struct ast_cdr *cdr, struct ast_flags *_flags)
{
struct ast_cdr *duplicate;
struct ast_flags flags = { 0 };
if (_flags)
ast_copy_flags(&flags, _flags, AST_FLAGS_ALL);
for ( ; cdr ; cdr = cdr->next) {
/* Detach if post is requested */
if (ast_test_flag(&flags, AST_CDR_FLAG_LOCKED) || !ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
if (ast_test_flag(&flags, AST_CDR_FLAG_POSTED)) {
ast_cdr_end(cdr);
if ((duplicate = ast_cdr_dup_unique_swap(cdr))) {
ast_cdr_detach(duplicate);
}
ast_set_flag(cdr, AST_CDR_FLAG_POSTED);
}
/* enable CDR only */
if (ast_test_flag(&flags, AST_CDR_FLAG_POST_ENABLE)) {
ast_clear_flag(cdr, AST_CDR_FLAG_POST_DISABLED);
continue;
}
/* clear variables */
if (!ast_test_flag(&flags, AST_CDR_FLAG_KEEP_VARS)) {
ast_cdr_free_vars(cdr, 0);
}
/* Reset to initial state */
ast_clear_flag(cdr, AST_FLAGS_ALL);
memset(&cdr->start, 0, sizeof(cdr->start));
memset(&cdr->end, 0, sizeof(cdr->end));
memset(&cdr->answer, 0, sizeof(cdr->answer));
cdr->billsec = 0;
cdr->duration = 0;
ast_cdr_start(cdr);
cdr->disposition = AST_CDR_NOANSWER;
}
}
}
If this line:
memset(&cdr->answer, 0, sizeof(cdr->answer));
is commented away, should work.
|
I don't think you need to change the Asterisk source for this (particularly since it is supposed to be wiping the answer time there).
If you want to keep the original answer time, use a custom field in your CDR, and set it prior to resetting:
exten => Set(CDR(orig_answer)=${CDR(answer)})
exten => ResetCDR(v)
Note the usage of 'v' to keep the custom variable that you just set.
--
Matthew Jordan
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org |
|
Back to top |
|
|
mgandikota at nts.net Guest
|
Posted: Fri Oct 17, 2014 12:51 pm Post subject: [asterisk-users] AMI and CDR(answer) |
|
|
From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Matthew Jordan
Sent: Friday, October 17, 2014 10:46 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] AMI and CDR(answer)
On Thu, Oct 16, 2014 at 4:12 PM, Murthy Gandikota <mgandikota@nts.net (mgandikota@nts.net)> wrote:
in cdr.c
void ast_cdr_reset(struct ast_cdr *cdr, struct ast_flags *_flags)
{
struct ast_cdr *duplicate;
struct ast_flags flags = { 0 };
if (_flags)
ast_copy_flags(&flags, _flags, AST_FLAGS_ALL);
for ( ; cdr ; cdr = cdr->next) {
/* Detach if post is requested */
if (ast_test_flag(&flags, AST_CDR_FLAG_LOCKED) || !ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
if (ast_test_flag(&flags, AST_CDR_FLAG_POSTED)) {
ast_cdr_end(cdr);
if ((duplicate = ast_cdr_dup_unique_swap(cdr))) {
ast_cdr_detach(duplicate);
}
ast_set_flag(cdr, AST_CDR_FLAG_POSTED);
}
/* enable CDR only */
if (ast_test_flag(&flags, AST_CDR_FLAG_POST_ENABLE)) {
ast_clear_flag(cdr, AST_CDR_FLAG_POST_DISABLED);
continue;
}
/* clear variables */
if (!ast_test_flag(&flags, AST_CDR_FLAG_KEEP_VARS)) {
ast_cdr_free_vars(cdr, 0);
}
/* Reset to initial state */
ast_clear_flag(cdr, AST_FLAGS_ALL);
memset(&cdr->start, 0, sizeof(cdr->start));
memset(&cdr->end, 0, sizeof(cdr->end));
memset(&cdr->answer, 0, sizeof(cdr->answer));
cdr->billsec = 0;
cdr->duration = 0;
ast_cdr_start(cdr);
cdr->disposition = AST_CDR_NOANSWER;
}
}
}
If this line:
memset(&cdr->answer, 0, sizeof(cdr->answer));
is commented away, should work.
I don't think you need to change the Asterisk source for this (particularly since it is supposed to be wiping the answer time there).
If you want to keep the original answer time, use a custom field in your CDR, and set it prior to resetting:
exten => Set(CDR(orig_answer)=${CDR(answer)})
exten => ResetCDR(v)
Note the usage of 'v' to keep the custom variable that you just set.
--
Matthew Jordan
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org
I agree with a caveat. As I mentioned before, strftime can be used instead of CDR(answer) for the answer time. It will be like any other user defined variable. |
|
Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|