Asterisk server allow 2 connection for same extension

How can I block one extension to connect in 2 clients in the same time?

I wish that if the extension is connected in one place not allow to connect in another place, because actually I can put the presence like ON for two clients in the same time.

Use group counts, to limit the calls to that extension.

set the max_contexts setting to 1 in your aor definition in pjsip.conf for the endpoint.