Forcing a 503 error

I want to be able to make an inbound call return a 503 “Service Unavailable” error instead of a 484 “Address Incomplete.” The reason I want to do this is so that the call will not be dropped but rather return to the switch and complete via another route. I am willing to hear any possible solutions.

Thank you,


the ‘right’ way to do this is to have whatever is dialing then try another route or possibly have Asterisk try the other route directly. However if you really want this to happen the only way I can think of doing it is hack the chan_sip code so it always returns 503 instead of 484…

To elaborate on the issue. We are having calls passed to our switch from a clec and need to send back the calls that fall outside of their jurisdiction so that they can re-route the call via a valid carrier.

Is it possible to make a port on Asterisk unavailable? I can then use ANI screening to pass calls to the asterisk box and have it turn around with a 503. I would rather not mod the code but will do it if necessary. You mention the chan_sip code. Is that in the source code or a conf file?

Many Thanks.

uhhh… not sure i understand the setup… you have

(some kind of switch) – asterisk – your CLEC?

Asterisk can filter calls based on ANI, look into GotoIf and ExecIf as well as the ${ANI} variable…

asterisk can also filter calls based on patterns for example:

exten => _NXXXXXX,1,Dial(SIP/clec1/${EXTEN}) ; sends the call to SIP/clec1
exten => _1NXXNXXXXXX,1,Dial(SIP/clec2/${EXTEN}) ; sends LD calls to clec2

is that what you mean?

You can set Hangup cause codes.

I have been using

exten => pd-CHANUNAVAIL,1,Set(PRI_CAUSE=42)
exten => pd-CHANUNAVAIL,2,Hangup()

you could also use _X.,10,Congestion()

or something like that.