b2b_terminate
Terminate any active B2B session using its unique entity key obtained from listing sessions.
Instructions
Terminate a B2B session by its entity key.
Parameters
key:
The B2B session key as reported by b2b_list_sessions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The async handler function that executes the b2b_terminate tool logic. Decorated with @mcp.tool(), @audited('b2b_terminate'), and @require_permission('mi.write'). Takes a 'key' parameter identifying the B2B session to terminate and executes the 'b2b_terminate' MI command via the MI client.
@mcp.tool() @audited("b2b_terminate") @require_permission("mi.write") async def b2b_terminate(ctx: Context, key: str) -> dict[str, Any]: """Terminate a B2B session by its entity key. Parameters ---------- key: The B2B session key as reported by ``b2b_list_sessions``. """ app = ctx.request_context.lifespan_context return await app.mi_client.execute("b2b_terminate", {"key": key}) - src/opensips_mcp/tools/b2b_tools.py:37-38 (registration)Registration of b2b_terminate as an MCP tool via the @mcp.tool() decorator on the handler function.
@mcp.tool() @audited("b2b_terminate") - Registers the 'b2b_terminate' MI command in the MI_COMMANDS registry under the 'b2b_logic' module/category, requiring 'mi.write' permission, with a 'key' parameter description.
_r("b2b_terminate", "b2b_logic", "Terminate a B2B session", ["key"], "mi.write", "b2b_logic")