The issue is resolved. Thanks for sending us in the right direction.
Here is an excerpt from the log:
WARNING[1979] chan_sip.c: Retransmission timeout reached on transmission pcst14516632599563792944210@192.168.201.117 for seqno 103 (Critical Request) -- See https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions
Packet timed out after 32001ms with no response
WARNING[1979] chan_sip.c: Hanging up call pcst14516632599563792944210@192.168.201.117 - no reply to our critical packet (see https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions).`
The time stamp on the above log was exactly 25 secs after the call transfer.
This looked like a NAT or firewall issue.
(We don't have any ip from the network 192.168.201.0)
We ran a wireshark packet capture, it shows that RTP packets are flowing only from the Freepbx server to the IP Phone and no reply from the Freepbx server to the SIP provider.
So we checked our trunks and it turned out that our SIP provider has a different ip for the trunks we have. After changing that we see the RTP packets from the Freepbx server to the SIP provider and transferred calls do not drop.
Correct me if I'am wrong in the diagnosis.