Even with a proper analogue card, analogue answer supervision is a problem as not all PSTN operators provide it. With your setup the SIP side has already signalled answer before the digits are sent.
The only thing you can do from the Asterisk side is to wait for silence.
However, have you checked that the gateway is not capable of automatically waiting for secondary dialtone,
That seems strange. Even with providers with weird requirements, that’s not where I’d expect problems. You need to report the problem as, if it is not known, chan_sip will disappear with no solution for the problem in chan_psip,
If it is reported as a problem you’ll need to state what “does not handle end of calls well” means and provide a SIP trace using “pjsip set logger on”.
The only thing I can think of that would cause problems with ending a call is if the Grandstream is sending the wrong address in its Contact headers, in which case there is a rewrite contact option in chan_pjsip, to work round that.
This could happen if the Grandstream is inside NAT, and not compensating for it, and Asterisk is not in that particular NAT.