An issue where using the G option of Dial creates multiple CDRs

When you make a call using this system, you want the caller to play the call-connected music, and when the receiver answers the call, you want to play music to both the caller and receiver at the same time.

I wrote a dial plan as follows.

extensions.conf

...
...
exten => _X.,n,Set(__ORIGCHANNEL=${CHANNEL})
exten => _X.,n,Dial(SIP/${EXTEN},,m(${caller_sound_file})G(default,_X.,100))
exten => _X.,n,Hangup()

exten => _X.,100,Goto(_X.,200)
exten => _X.,101,Goto(_X.,300)
exten => _X.,n,Hangup()

exten => _X.,200,Playback(caller_sound_file2)
exten => _X.,n,Hangup()

exten => _X.,300,Playback(callee_sound_file)
exten => _X.,n,Bridge(${ORIGCHANNEL}) ; bridge
exten => _X.,n,Hangup()

Problem:
Three CDRs are created.
스크린샷 2021-06-04 오후 6.07.31

Until it becomes a bridged, it seems to be a completely different call. (If you end the call while music is playing on both sides, only one side is terminated.)
After the bridge is established, the call connection is normal and the call ends well.

What’s the reason?
If I am using the dial G option incorrectly, please let me know the correct way.
I’d like to write a scenario like the one above in a different way. Help me. :scream:

OS : Amazon Linux 2
Asterisk Version: 16
CDR module : Adaptive ODBC, MySQL

The CDR options were not modified.

That’s expected behaviour for the G option. The Dial application is no longer running, and there is no bridge, but those are the only things that know that the two channels running dialplan are really one call.

Also, you should not invoke Hangup at priority 201, as, there is a significant chance that it will execute before the the Bridge, in which case the Bridge will fail. You should include a Wait.

PS a cropped and redacted picture of the CDRs doesn’t really help. If they are needed, provide the the complete text, as text, and redact in such a way that one can still distinguish different values (and distinguish between private and public addresses), even though the actual values are no longer used.

The attached file only shows that 3 CDRs are generated and that the src/dst values are different.

okay… It is difficult to write the scenario I want other than the G option, and the creation of three CDRs is also an expected behavior of the G option, right?

PS If the G option is the expected scenario, is the G option an option for multiple phones?

Running the two legs as though they are separate calls is the expected behaviour.

There has been a rewrite of CDRs since I last looked at them in much detail, but, historically the rule tended to be that if you did anything unusual, you needed to run test cases. CEL was introduced to allow better handling of complex cases, at the expense of more complex post-processing.

I’d note that Bridge is different form Dial, in that dialplan execution continues after the B side hangs up, in the normal case, so I think I would expect a CDR off the bridge and also one as the result of a Hangup. However, historically, as I said, one would look at what one actually got, and post-process accordingly.

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