TIPS Make blacklist NOT answer channel when playing "no service" message?

kyle95wm

Phone Genius Owner
Joined
Apr 16, 2016
Messages
520
Reaction score
90
So I was wondering if I could make the blacklist NOT answer the channel but instead play the Zapateller sound and no service message as EARLY MEDIA.

Here's what my app-blacklist-check looks like:

Code:
[app-blacklist-check]
exten => s,1(check),Set(CDR(did)=${FROM_DID})
;Original first line of context with line number changed
exten => s,n,GotoIf($["${BLACKLIST()}"="1"]?blacklisted)
;Blacklist Caller ID names found in custom Asterisk database BLISTNAME if used
exten => s,n,GotoIf($["${DB_EXISTS(BLISTNAME/${TOUPPER(${CALLERID(name)})})}"="1"]?blacklisted)
;Blacklist Caller ID names of single letter followed by 9 or more digits
exten => s,n,Set(regx=^[A-Z][0-9]{9}[0-9]* *$)
exten => s,n,GotoIf($[${REGEX("${regx}" ${CALLERID(name)})} = 1]?blacklisted)
;Blacklist numbers where first digit of 7 digit local number is 0 or 1
exten => s,n,Set(regx=^[+]?1?[0-9]{3}[01][0-9]{6}$)
exten => s,n,GotoIf($[${REGEX("${regx}" ${CALLERID(num)})} = 1]?blacklisted)
;Blacklist numbers where first digit of area code is 0 or 1
exten => s,n,Set(regx=^[+]?1?[01][0-9]{9}$)
exten => s,n,GotoIf($[${REGEX("${regx}" ${CALLERID(num)})} = 1]?blacklisted)
;Blacklist numbers where first three digits of 7 digit local number are 555
;exten => s,n,Set(regx=^[+]?1?[0-9]{3}555[0-9]{4}$)
;exten => s,n,GotoIf($[${REGEX("${regx}" ${CALLERID(num)})} = 1]?blacklisted)
;Blacklist numbers that start with 1 but are longer than 11 digits total
exten => s,n,Set(regx=^[+]?1[0-9]{11}[0-9]*$)
exten => s,n,GotoIf($[${REGEX("${regx}" ${CALLERID(num)})} = 1]?blacklisted)
;Blacklist numbers of less than 7 digits in length
exten => s,n,GotoIf($[${LEN(${CALLERID(num)})} < 7]?blacklisted)
;Blacklist numbers of 8 digits in length
exten => s,n,GotoIf($[${LEN(${CALLERID(num)})} = 8]?blacklisted)
;Next line is from the original blacklist context
exten => s,n,Set(CALLED_BLACKLIST=1)
;Special CallerID name lookup; should not really be here but works
exten => s,n,ExecIf($["${DB_EXISTS(cidname/${CALLERID(num)})}"!="1″]?Return())
exten => s,n,Set(CALLERID(name)=${DB(cidname/${CALLERID(num)})})
exten => s,n,Set(__SKIPCIDLOOKUP=1)
;More original blacklist context
exten => s,n,Return()
exten => s,n(blacklisted),Answer
;Prepend *BL* to Caller ID name of blacklisted numbers so they can be distinguished in CDR
exten => s,n,Set(CALLERID(name)=*BL*${CALLERID(name)})
;Set Call Detail Record Userfield to Blacklisted
exten => s,n,Set(CDR(userfield)=Blacklisted)
;Still more original blacklist context
exten => s,n,Wait(1)
exten => s,n,Zapateller()
exten => s,n,Playback(ss-noservice)
exten => s,n,Hangup
;–== end of [app-blacklist-check] ==–;

I assume that towards the bottom I have to change "Answer" to something else? I need someone to help me with this. Just tell me what needs to be changed.

For reference here's an announcement I made in FreePBX that does not answer the channel when played:

Code:
[app-announcement-1]
include => app-announcement-1-custom
exten => s,1,Progress
exten => s,n(begin),Noop(Playing announcement welcome)
exten => s,n,Playback(custom/welcome,noanswer)
exten => s,n,Goto(ext-group,600,1)


and here's the original app-blacklist-check code:

Code:
[app-blacklist-check]
include => app-blacklist-check-custom
exten => s,1(check),GotoIf($["${BLACKLIST()}"="1"]?blacklisted)
exten => s,n,Set(CALLED_BLACKLIST=1)
exten => s,n,Return()
exten => s,n(blacklisted),Answer
exten => s,n,Wait(1)
exten => s,n,Zapateller()
exten => s,n,Playback(ss-noservice)
exten => s,n,Hangup
 
Joined
Nov 14, 2008
Messages
1,398
Reaction score
320
Unlikely, early media worked in the old days but these days you either answer and get an RTP audio path or you don't. You aren't going to be able to get an audio path without answering unless you had complete control of the end to end path.

I don't see any issue with answering the call. The costs if any to the calling party are minimal
 

kyle95wm

Phone Genius Owner
Joined
Apr 16, 2016
Messages
520
Reaction score
90
Okay, then why do announcements offer this feature, and not to mention it fully works?
 
Joined
Nov 14, 2008
Messages
1,398
Reaction score
320
It's not that it doesn't "work" in the sense that asterisk will take appropriate local actions but it wrongly assumes all the other pieces will cooperate ie: the local router, providers at both ends and then distant router and phone system. RTP would have to flow all the way through. In some circumstances Early Media may work like on an outgoing call to an analog busy number but that is only a partial route.
 

billsimon

Well-Known Member
Joined
Jan 2, 2011
Messages
1,540
Reaction score
729
Answering the call tells the calling (robot) party that your number works. Better to reject the call with an error code that will signal the caller that your line is disconnected. Hangup(404) should do that. No audio necessary. The remote end switch can interpret the condition and play an error message to the caller.
 

kyle95wm

Phone Genius Owner
Joined
Apr 16, 2016
Messages
520
Reaction score
90
So what would my final script look like in theory? Remember I wanna use my custom blacklist checker script (first code snippet)

EDIT: Here's my final script

Code:
[app-blacklist-check]
exten => s,1(check),Set(CDR(did)=${FROM_DID})
;Original first line of context with line number changed
exten => s,n,GotoIf($["${BLACKLIST()}"="1"]?blacklisted)
;Blacklist Caller ID names found in custom Asterisk database BLISTNAME if used
exten => s,n,GotoIf($["${DB_EXISTS(BLISTNAME/${TOUPPER(${CALLERID(name)})})}"="1"]?blacklisted)
;Blacklist Caller ID names of single letter followed by 9 or more digits
exten => s,n,Set(regx=^[A-Z][0-9]{9}[0-9]* *$)
exten => s,n,GotoIf($[${REGEX("${regx}" ${CALLERID(name)})} = 1]?blacklisted)
;Blacklist numbers where first digit of 7 digit local number is 0 or 1
exten => s,n,Set(regx=^[+]?1?[0-9]{3}[01][0-9]{6}$)
exten => s,n,GotoIf($[${REGEX("${regx}" ${CALLERID(num)})} = 1]?blacklisted)
;Blacklist numbers where first digit of area code is 0 or 1
exten => s,n,Set(regx=^[+]?1?[01][0-9]{9}$)
exten => s,n,GotoIf($[${REGEX("${regx}" ${CALLERID(num)})} = 1]?blacklisted)
;Blacklist numbers where first three digits of 7 digit local number are 555
;exten => s,n,Set(regx=^[+]?1?[0-9]{3}555[0-9]{4}$)
;exten => s,n,GotoIf($[${REGEX("${regx}" ${CALLERID(num)})} = 1]?blacklisted)
;Blacklist numbers that start with 1 but are longer than 11 digits total
exten => s,n,Set(regx=^[+]?1[0-9]{11}[0-9]*$)
exten => s,n,GotoIf($[${REGEX("${regx}" ${CALLERID(num)})} = 1]?blacklisted)
;Blacklist numbers of less than 7 digits in length
exten => s,n,GotoIf($[${LEN(${CALLERID(num)})} < 7]?blacklisted)
;Blacklist numbers of 8 digits in length
exten => s,n,GotoIf($[${LEN(${CALLERID(num)})} = 8]?blacklisted)
;Next line is from the original blacklist context
exten => s,n,Set(CALLED_BLACKLIST=1)
;Special CallerID name lookup; should not really be here but works
exten => s,n,ExecIf($["${DB_EXISTS(cidname/${CALLERID(num)})}"!="1″]?Return())
exten => s,n,Set(CALLERID(name)=${DB(cidname/${CALLERID(num)})})
exten => s,n,Set(__SKIPCIDLOOKUP=1)
;More original blacklist context
exten => s,n,Return()
;exten => s,n(blacklisted),Answer
exten => s,n(blacklisted),Hangup(404)
;Prepend *BL* to Caller ID name of blacklisted numbers so they can be distinguished in CDR
exten => s,n,Set(CALLERID(name)=*BL*${CALLERID(name)})
;Set Call Detail Record Userfield to Blacklisted
exten => s,n,Set(CDR(userfield)=Blacklisted)
;Still more original blacklist context
;exten => s,n,Wait(1)
;exten => s,n,Zapateller()
;exten => s,n,Playback(ss-noservice)
;exten => s,n,Hangup
;exten => s,n,Hangup(404)
;–== end of [app-blacklist-check] ==–;

I tested it with a phone and got a "busy" message. Is this supposed to happen?
 
Last edited:

Members online

No members online now.

Forum statistics

Threads
25,809
Messages
167,745
Members
19,239
Latest member
dbradford
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top