Freepbx DID issue in outgoing

The outbound INVITE (lines 822 - 851 of your paste) does not contain the P-Preferred-Identity header that TATA requires, so they rejected the call (paste lines 870 - 878).

The word ‘Identity’ does not appear anywhere in your paste, so whatever code you may have used to add that header apparently did not get executed.

A good way to add the header is with a predial hook; see

Sample code to go in /etc/asterisk/extensions_custom.conf (not tested) could be something like:

[macro-dialout-trunk-predial-hook]
exten => s,1,Noop(Adding caller ID for TATA)
exten => s,n,SipAddHeader(P-Preferred-Identity: <sip:[email protected]>)
exten => s,n,MacroExit()

Restart Asterisk after modifying the file.

If no luck, look at the SIP trace to see whether P-Asserted-Identity is being properly added.

If you still have trouble, paste a new log.