Simplify the example at Context for scripts (incoming calls)
However, are you really sure that Asterisk is able to distinguish the accounts? The usual problem is that there isn’t enough information to do that and all incoming calls are matched to the first account for the provider.