Handle Number which doesn't exist:

Hello,

I am using asterisk 10.0.1. When I call on Invalid number then I get response like below-

-- Attempting call on SIP/relnew/918023591761 for 918827786685@hello_test:1 (Retry 1) == Using SIP RTP CoS mark 5 > Channel SIP/relnew-0007b18a was never answered. -- Executing [failed@hello_test:1] NoOp("OutgoingSpoolFailed", "Called failed = ") in new stack -- Auto fallthrough, channel 'OutgoingSpoolFailed' status is 'UNKNOWN' -- Executing [h@hello_test:1] Set("OutgoingSpoolFailed", "sip_cause=") in new stack [Apr 17 06:41:18] NOTICE[14062]: pbx_spool.c:360 attempt_thread: Call failed to go through, reason (8) Congestion (circuits busy) [Apr 17 06:41:18] NOTICE[14062]: pbx_spool.c:363 attempt_thread: Queued call to SIP/relnew/918023591761 expired without completion after 0 attempts

I am not getting 404 Not found response anywhere. I told to provider and they said they are sending 404 response. I want to handle sip response so that I can Identify those numbers which doesn’t exist. Please help me to solve this issue. What I have to do so that I can get 404 response or Is there any variable which stores SIP response ?

Add code after the Dial application call. ${HANGUPCAUSE} will contain the equivalent ISDN cause code. There are now ways to access the SIP code.

I tested this variable ${HANGUPCAUSE} and getting response 0 on Invalid number.
Now problem is If number is switched Off then also I am getting same response i.e 0

You are going to need to provide the dialplan and logs at at least verbose level 3. HANGUPCAUSE does work.

Below is the dialplan which I am using for testing purpose -

[code][hello_test]
exten => _X.,1,Answer()
exten => _X.,n,Playback(/var/lib/asterisk/sounds/en/demo-thanks)

exten => failed,1,NoOp(Called failed = ${HANGUPCAUSE})

exten => h,1, NoOp(HangupCause is =${HANGUPCAUSE})[/code]

Below is the log for Invalid number-

[Apr 17 07:22:05] VERBOSE[26213] pbx_spool.c: -- Attempting call on SIP/relnew/918023591761 for 918827786685@hello_test:1 (Retry 1) [Apr 17 07:22:05] VERBOSE[26213] netsock2.c: == Using SIP RTP CoS mark 5 [Apr 17 07:22:06] VERBOSE[26213] pbx.c: > Channel SIP/relnew-0007b19e was never answered. [Apr 17 07:22:06] VERBOSE[26213] pbx.c: -- Executing [failed@hello_test:1] NoOp("OutgoingSpoolFailed", "Called failed = 0") in new stack [Apr 17 07:22:06] VERBOSE[26213] pbx.c: -- Auto fallthrough, channel 'OutgoingSpoolFailed' status is 'UNKNOWN' [Apr 17 07:22:06] VERBOSE[26213] pbx.c: -- Executing [h@hello_test:1] NoOp("OutgoingSpoolFailed", "HangupCause is =0") in new stack [Apr 17 07:22:06] NOTICE[26213] pbx_spool.c: Call failed to go through, reason (8) Congestion (circuits busy) [Apr 17 07:22:06] NOTICE[26213] pbx_spool.c: Queued call to SIP/relnew/918023591761 expired without completion after 0 attempts

Below is the log for valid number but it was switched Off-

[Apr 17 07:25:18] VERBOSE[27276] pbx_spool.c: -- Attempting call on SIP/relnew/919691004887 for 918827786685@hello_test:1 (Retry 1) [Apr 17 07:25:18] VERBOSE[27276] netsock2.c: == Using SIP RTP CoS mark 5 [Apr 17 07:25:30] VERBOSE[17925] chan_sip.c: -- Got SIP response 480 "Temporarily Unavailable" back from 80.77.12.137:5060 [Apr 17 07:25:30] VERBOSE[27276] pbx.c: > Channel SIP/relnew-0007b1bf was never answered. [Apr 17 07:25:30] VERBOSE[27276] pbx.c: -- Executing [failed@hello_test:1] NoOp("OutgoingSpoolFailed", "Called failed = 0") in new stack [Apr 17 07:25:30] VERBOSE[27276] pbx.c: -- Auto fallthrough, channel 'OutgoingSpoolFailed' status is 'UNKNOWN' [Apr 17 07:25:30] VERBOSE[27276] pbx.c: -- Executing [h@hello_test:1] NoOp("OutgoingSpoolFailed", "HangupCause is =0") in new stack [Apr 17 07:25:30] NOTICE[27276] pbx_spool.c: Call failed to go through, reason (8) Congestion (circuits busy) [Apr 17 07:25:30] NOTICE[27276] pbx_spool.c: Queued call to SIP/relnew/919691004887 expired without completion after 0 attempts

You didn’t say you were using call files! You need to Dial the number, which means you need to use a local channel.

Okay…Thanks…I’ll try this using DIAL then I’ll let you know.

I am not able to call using DIAL,… Please provide me steps how to call using DIAL function. I know calling only by call files.

Or is it possible to handle same status using call files ?