Queue breaks when extension is offline

I will explain again,

There are two servers connected via IAX2, my dial plan is 8|. for this trunk.

I created a new queue with all local extensions and remote extensions, the problem starts when i dial remote extensions, the queue manager doesn’t know it’s remote extension and when the voicemail answers it considered as it was answered by an agent.

Another small question, how can i add 8 prefix to CID on this trunk for outgoing calls? I have same extensions number on each server and local lookup of extensions override the source (i think that adding 8 prefix to outgoing on this trunk will solve the problem)

Thanks !