SOLVED Taming the Call Box

Prits

Active Member
Joined
May 28, 2013
Messages
165
Reaction score
30
Hello,

So I have been using the following for a while happily:


But I need help/instructions/steps in modifying this slightly please:

1. I want to set up an inbound DID to point to a custom destination to run the Call-Box script but without depending on the a specific CallerID.
2. I have a few condo's but sometimes they change their outbound callerID on their Call Boxes so I do not want to worry about this if it was to happen again.
3. So no matter who calls the inbound DID, it routes always to the call box script.

Thank you
 
Last edited:
Keep in mind that when the call arrives at the call box, it opens the door. Is that really what you want for every call that comes in??
 
Keep in mind that when the call arrives at the call box, it opens the door. Is that really what you want for every call that comes in??
Hey @wardmundy

It opens the door upon entering the PIN code, so I still want the same functionality, call comes in, PIN is still required etc.

I just don't want asterisk running the from-call-box routine when it only detects that the inbound did was called from a specific telephone number, ie: I don't want this:

exten => 8881234567,n,GotoIf($["${CALLERID(number)}" = "9990000000"]?BUZZMEUP)

So, basically, anyone can call my inbound DID number (8881234567) and I want to be able to run the rest of the routine oppose to only running the routine if my inbound DID number (8881234567) was only called from 9990000000.

Thank you
 
Code:
[from-callbox]
exten => 8881234567,1,Answer
exten => 8881234567,n,Wait(1)
exten => 8881234567,n,NoOp(*** Incoming call on 8881234567 DID ***)
;exten => 8881234567,n,GotoIf($["${CALLERID(number)}" = "9990000000"]?BUZZMEUP)
;exten => 8881234567,n,Goto(from-trunk,8881234567,1)
;exten => 8881234567,n,Hangup
exten => 8881234567,n(BUZZMEUP),Authenticate(90210)
exten => 8881234567,n,Playback(access-granted)
exten => 8881234567,n,agi(picotts.agi,"The door is opening. Please come in.")
exten => 8881234567,n,SendDTMF(9,50,2000)
exten => 8881234567,n,system(echo "Condo door opened" | /usr/bin/mail -s ALERT [email protected])
exten => 8881234567,n,Wait(3)
exten => 8881234567,n,Playback(goodbye)
exten => 8881234567,n,Hangup
exten => s,1,Hangup
 
Code:
[from-callbox]
exten => 8881234567,1,Answer
exten => 8881234567,n,Wait(1)
exten => 8881234567,n,NoOp(*** Incoming call on 8881234567 DID ***)
;exten => 8881234567,n,GotoIf($["${CALLERID(number)}" = "9990000000"]?BUZZMEUP)
;exten => 8881234567,n,Goto(from-trunk,8881234567,1)
;exten => 8881234567,n,Hangup
exten => 8881234567,n(BUZZMEUP),Authenticate(90210)
exten => 8881234567,n,Playback(access-granted)
exten => 8881234567,n,agi(picotts.agi,"The door is opening. Please come in.")
exten => 8881234567,n,SendDTMF(9,50,2000)
exten => 8881234567,n,system(echo "Condo door opened" | /usr/bin/mail -s ALERT [email protected])
exten => 8881234567,n,Wait(3)
exten => 8881234567,n,Playback(goodbye)
exten => 8881234567,n,Hangup
exten => s,1,Hangup

Hello @wardmundy

Thank you for your help...

The above code is exactly the same as published in your article and will only work if the incoming call on the DID is from a specific callerID.

I just don't want asterisk running the from-call-box routine when it only detects that the inbound did was called from a specific telephone number, ie: I don't want this:

exten => 8881234567,n,GotoIf($["${CALLERID(number)}" = "9990000000"]?BUZZMEUP)

What I would like is that anyone can call my inbound DID number (8881234567) and I want to be able to run the rest of the routine oppose to only running the routine if my inbound DID number (8881234567) was only called from 9990000000.

Thank you again.
 
Its really simple. Just delete the lines related to the IF statement. @wardmundy commented out those lines in his response above. If you want it more plain, I have deleted the lines for you. Where 8881234567 is your DID number and 90210 is the PIN number and the SendDTMF command sends necessary tones to the door system.
Code:
[from-callbox]
exten => 8881234567,1,Answer
exten => 8881234567,n,Wait(1)
exten => 8881234567,n,NoOp(*** Incoming call on 8881234567 DID ***)
exten => 8881234567,n,Authenticate(90210)
exten => 8881234567,n,Playback(access-granted)
exten => 8881234567,n,agi(picotts.agi,"The door is opening. Please come in.")
exten => 8881234567,n,SendDTMF(9,50,2000)
exten => 8881234567,n,system(echo "Condo door opened" | /usr/bin/mail -s ALERT [email protected])
exten => 8881234567,n,Wait(3)
exten => 8881234567,n,Playback(goodbye)
exten => 8881234567,n,Hangup
exten => s,1,Hangup
 
Hello @wardmundy

Thank you for your help...

The above code is exactly the same as published in your article and will only work if the incoming call on the DID is from a specific callerID.

I just don't want asterisk running the from-call-box routine when it only detects that the inbound did was called from a specific telephone number, ie: I don't want this:

exten => 8881234567,n,GotoIf($["${CALLERID(number)}" = "9990000000"]?BUZZMEUP)

What I would like is that anyone can call my inbound DID number (8881234567) and I want to be able to run the rest of the routine oppose to only running the routine if my inbound DID number (8881234567) was only called from 9990000000.

Thank you again.
Did you not see that 3 lines of the script were commented out?? The 888 number is the DID, not CallerID.
 
Prits, look again the code IS the same BUT with the Gotoif lines commented out (the semicolon in front of the 3 lines)

Ward commented them out in case at some pointt the numbers for caller ID can be made permanent and not varied. You could just delete the 3 lines but commenting out is for reverting to one number only again.
 
Hey @wardmundy

It opens the door upon entering the PIN code, so I still want the same functionality, call comes in, PIN is still required etc.

I just don't want asterisk running the from-call-box routine when it only detects that the inbound did was called from a specific telephone number, ie: I don't want this:

exten => 8881234567,n,GotoIf($["${CALLERID(number)}" = "9990000000"]?BUZZMEUP)

So, basically, anyone can call my inbound DID number (8881234567) and I want to be able to run the rest of the routine oppose to only running the routine if my inbound DID number (8881234567) was only called from 9990000000.

Thank you

So back to Wards original point, and probably the lawyers when something bad happens in the building.

Anyone, anywhere in the world can dial the number now and open the door with a random AI generated pin code. May take a couple of passes, but with the comments in place as proposed that's apparently not an issue.
 
Did you not see that 3 lines of the script were commented out?? The 888 number is the DID, not CallerID.
Sorry @wardmundy , my eyes are obviously getting worse in my old age lol

Nonetheless, it does not work. It now bypasses and calls the extension that I have the incoming DID assigned to.
 
Last edited:
Its really simple. Just delete the lines related to the IF statement. @wardmundy commented out those lines in his response above. If you want it more plain, I have deleted the lines for you. Where 8881234567 is your DID number and 90210 is the PIN number and the SendDTMF command sends necessary tones to the door system.
Code:
[from-callbox]
exten => 8881234567,1,Answer
exten => 8881234567,n,Wait(1)
exten => 8881234567,n,NoOp(*** Incoming call on 8881234567 DID ***)
exten => 8881234567,n,Authenticate(90210)
exten => 8881234567,n,Playback(access-granted)
exten => 8881234567,n,agi(picotts.agi,"The door is opening. Please come in.")
exten => 8881234567,n,SendDTMF(9,50,2000)
exten => 8881234567,n,system(echo "Condo door opened" | /usr/bin/mail -s ALERT [email protected])
exten => 8881234567,n,Wait(3)
exten => 8881234567,n,Playback(goodbye)
exten => 8881234567,n,Hangup
exten => s,1,Hangup
@kenn10 , Thank you!

This worked and I see that the following line was the culprit:

exten => 8881234567,n(BUZZMEUP),Authenticate(90210)

and you have it correct:

exten => 8881234567,n,Authenticate(90210)

Thank you again for all contributors!

Now my next goal is to turn [from-callbox] into a custom destination so that I can point multiple inbound DIDs to a custom destination rather than create multiple [from-callbox]'s , ie. [from-callbox1], [from-callbox2], [from-callbox3] and so forth for my different condo's across the nation.

Right now I duplicate these scripts, each with it's own inbound DID in extensions_custom.conf

If anyone can help guide me on how to turn this [from-callbox] from a routine to a custom destination accepting any inbound DID pointed to it, I would really appreciate that too!

Thank you in advance!
 
Last edited:
@Prits You seriously need to study up and learn Asterisk dial plan language and commands rather than asking someone to do it for you. You can create a custom destination named whatever you want after you put the following in your /etc/asterisk/extensons_custom.conf and do an asterisk -rx "dialplan reload" Also, if you study up on the authenticate() command, you will see you can also have a database file with allowed PIN numbers to validate against. You can even incorporate if statements into the custom script to send the open command to different doors depending on the incoming DID called.

Code:
[custom-from-callbox]
exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n,NoOp(*** Incoming call on s DID ***)
exten => s,n,Authenticate(90210)
exten => s,n,Playback(access-granted)
exten => s,n,agi(picotts.agi,"The door is opening. Please come in.")
exten => s,n,SendDTMF(9,50,2000)
exten => s,n,system(echo "Condo door opened" | /usr/bin/mail -s ALERT [email protected])
exten => s,n,Wait(3)
exten => s,n,Playback(goodbye)
exten => s,n,Hangup

1687222941067.png
 
Last edited:
@Prits You seriously need to study up and learn Asterisk dial plan language and commands rather than asking someone to do it for you. You can create a custom destination named whatever you want after you put the following in your /etc/asterisk/extensons_custom.conf and do an asterisk -rx "dialplan reload" Also, if you study up on the authenticate() command, you will see you can also have a database file with allowed PIN numbers to validate against. You can even incorporate if statements into the custom script to send the open command to different doors depending on the incoming DID called.

Code:
[custom-from-callbox]
exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n,NoOp(*** Incoming call on s DID ***)
exten => s,n,Authenticate(90210)
exten => s,n,Playback(access-granted)
exten => s,n,agi(picotts.agi,"The door is opening. Please come in.")
exten => s,n,SendDTMF(9,50,2000)
exten => s,n,system(echo "Condo door opened" | /usr/bin/mail -s ALERT [email protected])
exten => s,n,Wait(3)
exten => s,n,Playback(goodbye)
exten => s,n,Hangup

View attachment 4988
@kenn10

I apologize for my lack of knowledge. I tried to do this first by reading and learning some asterisk stuff online but just couldn't quite grasp it just yet.

I thought I would reach out to the community, I did not mean to cross any boundaries.

I sincerely appreciate your willingness to help me regardless!

Thank you
 
One of the best ways to learn about things is to read through the .conf files in the /etc/asterisk directory. The extensions_custom.conf generally has interesting things in it that you can use or copy then modify for your needs. All of the conf files contain asterisk commands that you can study and learn from.

Google remains your best way to locate additional information. For example, try searching for this:
Code:
asterisk dial plan "authenticate"

Also, do yourself a favor and buy some of these books: https://www.amazon.com/s?k=o'reilly...'reilly+asterisk,stripbooks,95&ref=nb_sb_noss
 
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.
Back
Top