SIP providers routing

Hi all. I write an application using ARI. This application originates channels using endpoint and Stasis app name and listens to events from this app. I’ve got several SIP providers configured and I need to route originated call through one of them, depending, for example, on country code.
I want this to be configured in Asterisk, but the problem is endpoint in ARI method is set to ‘SIP/ {provider}/{number}’, so application should choose provider by itself.

So are there any solutions to this problem?

You could send the call to “Local/{number}@outgoing_context” where “outgoing_context” is a dialplan context that does your routing.