Skip to content

Commit

Permalink
fix: solve returning 500 in place of 404 for agent-to-agent routing
Browse files Browse the repository at this point in the history
  • Loading branch information
psanders committed Sep 27, 2023
1 parent 03be7c2 commit 8e9c514
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions mods/connect/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,28 +143,28 @@ export function router(location: ILocationService, apiClient: CC.APIClient) {
switch (routingDirection) {
case RoutingDirection.AGENT_TO_AGENT: {
const route = await agentToAgent(location, request)
return {
return route ? {
...route,
metadata: caller.extended
}
} : null
}
case RoutingDirection.AGENT_TO_PEER: {
const route = await agentToPeer(location, callee as CC.Peer, request)
return {
return route ? {
...route,
metadata: caller.extended
}
} : null
}
case RoutingDirection.AGENT_TO_PSTN: {
const route = await agentToPSTN(
request,
caller as CC.Agent,
requestURI.user
)
return {
return route? {
...route,
metadata: caller.extended
}
} : null
}
case RoutingDirection.FROM_PSTN: {
const route = await fromPSTN(
Expand All @@ -173,10 +173,10 @@ export function router(location: ILocationService, apiClient: CC.APIClient) {
callee as CC.INumber,
request
)
return {
return route ? {
...route,
metadata: callee.extended
}
} : null
}
case RoutingDirection.PEER_TO_PSTN:
return await peerToPSTN(apiClient, request)
Expand Down

0 comments on commit 8e9c514

Please sign in to comment.