Routing PSTN to SIP based on called number

This example shows how to route PSTN calls to different SIP servers based on the called number.

Note: For simplicity, this example assumes that all inbound calls using TEL URIs are PSTN calls and that SIP calls never use TEL URIs. In cases where the gateway needs to match inbound PSTN calls and inbound SIP calls that use TEL URIs to different routes, you must define separate routing profiles. See the Inbound protocol parameter in General routing profile parameters.

ID

Profile

Incoming Called party

Incoming Calling party

Outgoing Called party

Outgoing Calling party

1

Default

tel:8479258900

tel:(\d+)

sip:service1@server1.com

sip:$1@gateway

2

Default

tel:5082711000

tel:(\d+)

sip:service2@server2.com

sip:$1@gateway

3

Default

tel:(\d+)

tel:(\d+)

sip:service3@server3.com

sip:$1@gateway

The following rules are used in this example:

Rule

Description

1

Matches a call from any PSTN calling number to 8479258900 and routes the call to service1@server1.com.

2

Matches a call from any PSTN calling number to 5082711000 and routes the call to service2@server2.com.

3

Matches a call from any PSTN calling number to any other number and routes the call to service3@server3.com.

Sample Input/Output: Incoming PSTN call

Calling: tel:3125551212 => sip: 3125551212@gateway (rule 2 match)
Called: tel:5082711000 => sip:service2@server2.com

Calling: tel:3125551212 => sip: 3125551212@gateway (rule 3 match)
Called: tel:5085551212 => sip:service3@server3.com