Álvaro Palma
2006-May-09 10:13 UTC
[Asterisk-Users] How to distinguish between UNEXISTENT channels v/s UNAVAILABLE channels
Is there a way to distinguish, in the answer of the Dial command, when a channel is not available (for example, an unregistered but valid SIP user) v/s when the dialed channel is inexistent, even when it matches an extension? For example, I've the following simple dial plan: exten => _XX,1,Dial(SIP/${EXTEN},10,) exten => _XX,2,GotoIf(DIALSTATUS = CHANUNAVAIL?4:3) exten => _XX,3,VoiceMail(u${EXTEN}@default) exten => _XX,4,Hangup() exten => _XX,102,VoiceMail(b${EXTEN}@default) exten => _XX,103,Hangup() I've also defined a couple of SIP users, 01 and 02, with their corresponding mailboxes. My idea is that, if somebody dial these valid extensions, if the users is not connected at the time, a message can be recorded, and also, if somebody dials an extension that matches the pattern, but it's invalid (e.g., 10), the call is inmediatly terminated. The dialplan showed fails, because if the valid SIP user is not registered, the DIALSTATUS is always CHANUNAVAIL, the same that if the extension is invalid, so no call is recorded for my valid user :( Is there a way to do this without having to declare explicitly every valid extension? If I remove the line: exten => _XX,2,GotoIf(DIALSTATUS = CHANUNAVAIL?4:3) the message is recorded if the valid SIP user is not registered, but the VoiceMail application is called even for an unexistent user, generating an error in the command line, that is maybe harmless, but anoying (and no elegant at all :) ). Besides, the user who dialed the wrong extension doesn't receive a 404 Not Found in that case, so he doesn't know he dialed a wrong number. Thanks a lot for your attention, patience and help. -- Atly. ?lvaro Palma