In the previous chapter, you learned how to use OpenSIPS to route calls between SIP users, provision such users, and authenticate them using a database backend. However, you still cannot send calls to ordinary phones because you are not connected to the Public Switched Telephone Network (PSTN). The challenge now is to route calls from and to the PSTN, as shown in the following figure:
This PSTN interconnection comes with special needs such as advanced number matching and manipulation (dialplans), IP-based authentication, and dynamic routing (based on the prefix, priority, location, or time of day).
Unless you have a SIP trunk to interconnect calls with the PSTN, you will need a device called SIP PSTN gateway. There are several manufacturers for these devices in the market, such as CiscoTM, AudioCodesTM, and others. You can also use open source software such as FreeSWITCH or Asterisk private branch exchange (PBX) for this task. SIP trunks are becoming more...