-
-
Notifications
You must be signed in to change notification settings - Fork 172
Description
What happened?
Bug Description
The rtprelay-middleware returns 403 Forbidden for inbound PSTN calls (from-pstn routing direction) without contacting RTPEngine, while outbound calls (web-to-phone) work correctly.
Environment
- Routr:
fonoster/routr-one:latest - RTPEngine:
fonoster/rtpengine:0.3.17 - Architecture: PSTN Provider → Asterisk (UDP) → Routr → Voice App
Steps to Reproduce
- Configure a trunk in Routr pointing to Asterisk (UDP transport)
- Configure a DID number with
aor_linkpointing to a Voice App peer - Send an INVITE from Asterisk (UDP) to Routr for the DID number
- Routr identifies routing as
from-pstncorrectly - rtprelay-middleware returns 403 without forwarding to Voice App
Expected Behavior
- rtprelay-middleware should process the INVITE
- Call should be forwarded to the Voice App endpoint
- RTPEngine should receive
queryandoffercommands
Actual Behavior
- rtprelay-middleware breaks the chain immediately
- No
(rtprelay) requestlog appears (unlikeweb-to-phonecalls which show this log) - RTPEngine receives NO requests for inbound calls (confirmed with log-level=7)
- 403 Forbidden returned to caller
Logs
Outbound call (WORKS):
(connect) routing request from: sip:[email protected], to: sip:[email protected] {"routingDirection":"agent-to-pstn"}
(dispatcher) sending request to middleware {"middlewareRef":"rtprelay-middleware"...}
(rtprelay) request {"direction":"web-to-phone","isNewCall":true,"type":"INVITE"}
RTPEngine logs show query and offer commands received ✅
Inbound call (FAILS):
(connect) routing request from: sip:[email protected], to: sip:+9140XXXXXXXX@XXXXXXX {"routingDirection":"from-pstn"}
(dispatcher) sending request to middleware {"middlewareRef":"rtprelay-middleware"...}
(dispatcher) found messageType to be responseType and broke the chain
- No
(rtprelay) requestlog - RTPEngine logs show NO requests received ❌
Analysis
Looking at the rtprelay code in /service/node_modules/@routr/rtprelay/dist/service.js:
if (shouldNotHandleRequest(req)) return res.send(req);
const direction = getDirectionFromRequest(req); // Returns PHONE_TO_PHONE for UDP→UDP
const queryResponse = yield query(rtpeConfig)(req); // <-- Fails here for inbound
logger.verbose("request", { direction, isNewCall, type }); // Never reachedThe code fails at the query call before the logging statement. The exception is caught and returns 403.
Direction Detection Issue
From utils.js, direction is determined by transport:
- WebSocket source →
WEB_TO_PHONEorWEB_TO_WEB(works) - UDP source →
PHONE_TO_PHONEorPHONE_TO_WEB
For PHONE_TO_PHONE (UDP→UDP), the rtprelay fails before contacting RTPEngine.
Configuration (verified correct)
-- Numbers
tel:+9140554545 → aor_link: sip:voice@office.fonoster.local
→ trunk_ref: linked to trunk with inbound_uri: XXXXXXX
-- Peers
Voice Server → aor: sip:voice@office.fonoster.local, contact_addr: XXXXX:50061
Asterisk PBX → aor: sip:asterisk@office.fonoster.local, contact_addr: XXXXXXX:5060Connectivity Verified
- RTPEngine UDP port 22222: Accessible ✅
- RTPEngine HTTP port 8080: Accessible ✅
RTPENGINE_HOST=rtpengine,RTPENGINE_PORT=22222configured ✅
Impact
This bug prevents using Fonoster/Routr for inbound PSTN calls to Voice Apps when the PSTN trunk connects via UDP (standard SIP). Only WebRTC-originated calls work.
Possible Fix
The rtprelay-middleware should handle PHONE_TO_PHONE direction the same way it handles other directions, or provide an option to bypass rtprelay for non-WebRTC calls.
Steps to reproduce
Bug Description
The rtprelay-middleware returns 403 Forbidden for inbound PSTN calls (from-pstn routing direction) without contacting RTPEngine, while outbound calls (web-to-phone) work correctly.
Environment
- Routr:
fonoster/routr-one:latest - RTPEngine:
fonoster/rtpengine:0.3.17 - Architecture: PSTN Provider → Asterisk (UDP) → Routr → Voice App
Steps to Reproduce
- Configure a trunk in Routr pointing to Asterisk (UDP transport)
- Configure a DID number with
aor_linkpointing to a Voice App peer - Send an INVITE from Asterisk (UDP) to Routr for the DID number
- Routr identifies routing as
from-pstncorrectly - rtprelay-middleware returns 403 without forwarding to Voice App
Expected Behavior
- rtprelay-middleware should process the INVITE
- Call should be forwarded to the Voice App endpoint
- RTPEngine should receive
queryandoffercommands
Actual Behavior
- rtprelay-middleware breaks the chain immediately
- No
(rtprelay) requestlog appears (unlikeweb-to-phonecalls which show this log) - RTPEngine receives NO requests for inbound calls (confirmed with log-level=7)
- 403 Forbidden returned to caller
Logs
Outbound call (WORKS):
(connect) routing request from: sip:[email protected], to: sip:[email protected] {"routingDirection":"agent-to-pstn"}
(dispatcher) sending request to middleware {"middlewareRef":"rtprelay-middleware"...}
(rtprelay) request {"direction":"web-to-phone","isNewCall":true,"type":"INVITE"}
RTPEngine logs show query and offer commands received ✅
Inbound call (FAILS):
(connect) routing request from: sip:[email protected], to: sip:+9140XXXXXXXX@XXXXXXX {"routingDirection":"from-pstn"}
(dispatcher) sending request to middleware {"middlewareRef":"rtprelay-middleware"...}
(dispatcher) found messageType to be responseType and broke the chain
- No
(rtprelay) requestlog - RTPEngine logs show NO requests received ❌
Analysis
Looking at the rtprelay code in /service/node_modules/@routr/rtprelay/dist/service.js:
if (shouldNotHandleRequest(req)) return res.send(req);
const direction = getDirectionFromRequest(req); // Returns PHONE_TO_PHONE for UDP→UDP
const queryResponse = yield query(rtpeConfig)(req); // <-- Fails here for inbound
logger.verbose("request", { direction, isNewCall, type }); // Never reachedThe code fails at the query call before the logging statement. The exception is caught and returns 403.
Direction Detection Issue
From utils.js, direction is determined by transport:
- WebSocket source →
WEB_TO_PHONEorWEB_TO_WEB(works) - UDP source →
PHONE_TO_PHONEorPHONE_TO_WEB
For PHONE_TO_PHONE (UDP→UDP), the rtprelay fails before contacting RTPEngine.
Configuration (verified correct)
-- Numbers
tel:+9140554545 → aor_link: sip:voice@office.fonoster.local
→ trunk_ref: linked to trunk with inbound_uri: XXXXXXX
-- Peers
Voice Server → aor: sip:voice@office.fonoster.local, contact_addr: XXXXX:50061
Asterisk PBX → aor: sip:asterisk@office.fonoster.local, contact_addr: XXXXXXX:5060Connectivity Verified
- RTPEngine UDP port 22222: Accessible ✅
- RTPEngine HTTP port 8080: Accessible ✅
RTPENGINE_HOST=rtpengine,RTPENGINE_PORT=22222configured ✅
Impact
This bug prevents using Fonoster/Routr for inbound PSTN calls to Voice Apps when the PSTN trunk connects via UDP (standard SIP). Only WebRTC-originated calls work.
Possible Fix
The rtprelay-middleware should handle PHONE_TO_PHONE direction the same way it handles other directions, or provide an option to bypass rtprelay for non-WebRTC calls.
Expected behavior
Bug Description
The rtprelay-middleware returns 403 Forbidden for inbound PSTN calls (from-pstn routing direction) without contacting RTPEngine, while outbound calls (web-to-phone) work correctly.
Environment
- Routr:
fonoster/routr-one:latest - RTPEngine:
fonoster/rtpengine:0.3.17 - Architecture: PSTN Provider → Asterisk (UDP) → Routr → Voice App
Steps to Reproduce
- Configure a trunk in Routr pointing to Asterisk (UDP transport)
- Configure a DID number with
aor_linkpointing to a Voice App peer - Send an INVITE from Asterisk (UDP) to Routr for the DID number
- Routr identifies routing as
from-pstncorrectly - rtprelay-middleware returns 403 without forwarding to Voice App
Expected Behavior
- rtprelay-middleware should process the INVITE
- Call should be forwarded to the Voice App endpoint
- RTPEngine should receive
queryandoffercommands
Actual Behavior
- rtprelay-middleware breaks the chain immediately
- No
(rtprelay) requestlog appears (unlikeweb-to-phonecalls which show this log) - RTPEngine receives NO requests for inbound calls (confirmed with log-level=7)
- 403 Forbidden returned to caller
Logs
Outbound call (WORKS):
(connect) routing request from: sip:[email protected], to: sip:[email protected] {"routingDirection":"agent-to-pstn"}
(dispatcher) sending request to middleware {"middlewareRef":"rtprelay-middleware"...}
(rtprelay) request {"direction":"web-to-phone","isNewCall":true,"type":"INVITE"}
RTPEngine logs show query and offer commands received ✅
Inbound call (FAILS):
(connect) routing request from: sip:[email protected], to: sip:+9140XXXXXXXX@XXXXXXX {"routingDirection":"from-pstn"}
(dispatcher) sending request to middleware {"middlewareRef":"rtprelay-middleware"...}
(dispatcher) found messageType to be responseType and broke the chain
- No
(rtprelay) requestlog - RTPEngine logs show NO requests received ❌
Analysis
Looking at the rtprelay code in /service/node_modules/@routr/rtprelay/dist/service.js:
if (shouldNotHandleRequest(req)) return res.send(req);
const direction = getDirectionFromRequest(req); // Returns PHONE_TO_PHONE for UDP→UDP
const queryResponse = yield query(rtpeConfig)(req); // <-- Fails here for inbound
logger.verbose("request", { direction, isNewCall, type }); // Never reachedThe code fails at the query call before the logging statement. The exception is caught and returns 403.
Direction Detection Issue
From utils.js, direction is determined by transport:
- WebSocket source →
WEB_TO_PHONEorWEB_TO_WEB(works) - UDP source →
PHONE_TO_PHONEorPHONE_TO_WEB
For PHONE_TO_PHONE (UDP→UDP), the rtprelay fails before contacting RTPEngine.
Configuration (verified correct)
-- Numbers
tel:+9140554545 → aor_link: sip:voice@office.fonoster.local
→ trunk_ref: linked to trunk with inbound_uri: XXXXXXX
-- Peers
Voice Server → aor: sip:voice@office.fonoster.local, contact_addr: XXXXX:50061
Asterisk PBX → aor: sip:asterisk@office.fonoster.local, contact_addr: XXXXXXX:5060Connectivity Verified
- RTPEngine UDP port 22222: Accessible ✅
- RTPEngine HTTP port 8080: Accessible ✅
RTPENGINE_HOST=rtpengine,RTPENGINE_PORT=22222configured ✅
Impact
This bug prevents using Fonoster/Routr for inbound PSTN calls to Voice Apps when the PSTN trunk connects via UDP (standard SIP). Only WebRTC-originated calls work.
Possible Fix
The rtprelay-middleware should handle PHONE_TO_PHONE direction the same way it handles other directions, or provide an option to bypass rtprelay for non-WebRTC calls.
Additional context
Bug Description
The rtprelay-middleware returns 403 Forbidden for inbound PSTN calls (from-pstn routing direction) without contacting RTPEngine, while outbound calls (web-to-phone) work correctly.
Environment
- Routr:
fonoster/routr-one:latest - RTPEngine:
fonoster/rtpengine:0.3.17 - Architecture: PSTN Provider → Asterisk (UDP) → Routr → Voice App
Steps to Reproduce
- Configure a trunk in Routr pointing to Asterisk (UDP transport)
- Configure a DID number with
aor_linkpointing to a Voice App peer - Send an INVITE from Asterisk (UDP) to Routr for the DID number
- Routr identifies routing as
from-pstncorrectly - rtprelay-middleware returns 403 without forwarding to Voice App
Expected Behavior
- rtprelay-middleware should process the INVITE
- Call should be forwarded to the Voice App endpoint
- RTPEngine should receive
queryandoffercommands
Actual Behavior
- rtprelay-middleware breaks the chain immediately
- No
(rtprelay) requestlog appears (unlikeweb-to-phonecalls which show this log) - RTPEngine receives NO requests for inbound calls (confirmed with log-level=7)
- 403 Forbidden returned to caller
Logs
Outbound call (WORKS):
(connect) routing request from: sip:[email protected], to: sip:[email protected] {"routingDirection":"agent-to-pstn"}
(dispatcher) sending request to middleware {"middlewareRef":"rtprelay-middleware"...}
(rtprelay) request {"direction":"web-to-phone","isNewCall":true,"type":"INVITE"}
RTPEngine logs show query and offer commands received ✅
Inbound call (FAILS):
(connect) routing request from: sip:[email protected], to: sip:+9140XXXXXXXX@XXXXXXX {"routingDirection":"from-pstn"}
(dispatcher) sending request to middleware {"middlewareRef":"rtprelay-middleware"...}
(dispatcher) found messageType to be responseType and broke the chain
- No
(rtprelay) requestlog - RTPEngine logs show NO requests received ❌
Analysis
Looking at the rtprelay code in /service/node_modules/@routr/rtprelay/dist/service.js:
if (shouldNotHandleRequest(req)) return res.send(req);
const direction = getDirectionFromRequest(req); // Returns PHONE_TO_PHONE for UDP→UDP
const queryResponse = yield query(rtpeConfig)(req); // <-- Fails here for inbound
logger.verbose("request", { direction, isNewCall, type }); // Never reachedThe code fails at the query call before the logging statement. The exception is caught and returns 403.
Direction Detection Issue
From utils.js, direction is determined by transport:
- WebSocket source →
WEB_TO_PHONEorWEB_TO_WEB(works) - UDP source →
PHONE_TO_PHONEorPHONE_TO_WEB
For PHONE_TO_PHONE (UDP→UDP), the rtprelay fails before contacting RTPEngine.
Configuration (verified correct)
-- Numbers
tel:+9140554545 → aor_link: sip:voice@office.fonoster.local
→ trunk_ref: linked to trunk with inbound_uri: XXXXXXX
-- Peers
Voice Server → aor: sip:voice@office.fonoster.local, contact_addr: XXXXX:50061
Asterisk PBX → aor: sip:asterisk@office.fonoster.local, contact_addr: XXXXXXX:5060Connectivity Verified
- RTPEngine UDP port 22222: Accessible ✅
- RTPEngine HTTP port 8080: Accessible ✅
RTPENGINE_HOST=rtpengine,RTPENGINE_PORT=22222configured ✅
Impact
This bug prevents using Fonoster/Routr for inbound PSTN calls to Voice Apps when the PSTN trunk connects via UDP (standard SIP). Only WebRTC-originated calls work.
Possible Fix
The rtprelay-middleware should handle PHONE_TO_PHONE direction the same way it handles other directions, or provide an option to bypass rtprelay for non-WebRTC calls.