I’m working on an architecture where I want to separate the IVR (Call Flow) server from the Queue/Agent server, and I’d appreciate your guidance on achieving this setup.
High-Level Requirement:
I want to handle IVR and call flow logic on one server, and manage queues and agent registrations on a separate server. Here’s the intended call flow:
1) Inbound Call:
A call arrives from the SIP provider to my SIP router (using Kamailio/OpenSIPS). The SIP router routes the call to the IVR/Call Flow server.
2) IVR Interaction:
The caller navigates the IVR and makes a selection (e.g., to speak with an agent). During this process, certain channel variables are set (e.g., selected language, customer ID, etc.).
3) Call Handoff:
After the selection, I want to disconnect the call from the IVR server and send it back to the SIP router—with all the previously set variables preserved.
4) Routing to Agent Server:
The SIP router then forwards the call to the Queue/Agent server, where the agents are registered and the call is queued.
5) Variable Access:
On the Queue/Agent server, I need access to the variables that were originally set on the IVR server, associated with the same call.
6) Final Media Path:
Once an agent answers the call, the media path should ideally be:
Agent <-> Queue/Agent Server <-> SIP Router <-> SIP Provider <-> Customer
Question:
How can I achieve this type of call flow and variable preservation across different Asterisk servers? Is there a best practice for passing channel variables (or other context/state data) between Asterisk boxes via Kamailio/OpenSIPS, possibly using SIP headers, REINVITEs, or other methods?
Any recommendations, best practices, or examples are greatly appreciated.
On Friday 20 June 2025 at 12:24:31, neyamt via Asterisk Community wrote:
I’m working on an architecture where I want to separate the IVR (Call Flow)
server from the Queue/Agent server, and I’d appreciate your guidance on
achieving this setup.
I think you can achieve everything you’ve outlined regarding variables simply
by using custom SIP headers.
The IVR server sets custom headers containing the variables you mentioned.
The SIP router passes custom headers through as they are.
The Queue / Agent server reads the custom headers and does whatever it needs
to with them.
I’m not so sure about the call flow, where you start with:
Provider → Router → IVR Server → Router → Queue Server → Agent
and you want to end up with
Agent → Queue Server → Router → Provider
Some fiddling with Direct Media might be able to do what you want there,
though.
Antony.
–
“Can you keep a secret?”
“Well, I shouldn’t really tell you this, but… no.”
You’d need to encode all the information in the Refer-To URI. Ideally you should do it using URI parameters, which should end up as headers in the resulting INVITE, but I don’t know if either Asterisk or the proxy can actually do that, so you would need to experiment. My guess is that chan_pjsip is more likely to accept URIs with parameters on the Transfer application.
If you can’t use parameters, you will have to encode it in the user part.
I want the call to be disconnected from IVR Server once it complete its dialplan navigation and set the variable and transfer/redirect back to SIP Router with the variables.
==================================================================
Provider → Router → IVR Server → Router → Queue Server → Agent