Change recording for failed outbound calls

Hey guys, with our SIP provider, when our users dial a bad number this is what happens with Asterisk:

VERBOSE[3910][C-000003dd] chan_sip.c: – Got SIP response 500 “Unknown NXX” back from xxxxxxxxxx:5060
VERBOSE[32721][C-000003dd] app_dial.c: – SIP/TrunkA-VA-000007ad is circuit-busy
VERBOSE[32721][C-000003dd] app_dial.c: == Everyone is busy/congested at this time (1:0/1/0)
VERBOSE[32721][C-000003dd] pbx.c: – Executing [s@macro-dialout-trunk:31] NoOp(“SIP/564-000007ab”, “Dial failed for some reason with DIALSTATUS = CONGESTION and HANGUPCAUSE = 38”) in new stack
VERBOSE[32721][C-000003dd] pbx.c: – Executing [s@macro-dialout-trunk:32] GotoIf(“SIP/564-000007ab”, “1?continue,1:s-CONGESTION,1”) in new stack
VERBOSE[32721][C-000003dd] pbx.c: – Goto (macro-dialout-trunk,continue,1)
VERBOSE[32721][C-000003dd] pbx.c: – Executing [continue@macro-dialout-trunk:1] NoOp(“SIP/564-000007ab”, “TRUNK Dial failed due to CONGESTION HANGUPCAUSE: 38 - failing through to other trunks”) in new stack
VERBOSE[32721][C-000003dd] pbx.c: – Executing [continue@macro-dialout-trunk:2] ExecIf(“SIP/564-000007ab”, “1?Set(CALLERID(number)=564)”) in new stack
VERBOSE[32721][C-000003dd] pbx.c: – Executing [18025703355@from-internal:9] Macro(“SIP/564-000007ab”, “outisbusy,”) in new stack
VERBOSE[32721][C-000003dd] pbx.c: – Executing [s@macro-outisbusy:1] Progress(“SIP/564-000007ab”, “”) in new stack
VERBOSE[32721][C-000003dd] pbx.c: – Executing [s@macro-outisbusy:2] GotoIf(“SIP/564-000007ab”, “0?emergency,1”) in new stack
VERBOSE[32721][C-000003dd] pbx.c: – Executing [s@macro-outisbusy:3] GotoIf(“SIP/564-000007ab”, “0?intracompany,1”) in new stack
VERBOSE[32721][C-000003dd] pbx.c: – Executing [s@macro-outisbusy:4] Playback(“SIP/564-000007ab”, “all-circuits-busy-now&please-try-call-later, noanswer”) in new stack
VERBOSE[32721][C-000003dd] file.c: – <SIP/564-000007ab> Playing ‘all-circuits-busy-now.ulaw’ (language ‘en’)
VERBOSE[32721][C-000003dd] file.c: – <SIP/564-000007ab> Playing ‘please-try-call-later.ulaw’ (language ‘en’)
VERBOSE[32721][C-000003dd] app_macro.c: == Spawn extension (macro-outisbusy, s, 4) exited non-zero on ‘SIP/564-000007ab’ in macro ‘outisbusy’

As a result my users receive the all-circuits-busy.ulaw recording, which they interpret as a failure in the phone system, not a bad number. I was wondering what the best way to remedy this is. I’m guessing I could just replace the all-circuits-busy-now.ulaw file with another recording, but that seems kinda hacky and I figured there’s gotta be a better method. Any ideas?

The system is returning a “CONGESTION” error code, so you’re going to go down that hole. Changing the recording is just going to mask the error and your callers will learn to interpret the error as a failure in the PBX.

It looks like this might be a bug in Asterisk - specifically in the error handling in the Chan-SIP driver. If that’s the case, you’re going to end up having to do something “hackish” because development on Chan-SIP is pretty much finished.

You might try changing the connection to a PJ-SIP channel and see if you get better resolution on that driver. I have my doubts, I suspect that the 500 response you are getting from your ITSP.