register_global_routing_callback
register_global_routing_callback
Register a custom routing callback on every registered agent at the specified path. When a request arrives at that path on any agent, the callback is invoked to determine whether to redirect the request to a different agent route.
This is the low-level mechanism that powers setup_sip_routing().
Use it directly when you need custom routing logic beyond SIP username matching —
for example, routing based on HTTP headers, query parameters, or request body content.
Parameters
callback_fn
A function that receives a FastAPI Request object and the parsed request body dict.
Return a route string (e.g., "/sales") to redirect, or None to let the current
agent handle the request.
path
The URL path where the callback is triggered (e.g., "/route"). Leading slashes are
added and trailing slashes are stripped automatically.
Returns
None