How to figure out whitelist based asterisk dialplan


#1

I m new On Asterisk.
i want to make whitelist based dialplan
my call incoming number like : 723499457865 (12 digit)
in whitelist Database 720503499457865 (the 05 after 72 its random 01-32)
my white list in astdb database.
if whitelist allowed 720503499457865 (number match last 9 digit-499457865)
Dial to iax2peer/05034994557865 ( without 72)

Please help
I m Trying make 1 like this :

[from-server]
include => internal
exten => _9234[0126-9].,1,NoOp(Going Out)
same => n,Macro(whitelist,${EXTEN:4})
same => n,HangUp()
[macro-whitelist]
exten => s,1,GotoIf(${SHELL(/etc/asterisk/checkwhitelist.sh ${ARG1}):0:-1})?allowed:notallowed)
same => n(allowed),NoOp(You may call ${ARG1})
same => n,Dial(SYNC/Tunnel9/device01${ARG1})
same => n,HangUp()
same => n(notallowed),NoOp(YOU ARE NOT ALLOWED TO CALL ${ARG1})
same => n,HangUp()


#2

I’m not understanding the question.

I don’t see you using a database anywhere in your code above.


#3

Thank u johnkiniston
i found it here http://www.binaryheartbeat.net/2014/03/asterisk-outbound-whitelisting.html

i have one another example

[macro-inbound-whitelist]
exten => s,1,GotoIf(${DB_EXISTS(whitelist/${CALLERID(num)})}?:blacklisted,s,1)
exten => s,2,Dial(${ARG1})

[blacklisted]
exten => s,1,Playback(not-taking-your-call)
exten => s,3,Hangup

exten => 7234,1,Macro(inbound-whitelist,SIP/123)
exten => 7234,2,Hangup

i want to to make like " incoming 723412345678 " then cut first 2 digit then add a random number 1-32 example 13412345678 then chk whitelist DB then outgoing to iax2/sip peer.

astdb database store the number 13412345678


#4

This still seems like a very odd request.

You get a call in from Caller ID 123-456-7890

You are saying you want to transform that caller ID by removing the first two digits making it
3-456-7890
Then you want to ‘add a random number 1-32’ and I’m assuimg that’s to the beginning of the number.
So let’s add 20
Now your caller ID is 203-456-7890?

And finally you want to see if the caller ID that you made up 203-456-7890 is in your blacklist?

Why would the call be in your blacklist? You just made the number up! It has no relation to the number of the person who is actually calling you.


#5

Can you describe why you need to add random two/three digits between 72 and 34 then check in DB with new string generated without 72 ?

And then why you dial this number without 72 ?

If you give us more explanation, that could help to understand, because I’m not sure to understand the final purpose.

Best Regards


#6

My point is that my customers will send a call to 7234xxxxxxxx but i have 32 devices and 32 prefixes separated by 1,034xxxxxxxx, 2,034xxxxxxxx .

i store whitelist db : 10345656879
20344646876


#7

sir
how can i make a dialplan like - i have 100 difrent route with difrent prefix, like 1101 , 1102, 1103, etc.
i want to set every prefix 10 whitelist number,

my incoming prefix is 034X
when call come chk DB if it on whitelist and chk which prefix group, prefix group like 1101 , 1102, 1103
if it found the prefix group and whitelist number then route call to any of 1101, 1102,1103 exten.