Need help to make shorter a BLACKLIST and VOICEMAL dialplan

Catalog of dial plans
qubo
Posts: 127
Joined: Tue Apr 12, 2011 6:11 am

Re: Need help to make shorter a BLACKLIST and VOICEMAL dialp

Post by qubo » Mon Sep 08, 2014 11:04 pm

HI Aaron I tried all options but none was succesful. it is weird. I even put a rule that match all my area phones "^5233\d{8}" to catch-all phones without success. it is not matching the rules filters.

could we tried a diferent aproach ?

something that is working fine before but instead of a list of number list. it could be the emails it would sent. as they are the largest text in the dialplan.... example ?

Code: Select all

sysEmail-1 = [ sys.Email("ubj9BBv8PuvLUFV5ydscgjCnAB@api.pushover.net", "ANTUA Bloqueando a", " #{req.Header.From.FromURI.User}.") #Blocking configs
      
sysEmail-2 = [ sys.Email("porahiva@hotmail.com", "ANTUA transfiriendo a", " #{req.Header.From.FromURI.User}.") #transfer configs
      
sysEmail-3 = [ sys.Email("lacucarachayanopuedecaminar@gmail.com.com", "ANTUA al buzon ", " #{req.Header.From.FromURI.User}.") #voicemail configs
      
sysEmail-Generic = [ sys.Email("simnequierenomequiere@gmail.com.com", "ANTUA incoming call ", " #{req.Header.From.FromURI.User}.") #all incomings withou routes



 case req.Header.from.FromURI.User.to_s
 #blacklist
 when /^528944532/ then sys.Email("sysEmail-1")&sys.Respond(403, "Forbidden")
 when /^528943324// then sys.Email("sysEmail-1")&sys.Respond(403, "Forbidden")
 when /^52894\d{7}/ then sys.Email("sysEmail-1")&sys.Respond(403, "Forbidden")
    
 #papaList
 when /^523344532/ then sys.Email("sysEmail-2")&sys.Dial("17772492333@in.callcentric.com")
 when /^523343324// then sys.Email("sysEmail-2")&sys.Dial("17772492333@in.callcentric.com")
 when /^52334\d{7}/ then sys.Email("sysEmail-2")&sys.Dial("17772492333@in.callcentric.com")

 #voiceList
  when /^522244532/ then sys.Email("sysEmail-3")&sys.Dial("17772491113@in.callcentric.com")
  when /^522243324// then sys.Email("sysEmail-3")&sys.Dial("17772491113@in.callcentric.com")
  when /^52224\d{7}/ then sys.Email("sysEmail-3")&sys.Dial("17772491113@in.callcentric.com")
    
 # all others that are not in list

 sys.Email("sysEmail-Generic")

Aaron
Site Admin
Posts: 4652
Joined: Thu Jul 12, 2007 12:13 am

Re: Need help to make shorter a BLACKLIST and VOICEMAL dialp

Post by Aaron » Tue Sep 09, 2014 11:49 am

You can't chain together dialplan functions with the '&' character. You can't do this:

Code: Select all

# Wrong
sys.Email("sysEmail-1")&sys.Respond(403, "Forbidden")
Instead you need to put the calls on separate lines.

Code: Select all

#Correct
sys.Email("sysEmail-1")
sys.Respond(403, "Forbidden")
The place you can use the '&' character within the sys.Dial string method to chain call destinations together.

Code: Select all

#Correct
sys.Dial("1234@provider1&4567@provider2")

qubo
Posts: 127
Joined: Tue Apr 12, 2011 6:11 am

Re: Need help to make shorter a BLACKLIST and VOICEMAL dialp

Post by qubo » Tue Sep 09, 2014 1:34 pm

So the last dialplan. I put is ok with your corrections ? I said. because i put as example only

qubo
Posts: 127
Joined: Tue Apr 12, 2011 6:11 am

Re: Need help to make shorter a BLACKLIST and VOICEMAL dialp

Post by qubo » Tue Sep 09, 2014 4:41 pm

Aaron could you help me in what I need to fix to this dialplan ? it seems is almost done but not working yet thanks so much

Code: Select all

sysEmail-1 = [ ("ubj9BBv8PuvLUFV5ydscgjCn@api.pushover.net", "ANTUA Bloqueando a", " #{req.Header.From.FromURI.User}.") ] #Blocking configs
     
sysEmail-2 = [ ("ubj9BBv8PuvLUFV5ydscgjCn@api.pushover.net", "Transfiriendo a papa", " #{req.Header.From.FromURI.User}.") ] #transfer configs
     
sysEmail-3 = [ ("ubj9BBv8PuvLUFV5ydscgjCn@api.pushover.net", "ANTUA al buzon ", " #{req.Header.From.FromURI.User}.") ] #voicemail configs
     
sysEmail-Generic = [ ("ubj9BBv8PuvLUFV5ydscgjCn@api.pushover.net", "ANTUA Recibiendo Llamada de ", " #{req.Header.From.FromURI.User}.") ] #all incomings withou routes

sysEmail-Evernote = [ ("jcolinspam.c@m.evernote.com", "ANTUA Recibiendo Llamada de ", " #{req.Header.From.FromURI.User}.") ] #all incomings withou routes




case req.Header.from.FromURI.User.to_s
 
 #BLACKLIST
when /^5289\d{8}/ then 
sys.Email("sysEmail-1")
sys.Respond(403, "Forbidden")
when /^523334698511/ then 
sys.Email("sysEmail-1")
sys.Respond(403, "Forbidden")
when /^523336470711/ then 
sys.Email("sysEmail-1")
sys.Respond(403, "Forbidden")
   
 #PAPALIST
when /^523344532/ then 
sys.Email("sysEmail-2")
sys.Dial("pbxxxx@sipsorcery.com")
when /^523343324/ then 
sys.Email("sysEmail-2")
sys.Dial("pbxxxx@sipsorcery.com")
when /^52334\d{7}/ then 
sys.Email("sysEmail-2")
sys.Dial("pbxxx@sipsorcery.com")

 #VOICEMAIL
when /^anonymous/ then 
sys.Email("sysEmail-3")
sys.Dial("17772492333@in.callcentric.com")
when /^522243324/ then 
sys.Email("sysEmail-3")
sys.Dial("17772492333@in.callcentric.com")
when /^52224\d{7}/ then 
sys.Email("sysEmail-3")
sys.Dial("17772492333@in.callcentric.com")
   
 # ALL OTHERS

 sys.Email("sysEmail-Generic")
 sys.Email("sysEmail-Evernote")
 sys.Dial("1234xxxxxx@sipsorcery.com&17772492333@in.callcentric.com[dt=40]")
end

Aaron
Site Admin
Posts: 4652
Joined: Thu Jul 12, 2007 12:13 am

Re: Need help to make shorter a BLACKLIST and VOICEMAL dialp

Post by Aaron » Wed Sep 10, 2014 11:08 am

Try this version. It should have all the syntax errors fixed up.

Code: Select all

sysEmail_1 = [ "ubj9BBv8PuvLUFV5ydscgjCn@api.pushover.net", "ANTUA Bloqueando a", " #{req.Header.From.FromURI.User}." ] #Blocking configs
 
sysEmail_2 = [ "ubj9BBv8PuvLUFV5ydscgjCn@api.pushover.net", "Transfiriendo a papa", " #{req.Header.From.FromURI.User}." ] #transfer configs
     
sysEmail_3 = [ "ubj9BBv8PuvLUFV5ydscgjCn@api.pushover.net", "ANTUA al buzon ", " #{req.Header.From.FromURI.User}." ] #voicemail configs
     
sysEmail_Generic = [ "ubj9BBv8PuvLUFV5ydscgjCn@api.pushover.net", "ANTUA Recibiendo Llamada de ", " #{req.Header.From.FromURI.User}." ] #all incomings withou routes

sysEmail_Evernote = [ "jcolinspam.c@m.evernote.com", "ANTUA Recibiendo Llamada de ", " #{req.Header.From.FromURI.User}." ] #all incomings withou routes

sys.Log("Incoming call from #{req.Header.From.FromURI.ToString()}.")

case req.Header.from.FromURI.User.to_s
 
	#BLACKLIST
	when /^5289\d{8}/ then 
		sys.Email(*sysEmail_1)
		sys.Respond(403, "Forbidden")
	when /^523334698511/ then 
		sys.Email(*sysEmail_1)
		sys.Respond(403, "Forbidden")
	when /^523336470711/ then 
		sys.Email(*sysEmail_1)
		sys.Respond(403, "Forbidden")
   
	#PAPALIST
	when /^523344532/ then 
		sys.Email(*sysEmail_2)
		sys.Dial("pbxxxx@sipsorcery.com")
	when /^523343324/ then 
		sys.Email(*sysEmail_2)
		sys.Dial("pbxxxx@sipsorcery.com")
	when /^52334\d{7}/ then 
		sys.Email(*sysEmail_2)
		sys.Dial("pbxxx@sipsorcery.com")

	#VOICEMAIL
	when /^anonymous/ then 
		sys.Email(*sysEmail_3)
		sys.Dial("17772492333@in.callcentric.com")
	when /^522243324/ then 
		sys.Email(*sysEmail_3)
		sys.Dial("17772492333@in.callcentric.com")
	when /^52224\d{7}/ then 
		sys.Email(*sysEmail_3)
		sys.Dial("17772492333@in.callcentric.com")
   
	# ALL OTHERS
	else
		sys.Email(*sysEmail_Generic)
		sys.Email(*sysEmail_Evernote)
		sys.Dial("1234xxxxxx@sipsorcery.com&17772492333@in.callcentric.com[dt=40]")
	
end

qubo
Posts: 127
Joined: Tue Apr 12, 2011 6:11 am

Re: Need help to make shorter a BLACKLIST and VOICEMAL dialp

Post by qubo » Wed Sep 10, 2014 3:05 pm

Thanks so much Aaron it WORKS pretty well. Thanks for your help and patience

Post Reply