Local channels produces extra CDR records

Hello team!

As I saw in asterisk wiki, local channels when invoked by external party, via Originate, for example. Produces only 2 CDR records.

In my case Local channels invoked by call files and produces 4 CDR records (2 for local channels and 2 for PJSIP channels which invoked later, by local channels). It’s little bit confusing, when using CDR for billing as well as having 2 records will save a space of database storage.

This what I have see in docs:
An external application Originates a Local channel. The first half of the Local channel Dials Alice over a SIP channel; Alice answers. This triggers the second half of the Local channel, which Dials Bob. Bob Answers, and Alice and Bob talk. Alice hangs up, the Local channels are hung up, and Bob is hung up on.

Anyone know why in examples they have pretty informative only 2 CDR, but I have even 4? As on screenshot:

I need originate a call from Asterisk to 2 parties and have only 2 CDR records after call end. Asterisk will make a call through provider to party A, when party A is answered then Asterisk will call through provider to party B. When party B answered - bridge party A and party B together, let them talk. After of the channels is hang up - save their CDR records to database.

Maybe I see 4 CDR due to using call files, and if channels will be invoked through ARI or AMI for example in CDR will be also 2?

Thanks in advance.

The example is when a single Local channel set is involved. In your CDRs you have 2 sets due to the way you are doing things. This results in more records. Without showing how exactly you are doing things and what exactly you are hoping to accomplish it’s hard for anyone to comment.

Make sense.

What I am doing is originate a call by a call file with a following content:

Channel: Local/+7931xxx9521@outgoing/n
Application: Dial
Data: Local/+7911xxx6445@outgoing/n

Expect that 2 people will talk with each other like if they just call themselves directly without Asterisk in the middle.

I expect to see in CDR after call is end 2 records which shows seconds for a call Asterisk - party A, and Asterisk - party B. For example 15 and 10 seconds.

Time is not equal because party A pick up the phone, when Asterisk call him, after it bill seconds starts to count and after that we start call party B. While party A listen beeps. That is why party A usually have more billsec than party B.

What I should to change, to have only 2 CDR? And probably use only single set of Local channel, not 2?

Thanks in advance.

You would need to either not use a Local channel to the “Channel” argument or instead of using Dial as the application send the resulting call into the dialplan.

I tried even 3 variants and all of them didn’t produce exactly what need, yet.

  1. Not use Local channel to “Channel” argument.
    Produce 4 CDR records. There was not separate lines spent for party A and party B on conversation. Instead these values should be additionally calculated:

For party A:
3 line - how many seconds he waiting on the line while calling party B (listen beeps)
4 line - how many seconds he speaking with party B after party B pick up the phone (was in the bridge)

For party B:
Only 4 line - how many seconds he speaking with party A (was in the bridge)

Is there possible to get just 2 records for party A and party B?
Party A records should shows a time spent since he pick up the phone till hang it up. Not splitting by event, when he enter to the bridge with party B. Like it splitting now.
Party B records should shows time when he pick up the phone, till hang it up. There will no events like enter the bridge in the middle of the call, so billing relatively easy.

Call file:

Channel: PJSIP/+7931xxx9521@provider
Application: Dial
Data: Local/+7911xxx6445@outgoing
  1. Not use Dial as the application. Instead send resulting call into the dialplan.
    Produce 3 records.
    1 row: is party A to party B channel and 20 sec was a call duration. That is correct.
    2 row: seems party B to party A channel and actually it was not 20 sec, seems it just duplication of 20 sec, representing internal magic of Asterisk which I not fully understand yet.
    3 row: shows 5 seconds. It’s how many seconds party A and party B actually speaking.

If 1 row shows 20 seconds, and 2 row shows 5 seconds and there will not additional rows - it will be exactly what I am looking for. Is it possible have only 2 rows?

Call file:

Channel: Local/+7931xxx9521@outgoing
Context: outgoing
Extension: +7911xxx6445
  1. Use just PJSIP for both “Channel” and argument for Dial application:
    Produce 2 records.
    1 row - time spent Asterisk to calling party A, until it pick up the phone.
    2 row - seconds spent party A from pick up the phone, calling party B (listen beeps), until party B pick up the phone. After party A and party B enter to the bridge - no records.

    Call fine was:
Channel: PJSIP/+7931xxx9521@provider
Application: Dial
Data: PJSIP/+7911xxx6445@provider

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.