VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
universe at truemetal.org Guest
|
Posted: Sat Jun 04, 2016 1:54 pm Post subject: [asterisk-users] Including doesn't have any effect |
|
|
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
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
asterisk.org at sedwar... Guest
|
Posted: Sat Jun 04, 2016 2:58 pm Post subject: [asterisk-users] Including doesn't have any effect |
|
|
On Sat, 4 Jun 2016, Markus wrote:
Quote: | 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@sedwards.com Voice: +1-760-468-3867 PST
https://www.linkedin.com/in/steve-edwards-4244281
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
universe at truemetal.org Guest
|
Posted: Sat Jun 04, 2016 4:07 pm Post subject: [asterisk-users] Including doesn't have any effect |
|
|
Am 04.06.2016 um 21:58 schrieb Steve Edwards:
Quote: | 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!
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
mailinglist at linuxis... Guest
|
Posted: Sat Jun 04, 2016 4:14 pm Post subject: [asterisk-users] Including doesn't have any effect |
|
|
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()
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
asterisk.org at sedwar... Guest
|
Posted: Sat Jun 04, 2016 5:19 pm Post subject: [asterisk-users] Including doesn't have any effect |
|
|
On Sat, 4 Jun 2016, Frank Vanoni wrote:
Quote: | 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@sedwards.com Voice: +1-760-468-3867 PST
https://www.linkedin.com/in/steve-edwards-4244281
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
asterisk_list at earth... Guest
|
Posted: Mon Jun 06, 2016 3:20 am Post subject: [asterisk-users] Including doesn't have any effect |
|
|
On Saturday 04 Jun 2016, Markus wrote:
Quote: | 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 .
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
universe at truemetal.org Guest
|
Posted: Mon Jun 06, 2016 4:00 am Post subject: [asterisk-users] Including doesn't have any effect |
|
|
Hi AJ,
Am 06.06.2016 um 10:14 schrieb A J Stiles:
Quote: | 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.
Regards
Markus
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
mailinglist at linuxis... Guest
|
Posted: Mon Jun 06, 2016 4:41 am Post subject: [asterisk-users] Including doesn't have any effect |
|
|
On Sat, 2016-06-04 at 15:19 -0700, Steve Edwards wrote:
Quote: | Using a 'goto' to exit from a gosub is a bad idea.
|
Why?
Quote: | A better idea would be
to set a channel variable and check it's value after the return, in the
calling context.
|
The idea is to update the blacklist.conf whenever I want to add or
remove a specific number or an entire area code and leave the
extensions.conf untouched and to avoid complex regular expressions.
Quote: | Also, can a 'goto' in a subroutine reference an extension in the calling
context? Seems weird, but 'dialplan' is a weird language
|
Well... I'm not an expert and my approach is by "trial and error". It
works perfectly.
Frank
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
asterisk.org at sedwar... Guest
|
Posted: Mon Jun 06, 2016 10:08 am Post subject: [asterisk-users] Including doesn't have any effect |
|
|
On Mon, 6 Jun 2016, Frank Vanoni wrote:
Quote: | On Sat, 2016-06-04 at 15:19 -0700, Steve Edwards wrote:
Quote: | Using a 'goto' to exit from a gosub is a bad idea.
|
Why?
|
The purpose of a subroutine (code that is entered by a gosub and exited by
a return) is to allow the creation of easily reusable code. It 'packages'
complex or frequently used code into a nice little black box. You don't
need to know all the details of what happens in the box and you can use
this little box throughout your code without having to tell it where to
continue when it has finished -- it just 'knows' by virtue of it's
implementation.
A 'gosub' is implemented (in most languages) by pushing the address of the
instruction following the gosub onto the stack. When the return is
executed, this address is popped off the stack and loaded into the program
counter.
Using a 'goto' to exit from a subroutine does not 'pop' off the return
address. If this cycle of pushing addresses and not popping off addresses
is repeated enough, you may run out of stack space.
Think how complex and difficult to maintain your dialplan would be if you
had to tell each application (dial(), playback(), set(), etc) where to go
when it was finished. Even worse, imagine if each application had a fixed
"I'm finished" address (priority or label).
Most programmers consider 'goto' to be 'evil' because it allows
(encourages?) lazy design leading to difficult to maintain/reuse code.
(Google 'why is goto bad'.) Some languages do not even include a 'goto' by
design to encourage programmers to write better code.
Quote: | Quote: | A better idea would be to set a channel variable and check it's value
after the return, in the calling context.
|
The idea is to update the blacklist.conf whenever I want to add or
remove a specific number or an entire area code and leave the
extensions.conf untouched and to avoid complex regular expressions.
|
The idea is fine. The implementation is flawed.
It should be implemented as a subroutine (or AGI) and return the success
or failure as a channel variable. This will result in an 'easier to
comprehend' and more maintainable dialplan.
This 'design pattern' (a subroutine) would allow you to reuse this same
'black box' in other parts of your dialplan.
Think of 'the next guy' -- which may be you in a couple of months when the
'finer details' of your implementation fade. If you jump all around your
dialplan it gets very hard to comprehend. If you can see that you execute
a little black box and then do something based on an intuitively named
channel variable the design and intent is obvious.
Quote: | Well... I'm not an expert and my approach is by "trial and error". It
works perfectly.
|
A 'better' approach is to learn from the mistakes of others.
I suspect it 'works perfectly' until it's been running long enough to
cause difficult to diagnose problems.
--
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards sedwards@sedwards.com Voice: +1-760-468-3867 PST
https://www.linkedin.com/in/steve-edwards-4244281
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
asterisk_list at earth... Guest
|
Posted: Mon Jun 06, 2016 10:55 am Post subject: [asterisk-users] Including doesn't have any effect |
|
|
On Monday 06 Jun 2016, Markus wrote:
Quote: | Hi AJ,
Am 06.06.2016 um 10:14 schrieb A J Stiles:
Quote: | 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.
| ..... stuff deleted .....
you're right, it would be the better solution! But I'm simply too lazy
to implement that.
|
Are you lazy enough to edit a text file and reload your dialplan, *every single
time* someone calls you, that you don't want to have to speak to ever again?
Not sure about you, but that sounds way too much like hard work for me!
--
AJS
Note: Originating address only accepts e-mail from list! If replying off-
list, change address to asterisk1list at earthshod dot co dot uk .
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
cursor at telecomabmex... Guest
|
Posted: Mon Jun 06, 2016 11:22 am Post subject: [asterisk-users] Including doesn't have any effect |
|
|
On 6/6/16 10:55 AM, A J Stiles wrote:
Quote: | On Monday 06 Jun 2016, Markus wrote:
Quote: | Hi AJ,
Am 06.06.2016 um 10:14 schrieb A J Stiles:
Quote: | 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.
| ..... stuff deleted .....
you're right, it would be the better solution! But I'm simply too lazy
to implement that.
| Are you lazy enough to edit a text file and reload your dialplan, *every single
time* someone calls you, that you don't want to have to speak to ever again?
Not sure about you, but that sounds way too much like hard work for me!
| And the BLACKLIST function is not a better option for this? So
much simpler than an AGI or even including a file in the dialplan. Every
time you modify the dialplan you run the risk of a typo that will
prevent something from loading.
--
Telecomunicaciones Abiertas de México S.A. de C.V.
Carlos Chávez
+52 (55)9116-91161
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
jb_soft at trink.co.uk Guest
|
Posted: Mon Jun 06, 2016 11:48 am Post subject: [asterisk-users] Including doesn't have any effect |
|
|
On Monday, June 6, 2016, 4:55:12 PM, AJS wrote:
> Are you lazy enough to edit a text file and reload your dialplan, *every single
Quote: | time* someone calls you, that you don't want to have to speak to ever again?
|
Quote: | Not sure about you, but that sounds way too much like hard work for me!
|
Indeed, too much for me too...
exten => s,n,GotoIf(${DB_EXISTS(blacklist/${CDR(src)})}?block) ; Check whether caller blacklisted
[snip additional logging]
exten => s,n,Dial(SIP/phones,30)
exten => s,n,Voicemail(xxxxx@work,su)
exten => s,n,Hangup()
exten => s,n(block),GoSub(Handler-MarketingCall,s,1) ; deal with blacklisted callers
[snip]
This is linked to couple of simple routines that allow me to add the current (##666) or last caller (*32) to the blacklist or manually input any other number (*30).
--
Best regards,
Julian mailto:jb_soft@trink.co.uk (jb_soft@trink.co.uk) |
|
Back to top |
|
|
mailinglist at linuxis... Guest
|
Posted: Mon Jun 06, 2016 3:47 pm Post subject: [asterisk-users] Including doesn't have any effect |
|
|
On Mon, 2016-06-06 at 17:47 +0100, Julian Beach wrote:
Quote: | exten => s,n,GotoIf(${DB_EXISTS(blacklist/${CDR(src)})}?block) ; Check
whether caller blacklisted
|
As far as I know, Asterisk's database/blacklist function only supports
exact match of caller ID.
If you want to block a specific area code or a block of numbers (eg.
321-654-8XXX) the blacklist function is useless.
Correct me if I'm wrong.
Frank
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
mailinglist at linuxis... Guest
|
Posted: Mon Jun 06, 2016 3:54 pm Post subject: [asterisk-users] Including doesn't have any effect |
|
|
On Mon, 2016-06-06 at 08:08 -0700, Steve Edwards wrote:
Quote: | The purpose of a subroutine (code that is entered by a gosub and exited by
a return) is to allow the creation of easily reusable code. ....
| [snip]
Steve
Thank you very, very much for your answer. I really appreciated your
interesting and detailed explanation.
I'll go over the books again and rewrite the little "black box" taking
in consideration your suggestions.
Thanks again!
Best regards
Frank
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
jb_soft at trink.co.uk Guest
|
Posted: Mon Jun 06, 2016 5:13 pm Post subject: [asterisk-users] Including doesn't have any effect |
|
|
Hello Frank,
Monday, June 6, 2016, 9:46:47 PM, you wrote:
> As far as I know, Asterisk's database/blacklist function only supports
Quote: | exact match of caller ID.
If you want to block a specific area code or a block of numbers (eg.
321-654-8XXX) the blacklist function is useless.
|
Ah, possibly. I only need to block specific incoming numbers.
Julian
--
Best regards,
Julian mailto:jb_soft@trink.co.uk (jb_soft@trink.co.uk) |
|
Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|