Asterisk: block inbound call by CALLERID(num) (AEL syntax)

One number :

    73522123456 =>
    {
        if(${CALLERID(num)} = 74995008119)
            {
            Hangup;
            }
        Dial(IAX2/iaxpeer/somedevice);
    }

Several numbers:

    73522123456 =>
    {
    switch (${CALLERID(num)}) {

         case 74957805170:
            NoOp(Block call from Susan);
            Hangup();
            break;

        pattern [78]4957805174:
            NoOp(Block call from Anna);
            Hangup();
            break;

        pattern [78]4957805061:
            NoOp(Block call from Lily );
            Hangup();
            break;

        pattern [78]495780508X:
            NoOp(Block call from Samantha);
            Hangup();
            break;

        default:
            Set(CDR(accountcode)=some-accountcode);
            Dial(SIP/somepeer/tomsphone01,,r);
        }
    }

pattern – here you may use constructions like [167] and/or 123X.
case – is exact sequence of symbols.

https://wiki.asterisk.org/wiki/display/AST/AEL+Conditionals

Tags: , , , ,

Comments are closed.