“SIP Trunking 创建”的版本间的差异
(创建页面,内容为“SIP Trunking Setup One common task for an SBC is to act as a termination point for SIP trunks. The typical scenario is an enterprise with a PBX on the internal netw...”) |
(没有差异)
|
2016年1月29日 (五) 14:27的版本
SIP Trunking Setup
One common task for an SBC is to act as a termination point for SIP trunks. The typical scenario is an enterprise with a PBX on the internal network wants to connect to a SIP trunk provider in order to have PSTN connectivity. In this case the SBC will reside either on the public network directly or in a DMZ and will be responsible for receiving calls from the provider network and passing them along to the internal PBX for routing to the final destination. Conversely, calls that the PBX routes to the PSTN will be received by the SBC and sent onwards to the provider network.
In cases like these, there may be transcoding involved or manipulation of various SIP parameters before routing the call. This guide will not focus on those, but instead on the basic configuration tasks necessary for connecting and routing. Some of the steps may need to be adapted to your environment for complete compatibility.
Use Case
Before You Begin:
The SBC appliance is connected to the network and all IP addresses are configured as needed You are able to connect to the Web interface of the SBC You know all of the details and requirements to connect to the SIP trunk (credentials, transport types, authentication methods) Step 1: Create SIP Profiles
For this type of deployment, it is recommended to create two SIP profiles; one for the Internal network and one for the External. They can be bound to a single network interface if you are only using one port on the SBC, but in that case they would need to be configured to use separate TCP/UDP ports. To create SIP Profiles, click on the configuration section in the SBC Web UI. Find the section that says SIP Profiles and click there. In the right pane, click the Add button.
You can name the SIP Profiles whatever you prefer. In our examples, we will use the names "External" and "Internal".
SIP IP Address: Select the interface you want to bind this profile to from the dropdown. External SIP IP Address: If you are using the SBC in a DMZ, set this to the public IP address that the SBC will be NAT'ed to when it communicates on the internet. If you are not passing through a NAT, there is not need to set this. Transport: Set the transport layer protocol that your SIP trunk provider expects to use here. External RTP IP Address: Set this only if the SBC is behind the NAT or if some device other than the SBC will be forwarding the RTP packets for this call. If you are unsure, set it to the same as the External SIP IP Address field. The picture below shows a real example profile set up for use with a SIP trunk provider. If you know you need to change a setting, make the adjustments now. Otherwise leave the rest default and save the profile.
For the Internal SIP Profile, click the Add button, name the profile appropriately, and perform the same configuration tasks with the exception of the External IP Address settings which likely are not needed for an internal profile.
Step 2: Create a Trunk
From the SBC Web UI Menu, click configuration, then click on SIP Trunks. Click the Add button and name your Trunk appropriately. This trunk section will contain all of the necessary information and credentials to connect to your trunk.
Domain: Enter the IP address of the trunk provider or the domain name. Username/Password: Enter the authentication credentials for connecting to the trunk. Registration: If you trunk requires registration, set this to Enabled. SIP Profile: Select the external SIP Profile you want to associate this trunk with. In our example, it is the External profile. The remaining settings can be left default unless you specifically know you need something.
At this point, you should apply any settings you have saved up to this point and restart SBC. Under the Configuration section (Management) click apply to make the changes take effect.
If you are registering to your trunk, now is a good time to check that it is connected and registered. To verify that the trunk is registered, click on the Overview section, then SIP Status. On this page you will see all of the SIP profiles you have defined. Select the external profile by clicking View for the section you want to view.
This page will appear showing you some information about the profile as well as any trunks associated. At the bottom, check the state of the trunk. If you are registering it should say "REGED" in green. In our example, we are not registering with the trunk so the status says "NOREG" in amber. If you are using registration and your trunk says NOREG, you will need to troubleshoot to find out why the trunk is not registering. The most common cause is an incorrect domain OR incorrect credentials.
Step 3: Create Dialplans
Now that the trunk is created and registered it is ready to pass calls. The final configuration task is to tell the SBC how to handle the calls. We will create two dialplans, one to handle calls coming in from the External and another to handle calls from the internal PBX to be routed to the trunk.
Routing Calls Outbound from PBX
In the Web UI under Configuration, select Call Routing. Create a dialplan by clicking Add and name it "Internal_Routing" (or anything you prefer to identify it as the internal routing plan). We will create the rules for routing internal calls first.
You can now paste the following code into your editor:
<extension>
<condition field="destination_number" expression="(.*)" break="on-true"> <action application="bridge" data="sip/trunk/<trunk name>/$1" /> </condition>
</extension> This rule states that any call reaching the internal profile should be bridged to the SIP Trunk. Be sure you replace <trunk name> in the example with your own trunk name.
The "$1" parameter says to place the number captured from the destination number (dialled number) of the call. For more details on this, please see documentation on Perl Compatible Regular Expressions (PCRE).
Save the changes once you have completed the editing.
In order for this dialplan to be used, it is necessary to apply it to a SIP Profile. Return to the SIP Profiles section and Modify the Internal profile. Click Edit on the next page. Scroll to the bottom and under the "Session Routing" header, find the field labelled "Routing Plan". Select the Internal_Routing plan that you created.
Save and Apply the changes.
You should now be able to route a call from the internal PBX to the SBC and it will place the call exactly as dialled to the trunk.
Routing Calls Inbound From Trunks
Before a call can be received from the trunk we will need to define a set of routing rules for handling calls from the trunk. In the Web UI under Configuration, select Call Routing. Create a dialplan by clicking Add and name it "External_Routing" (or anything you prefer to identify it as the external routing plan).
<extension>
<condition field="destination_number" expression="(.*)" break="on-true"> <action application="bridge" data="sip/Internal/$1@<pbx IP or domain>" /> </condition>
</extension> This rule states that any call reaching the External profile should be routing using the internal profile to the PBX. This rule will send the dialled number, but you can replace "$1" to route it to a specific extension or to an IVR as you please.
Save this routing plan, then as before go to the SIP Profiles section. Select your External profile by clicking "Modify" and then click "Edit". Scroll to the bottom and under the "Session Routing" header, find the field labelled "Routing Plan". Select the External_Routing plan that you created.
Save and Apply the changes. You should now be able to route a call in both directions through the SBC between the PBX and the Trunk.