So im doing some integration testing, I am sending a call to sofia profile A , and its routed out profile B.

if I take profile B down,  I can see freeswitch logs "mod_sofia.c:4417 Invalid Profile", which is fine..  the profile is stopped.

but what I did not expect is that Freeswitch responds ( on profile A )
with :

SIP/2.0 502 Bad Gateway
Reason: SIP;cause=611;text="INVALID_PROFILE"


which isnt even listed in  https://freeswitch.org/confluence/display/FREESWITCH/Hangup+Cause+Code+Table as a valid hangup cause !! 

What I want to know is,  how can I make freeswitch send a Q850 cause 41 in this case ??
( without patching mod_sofia :P )

--
Sincerely

Jay