Get callgroup/pickupgroup in extension.conf


Is it possible to get the callgroup/pickupgroup to which a phone belongs, in the extension.conf? So I can make decisions upon that?

Or is there another possibility to group a few phones which are allowed to call a special extension? All other phones, which are not in this group are not allowed to call that that extension. I can’t group them by their phone number.