Polarity change not working

Hello,
I am having an issue that I cannot resolve although I have tried several changes with no luck. Let me explain the scenario and the settings that I have checked/changed and did not work.
I am trying to set up a VoIP system for a telephone booth with a Cisco PAP2NA - Asterisk - FreePbx - A2billing. The issues is that the telephone booth/tel kiosk /call center (not sure what is the translation in English of locutorio) software is starting to count the seconds of the call just when the customer has finished dialing. I want this to start counting when the callee pickups the phone.

Tests done:
1 - With the above scenario (ATA-Telephony booth - Asterisk) I have change in all the possible combinations the ATA settings on the polarity configuration section for the line. With the idle polarity value in reverse the telephony software detects the change on polarity but when the customer finishes dialing (not when the other side pickups the call)
2 - Skipped the Asterisk system and connected directly the ATA to the trunk with the idle polarity in reverse. This works. Here is where I started to suspect that the issue was Asterisk. Of course under this simple configuration I cannot take advantage of all the Asterisk-A2billing advantages.
3 - With the full system (ATA-Telephony booth - Asterisk) I tried by changing the values in the file /etc/asterisk/chan_dahdi.conf to:
answeronpolarityswitch=yes
hanguponpolarityswitch=yes

After saving the changes with vim, I reloaded the chan_dahdi module in asterisk and tried again. Did not work. Just to clarify the first thing was to search the text on the answeronpolarityswitch on the /etc/asterisk directory (grep “answeronpolarityswitch” /etc/asterisk/*). I only found one instance on the file chan_dahdi.conf

4 - I also tried with the configuration 3 but also by changing busydetect and reloading the module. No luck again.

Is there any tip that you can provide or link that I can use to resolve this issue or at least to keep trying things until I can resolve it?

What applications precede Dial in the dialplan?

Hello David, I am not sure I understand your question… please let me know if what I put below replies your questions.
The set of apps that I have is Asterisk - Freepbx - A2Billing - VOIP trunk. Besides those and the firmware of the ATA, I do not have any other app on the call workflow.

Do you have Answer(), Playback(), etc., before Dial()?

If you have Freepbx, the details depend on that and you really need to ask on a Freepbx forum.

Hi David,
I was checking my files and trying to understand from where to get these details based on my configuration. I found the folllowing:

[a2billing]
; CallingCard application
exten => _X.,1,Answer
exten => _X.,2,Wait(2)
exten => _X.,3,DeadAGI(a2billing.php)
exten => _X.,4,Wait(2)
exten => _X.,5,Hangup

I am not an expert… but I guess the DeadAGI is in charge of the Dial call… I mean the call is processed by the php script that in my case is an a2billing call.
Does it makes sense the first line says Answer? and by that I guess it changes the polarity before even dialing? What are your thoughts?

It might change the polarity if the incoming line is on an FXS interface, although I’m not sure that is supported. On an FXO port, it will loop the line.

From your point of view, though, it marks the CDR as answered, so, unless you reset the CDR, which will probably confuse your billing software, the outgoing call will not affect the answer time no the CDR.

I personally consider it bad practice to answer early, but there may be some good reason why the canned dialplans you are using do do it.