Page 1 of 1

Route inbound calls based on postal code entry

PostPosted: Wed Jan 16, 2019 1:50 pm
by dspaan
I want to create a call menu where the caller is asked to enter their 4 digit postal/zip code and based on their entry send the caller to either ingroup A or ingroup B. I suppose i have to do this with an AGI script. Does anyone have an example? Or maybe there is an existing feature that i don't know of?

Re: Route inbound calls based on postal code entry

PostPosted: Wed Jan 16, 2019 2:04 pm
by williamconley
Simpler:

Filter URL DID Redirect -If the Filter Inbound Number field is set to URL then this setting allows the URL response to specify a system DID to redirect the call to instead of using the default action. If a 0 is returned then the default action is used. If anything other than a 0 is returned then the call will be redirected to the resulting URL response value.

Or use a call menu with a multi-digit response option which can route via agi or back to a DID for more decisions.

Don't forget that you can use a menu or VIDPrompt to gather the info and then route to a call menu and/or back to another DID for secondary processing to manage multiple stages (get the info, route according to the info).

For instance: You could have the initial DID filter check for a matching vicidial lead and grab the postal code and complete the transaction OR (if no lead record matches inbound CID) route to an "i need my postal code checked" DID that bounces to a call menu or uses the VIDprompt ... and so on.

Re: Route inbound calls based on postal code entry

PostPosted: Thu Jan 17, 2019 6:08 am
by mflorell
We added this AGI script a few years ago for inbound postal code routing in the USA:

# 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)

Re: Route inbound calls based on postal code entry

PostPosted: Thu Jan 17, 2019 12:22 pm
by ambiorixg12
I was willing to post a solution using phpagi class, but I wont reinvent the wheel, the solution below seems to be perfect

mflorell wrote:We added this AGI script a few years ago for inbound postal code routing in the USA:

# 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)

Re: Route inbound calls based on postal code entry

PostPosted: Mon Jan 21, 2019 5:19 am
by dspaan
mflorell wrote:We added this AGI script a few years ago for inbound postal code routing in the USA:


How does the translation from postal code to state work? Our callers are located in The Netherlands so states don't apply. We have two departments 'North' and 'South' each with their own range of postalcodes.

williamconley wrote:Filter URL DID Redirect -If the Filter Inbound Number field is set to URL then this setting allows the URL response to specify a system DID to redirect the call to instead of using the default action. If a 0 is returned then the default action is used. If anything other than a 0 is returned then the call will be redirected to the resulting URL response value.

Or use a call menu with a multi-digit response option which can route via agi or back to a DID for more decisions.

Don't forget that you can use a menu or VIDPrompt to gather the info and then route to a call menu and/or back to another DID for secondary processing to manage multiple stages (get the info, route according to the info).

For instance: You could have the initial DID filter check for a matching vicidial lead and grab the postal code and complete the transaction OR (if no lead record matches inbound CID) route to an "i need my postal code checked" DID that bounces to a call menu or uses the VIDprompt ... and so on.


The management team in all their wisdom has now decided it would be better if the call whent to an ingroup with agents first who will then determine if they belong to either the 'North' or 'South' department and set that value with a custom field dropdown and then the next time when they call they are routed to 'North' or 'South' ingroup. I suppose the best way to do that would be with the Filter URL option where we lookup the lead_id based on caller ID and return 0 or 1?

Re: Route inbound calls based on postal code entry

PostPosted: Mon Jan 21, 2019 6:53 am
by mflorell
The AGI script uses the "vicidial_postal_codes" database table to determine the state, and we have had clients add additional zipcodes to that table to be able to do other lookups outside of the USA.

As for your other scenario, yes, a custom URL lookup or custom AGI script is certainly possible using a different dataset.