How do I get asterisk to reject a call

Specifically, what I want asterisk to do is to first speak some message and then get it to reject the call. I use it from SIP and what I would like to happen is the following:

  1. Asterisk receive an INVITE from some number.
  2. Asterisk send 183 ringing with SDP.
  3. Asterisk play voice file speaking some message.
  4. Asterisk hang up with error - i.e. does not send 200 OK but rather some 4xx message, preferably one I can set. I don’t have to be able to set to any status code but I would like to be able to select from a small set of suitable codes such as 403, 404 and some others. The user should then hear a error indication when asterisk hangs up.

I use it for making a simple IVR for when the user dial to some place that is permanently or temporarily unavailable for the user. For example if he wants to dial a non-local call and the phone is set up to only make local calls.

I.e. if my system detects that the user make such a call, I want to direct him to asterisk and have asterisk play a message such as “you cannot dial non-local calls from this phone” and then hang up with an error tone instead of just hanging up as for regular phone calls. I also would like asterisk to respond with a suitable 4xx message instead of 200 OK in this case for that INVITE.

Anyone have any idea how I can do this in extensions.conf?