Route extension calls to IVR's

So I have an odd situation. I have a requirement for my customer to have each individuals extension act like a queue/hold line. Rather than create 100 individual queues which I believe could cause system problems. Was to create an IVR for each individual that after ringing the extension could then route to their IVR. The IVR would give options to continue holding or leave a voicemail or be rerouted to an actual queue system to hold for someone else.
I had thought find me follow me could work for this but I cant seem to figure out how to select an IVR as the destination.
I know there is a personal IVR option for each extension but it does not seem like there is a central method of managing these. I would need to login to each individual account and record on each persons phone a personal IVR greeting…that is so taxing.
So I am wondering if anyone might have a solution for this as I am at my wits end with this need.

Increase the extension Ring Time and set up a call forward on no answer for each one.

So I went deeper and had GPT give me some help (I don’t entirely know how to make dialplans myself.)
I made up this dialplan and used custom context to get inbound routes routing to it. I can get the extension to ring and then ill have to make my sound files and put them in the right place. What I cant seem to resolve is how do I transfer the call to a different IVR in the system at the end of the dialplan…

[my-custom-last4]
; -------------------------------------------
; Step 1 & 2: Extract last 4 digits from the DID and Dial
; -------------------------------------------
exten => s,1,NoOp(===> In my-custom-last4 via 's')
    ; 1) Retrieve the full DID (confirm correct variable!)
    same => n,Set(CALLED_DID=${CALLERID(dnid)})
    ; 2) Extract the last 4 digits
    same => n,Set(LAST4=TPC${CALLERID(dnid):-4})
    ; 3) Dial the extension (last 4 digits)
    same => n,NoOp(===> Dialing extension ${LAST4})
    same => n,Dial(PJSIP/${LAST4},20)
    same => n,GotoIf($["${DIALSTATUS}"="NOANSWER"]?hold-ivr,1)
    same => n,Hangup()

; -----------------------------------------------------
; Step 3 & 4: IVR if no answer, with dynamic greeting
; -----------------------------------------------------
exten => hold-ivr,1,NoOp(===> Caller is now in the IVR for extension ${LAST4})
    same => n,Answer()
    same => n,Playback(thank-you-for-holding-for)
    same => n,ExecIf($[${STAT(e,/var/spool/asterisk/voicemail/tpc-voicemail/${LAST4}/greet.wav)}] ?Playback(/var/spool/asterisk/voicemail/tpc-voicemail/${LAST4}/greet)
    same => n,Playback(custom/ivr-options)  ; e.g., "Press 1 to keep holding, 2 for voicemail, 3 for next agent"
    same => n,WaitExten(10)

; ------------------------------------------------
; Step 5: Press 1 => Retry (loop back)
; ------------------------------------------------
exten => 1,1,NoOp(===> customer pressed 1 to continue holding for ${LAST4})
    same => n,Goto(my-custom-last4,${LAST4},1)

; ------------------------------------------------
; Step 6: Press 2 => Voicemail
; ------------------------------------------------
exten => 2,1,NoOp(===> customer pressed 2 for voicemail for ${LAST4})
    same => n,Voicemail(${LAST4}@default,u)
    same => n,Hangup()

; ---------------------------------------------------
; Step 7: Press 3 => Another IVR / Next Agent
; ---------------------------------------------------
exten => 3,1,NoOp(===> Transferring caller to another IVR)
    same => n,Goto(collisionIVR?,s,1) 

; ---------------------------------------------------
; Invalid (i) / Timeout (t)
; ---------------------------------------------------
exten => i,1,Playback(invalid)
    same => n,Goto(hold-ivr,1)

exten => t,1,Playback(noresponse)
    same => n,Hangup()

; ---------------------------------------------------
; We also define _X. for the “Goto(my-custom-last4,XXXX,1)” references
; ---------------------------------------------------
exten => _X.,1,NoOp(===> We got asked to dial extension: ${EXTEN})
    same => n,Dial(PJSIP/${EXTEN},20)
    same => n,GotoIf($["${DIALSTATUS}"="NOANSWER"]?hold-ivr,1)
    same => n,Hangup()

I was wondering if you had advice on that portion?

You can use the Goto() application to send the call somewhere else, or use the Return() application to send back the call to the custom context destination.

Thanks, so return() is working since quite some time there?
I can only remember the days where return() was not working.

Yes. It is working well for a long time now.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.