fix: SIP driven by Agent entity, token refresh, network indicator

- SIP connection only for users with Agent entity (no env var fallback)
- Supervisor no longer intercepts CC agent calls
- Auth controller checks Agent entity for ALL roles, not just cc-agent
- Token refresh handles GraphQL UNAUTHENTICATED errors (200 with error body)
- Token refresh handles sidecar 400s from expired upstream tokens
- Network quality indicator in sidebar (offline/unstable/good)
- Ozonetel IDLE event mapped to ready state (fixes stuck calling after canceled call)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-25 11:51:32 +05:30
parent 70e0f6fc3e
commit daa2fbb0c2
4 changed files with 121 additions and 19 deletions

View File

@@ -13,6 +13,8 @@ import {
faCalendarCheck,
faPhone,
faUsers,
faWifi,
faWifiSlash,
faArrowRightFromBracket,
faTowerBroadcast,
faChartLine,
@@ -32,6 +34,7 @@ import { Avatar } from "@/components/base/avatar/avatar";
import { apiClient } from "@/lib/api-client";
import { notify } from "@/lib/toast";
import { useAuth } from "@/providers/auth-provider";
import { useNetworkStatus } from "@/hooks/use-network-status";
import { sidebarCollapsedAtom } from "@/state/sidebar-state";
import { cx } from "@/utils/cx";
@@ -123,6 +126,7 @@ export const Sidebar = ({ activeUrl = "/" }: SidebarProps) => {
const { logout, user } = useAuth();
const navigate = useNavigate();
const [collapsed, setCollapsed] = useAtom(sidebarCollapsedAtom);
const networkQuality = useNetworkStatus();
const width = collapsed ? COLLAPSED_WIDTH : EXPANDED_WIDTH;
@@ -218,6 +222,25 @@ export const Sidebar = ({ activeUrl = "/" }: SidebarProps) => {
))}
</ul>
{/* Network indicator — only shows when network is degraded */}
{networkQuality !== 'good' && (
<div className={cx(
"mx-3 mb-2 flex items-center gap-2 rounded-lg px-3 py-2 text-xs font-medium",
networkQuality === 'offline'
? "bg-error-secondary text-error-primary"
: "bg-warning-secondary text-warning-primary",
collapsed && "justify-center mx-2 px-2",
)}>
<FontAwesomeIcon
icon={networkQuality === 'offline' ? faWifiSlash : faWifi}
className="size-3.5 shrink-0"
/>
{!collapsed && (
<span>{networkQuality === 'offline' ? 'No connection' : 'Unstable network'}</span>
)}
</div>
)}
{/* Account card */}
<div className={cx("mt-auto py-4", collapsed ? "flex justify-center px-2" : "px-2 lg:px-4")}>
{collapsed ? (