chris vince
2004-Dec-12 01:09 UTC
[Asterisk-Users] DIALSTATUS missing an important condition?
I have recently built my first asterisk system and am very impressed with its capabilities. However, I have run into one problem that hopefully someone can help me with. I am trying to use the DIALSTATUS function to route incoming calls to the appropriate Voice Mail (busy or unavailable) or to an Unavailable Number recording if the number is not assigned. However, I find that DIALSTATUS seems to generate an CHANUNAVAIL status for any 1 of 2 conditions: 1) the dialled user is not logged in (and hence no channel) or 2) the dialled user does not exist at all (ie the number is not assigned in sip.conf) (and hence no channel) Obviously for condition 1 the call should be sent to VM unavailable, whereas for condition 2 I would like to send it to a "number you have dialled is not in service" recording - with no Voice Mail involved. I have managed to get this scenario working but I don't think my solution is very elegant or even correct (although it seems to work). Here are the relevant parts of my extensions.conf. My VM box numbers are exactly the same as the phone number so I only use ARG1 in the macro. (2000 = 2000 etc.). I only have SIP phones at the moment and they are all allocated in the 20XX numbering range. [altea_extensions] ;This is a "catchall" for any 4 digit number dialled starting with "20" ;Using it removes the need to provide a routing plan for each phone exten => _20XX,1,ResponseTimeout,1 ; Response Timeout for non working numbers exten => _20XX,2,Macro(stdexten_sip,${EXTEN}) ;send to macro for processing ;following is needed if an extension is unassigned (ie not datafilled) because ;DIALSTATUS cannot (?) differentiate between an unassigned # or 1 that is not answered or not logged in ;an unassigned (non working number) causes a timeout in the std-extn macro and it drops back here ;where I provide a "not in service" recording exten => t,1,Macro(not_in_service) ;send to "number not in service" recording exten => t,2,Hangup [macro-stdexten_sip] ; Standard extension macro for SIP phones (modified): ; ${ARG1} = Dialled number ; exten => s,1,Dial(SIP/${ARG1},20,tT) ; Ring the interface, 20 secs maximum exten => s,2,Goto(s-${DIALSTATUS},1); Jump on Status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER) exten => s-NOANSWER,1,Voicemail(u${ARG1}) ; no answer = unavailable exten => s-BUSY,1,Voicemail(b${ARG1}) ; busy exten => s-CHANUNAVAIL,1,Voicemail(u${ARG1}) ;no channel (not logged in) = unavailable exten => s-CONGESTION,1,Macro(120_ipm) ;Don't know what this is but will include anyway Am I missing something here or should there be another condition such as "Unassigned"? Asterisk seems to know that the number is unassigned because it writes a "No such host" message into the log. Is there any way of trapping this message in Call Processing to route this call correctly? Or am I getting to deep here and there's a real simple way to do it that I've missed????? chris