Redirect calls from IVR to outbound trunk

hi all,
I’m not sure if I am allowed to ask this question here, but since elastix gurus have left the site, I couldn’t get a proper answer there… and someone told me to come here and seek for answer.

I have an IVR on my elastix server and direct dial is enabled on it. we have two kind of extensions in our company, SIP extensions(on Elastix server) and our Physical PBX’ extensions. SIP extensions have two digits and PBX ones have three digits. my FXO module is connected to our physical PBX (via a cisco router which has FXO modules on it and is connected to my elastix server using SIP protocol) and an outbound route, handles three digit extensions.

when a costumer calls, Elastix picks up the phone and plays the IVR, then he can dial the numbers given in the IVR or use direct dialing for SIP extensions.
the main problem is, when he dials a three digit extension -which is on the physical PBX- elastix plays “invalid.gsm” cause in it’s address book, there is not such an extension.
my costumers need access to those extensions and I don’t know how to tell elastix to use an outbound route when IVR recieves three digit extensions.

is there any way to do this?

I have already googled it and found this post:
but when I tried to change the dial() trying to use SIP instead of IAX I failed…

thank you for your concern and help