Re: [asterisk-users] how to match no callerid in 1.6 ?

2009-07-25 Thread Louis-David Mitterrand
On Fri, Jul 24, 2009 at 11:14:47AM +0200, Philipp Kempgen wrote:
 Louis-David Mitterrand schrieb:
  On Fri, Jul 24, 2009 at 10:37:38AM +0200, Michiel van Baak wrote:
  On 10:17, Fri 24 Jul 09, Louis-David Mitterrand wrote:
   
   This used to work fine in 1.4:
   
exten = 2131/,1,NoOp(reject3: ${CALLERID(num)})
exten = 2131/,n,Playback(no_unknow_callerid_here)
exten = 2131/,n,Hangup
   
   And now, after upgrading to 1.6.1.x it matches every callerid.
 
  Why remove the elegant and minimal exten/emtpy
  notation
 
 Not that need the exten/callerid syntax for anything but I'd say
 this is a bug and a regression.
 The syntax is exten[/callerid] so the / clearly says that there
 is a second argument even if that happens to be an empty string.

Dear asterisk devs: should I file a bug report? (exten/,prio
matching all callerid's)

___
-- 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


Re: [asterisk-users] how to match no callerid in 1.6 ?

2009-07-25 Thread Leif Madsen
Philipp Kempgen wrote:
 Louis-David Mitterrand schrieb:
 On Fri, Jul 24, 2009 at 10:37:38AM +0200, Michiel van Baak wrote:
 On 10:17, Fri 24 Jul 09, Louis-David Mitterrand wrote:
 This used to work fine in 1.4:

exten = 2131/,1,NoOp(reject3: ${CALLERID(num)})
exten = 2131/,n,Playback(no_unknow_callerid_here)
exten = 2131/,n,Hangup

 And now, after upgrading to 1.6.1.x it matches every callerid.
 
 Why remove the elegant and minimal exten/emtpy
 notation
 
 Not that need the exten/callerid syntax for anything but I'd say
 this is a bug and a regression.
 The syntax is exten[/callerid] so the / clearly says that there
 is a second argument even if that happens to be an empty string.

While this could be a bug and a regression, I don't see how using the 
exten[/callerid] notation is really better than the GotoIf()

Personally, the GotoIf() makes much more sense to me, because you're placing 
the 
matching logic in a single place, as opposed to an error prone method of adding 
an ending / at the end of every line of that extension.

Typically I try to get away from a pattern match as soon as I can, by doing 
something like:

exten = _[A-Za-z0-9].,1,Set(EXTENSION=${EXTEN})
exten = _[A-Za-z0-9].,n,Goto(start,1)

exten = start,1,Verbose(2,Incoming call from ${CALLERID(num)} to extension 
${EXTENSION})
exten = start,n,GotoIf($[${CALLERID(num)} = 5551212]?bad_callerid,1)
exten = start,n,...

exten = bad_callerid,1,Verbose(2,A very bad man!)
exten = bad_callerid,n,Hangup()


I think that is a better method than constantly typing a complex pattern match, 
or adding additional extra characters that could potentially be missed, and 
leading to additional debugging, or errors in dialplan.

Leif Madsen.
http://www.leifmadsen.com
http://www.oreilly.com/catalog/asterisk

___
-- 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


Re: [asterisk-users] how to match no callerid in 1.6 ?

2009-07-25 Thread Philipp Kempgen
Leif Madsen schrieb:

 I don't see how using the 
 exten[/callerid] notation is really better than the GotoIf()
 
 Personally, the GotoIf() makes much more sense to me, because you're placing 
 the 
 matching logic in a single place,

True.

 as opposed to an error prone method of adding 
 an ending / at the end of every line of that extension.

 exten = _[A-Za-z0-9].,1,Set(EXTENSION=${EXTEN})
 exten = _[A-Za-z0-9].,n,Goto(start,1)

 exten = start,1,Verbose(2,Incoming call from ${CALLERID(num)} to extension 
 ${EXTENSION})
 exten = start,n,GotoIf($[${CALLERID(num)} = 5551212]?bad_callerid,1)
 exten = start,n,...
 
 exten = bad_callerid,1,Verbose(2,A very bad man!)
 exten = bad_callerid,n,Hangup()

 I think that is a better method than constantly typing a complex pattern 
 match, 

BTW: If you hate having to type the same exten =  stuff over
and over for each priority: use AEL and let the AEL compiler do the
work. :-)

_[A-Za-z0-9]. = {
Verbose(2,Incoming call from ${CALLERID(num)} to extension ${EXTEN});
if (${CALLERID(num)} = 5551212) {
Verbose(2,A very bad man!);
Hangup();
}
...
}

And while we're at it: In many cases database lookups by means of
DB() or AGI() or a custom ODBC_*() function make even more sense
than a hard-coded list of GotoIf()s resp. if clauses.


Philipp Kempgen
-- 
AMOOMA GmbH - Bachstr. 126 - 56566 Neuwied  -  http://www.amooma.de
Geschäftsführer: Stefan Wintermeyer, Handelsregister: Neuwied B14998
Asterisk: http://the-asterisk-book.com - http://das-asterisk-buch.de
Videos of the AMOOCON VoIP conference 2009 -  http://www.amoocon.de
-- 

___
-- 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


Re: [asterisk-users] how to match no callerid in 1.6 ?

2009-07-25 Thread Stanisław Pitucha
2009/7/24 Louis-David Mitterrand vindex+lists-asterisk-us...@apartia.org:
 This used to work fine in 1.4:

        exten = 2131/,1,NoOp(reject3: ${CALLERID(num)})
        exten = 2131/,n,Playback(no_unknow_callerid_here)
        exten = 2131/,n,Hangup

 And now, after upgrading to 1.6.1.x it matches every callerid.

I'm not sure if it's the same reason, but have a look at this bug
(exists in 1.6.1.1):
https://issues.asterisk.org/view.php?id=15476
Whether you want to use the function, or a pattern match in version
1.6, you might want to upgrade past revision 206705. Especially if
you're trying to detect no callerid. Otherwise you'll get a wrong
result. (assuming you're using SIP)

HTH

___
-- 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


[asterisk-users] how to match no callerid in 1.6 ?

2009-07-24 Thread Louis-David Mitterrand
Hi,

This used to work fine in 1.4:

exten = 2131/,1,NoOp(reject3: ${CALLERID(num)})
exten = 2131/,n,Playback(no_unknow_callerid_here)
exten = 2131/,n,Hangup

And now, after upgrading to 1.6.1.x it matches every callerid.

Did something change?

Thanks,

___
-- 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


Re: [asterisk-users] how to match no callerid in 1.6 ?

2009-07-24 Thread Michiel van Baak
On 10:17, Fri 24 Jul 09, Louis-David Mitterrand wrote:
 Hi,
 
 This used to work fine in 1.4:
 
   exten = 2131/,1,NoOp(reject3: ${CALLERID(num)})
   exten = 2131/,n,Playback(no_unknow_callerid_here)
   exten = 2131/,n,Hangup
 
 And now, after upgrading to 1.6.1.x it matches every callerid.
 
 Did something change?

Yes, it's now working as it supposed to work.
Use something like this:

exten = 2131,1,GotoIf($[${CALERID(num) = ]?nocallerid,1)
exten = 2131,n,Dia(SIP/Something); or whatever you want to do

exten = nocallerid,1,Playback(no_unknown_callerid_here)
exten = nocallerid,n,Hangup()
-- 

Michiel van Baak
mich...@vanbaak.eu
http://michiel.vanbaak.eu
GnuPG key: http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x71C946BD

Why is it drug addicts and computer aficionados are both called users?


___
-- 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


Re: [asterisk-users] how to match no callerid in 1.6 ?

2009-07-24 Thread Louis-David Mitterrand
On Fri, Jul 24, 2009 at 10:37:38AM +0200, Michiel van Baak wrote:
 On 10:17, Fri 24 Jul 09, Louis-David Mitterrand wrote:
  
  This used to work fine in 1.4:
  
  exten = 2131/,1,NoOp(reject3: ${CALLERID(num)})
  exten = 2131/,n,Playback(no_unknow_callerid_here)
  exten = 2131/,n,Hangup
  
  And now, after upgrading to 1.6.1.x it matches every callerid.
  
  Did something change?
 
 Yes, it's now working as it supposed to work.
 Use something like this:
 
 exten = 2131,1,GotoIf($[${CALERID(num) = ]?nocallerid,1)
 exten = 2131,n,Dia(SIP/Something); or whatever you want to do
 
 exten = nocallerid,1,Playback(no_unknown_callerid_here)
 exten = nocallerid,n,Hangup()

Thanks for clearing that up.

But this sucks. Why remove the elegant and minimal exten/emtpy
notation in favor of an unwieldy GotoIf?

___
-- 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


Re: [asterisk-users] how to match no callerid in 1.6 ?

2009-07-24 Thread Philipp Kempgen
Louis-David Mitterrand schrieb:
 On Fri, Jul 24, 2009 at 10:37:38AM +0200, Michiel van Baak wrote:
 On 10:17, Fri 24 Jul 09, Louis-David Mitterrand wrote:
  
  This used to work fine in 1.4:
  
 exten = 2131/,1,NoOp(reject3: ${CALLERID(num)})
 exten = 2131/,n,Playback(no_unknow_callerid_here)
 exten = 2131/,n,Hangup
  
  And now, after upgrading to 1.6.1.x it matches every callerid.

 Why remove the elegant and minimal exten/emtpy
 notation

Not that need the exten/callerid syntax for anything but I'd say
this is a bug and a regression.
The syntax is exten[/callerid] so the / clearly says that there
is a second argument even if that happens to be an empty string.


Philipp Kempgen
-- 
AMOOMA GmbH - Bachstr. 126 - 56566 Neuwied  -  http://www.amooma.de
Geschäftsführer: Stefan Wintermeyer, Handelsregister: Neuwied B14998
Asterisk: http://the-asterisk-book.com - http://das-asterisk-buch.de
Videos of the AMOOCON VoIP conference 2009 -  http://www.amoocon.de
-- 

___
-- 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