Triggering SIP Response Codes
You can distinguish whether you are a proxy application, or a UAS application, by configuring the container to trigger the appropriate SIP response code, either a 401 SIP response code, or a 407 SIP response code. If your application needs to proxy an invitation, the 407 code is appropriate to use. If your application is a registrar application, you must use the 401 code.
To configure the container to respond with a 407 SIP response code instead of a 401 SIP response code, you must add the <proxy-authentication>
element to the security constraint.