Problem calling over AMI/TAPI with trunk failover


I did file a bug report today for this issue, but it was closed and suggested that I discuss this issue on the forum. So here I am. I have following situation:

I am using asterisk 1.4.25 , freepbx and have 25 extensions. People are initiating calls from their computers (for example from microsoft outlook address book) over tapi interface in windows and using sip phones with headsets to talk.
In this setup i have five sip trunks. They are configured for different destination numbers and I always have minimum two of them in one outbound route (so that they can failover if one of them is busy/congested etc). If i call from sip phone directly and one trunk returns SIP / 403 Forbidden (while I have not paid to that particular provider or rather dont have any more call credits on that account) dialplan will get failover to another trunk and try to call over that trunk.

Now if i am calling over outlook or microsoft dialer or any other tapi capable application it will hangup immediately if i get SIP / 403 Forbidden from sip trunk and wont failover thru other trunks. Can someone help me address this issue ?

Here are traces from asterisk:

This one is when i am calling over sip phone:


this if i am calling over tapi application:


turn on sip debug on the provider IP and re-run, so you can see exactly what is being sent to the provider in each case, and what they are sending back. That’s probably going to be the key to understand what is the difference in the two scenarios.

here i turned on sip debug . output looks like this: is the ip from first provider
83.65.x.x is ip from second provider = asterisk server = sip client - soft phone + tapi

difference between those two is when i call over tapi local channels is Local/EXTEN and direct over telephone channel is SIP/EXTEN

is there possible that some options are missing like Local/EXTEN@from-internal/n ? <- here i mean “/n”