The only way I can think of to do that without too much effort is to use a different carrier for each of the last digits of the phone number being dialed. Something like this:
exten => _91NXXNXXXXX0,1,AGI(
agi://127.0.0.1:4577/call_log)
exten => _91NXXNXXXXX0,2,Dial(${TRUNKA}/${EXTEN:1},,To)
exten => _91NXXNXXXXX0,3,Hangup
exten => _91NXXNXXXXX1,1,AGI(
agi://127.0.0.1:4577/call_log)
exten => _91NXXNXXXXX1,2,Dial(${TRUNKB}/${EXTEN:1},,To)
exten => _91NXXNXXXXX1,3,Hangup
exten => _91NXXNXXXXX2,1,AGI(
agi://127.0.0.1:4577/call_log)
exten => _91NXXNXXXXX2,2,Dial(${TRUNKC}/${EXTEN:1},,To)
exten => _91NXXNXXXXX2,3,Hangup
etc...