Use case (Goals): Consolidate several RGs that all “work the same” (same message, cadence, etc.) into (1)one RG that (2)remains accessible/editable from the GUI.
Dependencies:
-
Phonebook: an entry for the incoming DNID under Number and the ring group + destination (cell phone) under the Name. [ringgroup]:[destination] e.x. ringgroup 200 wanting the call to go to cell 555.555.5555 would be 200:5555555555
-
Extension: Create a custom extension (I did 1111111111) to enable a variable destination. Under the Advanced tab change the Dial field to
local/s@custom-dial
This will allow 111.111.1111 to call a variable destination, based on your dial plan code, meaning one extension can serve many ring groups. -
Ring Group(s): Create a ring group that matches your phonebook entry mentioned above. Assign extension 111.111.1111 to the Ring Group.
-
Code: I put everything under one .conf file (RGConsolidation.conf) and reference the conf file in the extension_custom.conf (#include FolderPath/RGConsolidation.conf)
-
Main Logic:
[rg-cons]
exten => s,1,GotoIf($["${CHANNEL(state)}" = “Up”]?begin)
exten => s,n,Answer
exten => s,n(begin),Set(RESULT=${DB_EXISTS(cidname/${CALLERID(dnid)})})
exten => s,n,Set(RESULT2=${SHELL(echo ${DB_RESULT} | rev | cut -d":" -f2- | rev)})
exten => s,n,Set(__RESULT3=${SHELL(echo ${DB_RESULT} | rev | cut -d: -f1 | rev)})
exten => s,n,Goto(ext-group,${RESULT2},1) ;—Route to defined Ring Group
exten => s,n,Hangup -
Variable Extension Logic:
[custom-dial]
exten => s,1,goto(from-internal,${RESULT3},1)
exten => s,n,Hangup -
Custom Destination: Make a custom destination for [rg-cons] for the inbound destination(s).
Putting it all together:
- Call hits inbound route
- Ring Group and Destination pulled from Phonebook Name
- Call routes to Ring Group
- Ring Group dials 111.111.1111, which in turn calls the variable destination ${RESULT3}, via [custom-dial] context
- Ring Group complete
That’s it! Its been great for us as we previously had 20+ Ring Groups that were all identical except for the extension used. They are all consolidated to one RG now. Additionally keeping the treatment in the GUI means that many more of our users will be able to edit the Ring Group settings without having to poke around in dial plan. Using Phonebook makes it easy for end users to edit the matches, Ring Groups and destinations using the GUI or Excel and avoids a remote data source dependency.
Thanks again everyone!