Elastix

how can I do that on a certain number only certain people can call?

Ask on an elastix forum.

For bare Asterisk, but the the callers into different contexts. If they are not local devices, you will need to use their callerid and GoTo the right context. Then put the each category of called number itnto its own context and include the allowed contexts in the callers’ contexts.

You can, obviously, do it all with just GoToIf and ExecIf.

You might want to google “ex-girlfriend logic” and also look at the CALLERID function.

Support questions should be directed to Aterisk Support, not to discussion forums.