by mflorell » Thu Oct 08, 2020 10:01 pm
Here are a couple of the AGI scripts included with VICIdial for this purpose(designed for the USA):
# cm_areacode.agi version 2.12
#
# Designed to work with Call Menus to allow searching of the areacode of the
# caller ID phone number the customer called in on, to be searched within the
# vicidial_phone_codes table to gather the state, then search the
# vicidial_inbound_dids table for that state in the did_carrier_description
# field and send the call on to the did that matches.
#
# If areacode is not found call will go to the 'D' option in the call menu
# If state DID is not found call will go to the 'C' option in the call menu
#
# Flag Options:
# 1- Country code to search the areacode within, default 1
# 2- Length of areacode in digits, default 3
# 3- DID prefix to filter by in searching for DIDs, default 999
#
# example of what to set in the Call Menu:
# Set the prompt to "sip-silence"
# Set the Timeout to 1 second
# Option: "Timeout" Route: "AGI" AGI: "cm_areacode.agi,1---3---999"
# cm_postal.agi version 2.12
#
# Designed to work with Cell Menus to allow searching of the number entered by
# the customer to be searched within the vicidial_postal_codes table to gather
# the state, then search the vicidial_inbound_dids table for that state in the
# did_carrier_description field and send the call on to the did that matches.
#
# If postal code is not found call will go to the 'D' option in the call menu
# If state DID is not found call will go to the 'C' option in the call menu
#
# Flag Options:
# 1- minimum number of digits allowed in postal code, default 5
# 2- DID prefix to filter by in searching for DIDs, default 999
#
# example of what to put in the Custom Dialplan entry for a Call Menu:
#exten => _XXXXX,1,AGI(cm_postal.agi,5---999)