Restrict extension on a specific DID

Good day guys!

Im a new PBX admin newbie and I have problems with the DID. We have 1 freePBX and its connected to 2 companies.

Let say company A and Company B

Company A has a DID of 714 - 111 -1111
Extension associated with these are
6501
6502

Company B has a DID of 714 - 222 - 2222
Extension associated with these are
6601
6602

Let say the customer called the company A and he used the Direct dial and he accidentally dialed the 6602 instead 6501

How can i set and error let say “Sorry its a valid extension”

I’m getting lots of complaints with the agent regards of miss routed calls

Thanks