Need a simple Proxy to avoid opening asterisk to annon calls

I want to allow inbound calls to an intermediary (proxy) server , then after certain criteria is met , simply redirect the call.

I want the extensions on an asterisk to have publicly available SIP URLs like would then pass to the asterisk server whether on or

In the way need not be open to receive call from any IP (annon calls) only would be open.

I need this to work with most any number sent , for instance ${EXTEN} will always pass to ${EXTEN} , with some rules applied.

aside from running another instance of asterisk (which I am not sure how that would happen on the same machine) , this seems like a relatively simple thing but not sure where to go with it.

Any ideas?

Thanks Mark

What advantage does this have over filtering them on the main server?

Running two instances is easy. You specify a different asterisk.conf in the initial command line, and go from there. However, if you want to do this in a separate process, a SIP proxy may well be better.

Note that you can’t change the caller ID on a redirect. You can only do so if you relay the call. Maybe that is what you meant.

Yes I know that a SIP proxy will do it any specific suggestions? Anything lightweight? . Not interested in a redirect I need a proxied call.

Use OpenSips or Kamalio for that. They have tutorials to do it.