support task-selectable SIP trunks

This commit is contained in:
2026-09-17 15:23:46 +08:00
parent 84d86319a3
commit e65cfbe3af
15 changed files with 452 additions and 39 deletions
+12 -3
View File
@@ -50,6 +50,8 @@ def _args() -> argparse.Namespace:
parser.add_argument("--callee", required=True)
parser.add_argument("--tenant-id", default=None)
parser.add_argument("--tenant-key", default=None)
parser.add_argument("--route-policy-id", default="route_policy_test")
parser.add_argument("--caller-profile-id", default="caller_profile_test")
parser.add_argument("--broker-url", default=None)
parser.add_argument("--ledger", default="/data/agent-call-cell.sqlite3")
parser.add_argument("--wait-seconds", type=int, default=240)
@@ -84,8 +86,8 @@ def _command(
"task_item_id": f"item_{execution_id}",
"task_revision": 1,
"callee": args.callee,
"route_policy_id": "route_policy_test",
"caller_profile_id": "caller_profile_test",
"route_policy_id": args.route_policy_id,
"caller_profile_id": args.caller_profile_id,
"agent_version_id": agent_version_id,
"variables": {},
"ring_timeout_ms": 30000,
@@ -142,6 +144,7 @@ def run(args: argparse.Namespace) -> dict[str, Any]:
CellExecutionLedger,
RealCellCall,
RealCellWorker,
load_cell_routes,
)
settings = _data(_path(args.profile))
@@ -181,7 +184,13 @@ def run(args: argparse.Namespace) -> dict[str, Any]:
broker = PikaBroker(args.broker_url or os.environ.get("RABBITMQ_URL", ""))
ledger = CellExecutionLedger(args.ledger)
executor = RealCellCall(CellCallConfig.from_env(), engine, BailianASR.from_env())
worker = RealCellWorker(broker, tenant_key, ledger, executor)
worker = RealCellWorker(
broker,
tenant_key,
ledger,
executor,
routes=load_cell_routes(os.environ.get("CELL_ROUTE_MAP_JSON")),
)
command = _command(settings, args, tenant_id, tenant_key, agent_version_id)
route = f"agent-call.tenant.{tenant_key}.call.execute"
broker.publish(