Monday, May 17, 2010

Possible Success?

I've just now been able to make four consecutive calls to John's home number that have gone through to the answering machine, which is certainly a good sign.

Since calls used to wind up with the AT&T (or whatever) lady telling us nicely that
"We're sorry, your call cannot be completed as dialed. Please check the number and dial again." and that we could get some outgoing calls to go through and incoming calls work 100% of the time (as tested so far), I decided that the Asterisk server probably wasn't the problem. I asked on the Asterisk forums which are fairly quiet, but still have a couple people who know what they're talking about frequently giving helpful advice. One of them suggested that it was more than likely some sort of timing issue between the Linksys and the phone company.

Thankfully there aren't many relevant timing settings in the Linksys control panel, so I systematically adjusted one of the 4 or 5 that looked to be likely candidates to see what happened (They're all in the Admin -> Voice -> PSTN Line -> FXO Timer Values section). Neither VoIP Answer Delay or PSTN Answer Delay had any effect, which didn't surprise me because we weren't having issues with answering incoming calls (although I guess I've never tried answering an incoming VoIP call from the Linksys). The PIN timeout settings weren't relevant, and "Ring thru" was not something I'd seen mentioned in any of the guides/webpages I had skimmed researching the problem.

The problem seems to have been that PSTN Dialing Delay , previously set to 1, was not long enough. I don't know what kind of "handshaking" goes on behind the scenes when one tries to connect a PSTN call, but based on the terminology I'd guess that previously Asterisk didn't wait long enough to make the proper connection to the PSTN, perhaps truncating or otherwise corrupting the number in the process and leading to the "We're sorry" message. The setting that is working consistently at the moment is:
PSTN Dialing Delay: 2
Maybe you can try it on your end to see if things are working in Kansas like they are in Virginia?

Friday, May 14, 2010

Still Puzzled....

...as to why Asterisk-to-PSTN calls don't work 3/4 times or so. Haven't found anything conclusive after a couple days of digging.

Monday, May 10, 2010

Asterisk Configuration for SPA3102- Outgoing Calls

In sip.conf I added the "line1" user. Note that this could be whatever you want, but you'd have to change the Linksys configuration.
[line1]
type=friend
host=[IP addr of Linksys]
username=line1
secret=[password]
dtmfmode=rfc2833
context=outbound-local
insecure=port,invite
disallow=all
allow=ulaw
nat=yes
qualify=yes
port=5061
I mentioned a bit earlier that I was getting warnings and errors in the console about registering. The error message was pretty straightforward:
[May 10 19:36:08] NOTICE[23761]: chan_sip.c:21538 handle_request_register: Registration from 'line1 ' failed for '[Linksys IP]' - Peer is not supposed to register
[May 10 19:36:12] ERROR[23761]: chan_sip.c:13010 register_verify: Peer 'line1' is trying to register, but not configured as host=dynamic
Obviously the error was due to the "host" attribute not being dynamic. For some reason calling out didn't work if the host was dynamic and I'm not exactly sure why. To clean up the console I just turned off registration for this particular peer.

In extensions.conf I created a new context:
[outbound-local]
exten => _9XXXXXXX,1,Dial(SIP/${EXTEN:1}@line1,25)
This matches any 8-digit pattern in which the first digit is 9 (patterns are prefaced with an underscore). The ${EXTEN:1} variable passes the number dialed to the trunk, and the ":1" strips off the 9. Sadly this is what took me so long to figure out, and I'm still confused about the syntax of the above "Dial" application, which seems different from what's in the book. Maybe it's a version issue?

Linksys SPA3102 Modified Configuration- Outgoing Calls

I can't remember if I covered this in the post showing the config for the PSTN Line incoming calls, but this is all on the "Line 1" tab in the Linksys Advanced Admin Tab.

-> Line Enable: yes

-> NAT Settings
NAT Mapping Enable: no
NAT Keep Alive Enable: no
-> SIP Settings
SIP Transport: UDP
SIP Port: 5060
-> Proxy and Registration
Proxy: [IP address of Asterisk server]
Use Outbound Proxy: no
Register: no
Make Call Without Reg: yes
Ans Call Without Reg: yes
-> Subscriber Information
Display Name: line1 [ /whatever you want]
User ID: line1
Password: [choose a password]
-> Dial Plan
Dial Plan: (*xx|[3469]11|0|00|[2-9]xxxxxxxxxS0|1xxx[2-9]xxxxxxS0) [this is the default]

Local Calls Success

After several days of treading water, I finally was able to make a local call from XLite to John's house (I didn't leave a message, sorry). In theory I believe anyone should be able to make calls in your area code from XLite, and the dialplan won't recognize numbers longer than 7 digits.

To "dial out", preface the local number with "9" (this could be changed to whatever we want). In XLite (and apparently in most VoIP phones) the dial tone doesn't "pause" like it would on a touchtone phone... probably because there's no dial tone to begin with. The leading 9 is stripped off when Asterisk passes the string to the Linksys. So for example, if the local number was 1234567 you'd enter 91234567 in XLite.

Technical details will be coming soon, as soon as I can figure out exactly how many circles I went in to eliminate me writing the same thing multiple times.

EDIT #1: It takes a few seconds for the PSTN line to start ringing.

EDIT #2: For some reason a flurry of error messages pop up in the console because I had to assign a static IP for the outgoing line's host. Not sure how to get around this at the moment.

Edit #3: Now I get a "We're sorry, the call cannot be completed as dialed" message ...

Edit #4: ...but it connects when I call Sarah? Strange. Maybe you can try it out and let me know how it goes.

Tuesday, May 4, 2010

Dialing Out from Asterisk- Local Calls

I think I've set up the system so that one can dial out to a local phone number from XLite. Put "9" before the 7-digit number and see if it connects. The pattern-matching line I have in there now disallows numbers longer than 7 digits.

(911 should work too, but maybe don't test that one out)

edit: never mind, doesn't work.

Asterisk Configuration for SPA3102- Incoming Calls

Two files needed to be modified for the PSTN-to-Asterisk connection.

I added the user "pstn" to /etc/asterisk/sip.conf
[pstn]
type=friend
host=dynamic
secret=*******
dtmfmode=rfc2833
context=pstn
insecure=very
nat=yes
qualify=yes
To forward an incoming call to my Asterisk extension, I created a new "pstn" context in /etc/asterisk/extensions.conf
[pstn]
exten => 1000,1,Dial(SIP/1000)