This example shows how to extract numbers from incoming SIP numbers and convert them, if necessary, to full international (US eleven-digit) format for outgoing PSTN calls:

Eleven-digit numbers are passed through as is.

Ten-digit numbers insert the US country code (1).

Seven-digit numbers insert both the area code (847) and country code (1).

ID |
Profile |
Incoming Called party |
Incoming Calling party |
Outgoing Called party |
Outgoing Calling party |

1 |
Default |
sip:(\d{11})@.* |
sip:(\d{11})@.* |
tel:$1 |
tel:$1 |

2 |
Default |
sip:(\d{10})@.* |
sip:(\d{10})@.* |
tel:1$1 |
tel:1$1 |

3 |
Default |
sip:(\d{7})@.* |
sip:(\d{7})@.* |
tel:1847$1 |
tel:1847$1 |

The following rules are used in this example:

Rule |
Description |

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

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

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

From: sip:8479258900@10.3.6.9 => tel:18479258900 (rule
2 match)

To: sip:5082711000@10.3.6.1 => tel:15082711000

From: sip:9258900@10.3.6.9 => tel:18479258900 (rule 3 match)

To: sip:2711000@10.3.6.1 => tel:18472711000