Detect busy and hangup tones from SIP trunk

Hello,
I have hacked together a personal IP PBX system using Asterisk and FreePBX on a Raspberry PI.

I have gotten all working, incoming and outgoing calls, extensions etc. But my FXO (connecting Asterisk to my landline) does not have built in a method for detecting when the remote caller hangs up. Rather it passes the hangup tones generated at my telco. Because of the way I have it set up, my FXO is an SIP trunk under Asterisk. I have already set:

Under the PEER details in FreePBX to allow the detection of DTMF tones. I was wondering if there was a similar setting for allowing Asterisk to detect the hangup tones (and if possible, busy and ringing tones too).

Being able to do this means that my voicemail messages will not be hours long if the person hangs up instead of “pressing pound”.

Thanks in Advance.

PS. I think I’m posting in the correct place, but please correct me if i’m wrong, it’s my first post here. Thanks :smile:

There is no capability to do this without hacking code.