I’m trying to modify the following Asterisk variable, which currently checks if the caller ID exists in the Asterisk Phonebook:
${DB_EXISTS(cidname/${CALLERID(number)})}
I’d like to adjust this so that it also checks if the caller ID exists in an “Allowlist” module database entry. Essentially, I want the logic to work as:
If the caller ID is in the Asterisk PhonebookOR in the Allowlist, the check should pass, with a 1. If not, it should result in a 0.
Any help or guidance would be greatly appreciated!
I think I’m missing something here. If I set the Asterisk Variable to:
${DB_EXISTS(allowlist/${CALLERID(number)})}
And I add my mobile number to the Allowlist and I call the external number, the call will reach the ring group (expected). If I remove my mobile number from the Allowlist and call the external number again, the call will ring once then hang-up and not go to the IVR for Unknown Calls if match “0”.
If I try to combine both as an OR, with either my mobile number in the Allowlist or not, calling the external number from my mobile just causes the call to ring out. It doesn’t seem to match either a “0” or a “1”?
I’m probably doing something wrong here, I think the problem is the way I am doing this as the allowlist isn’t returning 0 if the caller ID isn’t in the allowlist.
Thank you for spotting that out. The leading $ must have came off when I backspaced when pasting that into my response as the value looked like it had created a new line at that point. The one you modified is the one I tested and it doesn’t seem to return a “0” or “1”.
Are you using this expression with the Dynamic Routes module? If you’re using an expression with square brackets, you must disable substitutions in the dynroute.
Thank you! Yes, I was using this expression with a Dynamic Route and I had substitutions enabled. Just disabled that and now it’s working as I want it, thank you so much! This has been driving me insane for ages now, life saver!