PSTN Fallback Issues with Hybrid Routing - Can't Get Calls to Route Correctly

Hey all,

Running into a weird one with hybrid routing and PSTN fallback. We’re trying to set up a backup route for calls coming in via direct PSTN, so if SIP trunking goes down, everything should roll over to the PSTN gateway. Sounds simple enough, right? It’s… not.

The initial setup seemed fine - we’ve got a blended routing flow in Architect, using a Data Action to check the SIP trunk status. If it’s unavailable, the flow should drop to a separate queue for PSTN calls. It’s not doing that. Calls just hang, or we’re getting a weird “No Route Found” error on the leg. Not 100% sure but feels like the fallback isn’t kicking in properly.

Here’s the gist of what we’ve done:

  1. Architect Flow: We’ve got a main entry point that checks a custom attribute (sip_trunk_status) using a Data Action. If sip_trunk_status is ‘Available’, it goes to the SIP queue. If it’s anything else (like ‘Unavailable’), it should go to the PSTN queue.
  2. Data Action: The Data Action calls the /api/v2/users/{userId}/dataactions/sip_trunk_status endpoint (using the Python SDK). It’s returning the correct status - I’ve confirmed that in the logs. It should be setting the attribute on the session.
  3. PSTN Gateway: Configured with a fallback route in the Genesys Cloud admin interface. It’s set to use our local PSTN gateway.
  4. Hybrid Routing: Enabled for the site.

The problem is, even when I manually set sip_trunk_status to ‘Unavailable’ via the Data Action, calls still try to go through the SIP route. The console shows nothing super helpful, honestly. I thought it might be caching, but we’ve flushed that.

Here’s a snippet of the Data Action code (Python SDK, v3.4.1):

import requests
import json

def get_sip_status(session_id):
 url = f"https://api.genesyscloud.com/api/v2/users/{user_id}/dataactions/sip_trunk_status"
 headers = {
 "Authorization": "Bearer YOUR_OAUTH_TOKEN" # obviously replaced in the real code
 }
 response = requests.get(url, headers=headers)
 if response.status_code == 200:
 return response.json()['data']['sip_trunk_status']
 else:
 print(f"Error getting SIP status: {response.status_code} - {response.text}")
 return 'Unavailable' # Default to unavailable on error

FWIW, the ‘YOUR_OAUTH_TOKEN’ is replaced, of course. We’re using client credentials grant type.

Also, I’m a little confused about what ‘PSTN fallback’ even means in the context of hybrid routing. Is it something you configure per site, per flow, or…? The documentation isn’t super clear. YMMV.

Anyone else had issues getting this to work? Any pointers would be great. The logs are… not telling me anything useful. I’m seeing a ton of stuff about the SIP trunk connection, but nothing specific about why it’s not falling back. One gotcha I thought of - maybe the SIP trunk isn’t actually going down? We haven’t had a real outage yet to test that scenario.

1 Like