Integrating SSGWPE 3.2 to FreePBX
With SSGWPE 3.2, there is a seamless integration of the gateway to FreePBX as a SIP trunk. These are the steps to setting this up.
Installation of FreePBX with Asterisk
- You can skip this step if you already have FreePBX running on a computer somewhere. If not, then first do a fresh installation of Ubuntu 10.04. You can download a CD of this for the installation from here.
- Once you have Ubuntu 10.04 running, there is a script, found under this article, that can be used to set up FreePBX and Asterisk. Though the script is for Ubuntu 9.10, I think it should apply also for 10.04. Only use the second script. There are a few flaws with the first script. Do read the full article to make sure you comply to some of the security issues.
- With 10.04 some php functions have been deprecated, so you need to make some corrections to the FreePBX codes. This is easily done. Read the errors, go to the FreePBX codes and modify appropriately. For example, split can be replaced by explode and so on.
Configure SSGWPE Trunk via FreePBX
- Point your browser to the FreePBX web admin page.
- Click “Setup->Trunks->Add SIP Trunk”. Enter :
- Trunk Description: ssgwpe
- Maximum Channels: 1
- Outgoing Settings->TrunkName: ssgwpe
- Outgoing Settings->PEER Details:
- username=ssgwpe
- type=friend
- secret=password
- host=dynamic
These username and secret values should correspond to the values entered under “SIP” tab for the ssgwpe configuration.
- Do nothing for Incoming Settings.
Configure Outbound Route Through This Trunk
- Click “Setup->Outbound Routes->Add Route”. Enter:
- Route Name: Skype
- Dial Patterns: 70|.
- Trunk Sequence: SIP/ssgwpe
Once this is configured, you should then be able to call a Skype user from a SIP client (like XLite) by dialing 70 follow by the destination Skype ID. This is neat. The destination Skype address could also be a trunk into another PBX. This then facilitates inter PBX communication. A side benefit to using XLite is that it supports recording of conversations which means you now have a means to record your Skype conversations. Asterisk allows dial patterns that detect non numeric characters which means the preceding 70 can be replaced with more appropriate patterns. However, this cannot be done because of FreePBX limitation. You can choose to modify FreePBX if you know what you are doing. Configure Inbound Routes Through This Trunk Here we shall configure 4 incoming routes from the trunk. They are:
- skype2ivr which supports incoming calls from Skype to IVR of PBX,
- skype2disa which supports incoming calls from Skype to DISA service,
- skype2echo which supports incoming calls from Skype to echotest service and
- skype2ext which supports incoming calls from Skype to a SIP extension.
Once you get the idea, you can customize your own incoming routes. The names of the routes can then be used under the “Skype” tab of ssgwpe user interface. Skype callers are then directly by ssgwpe to the appropriate incoming routes to Asterisk. Before we do this, we need to add needed modules to FreePBX.
- Click “Setup->Module Admin->Check for updates online”.
- Choose to install “DISA” and “Misc Destinations”.
- At the bottom of the page, press “Process”.
Configure skype2ext Assuming that you have a PSTN trunk from your Asterisk and you intend to have some Skype callers directed to your mobile number. This is how you can do it.
- Click “Setup->Misc Destinations->Add Misc Destination”. Enter:
- Description: My Mobile
- Dial: XXXXXX, whatever your dial string setup to your mobile number
- Once changes are submitted,
- Click “Setup->Inbound Routes->Add Incoming Route”. Enter:
- Description: Skype 2 Ext
- DID Number: skype2ext
- Set Destination: check Misc and select “My Mobile”
- Submit changes and apply configuration changes.
From the user interface of SSGWPE, click on the “Skype” tab and enter:
- Click “Add Group” to add a new group to accommodate the Skype callers to your mobile number. Choose any name you like.
- You can use “Add Buddy To Group” or use “<<” to add the appropriate Skype buddies to your new group.
- Enter “sip:skype2ext@XXX.XXX.XXX.XXX” for the “Number to call for the group”. Replace “XXX.XXX.XXX.XXX” which your Asterisk server IP address.
- Enter your welcome message.
- Click “Save” to save the configuration.
The Skype callers in that group when calling this gateway should now be redirected to your mobile number. Configure skype2disa DISA service allows you to get a dial tone to dial out through the Asterisk trunks. To add a DISA service,
- Click “Setup->DISA->Add DISA”. Enter:
- DISA Name: Disa One
- PIN: XXXX -> choose what you like
- Leaves the rest unchanged.
- Submit changes and apply configuration changes.
To configure skype2disa incoming route,
- Click “Setup->Inbound Routes->Add Incoming Route”. Enter:
- Description: Skype 2 DISA
- DID Number: skype2disa
- Set Destination: check DISA and select “Disa One”
- Submit changes and apply configuration changes.
Similarly configure ssgwpe as per previous example to allow a group of Skype callers to have this service. Configure skype2echo and skype2ivr Echo test is written by me as a record and playback more akin to that of Skype EchoTest service. The default echotest service in FreePBX is more for latency test. Similarly, ivr is written as a test for “dtmf” tones from Skype callers. These two examples show how you can manually create your own services through various files used by FreePBX and Asterisk. Download this compressed file that contains the following 3 files:
- pls-enter-echo-message-after-tone.gsm
- dialout.gsm and
- getNumber.php
Uncompress the files and copy the 2 gsm files to “/var/lib/asterisk/sounds”. Copy “getNumber.php” to “/var/lib/asterisk/agi-bin”. The copying and changing of ownership to the files require you to have root permission. With root permission, edit “/etc/asterisk/extensions_custom.conf” and add in the following:
- ; echo test for call coming from ssgwpe
exten = 759731,1,Answer
;exten = 759731,n,Wait(2)
exten = 759731,n,Playback(pls-enter-echo-message-after-tone)
exten = 759731,n,Record(asterisk-recording%d:ulaw,2,20)
exten = 759731,n,Playback(${RECORDED_FILE})
exten = 759731,n,Playback(goodbye)
exten = 759731,n,Hangup; custom ivr for call coming from ssgwpe
exten = 759732,1,Answer
exten = 759732,n,SetMusicOnHold(default)
exten = 759732,n,WaitMusicOnHold(5)
exten = 759732,n,agi(getNumber.php)
exten = 759732,n,NoOp(${Number})
exten = 759732,n,GotoIf($["${Number}" != ""]?dial:end)
exten = 759732,n(dial),Playback(pls-hold-while-try)
exten = 759732,n,Goto(from-internal,${Number},1)
exten = 759732,n(end),Playback(goodbye)
exten = 759732,n,Hangup
Similar to earlier description on creation of “Misc Destination”, create “Record & Playback” with “Dial” extension as 759731 and “Skype 2 IVR” with “Dial” extension as 759732.
Similar to earlier description on creation of “Inbound Routes”, create these two routes:
- Description: Skype 2 Echotest
- DID Number: skype2echo
- Set Destination: Misc, select “Record & Playback”
and
- Description: Skype 2 Custom IVR
- DID Number: skype2ivr
- Set Destination: Misc, select “Skype 2 IVR”
“Apply configuration changes” so that Asterisk change reload with the updated configuration.
As per earlier example, configure ssgwpe to use these two routes.
Conclusion
Integrating SSGWPE via FreePBX is straight forward. The way SSGWPE is configured is similar to that for configuring Linksys Sipura 3102, albeit simpler. When SSGWPE is properly configured, it can be seen on the flash operator panel under the “Trunk” section.
SSGWPE affords you or your company a Skype internet identity, much like a PSTN number, where you and your employees can be reached easily even when they are not connected to the internet, but connected via GSM or PSTN networks.