How to limit maximum simultaneous incoming calls on a sip trunk

Is there a way by which we can limit maximum simultaneous incoming calls on a sip trunk. Freepbx says that you should enter automatically generated context in User details of trunk like “context=from-trunk-sip-trunkname”. I have entered this but it is not working. Please help.

Are the calls actually hitting that trunk (and context) you can checl sip channels in live call or look in CDR src channel field.

Yes the calls are hitting the correct trunk. How I can check whether call is hitting the correct context or not. Thanks for your quick response

The easiest way would be to watch the log.

It would be very helpful for me if you describe the exact way how we can limit maximum simultaneous incoming calls on a sip trunk. Please describe the steps. I am very thankful to you for your this help

Read the popup that goes with max channels, it explains what to do.

Thanks stonet, max channels in freepbx trunk settings works only for outbound calls. If we put the auto generated context in user details as described by max channels pop up then it counts according to simultaneous outbound calls. For example is if I have set max channels to 5 then it may allowed 3 outbound and 2 incoming calls. It would not allow to make 4th outbound call but it does not restrict 3rd incoming calls. I have achieved my goal by call-limit function inf freepbx trunk settings. But it sends sip response 480 (temporary unavailable) to my service provider. I want to change this to busy response or declined response. Do you have any idea ?

I have similar issue asterisk 1.8.10 Free PBX call-limit =5 and 5 incoming and outgoing is achieved.
The system sends back a 480 (unavailable)to my carrier how can this be changed to a 503 (congestion)?
any help here?

also check the trunk settings and make sure you have not set maximum channels