Converting PSTN numbers for country code

This example illustrates how incoming PSTN numbers are converted to full international (US eleven-digit) format.

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:(\d{11})$

tel:(\d{11})$

sip:$1@hostname.com

sip:$1@gateway

2

Default

tel:(\d{10})$

tel:(\d{10})$

sip:1$1@hostname.com

sip:1$1@gateway

3

Default

tel:(\d{7})$

tel:(\d{7})$

sip:1847$1@hostname.com

sip:1847$1@gateway

The following rules are used in this example:

Rule

Description

1

Matches and captures any PSTN calling/called numbers containing exactly eleven digits, and insert the numbers into SIP From/To headers.

2

Matches and captures any PSTN calling/called numbers containing exactly ten digits, prefixes one (1), and inserts the resulting numbers into SIP From/To headers.

3

Matches and captures any PSTN calling/called numbers containing exactly seven digits, prefixes 1847, and inserts the resulting numbers into SIP From/To headers.

Sample Input/Output: Incoming PSTN call

Calling: tel:8479258900 => sip:18479258900@gateway (rule 2 match)
Called: tel:8472711000 => sip:18472711000@hostname.com

Calling: tel:9258900 => sip:18479258900@gateway (rule 3 match)
Called: tel:2711000 => sip:18472711000@hostname.com