The response to number not known, busy here, etc. would be in the 400 range. 500 means a server down the line had a serious error with handling the call. The call probably hasn't even got to the end party.
As said, you need to liaise with the line provider to find out what the IP Office is asking for that is causing a 500 response.
That said, there are some idiots (I'll say that again - IDIOTS) called Orange Telecom in France who read the SIP RFCs very differently from anyone else and use 503 for busy rather than the usual 486. So it could be a specific line provider issue but you haven't said who or where. But it would be odd to use 500 which is a generic server error for anything that doesn't have a specific error code.
Stuck in a never ending cycle of file copying.