Signal Busy status to SIP endpoints on announcement

A SIP endpoint calls an extension number which I’m mapping in the dialplan to answer and play an announcement.

Yet, when I answer to play the announcement I’d like the endpoint to get this signaled not as a successful call establishment, but either as busy, or SIP code 608 Rejected.

Is that possible? Thanks

You would normally not answer in the dialplan, and instruct Playback to not answer either using the noanswer[1] option. The audio will then get sent using 183 Session Progress after which you could call Busy and the channel would be terminated.

[1] Playback - Asterisk Documentation

Thanks a lot for your reply and helpful suggestion.

Unfortunately, with this, neither when trying on my ATA nor a Softphone it works: they don’t seem to pass through the audio before the call is actually established. It’s just silence during the time while the announcement plays.

That’s quite likely, as early media provides a mechanism to avoid anyone getting billed for calls to automated announcement services. If they don’t support early media, you must accept the call, if you want to play an announcement.

I think that chan_pjsip will send a Reason header, on BYE, based on the HANGUPCAUSE value, which you can pass as a parameter, to BYE, but the calling system may well not be able to make any use of it.

Is Asterisk remote, with both of these being behind NAT?

It seems the problem was I missed a Progress() call in the dialplan before the noanswer-playback!