Elastix / FreePBX Configuration

mh348

Expert Member
Joined
Jun 2, 2006
Messages
4,229
Reaction score
41
Location
NW, SA
Over the past weekend I downloaded and installed the latest version of elastix. I also purchased a TDM800 (8 port) with 3 fxs and 1 fxo module.. So far I have setup sip extensions, using x-lite for the 'clients'... working 100%. I also setup zap extensions (fxs) which is also working. I didn't have to install any drivers for the tdm800, it detected the card and installed itself as elastix comes with the drivers.

Now I'm trying to setup trunks, and I struggling with this part.. I have a single telkom line that I connected to the fxo port.. I also have an fnb connect account that I want to use to setup a sip trunk..

I need help creating the zap trunk (Telkom line) and a sip trunk (FNB Connect) as well as setting up the inbound and outbound routes..

If someone can please help me with the settings or screenshots.. Also what dial strings/patterns should be used.
 
Update: I now have my zap Trunk (Telkom) line working for both inbound and outbound calls..

My SIP trunk (FNBConnect) works, but only for outgoing calls. I can't seem to get incoming calls through the SIP number..

On my SIP trunk I have the following settings"

Incoming Settings

USER Context: 087xxxxxxx

Code:
USER Details:
canreinvite=no
context=from-trunk
fromuser=087xxxxxxx
insecure=very
qualify=no
username=087xxxxxxx
secret=mypass
type=user

Could these setting be a problem?
 
I run elastix, and for FNBconnect I have the following defined under the Trunks menu

Trunk Name: 087XXXXXXX

Peer Details :

type=friend
host=voice.fnbconnect.co.za
username=087XXXXXXX
secret=XXXXXXXX
auth=md5
disallow=all
allow=g729
context=from-trunk
timezone=Africa/Johannesburg
trunkfreq=20
trunk=yes
qualify=yes
qualifysmoothing=yes

Note in the above I have a G729 codec licensed so I use that between them and me.

Register String :
087XXXXXXX:[email protected]

Under Inbound routes I have a specific DID setup to route my FNB number to a ring group

Under outbound routes I route my cell calls to the FNB trunk
 
I run elastix, and for FNBconnect I have the following defined under the Trunks menu

Trunk Name: 087XXXXXXX

Peer Details :

type=friend I have this as user
host=voice.fnbconnect.co.za
username=087XXXXXXX
secret=XXXXXXXX
auth=md5
disallow=all
allow=g729
context=from-trunk
timezone=Africa/Johannesburg
trunkfreq=20
trunk=yes
qualify=yes
qualifysmoothing=yes

Thanks.. I had this part woking whit slightly fewer lines, but adjusted to yours...using the above format in the OUT-going settings, the disallow=all seems to break my trunk, if I have that line in then when making a call I get a message saying "All Circuits are busy", so I remove it and its working again.. any idea what "disallow=all" means ?

Note in the above I have a G729 codec licensed so I use that between them and me.
I'm using the default g729 codec that comes with elastix

Register String :
087XXXXXXX:[email protected]

Thanks I had this part Correct

Under Inbound routes I have a specific DID setup to route my FNB number to a ring group

I tried this, added my number under DID with this format 087xxxxxxx but no luck, could it be under trunk menu, just below PEER details, in the user context is incorrect?

Code:
type=user
secret=pass
host=voice.fnbconnect.co.za
context=from-trunk
allow=g729

Under outbound routes I route my cell calls to the FNB trunk

Also tried this: using the following dial pattern
X[78]XXXXXXXX

basically I want all 08x numbers to be sent via the fnb trunk, only 086 should go through the ZAP trunk, so I'll probably have to create a seperate dial pattern there, or maybe adjust the above to exclude 086..
 
Elastix / Freepbx / Trixbox none of them come with a G729 codec, thats why disallow=all breaks your system as my next line allows only g729 for which I have a license.

You have to purchase and install a G729 codec yourself. You can purchase it direct for $10 per channel from www.digium.com or if you want you can take a look at http://asterisk.hosting.lv/ for some sample/test codecs they will work but ideally in production you want the official Digium codec.

I was lazy with my dial pattern on the outbound route and I listed all the ones individually as :

071.
072.
073.
074.
076.
078.
081.
082.
083.
084.

As for user context mine is left blank as I have the trunk defined as friend.
 
Elastix / Freepbx / Trixbox none of them come with a G729 codec, thats why disallow=all breaks your system as my next line allows only g729 for which I have a license.

Thanks, I picked it was for the codec, and changed it to gsm codec and got it working

You have to purchase and install a G729 codec yourself. You can purchase it direct for $10 per channel from www.digium.com or if you want you can take a look at http://asterisk.hosting.lv/ for some sample/test codecs they will work but ideally in production you want the official Digium codec.

Thanks.. I ordered my codec now, just waiting for them to process the order then I can install it..
I was lazy with my dial pattern on the outbound route and I listed all the ones individually as :

071.
072.
073.
074.
076.
078.
081.
082.
083.
084.

As for user context mine is left blank as I have the trunk defined as friend.

Thanks.. What about the inbound routes, what settings did you use there.. I can't seem to receive calls from the fnb number, I'm testing from my cellhone, I here it ringing on my cell but none of the phones in my ring groups ring.. what should the DID format be like? 087 or +2787 etc

Thanks for all the help :)
 
Last edited:
Thanks.. What about the inbound routes, what settings did you use there.. I can't seem to receive calls from the fnb number, I'm testing from my cellhone, I here it ringing on my cell but none of the phones in my ring groups ring.. what should the DID format be like? 087 or +2787 etc

My inbound route has DID Number set to 087XXXXXX and a destination of my ring group at the moment.

I'd suggest you SSH to your server and from the root logon run a asterisk -rvvvvvvv and then watch the console when you dial into your number from your cell phone, maybe you can pickup something there.
 
My inbound route has DID Number set to 087XXXXXX and a destination of my ring group at the moment.

I'd suggest you SSH to your server and from the root logon run a asterisk -rvvvvvvv and then watch the console when you dial into your number from your cell phone, maybe you can pickup something there.

I get this from the console:
Code:
  == Using SIP RTP TOS bits 184
  == Using SIP RTP CoS mark 5

According to some sites it could be the codec or the port forwarding... I installed the licensed g729 which now works for outbound calls..

I also forwarded the ports, udp 10000:10500 and udp 4569, but still no change..


Also another thing, for the pstn trunk (telkom), there is a delay when it rings, the calling party first hears three rings, only then does my fone start ringing.. I added the line "immediate=yes" in the chan_dahdi.conf so it starts ringing immediately, but still only rings after 3 rings on the remote side..
 
Also tried this: using the following dial pattern
X[78]XXXXXXXX

basically I want all 08x numbers to be sent via the fnb trunk, only 086 should go through the ZAP trunk, so I'll probably have to create a seperate dial pattern there, or maybe adjust the above to exclude 086..

Is that based on Asterisk? I'm not exactly sure how editing the dial plan works on FreePBX as I work on a CentOS patched with OpenVZ and Asterisk installed. If indeed it is Asterisk and you are indeed editing the extensions.conf directly.

Then in your pattern for 08x numbers would be:

exten => _08.,1,Dial(etc.)
exten => _08.,n,Hangup()

And for 086 to go through your ZAP trunk it would be:

exten => _086.,1,Dial(DAHDI/${EXTEN} or ZAP/${EXTEN})
exten => _086.,n,Hangup()

Note that Asterisk matches to the most specific case so 086 would never be matched on _08.
This should be placed in your internal context obviously :)

That said you can monitor what is happening it by starting asterisk with: asterisk -rvvvvvvvvvv

Reload the dial plan by either executing asterisk -rx "reload" or by running asterisk -rvvvvvvvvvv and typing reload in the CLI or using Asterisk-Java (or any type of AMI interface).
 
Last edited:
Is that based on Asterisk? I'm not exactly sure how editing the dial plan works on FreePBX as I work on a CentOS patched with OpenVZ and Asterisk installed. If indeed it is Asterisk and you are indeed editing the extensions.conf directly.

Then in your pattern for 08x numbers would be:

exten => _08.,1,Dial(etc.)
exten => _08.,n,Hangup()

And for 086 to go through your ZAP trunk it would be:

exten => _086.,1,Dial(DAHDI/${EXTEN} or ZAP/${EXTEN})
exten => _086.,n,Hangup()

Note that Asterisk matches to the most specific case so 086 would never be matched on _08.
This should be placed in your internal context obviously :)

That said you can monitor what is happening it by starting asterisk with: asterisk -rvvvvvvvvvv

Reload the dial plan by either executing asterisk -rx "reload" or by running asterisk -rvvvvvvvvvv and typing reload in the CLI or using Asterisk-Java (or any type of AMI interface).

Yes it's Asterisk based, I'm using Elastix Package.. I use the Elastix/FreePBX web gui, so editing the extensions.conf directly might cause a problem later, if I make other changes thru elastix/freepbx ,the file gets overwritten each time u make a change thru the web gui..
 
I can't seem to get my call transfer to work.. According to what I have read it might have something to do with the Asterisk Dial Commands Options (found under general settings)... I currently gave it set as "tr" and also tried "Tr".. for transfering a call I press ## but nothing happens.. it only works to/from internal extensions, if I make a call via the trunk (telkom/voip) it doesn't work, also for incoming calls nothing happens..

Any idea's what else I can check or if my dial command (as above) is correct?
 
I can't seem to get my call transfer to work.. According to what I have read it might have something to do with the Asterisk Dial Commands Options (found under general settings)... I currently gave it set as "tr" and also tried "Tr".. for transfering a call I press ## but nothing happens.. it only works to/from internal extensions, if I make a call via the trunk (telkom/voip) it doesn't work, also for incoming calls nothing happens..

Any idea's what else I can check or if my dial command (as above) is correct?

Why don't you go for Asterisk directly instead?

I wish I could help you with FreePBX but we are using Asterisk straight with our dial plan having been written completely by hand.

Transfers work perfectly tho, without needing to change anything.

One example I know of that is similar to what you want to do is: We have calls coming in from DAHDI (PSTN) then it rings on SIP channel of one of the call center staff members but they can set redirect (for when they leave the office). Those redirects then any number (on the PABX, the internal company phone lines or outside lines). It even displays the original caller ID no matter if you call an outside number (eg. If my phone number is 083 123 4567 and I call the call center and it is redirected to the call center staff member's cell phone they will see the caller ID 083 123 4567, very cool :p ).

If you need help with setting up Asterisk or a dial plan I can help tho.

What soft phone are you using tho? In Bria you can click transfer (should work straight out of the box with Asterisk).

Btw. This for a home setup?
 
Last edited:
@warwickw

Do you have more than 1 SIP FNB Connect trunk on your PBX?
Do you not use IAX?
If you use IAX , can you route inbound calls via inserting the DID?
Does inbound routing work with the DID number inserted?

For the life of me I cannot get more than 1 number to work. If I setup one SIP trunk incoming it works fine. If I setup one IAX line is registers then unregisters then registers again in a kind of loop , so I stuck with SIP. If I have more than one SIP trunk from FNB connect , the others just ring and never hit the PBX on incoming calls.

Spent countless hours now trying to do this with your setup and others , and have tried every imaginable setting. I'm starting to think this is a limitation on FNB's side - but was hoping to get some feedback from you first.
 
IAX isn't secure and should only be used if you have a VPN. IAX is really a bad choice IMHO for anything except connecting PBXs. But when connecting over a secure connection IAX is much better than SIP. Not so much if you only have a single channel running but the higher the call volume the more attractive IAX becomes.

Can you guys tell me, what is the difference between Asterisk GUI and FreePBX (both are available on the AsteriskNOW iso)?

I've never used either but I'm thinking of replacing a PBX for a small business of someone I know and I want them to at least have some control (and they don't know how to do configurations using the configuration files).

I'm leaning toward Asterisk GUI because I can still edit the configuration files if I want whereas FreePBX removes those files completely. FreePBX is definitely much less powerful than vanilla Asterisk configuration files (so is Asterisk GUI but at least you have options).
 
IAX isn't secure and should only be used if you have a VPN. IAX is really a bad choice IMHO for anything except connecting PBXs. But when connecting over a secure connection IAX is much better than SIP. Not so much if you only have a single channel running but the higher the call volume the more attractive IAX becomes.

What makes you say IAX is insecure?

Can you guys tell me, what is the difference between Asterisk GUI and FreePBX (both are available on the AsteriskNOW iso)?

I've never used either but I'm thinking of replacing a PBX for a small business of someone I know and I want them to at least have some control (and they don't know how to do configurations using the configuration files).

I'm leaning toward Asterisk GUI because I can still edit the configuration files if I want whereas FreePBX removes those files completely. FreePBX is definitely much less powerful than vanilla Asterisk configuration files (so is Asterisk GUI but at least you have options).

I have been using FreePBX for a while and it works well. You can still add your own custom code using the *_custom.conf files or if you need to hack extensions.conf directly there is a freepxb_override.conf file. For the day-to-day configs FreePBX is great.
 
I get this from the console:
Code:
  == Using SIP RTP TOS bits 184
  == Using SIP RTP CoS mark 5

According to some sites it could be the codec or the port forwarding... I installed the licensed g729 which now works for outbound calls..

I also forwarded the ports, udp 10000:10500 and udp 4569, but still no change..


Also another thing, for the pstn trunk (telkom), there is a delay when it rings, the calling party first hears three rings, only then does my fone start ringing.. I added the line "immediate=yes" in the chan_dahdi.conf so it starts ringing immediately, but still only rings after 3 rings on the remote side..

If I want my phones to ring immediately, in which custom files can I add the "immediate=yes".. Currently I have it in the chan_dahdi.conf but it still only starts ringing after 3 rings..
 
What makes you say IAX is insecure?

Actually, you know what, I checked again. They've fixed the security problems since I last checked. Ignore that comment :)

I have been using FreePBX for a while and it works well. You can still add your own custom code using the *_custom.conf files or if you need to hack extensions.conf directly there is a freepxb_override.conf file. For the day-to-day configs FreePBX is great.

Ah, Awesome! Thanks! I can't work without at least some access to the dial plan.
 
Last edited:
Actually, you know what, I checked again. They've fixed the security problems since I last checked. Ignore that comment :)
hehe, cool :)


Ah, Awesome! Thanks! I can't work without at least some access to the dial plan.
Once you understand how FreePBX touches the dial-plan it's actually quite easy to work with it when you need to make customizations.
 
Don't forget to make a sip_nat.conf file in Elastix so your external IP adress can be related to your server. Without doing this it can cause oneway audio and bad NAT communication.
Also take care of your codecs. When in the provider details you use G729 but in your extension details you force to use something else, it might go wrong as well, even with transfering a call.
So in your extension you can edit: disallow=all & allow=alaw. In your provider do the same. Or if you only want to use G729 do the same for that one. Or allow=alaw&G729
Using the right codecs is often the problem in getting circuits all busy messages.
I know almost everything about Elastix, so ask if you want. Always use type=friend in provider and never user or something else. That way you can use the same configuration for outgoing and incoming without 2 times filling out the details in the provider tab. So only fill it out once, and leave the other. Register string is almost always with any provider: username:password@provider/username
 
Top
Sign up to the MyBroadband newsletter
X