Hi list, n00b question, but I can't figure it out: [callthrough] exten => _+X.,1,NoOp(nothing here) #include "blockedall.conf" exten => _+X.,n(hangup),Hangup exten => _+X.,n(nohangup),GotoIf($["${CALLERID(num)}" = "anonymous"]?nocli:cli) ... more stuff that is handling the call ... I'm putting CLIs that I don't want to be able to call my system into blockedall.conf: exten => _+X.,n,GotoIf($["${CALLERID(num)}" = "+493456789"]?hangup:nohangup) exten => _+X.,n,GotoIf($["${CALLERID(num)}" = "+492345678"]?hangup:nohangup) exten => _+X.,n,GotoIf($["${CALLERID(num)}" = "+491234567"]?hangup:nohangup) But it never moves to "hangup" when I call from any of those CLIs :-( BUT, if I include it directly in extensions.conf, it works: [callthrough] exten => _+X.,1,NoOp(nothing here) exten => _+X.,n,GotoIf($["${CALLERID(num)}" = "+493456789"]?hangup:nohangup) exten => _+X.,n(hangup),Hangup exten => _+X.,n(nohangup),GotoIf($["${CALLERID(num)}" = "anonymous"]?nocli:cli) ... more stuff that is handling the call ... I made sure that "blockedall.conf" actually gets included by executing "dialplan show callthrough". What am I missing? Asterisk 11.17.1. Thank you! Markus
On Sat, 4 Jun 2016, Markus wrote:> n00b question, but I can't figure it out: > > [callthrough] > exten => _+X.,1,NoOp(nothing here) > #include "blockedall.conf" > exten => _+X.,n(hangup),Hangup > exten => _+X.,n(nohangup),GotoIf($["${CALLERID(num)}" = > "anonymous"]?nocli:cli) > ... more stuff that is handling the call ... > > I'm putting CLIs that I don't want to be able to call my system into > blockedall.conf: > > exten => _+X.,n,GotoIf($["${CALLERID(num)}" = "+493456789"]?hangup:nohangup) > exten => _+X.,n,GotoIf($["${CALLERID(num)}" = "+492345678"]?hangup:nohangup) > exten => _+X.,n,GotoIf($["${CALLERID(num)}" = "+491234567"]?hangup:nohangup) > > But it never moves to "hangup" when I call from any of those CLIs :-(0) You should use 'verbose()' instead of 'noop()' 1) If the caller ID matches '+493456789' (the first one), you goto the 'hangup' label. If it does not match, you goto the 'nohangup' label -- skipping the subsequent tests. 2) Please show the CLI output from 'dialplan show callthrough' 3) Please show the CLI output from a call matching the first test and from a call matching the second test. -- Thanks in advance, ------------------------------------------------------------------------- Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST https://www.linkedin.com/in/steve-edwards-4244281
Am 04.06.2016 um 21:58 schrieb Steve Edwards:> 1) If the caller ID matches '+493456789' (the first one), you goto the > 'hangup' label. If it does not match, you goto the 'nohangup' label -- > skipping the subsequent tests.Doh! Removed :nohangup from every line but the last one and now it works as it should. Thank you! :)
Another possible approach to blacklist two (or more) specific callers (098765432 and 012345678 as example) In extension.conf #include "blaklist.conf" exten => _+x.,1,Gosub(blacklist,s,1) exten => _+x.,n,.... exten => black,1,playback(tt-monkeys) In blacklist.conf exten => s/098765432,1,Goto(black,1) exten => s/012345678,1,Goto(black,1) exten => s,1,Return()
On Sat, 4 Jun 2016, Frank Vanoni wrote:> Another possible approach to blacklist two (or more) specific callers > (098765432 and 012345678 as example) > > exten => _+x.,1,Gosub(blacklist,s,1) > exten => _+x.,n,.... > exten => black,1,playback(tt-monkeys) > > In blacklist.conf > > exten => s/098765432,1,Goto(black,1) > exten => s/012345678,1,Goto(black,1)Using a 'goto' to exit from a gosub is a bad idea. A better idea would be to set a channel variable and check it's value after the return, in the calling context. Also, can a 'goto' in a subroutine reference an extension in the calling context? Seems weird, but 'dialplan' is a weird language :) -- Thanks in advance, ------------------------------------------------------------------------- Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST https://www.linkedin.com/in/steve-edwards-4244281
On Saturday 04 Jun 2016, Markus wrote:> Hi list, > > n00b question, but I can't figure it out: > > [callthrough] > exten => _+X.,1,NoOp(nothing here) > #include "blockedall.conf" > exten => _+X.,n(hangup),Hangup > exten => _+X.,n(nohangup),GotoIf($["${CALLERID(num)}" > "anonymous"]?nocli:cli) > ... more stuff that is handling the call ... > > I'm putting CLIs that I don't want to be able to call my system into > blockedall.conf: > > exten => _+X.,n,GotoIf($["${CALLERID(num)}" > "+493456789"]?hangup:nohangup) exten => _+X.,n,GotoIf($["${CALLERID(num)}" > = "+492345678"]?hangup:nohangup) exten => > _+X.,n,GotoIf($["${CALLERID(num)}" = "+491234567"]?hangup:nohangup) > > But it never moves to "hangup" when I call from any of those CLIs :-( > > BUT, if I include it directly in extensions.conf, it works: > > [callthrough] > exten => _+X.,1,NoOp(nothing here) > exten => _+X.,n,GotoIf($["${CALLERID(num)}" > "+493456789"]?hangup:nohangup) exten => _+X.,n(hangup),Hangup > exten => _+X.,n(nohangup),GotoIf($["${CALLERID(num)}" > "anonymous"]?nocli:cli) > ... more stuff that is handling the call ... > > I made sure that "blockedall.conf" actually gets included by executing > "dialplan show callthrough". > > What am I missing?You missed that you were jumping past the second and subsequent tests, if the first one failed. But that's already been pointed out. But why not call an AGI script, have this check the caller ID against a MySQL database and return a status -- blocked or not -- in a variable? Then you can manage individual number blocking in a much cleaner, more extensible fashion. Feel free to ignore me if it sounds like I'm suggesting you walk all the way to the tool shed to fetch a chisel, when you know the screwdriver in your drawer is already up to the job :) -- AJS Note: Originating address only accepts e-mail from list! If replying off- list, change address to asterisk1list at earthshod dot co dot uk .
Hi AJ, Am 06.06.2016 um 10:14 schrieb A J Stiles:> But why not call an AGI script, have this check the caller ID against a MySQL > database and return a status -- blocked or not -- in a variable? Then you can > manage individual number blocking in a much cleaner, more extensible fashion. > > Feel free to ignore me if it sounds like I'm suggesting you walk all the way > to the tool shed to fetch a chisel, when you know the screwdriver in your > drawer is already up to the job :)you're right, it would be the better solution! But I'm simply too lazy to implement that. :D Regards Markus