# Restricting no. of capacity/port and vmr for each department

**URL:** <https://community.pexip.com/t/restricting-no-of-capacity-port-and-vmr-for-each-department/129>\
**Category:** External Policies\
**Created:** [September 14, 2022, 3:00pm UTC](https://community.pexip.com/t/restricting-no-of-capacity-port-and-vmr-for-each-department/129 "2022-09-14T15:00:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joseph](https://avatars.discourse-cdn.com/v4/letter/j/dc4da7/32.png) [@Joseph](https://community.pexip.com/u/Joseph)\
**Post date:** [September 14, 2022, 3:00pm UTC](https://community.pexip.com/t/restricting-no-of-capacity-port-and-vmr-for-each-department/129/1 "2022-09-14T15:00:03Z")

</div>

How to create a policy to allocate no. of capacity/ports and vmr for each department.  
When user call it, it check if there is sufficient license for that department.

eg. Company has 1000 port capacity and 500 VMR, it has 5 departments, Sales (500, 100), Technical (200, 100), Admin (100, 50), Finance (100, 50), IT (100, 50).

Any sample code?  
Thanks

---

<div class="post-metadata">

**Author:** ![CameronMcGuffie](https://dub1.discourse-cdn.com/flex005/user_avatar/community.pexip.com/cameronmcguffie/32/23_2.png) [@CameronMcGuffie](https://community.pexip.com/u/CameronMcGuffie)\
**Post date:** [September 15, 2022, 7:08am UTC](https://community.pexip.com/t/restricting-no-of-capacity-port-and-vmr-for-each-department/129/2 "2022-09-15T07:08:43Z")

</div>

Hi @Joseph,

The only way that I can think to achieve this would be to create a database that tracks the amount of callers at a current time. An event sink would be triggered to add/update a record in the database each time that someone connected to track that connection, when the disconnect event sink triggered it would take it away. The external policy would check this database each time to check the amount of connections and accept or reject.

I have a question, how do you know which department they belong to? Is it a domain based rule or is it the first part of the URI?

Cameron

---

<div class="post-metadata">

**Author:** ![dorian](https://dub1.discourse-cdn.com/flex005/user_avatar/community.pexip.com/dorian/32/92_2.png) [@dorian](https://community.pexip.com/u/dorian)\
**Post date:** [September 15, 2022, 12:14pm UTC](https://community.pexip.com/t/restricting-no-of-capacity-port-and-vmr-for-each-department/129/3 "2022-09-15T12:14:32Z")

</div>

@CameronMcGuffie re this: “how do you know which department they belong to” - for a device you could use the service tag field

[https://docs.pexip.com/admin/service\_tag.htm](https://docs.pexip.com/admin/service_tag.htm)
