هنا شرح بالانجليزي حاول ان تتبعه اذا واجهتك صعوبات سوف احاول التعريب او مساعدتك مباشرة
كود: تحديد الكل
FreePBX Trunk setup:
For the PSTN setup here is what I did to finally get it working.
1) Create a new SIP trunk in FreePBX.
2) For Caller ID I put my inbound DID there since it's from my BellSouth POTS line.
3) Max channels: I put 1 since it's only one line. This is important because if you don't do this, and this trunk is busy, calls may not fall through properly to the next trunk, due to a combination of bugs in certain versions of Linksys/Sipura firmware, and a bug in chan_sip in some versions of Asterisk. Even with this set, this bug can still bite you if you have an Asterisk version earlier than 1.2.16, the device is in use for an incoming call and the system attempts to use it for an outgoing call (the max channels logic only counts outgoing channels, not incoming ones).
4) Dialing rules, Dialing Wizard and prefix I left blank. (Remembering to keep it simple at the beginning will go a long way). If you want to add or strip a prefix you can change the dialing rules later. (Note: If you plan to send out calls with the *67 privacy code prefix, after you get the rest of this working you can go to the page How to set up per-use Caller ID blocking (*67), and particularly take note of the section at the bottom of the page, "Additional Instructions if you are using a SPA-3000/SPA-3102 device...")
5) Trunk name: Call this 1-pstn (again, simple). The reason for starting this trunk name with the digit "1" is an attempt to make it the first sip trunk listed in /etc/sip_additional.conf, which can help you avoid a strange bug in Asterisk (more on this in the "Additional information" section below). IMPORTANT - Note that the Trunk Name must match the User ID in the "Sipura 3000/3102 Device Settings" section below, otherwise you may have registration problems.
6) Outgoing settings - Peer settings (don't enter the comments - the text following the semicolons):
disallow=all ;Starting with FreePBX 2.4 this must be the first statement in the peer settings
context=from-trunk ; this is needed here - very important.
dtmfmode=rfc2833 ; you can try inband if you have problems accessing your IVR menus
host=dynamic ; or you may use host= followed by a static IP address, SEE NOTE BELOW
nat=never ; if Sipura is not on your local network you may need nat=yes
port=5061 ; we use port 5061 rather than 5060
secret=XXXXXX ; pick a good password
username=1-pstn ; must match the trunk name or registration may fail.
NOTE: The original author of this page had written that the host setting should be host=dynamic and added the comment "IMPORTANT - use this even if you set the Sipura to use a static IP." However I (wiseoldowl) found that when the Sipura has a static IP address on the same local network, you can set the host= to that address (example: host=192.168.0.250) and it works fine EXCEPT that you will get complaints in your Asterisk log in the form "Peer '1-pstn' is trying to register, but not configured as host=dynamic". If you use the recommended host=dynamic (to avoid the log entries, or because the adapter really is on a dynamically assigned IP address), then you probably should use a fairly short registration interval in the SPA-3000/3102 configuration - see the section below on Sipura 3000/3102 PSTN settings.
7) Incoming settings - User settings
From wiseoldowl: It turns out that these are not needed at all as long as you set the type=friend in the Peer Settings. The original author of this page had placed some settings in this section but I do not believe they were actually being used and in fact may have been causing problems. Other Sipura 3000/3102 configuration pages on the net don't include a User context or User settings so I strongly advise leaving these blank.
8) No Register String is used. Click Submit Changes and remember to click the orange bar to update your system.
FreePBX Outbound Route setup:
You now are ready to setup your outbound routing.
1) Name the route whatever you like. I called my route spa3000; again this is to keep it simple.
2) No password for the route; keep it simple
3) I only want calls to my area code and 911 via this route so under dial pattern I have:
The point here is to use dial patterns that will allow only those calls that you wish to go out via the Sipura - don't just copy the above verbatim!
4) Trunk sequence: I have it going to the trunk associated with the Sipura (SIP/1-pstn) first. Then, to my Voipjet settings.
5) Submit Changes and remember to click the orange bar for the update.
FreePBX Inbound Route setup:
This is easy to set up, but necessary if you want to receive incoming calls!
1) Give the Inbound Route any name you like, such as 1-pstn or spa3000 - it's totally up to you.
2) For DID number, keep it simple and use the phone number associated with the line connected to the Sipura. The most important thing to remember is that this must EXACTLY match the number you put in "Dial Plan 2" while configuring the Sipura, as shown in the instructions below.
3) Skip down to the bottom of the page and set a destination for incoming calls - this can be a particular extension, your IVR, or any destination you like.
4) Submit Changes and remember to click the orange bar for the update.
Skip the other Inbound Route options for now - once you get it working you can come back and make changes if you like
كود: تحديد الكل
Sipura 3000/3102 Device Settings:
Next you need to setup your actual Sipura 3000/3102 PSTN settings.
The person who originally started this page said, "Ok here is where I was playing for 3 days to get this part working. It's strange that when I just removed everything and kept it very simple and logical it started to work just fine." So if possible, start with a Sipura 3000 or Linksys 3102 set to the factory default configuration and go from there, because other than the changes specifically mentioned below you'll probably want the default settings.
To begin the setup, login to the device, click on admin (if prompted, enter "admin" as the username and the password, if you have set one up), and then click on advanced. Some of the following settings may not be visible if you are only logged in as a user, or have not clicked on the advanced link.
Check the RTP Packet Size!!!
VERY IMPORTANT: Before you do anything else, go to the SIP tab. Look under RTP Parameters and check the RTP Packet Size. Linksys has set this to 0.030 by default, which is not correct for use on ulaw (G711u codec) connections. Change it to 0.020 instead (or 0.02 on older Sipura devices). If you don't do this, you may experience strange problems with "choppiness" or random clicks on some calls but not others, and you may also experience problems when playing Asterisk sound files. By the way, this applies to all Linksys/Sipura adapters, not just the SPA-3000/3102.
Next go to the PSTN Line tab - I am only putting what needs to change.
1) Sip settings: Just make sure the SIP Port is set to port 5061 (I did not need to change mine).
2) Proxy and Registration:
Proxy: The numeric IP address of your Asterisk box if both the Sipura and the Asterisk box are on the same local network, or the address of your Asterisk server if it is elsewhere on the Internet.
Make Call Without Reg: Yes
Ans Call Without Reg: Yes
Register Expires: 300 (if Asterisk box is on same local network and you used host=dynamic in the FreePBX Trunk settings), or see discussion in note below
Notes on Proxy and Registration section: Some people have reported that they had to set Make Call Without Reg and Ans Call Without Reg to Yes before things would work - it apparently doesn't hurt anything to change those two settings, and it may save you some grief. Also, if you used host=dynamic in the FreePBX Trunk settings (as discussed above), then you will probably want to make the Register Expires: setting something fairly low, especially if the SPA-3000/3102 is on the same local network as the Asterisk box - for example, Register Expires: 300 would make the unit re-register at five minute intervals, while a setting of 900 would probably be a good choice if the device and the Asterisk Server are not on the same local network. The reason for the shortened timeout is that when you use host=dynamic in the FreePBX Trunk settings, if registration is lost for any reason (such as a server reboot) then the SPA-3000/3102 will be inaccessible until the next time it re-registers. This has led some people to conclude that host=dynamic doesn't work, when in fact it does but is just waiting for the adapter to re-register.
3) Subscriber Information:
Display name: Put something here that will identify this line - this is only displayed on your phones if you get a call with no Caller ID information (or you don't subscribe to Caller ID). Keep it at 15 characters or shorter. You could use something like LOCAL PSTN CALL.
User ID: 1-pstn ; very important - this must exactly match the FreePBX Trunk name and username in the trunk configuration!
Password: XXXXXX (same as you used in FreePBX Trunk settings).
4) Audio Configuration (if you don't see all these settings, you forgot to click on "advanced"):
DTMF Process INFO: Yes
DTMF Process AVT: Yes
DTMF Tx Method: Auto
Note: The DTMF Tx Method is the one you especially need to check if your IVR is not receiving DTMF from your callers reliably. Also, in this section you may want to check to make sure that the Preferred Codec is set to the default G711u (assuming you placed "allow=ulaw" in the FreePBX Trunk configuration as shown above).
5) Dial Plans:
Under Dial Plans it's important not to change the default (xx.) on any except Dial Plan 2. I put it very simple to go to my inbound so FreePBX takes care of my calls:
Replace 1234567890 with the telephone number of the PSTN line coming into the device. Note that this must exactly match the DID number in your FreePBX Inbound Route setting for this device. If the number here and in the Inbound Route don't match exactly, you won't receive incoming calls.
6) VoIP-To-PSTN Gateway Setup:
This is another important settings section.
VoIP-To-PSTN Gateway Enable: yes
VoIP Caller Auth Method: None ; use "None" to start, you can change later for added security (see below).
VoIP PIN Max Retry: 3 ; I did not change this.
One Stage Dialing: Yes ; very important
Line 1 VoIP Caller DP: none
VoIP Caller Default DP: none
Line 1 Fallback DP: none
7) VoIP Users and Passwords (HTTP Authentication):
During the initial setup, leave all of these blank (the drop-downs can be left set to 1). After you get everything working you can revisit this section to add security, as will be discussued later.
8) PSTN-To-VoIP Gateway Setup:
Here is another section that made me pull my hair out.
PSTN-To-VoIP Gateway Enable: Yes
PSTN Caller Auth Method: none
PSTN Ring Thru Line 1: no ; I use Asterisk for my routing.
PSTN Pin Max Retry: 3
PSTN CID for VoIP CID: Yes if you subscribe to CallerID service on your PSTN line, otherwise No
PSTN CID Number Prefix: (Leave Blank)
PSTN Caller Default DP: 2 ; important - here is where it sends the calls to.
Off Hook While Calling VoIP: No
Line 1 Signal Hook Flash To PSTN: Disabled
PSTN CID Name Prefix: (Leave Blank)
Leave everything else in this section blank. We are almost finished now.
9) FXO Timer Values (sec):
Just change 2 items here.
Voip Answer Delay: 0 (The original recommendation was 1, but this can cause a spurious half ring on outgoing calls, before actual ringing from the called line commences, so 0 is now the recommended value).
PSTN Answer Delay: If you do not subscribe to CallerID service on your PSTN line, this can be set to 0. Most users will want to set it to at least 3 so that the incoming CallerID data is captured. In rare situations you may need a slightly longer delay (5 should be more than enough).
10) PSTN Disconnect Detection:
Skip the PSTN Disconnect Detection section unless you know what type of PSTN disconnect signal(s) are used on your PSTN line and wish to change the settings so that those signals (and only those signals) are detected. Generally you should only tweak this section if the Sipura isn't properly detecting disconnected calls on the PSTN side. The "Disconnect Tone" is by default set to detect the "fast busy" signal usually sent after a call has ended in North America - you may wish to tweak this setting if the switch serving your PSTN line sends a different tone after disconnect.
11) International Control
Check the settings here - each country uses different values for PSTN lines. If you live in Australia, Canada, the United States or most other countries with modern telephone systems you probably won't have to change anything except perhaps the gain levels, so we'll only deal with them for now. The default values for both the SPA To PSTN Gain and the PSTN To SPA Gain are 0 (zero), and that's where you should leave them when you're first setting up the SPA-3000/3102. But just so you know, here's some information on those settings:
If the SPA to PSTN gain is set too low, the parties on the PSTN side of the connection will probably complain about your volume being too low, or will ask you to speak up or talk closer to the phone. If it is set too high, however, you are more likely to hear echo, and outgoing calls may fail because the level of DTMF tones sent by the SPA-3000/3102 will be too "hot" to register properly at the PSTN switching equipment.
If the PSTN To SPA Gain is set too low, you'll hear low volume levels on PSTN calls. If it's set too high, the people on the PSTN side of the connection will be more likely to hear echo (they may hear their own voices echoed back from your end). Also, any echo that has been reflected back to you will be heard at a higher volume level, and will therefore be more objectionable.
While the default levels are usually adequate, we found that boosting both values up to 3 produced a more "natural" sounding volume level in both directions. However, this is very much dependent on the characteristics of the PSTN line - if you're on a very short loop, values of 0 may be adequate for both settings, if on a very long loop you may need to go even higher than 3. The valid range is -15 dB to 12 dB in 1 dB increments (but just enter a numeric value, do not enter "dB" in the text field). If you have actual test equipment available you can fine-tune the volume settings for best results.
We'll talk a bit more about settings in this section under "Troubleshooting", below. For now, that's it. Submit and it should register and you should be able to use the PSTN port on the Sipura. Note that if you used host=dynamic in the FreePBX Trunk setting, the adapter may take some time to register, and it will not be accessible until it does (as discussed above). If you're in a hurry, you can power-cycle the adapter to force it to re-register (but make sure that you have first submitted your changes, and that the adapter's web page has refreshed!).