This is the second of four posts:
- Asterisk + Twilio: Motivation (Part I)
- Asterisk + Twilio: The hardware, Cisco SPA3102 and the FXO vs FXS ports (Part II)
- Asterisk + Twilio: Making calls from home to twilio (Part III)
- Asterisk + Twilio: Receiving calls from twilio (Part IV)
I had my Asterisk server handling calls between softphones… but it didn’t really feel like a big achievement. I wanted to connect the server to my home line… but as I couldn’t wait, I took a quick read about the differences about FXS and FXO… and bought an ATA that had 2 FXS ports! when I realised that the FXS ports don’t connect to the line, but to a regular phone device it was too late.
I should have read it in the book, but I did a quick search on google and thought I had figured it out… but I hadn’t. In short:
- An FXO port connects to a phone line from your provider (PSTN or Public switched telephone network)
- An FXS port connects to regular phone, transforming your plain old phone into a VoIP phone
Then, I went ahead and ordered a Cisco SPA3102 on amazon. It’s a “Voice Gateway with Router” that has an FXO and an FXS port… I wanted one with two FXO ports (thought I’d buy a second line and route calls from one line to the other and have free calls from my mobile phone) but I’m glad I bought this one… I can use my wireless phone just as I used to and it can play in the wonderful Asterisk world. If I want to connect two PSTN lines, it still makes sense to buy another Cisco.
Setting up the Cisco SPA3102 wasn’t extremely complex (wasn’t a piece of cake either), the two things that took me the most to figure out was:
- I wanted to have incoming calls automatically reach an extension at Asterisk, but by default it just returns the dial tone to the caller. What I did was, on the PSTN User, set an automatic forward… using caller id * to an extension I want, and that’s how every call is transferred to it. This is how it looks
- The disconnect tone… the calls that came from the phone line were never terminated b/c it didn’t recognise the Uruguayan disconnect tone… I found it on the PSTN Line tab (not in the regional one) and the value for Uruguay is
420@-30,420@-30;2(.2/.2/1,.2/.6/1)I tried looking it up in an ITU document, but it was impossible for me (without any electrical background) to transform the amplitudes and frequencies there to something useful here… so I found it in this forum
Once I figured that out, it was pretty smooth… the next post is about calling from Asterisk to twilio :)