SPA3102 and FreePBX HOWTO
The target configuration
The target configuration for this HOWTO is an SPA3102 connected to the same LAN as the PBX, or at least a routed but non-NATted situation(we use this same configuration for an SPA3102 across a VPN). The SPA3102 will be connected to the LAN through the 'INTERNET' port, and to the PSTN through the 'LINE' port. Setting up the phone port is very easy, and you should look for another tutorial for this. If you decide to use the 'ETHERNET' port for something, that's fine, but you're on your own there too.
Why another howto?
Why another howto for getting the SPA3102 to play with FreePBX? Because the howtos I've seen just don't work for me. There was one I found once, actually, that was excellent: It walked you through steps, just as any other howto would, but broke it up into separate sections where the user would complete a set of steps and then do some tests to make sure that particular functionality was working before moving on. That works well for a user who's not an expert, but wants to narrow down what he has to debug at each step. I tried to follow this approach here. Suggestions welcome!
Audience
I'm quite familiar with UNIX, so it's natural for me to ssh in and run commands at the shell or to edit files. I'm not as familiar with VOIP, but I like to learn. If you know a little UNIX, and you're trying to learn about VOIP, then maybe this tutorial is for you! If you really prefer a cookbook recipe for how to do this and will rely on community support when things go wrong, another author, wiseoldowl on freepbx.org, recommends his excellent HOWTO to you.
I also assume you have a working FreePBX installed, and have set up an extension before, and generally know your way about the menus.
Quick links
SPA3102 IVR configuration menu documentation
Sipura dial plan documentation
ATA Administration Guide This 250 page manual covers several devices. It has a whole section on configuring the SPA3102 FXO port.
3am Systems' World PSTN Tone Database has disconnect (and other) tones from many countries. The raw information is available for free, and you can get the information in Asterisk and Sipura format, ready for cut and paste, if you register, which is free of charge, but requires you submit some information about yourself.
Another source for tone information is the International Telecommunication Union, who publish a PDF on this page: "VARIOUS TONES USED IN NATIONAL NETWORKS".
There's a giant thread about disconnect tones here on the Voxilla forums; the basic formula they supply is "f1@-30,f2@-30;n(t1/t2/1+2)", where f1/f2=frequencies in HZ (the same if only one tone), n=number of repetitions of the pattern, t1=seconds of frequency, t2=seconds of silence.
wiseoldowl's HOWTO on freepbx.org contains additional configuration options that you should consult after getting the basic setup working here. His has additional information about adjusting gain levels and other settings that might cause problems.
Planning
You'll need to have/decide the following things:
- FreePBX's IP address; in this example, 192.168.7.6
- SPA3102's IP address; in this example, 192.168.7.50
- DNS names work in place of IP addresses, if desired
- Make up a user name and password for the trunk; in this example, 'pstn' and 'pstnpass'
- Choose an extension number and password for Line 1; in this example, '100' and 'line1pass'
Before you start
Before anything, you'll have to get the SPA3102 actually on your network.
- The SPA3102 should already be powered on with 'LINE', 'PHONE', and 'INTERNET' ports connected. The 'INTERNET' port should be plugged into your LAN.
- Reset the SPA3102 to factory default for good measure, since this tutorial depends on default settings being untouched. With the handset, dial '****', and wait for the IVR to begin. Dial '73738#' ('RESET#'), and '1' to confirm.
- Temporarily connect your workstation's NIC directly to the SPA3102's 'ETHERNET' port. Your workstation should grab an IP address from the SPA3102. Navigate to http://192.168.0.1/admin/advanced and use the username 'admin', password 'admin'. If you didn't get to your adapter's configuration page, check your network settings to be sure your NIC has an IP address on the 192.168.0.x subnet.
- Now's a good chance to update the firmware. As of 2008/11, the latest is 5.1.7, and these instructions are written for that firmware.
- Choose a static IP for the adapter on your LAN. Go to the "Wan Setup" tab.
- In "Internet Connection Settings" select "Connection Type" "Static IP".
- In "Static IP Settings" enter the static IP, the netmask, and the gateway. In this example, we'll choose '192.168.7.50'.
- In "Remote Management" select "Enable WAN Web Server" "yes".
- Leave other settings as is, and click "Submit All Changes".
- Connect your workstation's NIC back to your LAN. You can leave the SPA3102's 'ETHERNET' port unplugged from now on. You should be able to visit the adaptor's configuration page through the 'INTERNET' port through this URL (change the IP to match the one you chose): http://192.168.7.50/admin/advanced
- If this didn't work, go back and check your configuration. The IVR may be helpful to find out what's going on too; see the IVR link in the 'Quick Links' section above.
- Make sure you know how to log into your FreePBX system and get to the Asterisk command line with
bash-3.1# asterisk -vvvr [...] bell*CLI>
Set up syslog on your PBX
Syslog is a handy way to debug the SPA3102.
- On the SPA3102 configuration page, 'Voice' tab, 'System' subtab,
- Set the 'Syslog Server' and 'Debug Server' to the IP of your
FreePBX, 192.168.7.6 in this example. - Set 'Debug Level' to 2 or higher.
- Set the 'Syslog Server' and 'Debug Server' to the IP of your
- On your FreePBX host,
- Append the following to /etc/syslog.conf:
# save messages from SPA3102 local2.debug,local3.debug /var/log/spa3102.log
- Add a '-r' to the syslogd command line. On CentOS (incl. Trixbox), edit /etc/sysconfig/syslogd, and edit this line:
SYSLOGD_OPTIONS="-m 0 -r"
- Restart syslogd; on CentOS (incl. Trixbox):
bash-3.1# service syslog restart
- Make sure syslogd is listening on UDP 514:
bash-3.1# netstat -ulnp | grep 514 udp 0 0 0.0.0.0:514 0.0.0.0:* 1064/syslogd
- Watch the log:
bash-3.1# tail -f /var/log/spa3102.log &
- Append the following to /etc/syslog.conf:
Set up line 1
You'll need line 1 working for testing. If you already have another extension set up that you'd rather use, then skip this section.
- In FreePBX, add a SIP extension.
- Set the extension number, '100' in this example.
- Set a password, 'line1pass' in this example.
- You can configure the Display Name, Voicemail, etc. now if desired.
- "Submit" and "Apply Configuration Changes".
- On the SPA3102, navigate to the 'Voice' tab, 'Line 1' sub-tab.
- Under "Proxy and Registration", set "Proxy" to your FreePBX's IP, 192.168.7.6. Also set both "Make Call Without Reg" and "Ans Call Without Reg" to Yes.
- Under "Subscriber Information" enter the extension number '100' as "User ID" and password 'line1pass' as "Password".
- Under "Dial Plan", set the "Dial Plan" to "([*x]x.)". This routes every number that begins with '*' or '0'-'9' to the PBX. See the dial plan documentation link in 'Quick Links' above.
- Click "Submit All Changes"
- Under "Proxy and Registration", set "Proxy" to your FreePBX's IP, 192.168.7.6. Also set both "Make Call Without Reg" and "Ans Call Without Reg" to Yes.
- Still under the 'Voice' tab, navigate to the 'Regional' tab, and clear out all the *XX entries under 'Vertical Service Activation Codes'. With these in place, the feature codes will be intercepted by the SPA3102 and never make it to the PBX.
- At the asterisk prompt now, verify that the SPA3102 has registered using
bell*CLI> sip show peers Name/username Host Dyn Nat ACL Port Status [...] 100/100 192.168.7.50 D N 5060 OK (15 ms) 5 sip peers [Monitored: 4 online, 1 offline Unmonitored: 0 online, 0 offline]
- Try dialing an extension to make sure it's really working. If you set up voicemail, you can dial *97 to test.
- If you don't see the extension registered or can't dial the PBX, check your settings and get this working before going on.
Configure the PSTN
Next step, the hard part, and the main goal of this tutorial: Configure the FXO port of the SPA3102.
Configure outgoing calls
We'll configure outgoing calls first.
- In FreePBX, configure a new SIP trunk.
- Set the 'Trunk Name', in this example, 'pstn'. This is the trunk user name you chose in the 'Planning' section above.
- Set 'Maximum Channels' to '1', since there is only one PSTN line.
- Set the 'PEER Details' as follows (you can leave out comments preceded by ';'):
canreinvite=no context=from-pstn host=192.168.7.50 nat=no port=5061 user=pstn ; set the same user name as the trunk user name secret=pstnpass type=friend qualify=yes dtmfmode=rfc2833
- Set your "Dial Rules" if you like, or just leave blank.
- Click "Submit Changes", and "Apply Configuration Changes".
- On the SPA3102 "Voice" tab, "PSTN Line" subtab,
- Under "Proxy and Registration",
- Set the "Proxy" to FreePBX's IP address
- Set "Make Call Without Reg" and "Ans Call Without Reg" to Yes
- Under "Subscriber Information", set "User ID" to the FreePBX 'Trunk Name' above, 'pstn', and the 'Password' to the FreePBX trunk's 'secret', 'pstnpass'.
- Click "Submit All Changes"
- Check the Asterisk command line and make sure the SPA3102 has registered:
bell*CLI> sip show peers Name/username Host Dyn Nat ACL Port Status [...] pstn/pstn 192.168.7.50 D 5061 OK (7 ms) 100/100 192.168.7.50 D N 5060 OK (7 ms) 5 sip peers [Monitored: 4 online, 1 offline Unmonitored: 0 online, 0 offline]
- If you don't see the 'pstn/pstn' registration, go back and check your settings.
- Back in FreePBX, create a new Outbound Route.
- Set the route name, perhaps to 'pstn' or something more specific.
- Set the 'Dial Patterns', using the wizard, or creating your own custom patterns.
- Set the 'Trunk Sequence' to your new trunk, 'SIP/pstn'.
- Click 'Submit Changes' and "Apply Configuration Changes".
- Try making an outgoing PSTN call. If it doesn't work, check the output at the Asterisk command line and the Syslog.
- Under "Proxy and Registration",
Configure incoming calls
- On the SPA3102 'Voice' Tab, 'PSTN Line' again,
- Scroll down to the 'PSTN-To-VoIP Gateway Setup' section.
- Set 'PSTN Ring Thru Line 1' to No
- Set 'PSTN Caller Default DP' to 2
- Scroll back up to 'Dial Plans', and set 'Dial Plan 2' to 'S0(<:01082113130>)', replacing '01082113130' with your inbound DID number. This routes all incoming calls to 01082113130@pbx.ip.ad.dr. See the dial plan documentation link in 'Quick Links' above.
- Scroll down to the 'PSTN-To-VoIP Gateway Setup' section.
- On the FreePBX page, add an inbound route:
- 'Description' could be 'pstn'
- 'DID Number' should be exactly the same as the DID in your 'Dial Plan 2', '01082113130' in the example
- Scroll down to 'Set Destination' and set to extension '<100>' for now so we can test.
- Call your PSTN DID from your cell, and cross your fingers that extension 100 rings!
- If it didn't ring, look at the Asterisk command line output, along with the syslog.
Other configuration
The following configurations are recommended, and the first and second should be considered mandatory.
- On the SPA3102 'Voice' tab, 'Sip' subtab, 'RTP Parameters' section, set 'RTP Packet Size' to '0.020' instead; check here for a discussion on this.
- Change the SPA3102's user and admin passwords in the 'Voice' tab, 'System' sub-tab.
- Add dialing rules for the trunk, if desired.
- China: disconnect?
- SPA3102, 'Voice', 'PSTN Line':
- 'Subscriber Information' section, set 'Display Name' to something like 'LOCAL PSTN CALL' to send this string as caller ID when no caller ID is provided by the PSTN.
- PSTN-To-VoIP Gateway Setup', set 'PSTN CID For VoIP CID' to Yes to support caller ID
- 'FXO Timer Values (sec)' section, set 'VoIP Answer Delay' to between 2 and 5 to give the caller ID signal a chance to come through
- 'PSTN Disconnect Detection' section, set 'Disconnect Tone' if you're not in the US, and the SPA3102 has difficulty detecting when the PSTN caller has hung up. See the 3am Systems link in the 'Quick Links' section above. In China, set the string to
450@-45,450@-45;4(0.35/0.35/1+2)
- SPA3102, 'Router', 'WAN Setup':
- Add a hostname and domain information. Why? Because it's cool.
- Add DNS information, especially if the WAN connection type is set to 'Static IP' rather than 'DHCP'.
- Add NTP servers so that the time is always synchronized. See http://www.pool.ntp.org/ for a list of servers in your region. DNS must be configured for this to work.
Troubleshooting and Debugging
I had all kinds of trouble getting this to work, even though it's a fairly simple setup. As all the other guides will tell you, it's best if you can start from defaults: clear out your trunk and in/outbound route definitions, reset the SPA3102 to factory defaults, and start from scratch, only changing the minimum number of settings. You can enable the fancier settings later on, but they really can mess you up if you try setting them too early without an initial working configuration.
After writing the main part of this article, I then went to repeat these instructions for a remote Sipura at the office. Outgoing calls worked fine, but incoming calls wouldn't pick up. I went through and checked all the SPA3102 settings very carefully, over and over, but nothing helped. Finally I went to the Asterisk side and did some SIP debugging over there. After a few hours of tracing the FreePBX dialplans and comparing them to my home setup, well, it turned out the difference was that I'd turned on NVFAX fax detection early on when I created the inbound route, and forgot all about it. This is an example of why you should keep it vanilla until you have a working configuration.
The way to debug is to log onto your Asterisk box, and use the Asterisk commandline:
bash-3.1# asterisk -vvvr Asterisk 1.4.20-1 RPM by vc-rpms@voipconsulting.nl, Copyright (C) 1999 - 2008 Digium, Inc. and others. [...] bell*CLI>
Enable SIP debugging for your SPA3102:
bell*CLI> sip show peers sip show peers Name/username Host Dyn Nat ACL Port Status pstn/pstn 192.168.7.50 5061 OK (11 ms) 100/100 192.168.7.50 D N 5060 OK (7 ms) [...] 4 sip peers [Monitored: 4 online, 0 offline Unmonitored: 0 online, 0 offline] bell*CLI> sip set debug peer pstn sip set debug peer pstn SIP Debugging Enabled for IP: 192.168.7.50:5061 bell*CLI>
In this script trace, we listed all peers using the 'sip show peers' command, where we saw
our trunk, 'pstn'. Then we enabled SIP packet tracing with 'sip set debug peer pstn'. This causes all SIP packets to be dumped out on the commandline. There may be copious output, so make sure the scrollback on your terminal software is set large enough to capture everything you need.
To stop the debugging, use 'sip set debug off'. The way I debug is to get everything ready to test, then turn on debugging the very moment before I initiate the call. Once the call fails, I then quickly turn off debugging so that all of the output is relevant.
A typical SIP session goes as follows. I will show the trace from a PSTN to VOIP call, with the SPA3102 initiating:
- SPA->*: INVITE sip:01082113130@192.168.7.6 SIP/2.0
- The Sipura 'invites' Asterisk to initiate a call.
- sip:01082113130@192.168.7.6 is the SIP URL on the asterisk side; the 010...3130 is matched with the 'DID' on the incoming route.
- Asterisk should output a message like "Found peer 'pstn'" that shows it recognizes the Sipura.
- *->SPA: SIP/2.0 407 Proxy Authentication Required
- This is only if you have passwords configured. I think. I set up two indentical Sipura and FreePBX configurations, but one was Trixbox (Asterisk 1.4), the other PIAF (Asterisk 1.6). Trixbox asks for Proxy Authentication, but PIAF doesn't. I don't know why, yet.
- SPA->*: ACK sip:01082113130@192.168.7.6 SIP/2.0
- The Sipura acknowledges the '407 Proxy Auth Required' message.
- SPA->*: INVITE sip:01082113130@192.168.7.6 SIP/2.0
- The Sipura sends a new invite; this time, there is a 'Proxy-Authorization' header with a username and MD5 password digest.
- Again, Asterisk should output "Found peer 'pstn'"
- It will also print some information about audio codecs, RTP ports, etc.
- *->SPA: SIP/2.0 100 Trying
- If Asterisk didn't send a 407 Proxy Auth Required, this would have been next after the Sipura's initial INVITE message.
- Asterisk notifies the Sipura that it is attempting to establish the call.
- At this point, you should see the normal Asterisk dialplan tracing going on; you can follow along in your files if the problem lies here.
- Asterisk prints out: "Executing [s@ivr-4:7] Answer [...] in new stack"; everything checks out, and it will begin the call.
- *->SPA: SIP/2.0 200 OK
- Asterisk sends an 'OK' along with some data about its own RTP stream.
- SPA->*: ACK sip:01082113130@192.168.7.6 SIP/2.0
- The Sipura acknowledges the OK message.
- At this point, Asterisk and the Sipura have finished setting up the call, and should be exchanging voice data via the negotiated RTP stream.
If you have enabled Sipura debugging through your syslog, you should be able to see an abbreviated version of the Sipura's status.
And that's the basics for debugging. Call set up should go through this basic sequence, which is actually pretty simple, despite the large amount of output. Google is your friend here when deciphering deviations from this sequence.
Hi,
This tutorial is great and having followed it, my system is working with one small issue! When I call my DDI from the mobile phone, I get the ringing tone on the mobile but its about 6rings before the phone on extension 100 starts ringing - any ideas? As an aside, it then stops ringing and I get 3 beeps but i i think thats the Sipura answering so I should be able to turn that off.
Is there any way with the dial plans to still by-pass the Voip and which to PSTN when calling from the phone? I want to be able to make it easy if the Asterisk box fails.
Thanks again for the great tutorial!
Tim
Hi Tim, glad you got your SPA3102 working. It can be tricky sometimes!
One setting you might look at is “PSTN Answer Delay” in the “FXO Timer Values” section under the “PSTN Line” tab; mine’s set to 3 seconds. I seem to recall it was set to 15 seconds by the factory, but my memory’s flakey.
You should be able to set the Line 1 dial plan to always dial straight out the PSTN line. This may not be necessary though; check the “Line 1″ tab in the “VoIP Fallback To PSTN” section, and set “Auto PSTN Fallback” to yes. You should find that if Asterisk is unavailable, calls will be routed out through the PSTN.
Hope this helps.
Hi
Thanks for the help. I got the answer delay sorted, but unfortunately the VoIP fall back didnt work. Managed to fix that with the dialplan though…
I hope you dont mind, but I have another question! Everything works great now, with the exception of one thing. When calling in via the PSTN, the call does ring extension 100. I actually set up a ring group to ring Exten100, and then Exten100 and 101, etc… However as soon as Exten 101 starts ringing, the calls drops back and I hear “beep beep beep” and then silence and then the beeps repeated. This happens even if I just have exten 100 ring though.
To me this sounds like the Sipura asking for the PSTN - to - VoIP pin, but I cant understand why. I have used your configuration above and aside from that, the VoIP part of the call (through tho the asterisk) has already happened….
Im really confused and any advice would be appreciated.
Thanks
Tim
Hi Tim. The dialplan might be a more elegant solution to PSTN fallback. If you do it right, you should be able to dial internal extensions through your PBX as well as outside numbers through the trunk.
Your new problem doesn’t ring a bell (pun unintended), but you should watch your asterisk console and your syslog to see whether the beeps are coming from the Asterisk side or the Sipura side. Also, you might try setting up X-lite or another softphone on extension 102 to see whether you get the same beeps dialing ext. 100 directly, which would point to Asterisk being the problem.
If you narrow it down to the Sipura, I’d be happy to share my configs with you so you can compare with a fine-toothed comb.
Good luck!
Eurika
Tim I was beginning to think this couldn’t be done.
Thank-you!
Thank-you!
Thank-you!
jman
Can you help me please!
I have followed your set up and all works excellent except….
All I get for CID from external callers is my sip trunk name (pstn)
Any help would be appreciated
Timinator,
I’m glad your setup is nearly working.
In the “PSTN-To-VoIP Gateway Setup”, try setting “PSTN CID for VoIP CID” to yes.
I don’t have CallerID here, so please let me know if this works for you, and I’ll change my HOWTO.
If you have any more suggestions for how this could have been more useful to you, let me know!
jman,
Tried that and tried that again. Didn’t work.
My linksys spa3102 does show the proper info on the info page, it just doesn’t seem to get to or through trixbox to the extensions (soft or hard)
Timinator,
Sorry for the delay, we’ve been on holiday for the Chinese Spring Festival. Happy Niu (Ox) Year!
I don’t know what the problem with your CallerID is, but here are things to check:
Is the spa3102 receiving the CallerID correctly? Check the Voice/Info tab, PSTN Line Status, “Last PSTN Caller” should show the CallerID of the last PSTN caller. The spa3102 syslog file also has this information.
Is the spa3102 sending CallerID, and is asterisk receiving it? As in the “Troubleshooting and Debugging” section above, enable SIP debugging for the spa3102, and phone in from outside. The third SIP packet or so should be a “101 INVITE” packet, with a header like this:
From: CHINA PSTN <sip:15810548686@192.168.3.19>;tag=40a064a83b5e0d94o1The number “15810548686″ is the CallerID number, and the “CHINA PSTN” is the CallerID name (we don’t have CallerID name in China, so this default comes from the config above in “Other configuration”, 5.1).
Be sure you’ve done the configurations above in “Other configuration”, 5.1 through 5.3.
Get back when you’ve tried these and let me know what you’ve found.
Hi jman,
Happy Belated Niu Year!
I followed your instructions and everything appears to be working, but I get a busy signal after I dial out.
Do you know how to interpret debug messages from the Sipura?
Feb 12 16:15:07 sipura [1:0]AUD ALLOC CALL (port=16400)
Feb 12 16:15:07 sipura [1:0]RTP Rx Up
Feb 12 16:15:07 sipura AUD:Stop PSTN Tone
Feb 12 16:15:07 sipura CC:Connected
Feb 12 16:15:07 sipura AUD:Stop PSTN Tone
Feb 12 16:15:07 sipura [1:0]ENC INIT 0
Feb 12 16:15:07 sipura [1:0]RTP Tx Up (pt=0->c0a87b48:17622)
Feb 12 16:15:08 sipura [1:0]RTCP Tx Up
Feb 12 16:15:08 sipura FXO:Stop CNDD
Feb 12 16:15:08 sipura [1:0]RTP Rx 1st PKT @16400(2)
Feb 12 16:15:08 sipura [1:0]DEC INIT 0
Feb 12 16:15:08 sipura FXO:CPC
Feb 12 16:15:08 sipura AUD:Stop PSTN Tone
Feb 12 16:15:08 sipura FXO:Stop CNDD
Feb 12 16:15:08 sipura AUD:Stop PSTN Tone
Feb 12 16:15:08 sipura [1:0]AUD Rel Call
Feb 12 16:15:08 sipura DLG Terminated 2b60d8
Feb 12 16:15:09 sipura Sess Terminated
Feb 12 16:15:40 sipura CC:Clean Up
Thanks in advance.
BTW, are you near the CCTV HQ?
Hi David, Happy Niu Year yourself! I’m in Wudaokou, not so near CCTV, but not so far. Are you thinking of the fireworks disaster? That’s a pretty inauspicious event for the New Year. Are you in Beijing?
These logs don’t tell me much. It looks like the RTP session is being established, but it doesn’t give much information about the call setup. Do you have the output from asterisk -vvvr as well? That’s probably the place to start, since it’ll tell you how the call’s being routed, and the reason (though probably not verbosely enough) for the call’s termination.
There’s also information on the SPA3102’s Voice Info tab about the last calls made and disconnect reason, so take a look there.
Hi jman,
I am writing from Los Angeles. I would love to visit Beijing some day. Yeah, I was thinking of the fireworks disaster. What a shame.
The log shows the following (hope there’s enough detail):
Asterisk: INVITE sip:18665551212@192.168.123.247:5061 SIP/2.0
Sipura: SIP/2.0 100 Trying
Sipura: SIP/2.0 180 Ringing
Sipura: SIP/2.0 200 OK
Asterisk: ACK sip:18665551212@192.168.123.247:5061 SIP/2.0
Sipura: BYE sip:310XXXXXXX@192.168.123.72 SIP/2.0
Asterisk: SIP/2.0 200 OK
On the SPA3102, “Last PSTN Disconnect Reason” is CPC Signal.
Hi David, Beijing is a great place to visit if you’re seeking a crazy adventure rather than relaxation and comfort. I recommend it highly if you like the former style of vacation.
It looks like the Sipura is successfully routing the call to the PSTN, but then hanging up. Do you have a phone line splitter that you could listen in with a handset to confirm the Sipura is actually picking up the phone line? Anyway, it appears the hangup is because it’s detecting a CPC signal. This could be a false positive. Try going to the Voice/PSTN Line tab, PSTN Disconnect Detection section, and set Detect CPC to No. I’m just guessing here, since I don’t have this problem.
Good luck!
David, while avoiding what I ought to be doing, and browsing around about the CPC problem instead, I found a paragraph here that might describe your problem:
If the “Detect CPC” setting works for you, you might try re-enabling it and playing with the “Min CPC Duration” option, since CPC, if you phone line supports it, can help the Sipura tell if other side of the PSTN phone call has hung up.
jman,
Didn’t have time to play with the “Detect CPC” setting until now. That certainly did the trick, I can dial out from my PSTN line now! Will try playing with “Min CPC Duration” and report my findings here. Thank you so much!
Will buy you a beer next time I am in Beijing, hopefully, within the next few years :) I travelled for a couple weeks in the Hua Dong area a couple years ago. Can’t wait to go back.
You should blog about your life in Beijing, I am sure a lot of people would be interested.
Thanks again!
jman,
Bumping the “Min CPC Duration” value from 0.2 to 0.3 worked intermittently, so I settled on 0.5 just in case.
David, Hua Dong means Shanghai, Nanjing, Zhejiang, etc. areas? I’ve spent some time in Suzhou, which has a nice, relaxed atmosphere, in some ways like Austin, my hometown. Can’t wait to go back.
Glad the CPC settings worked for you. If you verify that incoming callers hanging up on your voicemail don’t leave long recordings of busy signal tones, then you’re home free. Enjoy!
Awsome tutorial!! it worked for me.
jman, Awesome documentation. I had my AsteriskNOW 1.5 up and running from start to finish in under 1.5 hours. (I’m pretty methodical otherwise it would have been faster!) In any case, now that I can do both inbound and outbound pstn calls I’d like to be able to send all pstn calls to an unattended distribution with both the analog phone and soft ip phones being possible destinations. Is there a doc on this, or is this pretty straight forward. Thanks for you help in advance. JC
Hi, JC, glad it worked for you, but AsteriskNOW, you say? I’m a little confused; these instructions are for CentOS + FreePBX, which is similar to AsteriskNOW, but different.
By ‘unattended distribution’, do you mean an IVR, where the caller is greeted with a recording, and the option to dial your extensions? Just make sure the IVR and recordings modules are enabled, record your greeting, and create an IVR for it. You can set the incoming route’s destination to the IVR. Check the FreePBX docs.
Good luck!
Under Configuring incoming calls, the dial paln statement:
“2. Scroll back up to ‘Dial Plans’, and set ‘Dial Plan 2′ to ‘S0()’, replacing ‘5551212′ with your inbound DID number. This routes all incoming calls to 5551212@pbx.ip.ad.dr. See the dial plan documentation link in ‘Quick Links’ above.”
Should that be ‘(S0)’, where XXX is the US area code and 5551212 is your seven digit number? I’m a little confused here.
Also, if the phone service is thru a VOIP provider, how should the tutorial change to incorporate the SIP credentials from the VOIP provider. I have the PSTN (POTS) line working fine, but cannot get the VOIP connect to the PBX. Any help will be welcome.
DaveNovice,
Sorry for the confusion. I fixed the instructions; I have my Beijing phone number in there, and didn’t finish my attempt at removing real numbers. Anyway, check again, everything should be consistent, and make a little more sense now.
As for your VOIP provider, there’s a lot of documentation out there for this, and different providers are different. Here’s my incoming trunk for Vitelity:
Trunk name:
vit-inPeer details:
type=friend
username=myusername
secret=mypassword
context=from-trunk
insecure=very
canreinvite=no
host=inbound2.vitelity.net
disallow=all
allow=ulaw
qualify=yes
Register String:
myusername:mypassword@inbound2.vitelity.net:5060Vitelity requires separate trunks for incoming and outgoing (because different hosts); other companies only need one for both incoming and outgoing. Check your provider (many have asterisk@home/FreePBX sample setups) and the FreePBX forums for samples customized for your provider.
Good luck!
Is there a way to Avoid the call origination, like it established the full call with SPA3102 rather then wainting for the dialed party to pickup.
Is there any configuration to skip the call establishing before call establish on PSTN, like we do in X100 call never establish unless dialed party picks the Fone.
Thanks in advance.
Many thanks for you guide, it worked perfectly for me, and really good you covered every part of the spa3102 configuration.
Great Work!!!
Daniele
[...] guida la trovate a questo link: Guida, e devo veramente ringraziare l’autore del post/proprietario del [...]
Thanks for the CPC (Calling Party Control) discussion. I had the same error when using my PSTN line (in Beijing)… changed the setting to 0.5 and problem solved. I can now use the PSTN line as intended. Thanks.
These are byfar the best instructions on how to implement the SPA3102 with Asterisk. I had actually given up trying to make all components work. Every instructions out there seem to work but could not provide a complete solution i.e. (Inbound, Outbound and FXS) to work all together. Had a down day at work so I reset my device as instructed and everything is working well. I’m so happy, takes a lot to make this nerd happy.
Thank you so much!!! You are the man!!!
¿has anybody answered this comment from Dieno? (see below) The SPA3102 sends the 200 OK SIP message before the called party picks up the phone. Even, it sends this message before off hook the PSTN Line. ¿is there any parameter to configure in SPA3102 to delay the 200 OK SIP message until the called party picks up the phone? I’ve heard GRANDSTREAM ATA alows it.
Is there a way to Avoid the call origination, like it established the full call with SPA3102 rather then wainting for the dialed party to pickup.
Is there any configuration to skip the call establishing before call establish on PSTN, like we do in X100 call never establish unless dialed party picks the Fone.
Thanks in advance.
I’m sorry Albert, I’m not aware that the SPA3102 has this capability. As far as I know, POTS doesn’t have special signaling for when the called party picks up. Please correct me if I’m wrong. If this is true, then the Grandstream must listen for the ringing tone, clicks, or voice frequencies, which is non-standard and likely to be unreliable.
If you find a solution, let me know. This is a good reason to go with a VOIP service or a digital line, if you’re in an area where this is feasible and it is not cost prohibitive.