Hi all, new to the list and this is probably a basic question and couldn't find anything clear googling around but I don't know how to handle calls to sip extensions not defined on sip.conf while using pattern matching. On my example I have sip extensions 10, 11, 12, and 13 on sip.conf. On a basic extension.conf I set up a pattern starting with "1" and a second digit should dial the sip extension entered by the user and if the user don't pick up or is unavailable the call goes to the user voicemail and then hangup. This basic setup can be seen next: [default] exten => _1X,1,Dial(SIP/${EXTEN},10) exten => _1X,2,VoiceMail(${EXTEN}@default,u) exten => _1X,3,HangUp() Now, what happens if the user dials 15? Then the pattern is applied and the asterisk tries to dial that sip extension that doesn't exist, the next step that is the voicemail also fails as 15 is not defined on voicemail.conf and finally reaches the last step where it hang ups. This can be seen on the cli output copied below: astbox*CLI> -- Executing [15 at default:1] Dial("SIP/10-0820d8e0", "SIP/15|10") in new stack [Mar 21 19:57:48] WARNING[14321]: chan_sip.c:2860 create_addr: No such host: 15 [Mar 21 19:57:48] WARNING[14321]: app_dial.c:1111 dial_exec_full: Unable to create channel of type 'SIP' (cause 3 - No route to destination) == Everyone is busy/congested at this time (1:0/0/1) -- Executing [15 at default:2] VoiceMail("SIP/10-0820d8e0", "15 at default|u") in new stack [Mar 21 19:57:48] WARNING[14321]: app_voicemail.c:2808 leave_voicemail: No entry in voicemail config file for '15' -- Executing [15 at default:3] Hangup("SIP/10-0820d8e0", "") in new stack == Spawn extension (default, 15, 3) exited non-zero on 'SIP/10-0820d8e0' astbox*CLI> What I am looking for is to play Playback(pbx-invalid) if a user enters a sip extension not created. I've been testing a few options using DIALSTATUS, AVAILSTATUS and their values but without luck as if the sip phone 11 is not registered the pbx-invalid message. Thansk for reading and any suggestion will be welcome. Richard -- Want an e-mail address like mine? Get a free e-mail account today at www.mail.com! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20080321/59f6e528/attachment.htm
On Fri, 21 Mar 2008, Ricardo B. wrote:> On my example I have sip extensions 10, 11, 12, and 13 > on sip.conf. On a basic extension.conf I set up a pattern starting with > "1" and a second digit should dial the sip extension entered by the user > and if the user don't pick up or is unavailable the call goes to the > user voicemail and then hangup. This basic setup can be seen next: > > [default] > exten => _1X,1,Dial(SIP/${EXTEN},10) > exten => _1X,2,VoiceMail(${EXTEN}@default,u) > exten => _1X,3,HangUp() > > Now, what happens if the user dials 15? Then the pattern is applied and > the asterisk tries to dial that sip extension that doesn't exist, the > next step that is the voicemail also fails as 15 is not defined on > voicemail.conf and finally reaches the last step where it hang ups. > > What I am looking for is to play Playback(pbx-invalid) if a user enters a > sip extension not created.While I didn't take the time to test it, the following should be close: [default] exten = _1[1-3],1, dial(sip/${EXTEN},10) exten = _1[1-3],n, voicemail(${EXTEN}@default,u) exten = _1[1-3],n, hangup exten = i,1, playback(pbx-invalid) exten = i,n, hangup Thanks in advance, ------------------------------------------------------------------------ Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000
Thanks Steve, your solution works but I am looking for is something more general. The example I posted is a simplified one and on the real one I am using extensions on the 5XXX scenario so I can have 5000 to 5999 range. You answer for just 10 extension is great but for a 1000 and when not all extensions on the 5XXX are set up then it is not optimal to define each extension manually or add exceptions manually and I was looking to see if there a command or state that I could use like DIALSTATUS, etc to see if the dialled extension doesn't exist and then jump to the invalid prompt. Regards Richard ----- Original Message ----- From: "Steve Edwards" To: "Asterisk Users Mailing List - Non-Commercial Discussion" Subject: Re: [asterisk-users] Calls to sip extensions not defined Date: Fri, 21 Mar 2008 15:12:43 -0700 (PDT) On Fri, 21 Mar 2008, Ricardo B. wrote: > On my example I have sip extensions 10, 11, 12, and 13 > on sip.conf. On a basic extension.conf I set up a pattern starting with > "1" and a second digit should dial the sip extension entered by the user > and if the user don't pick up or is unavailable the call goes to the > user voicemail and then hangup. This basic setup can be seen next: > > [default] > exten => _1X,1,Dial(SIP/${EXTEN},10) > exten => _1X,2,VoiceMail(${EXTEN}@default,u) > exten => _1X,3,HangUp() > > Now, what happens if the user dials 15? Then the pattern is applied and > the asterisk tries to dial that sip extension that doesn't exist, the > next step that is the voicemail also fails as 15 is not defined on > voicemail.conf and finally reaches the last step where it hang ups. > > What I am looking for is to play Playback(pbx-invalid) if a user enters a > sip extension not created. While I didn't take the time to test it, the following should be close: [default] exten = _1[1-3],1, dial(sip/${EXTEN},10) exten = _1[1-3],n, voicemail(${EXTEN}@default,u) exten = _1[1-3],n, hangup exten = i,1, playback(pbx-invalid) exten = i,n, hangup Thanks in advance, ------------------------------------------------------------------------ Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000 _______________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- Want an e-mail address like mine? Get a free e-mail account today at www.mail.com! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20080322/834309b7/attachment.htm
Thanks all, I will follow the recommendation of moving my sip extensions to a db or use perl to check if the extension exists. I run tests with dialstatus, hangupcase, chanisavail and the return codes are the same if the extension doesn't exist on sip.conf or if the extension is not registered. Regards Richard ----- Original Message ----- From: "Eric Wieling" To: "Asterisk Users Mailing List - Non-Commercial Discussion" Subject: Re: [asterisk-users] Calls to sip extensions not defined Date: Sun, 23 Mar 2008 07:50:21 -0500 exten => i is for IVRs. You would need a wildcard catchall extension like the one below. Unfortunately you are doing the classic newbie mistake of thinking you can have a simple dialplan by making the SIP user/account ID be the same as the extension. Eventually you will realize this is a bad idea. If you think you have to use wildcards (you don't) then you would want to check the value of DIALSTATUS or HANGUPCAUSE after the Dial, before the Voicemail and handle the exception using a Goto. [default] exten = _1[1-3],1, dial(sip/${EXTEN},10) exten = _1[1-3],n, voicemail(${EXTEN}@default,u) exten = _1[1-3],n, hangup exten = _XXX,1, playback(pbx-invalid) exten = _XXX,n, hangup Steve Edwards wrote: > On Sat, 22 Mar 2008, R. B. wrote: > >> [default] >> exten = _1[1-3],1, dial(sip/${EXTEN},10) >> exten = _1[1-3],n, voicemail(${EXTEN}@default,u) >> exten = _1[1-3],n, hangup >> exten = i,1, playback(pbx-invalid) >> exten = i,n, hangup -- Consulting for Asterisk, Polycom, Sangoma, Digium, Cisco, LAN, WAN, QoS, T-1, PRI, Frame Relay, Linux, and network design. Based near Birmingham, AL. Now accepting clients worldwide. _______________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- Want an e-mail address like mine? Get a free e-mail account today at www.mail.com! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20080323/ee2e9838/attachment.htm
Mojo with Horan & Company, LLC
2008-Mar-25 00:24 UTC
[asterisk-users] Calls to sip extensions not defined
Ricardo B. wrote:> Hi all, new to the list and this is probably a basic question and > couldn't find anything clear googling around but I don't know how to > handle calls to sip extensions not defined on sip.conf while using > pattern matching. On my example I have sip extensions 10, 11, 12, and > 13 on sip.conf. On a basic extension.conf I set up a pattern starting > with "1" and a second digit should dial the sip extension entered by > the user and if the user don't pick up or is unavailable the call > goes to the user voicemail and then hangup. This basic setup can be > seen next: > > [default] > exten => _1X,1,Dial(SIP/${EXTEN},10) > exten => _1X,2,VoiceMail(${EXTEN}@default,u) > exten => _1X,3,HangUp() > > Now, what happens if the user dials 15? Then the pattern is applied > and the asterisk tries to dial that sip extension that doesn't exist, > the next step that is the voicemail also fails as 15 is not defined on > voicemail.conf and finally reaches the last step where it hang ups. > This can be seen on the cli output copied below: > > astbox*CLI> > -- Executing [15 at default:1] Dial("SIP/10-0820d8e0", "SIP/15|10") > in new stack > [Mar 21 19:57:48] WARNING[14321]: chan_sip.c:2860 create_addr: No such > host: 15 > [Mar 21 19:57:48] WARNING[14321]: app_dial.c:1111 dial_exec_full: > Unable to create channel of type 'SIP' (cause 3 - No route to destination) > == Everyone is busy/congested at this time (1:0/0/1) > -- Executing [15 at default:2] VoiceMail("SIP/10-0820d8e0", > "15 at default|u") in new stack > [Mar 21 19:57:48] WARNING[14321]: app_voicemail.c:2808 > leave_voicemail: No entry in voicemail config file for '15' > -- Executing [15 at default:3] Hangup("SIP/10-0820d8e0", "") in new stack > == Spawn extension (default, 15, 3) exited non-zero on 'SIP/10-0820d8e0' > astbox*CLI> > > > What I am looking for is to play Playback(pbx-invalid) if a user > enters a sip extension not created. I've been testing a few options > using DIALSTATUS, AVAILSTATUS and their values but without luck as if > the sip phone 11 is not registered the pbx-invalid message. > > Thansk for reading and any suggestion will be welcome. > > Richard > > > -- > Want an e-mail address like mine? > Get a *free e-mail *account today at www.mail.com > <http://www.mail.com/Product.aspx>! > ------------------------------------------------------------------------ > > _______________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-usersNot sure the scale of this job exactly, so this could be overkill - but for small setups with too-hefty-servers, I tend to grep the voicemail/sip config files with -c switch to test for presence of stuff like that ^\[15\]$ with a properly constructed expression one could determine if a peername like such is defined and not commented out You could of course grep the cli output of "sip show peer 15" to see if the peer is reachable, if you use qualify... or if it even exists :) just some ideas. These would probably kill a busy production box :) Moj