Skip to content

Commit

Permalink
fix: hotfix for interop issue with Twilio for outbound calls
Browse files Browse the repository at this point in the history
  • Loading branch information
psanders committed Feb 1, 2025
1 parent 988367c commit 0dd8552
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
7 changes: 3 additions & 4 deletions mods/connect/src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ export default function connectProcessor(config: ConnectProcessorConfig) {
// Remove the proxy and overwrite the contact with the sender info
return res.send(
// NOTE: We should consider making the overwriteContactWithSenderInfo an Agent/Peer level alteration
pipe(req, A.overwriteContactWithSenderInfo, A.removeTopVia)
// pipe(req, A.overwriteContactWithSenderInfo, A.removeTopVia)
pipe(req, A.removeTopVia)
)
}

Expand All @@ -84,9 +85,7 @@ export default function connectProcessor(config: ConnectProcessorConfig) {
pipe(
req,
A.decreaseMaxForwards,
// The order of the following alterations is important
// since addSelfViaUsingTheRouteHeaders uses the route headers
A.addSelfViaUsingTheRouteHeaders,
A.addSelfViaUsingExternalAddrs,
A.removeSelfRoutes
)
)
Expand Down
26 changes: 26 additions & 0 deletions mods/processor/src/alterations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,32 @@ export const addSelfViaUsingTheRouteHeaders = (
return req
}

// Experimental
export const addSelfViaUsingExternalAddrs = (
request: MessageRequest
): MessageRequest => {
const req = H.deepCopy(request)

const targetIntf = getEdgeInterface({
...request,
endpointIntf: {
host: request.message.requestUri.host,
port: request.message.requestUri.port,
transport: request.message.requestUri.transportParam
}
})

req.message.via = [
{
...targetIntf,
rPortFlag: true
},
...req.message.via
]

return req
}

export const addRouteToNextHop =
(route: Route) =>
(request: MessageRequest): MessageRequest => {
Expand Down

0 comments on commit 0dd8552

Please sign in to comment.