Creating a SIP Trunk for Outside Calls

Hello,
I am new to SIP and SIP PBX’s; I do however work in IT as an infrastructure analyst.
I have just installed Asterisk now with free PBX Asterisk 1.6.2.11. I have setup all the extensions in Free PBX and can login from SIP phones and call other extensions.

I have a SIP provider called Draytel that I would like to use to call outside lines.
I have been given a set of lines by this provider to add to the individual configuration files.
Here is the configuration I was given:

Setup Guide for Asterisk on DrayTEL:
Outgoing PSTN SIP Trunk ----------------------- The preferred method of configuring Asterisk is by using a combination of the sip.conf and extensions.conf files. The sip.conf file enables you to have much more configuration control over your SIP connection, allowing you to control things such as codec priorities, trunking, etc.
For connection to DrayTEL, a basic sip.conf entry would be:
[general] register => USERID:[email protected]/USERID
[draytel] type=friend username=USERID secret=PW fromuser=USERID host=draytel.org dtmfmode=rfc2833 fromdomain=draytel.org context=default insecure=very
The corresponding entry in extensions.conf would be:
exten => USERID,1,Dial(SIP/extension) exten => _0[1-9].,1,Dial(SIP/draytel/${EXTEN}) exten => _00[1-9].,1,Dial(SIP/draytel/${EXTEN})
where USERID is your DrayTEL ID, PW is your DrayTEL password and DrayTEL is the name of the SIP entity created in sip.conf for your DrayTEL account.
SIP to SIP Calls To make free SIP calls to any DrayTEL ID add the following to extensions.conf:
exten=> _8[1-9].,1,Dial(SIP/${EXTEN}@draytel)
Dialling Other Networks -----------------------
Please configure your extensions.conf locally for other networks.
Incoming PSTN Number -------------------- 1. Create an entry in iax.conf as follows: [DrayTEL Incoming Number] type=friend username=DrayTEL Incoming Number context=[XXXXXXXX]
2. Create an entry in extensions.conf as follows: [XXXXXXXX] exten => DrayTEL Incoming Number,1,Dial(SIP/XXX)
3. Example For example, if your incoming number is: 0870 068 0000:
iax.conf entry would look like this:
[08700680000] type=friend username=08700680000 context=default
extensions.conf entry would look like this:
[default] exten => 08700680000,1,Dial(SIP/1001)
As a result, all calls on that number would be routed to a SIP Phone with extension 1001

I am a little hesitant to add these configuration lines to my sip.conf directly as with this install the configuration should be done from FREEPBX itself??

I have attempted to fill out the fields for the SIP trunk in freepbx but this does not work and I can no loner get any SIP phones to connect to the server.

Any help with this would really be appreciated.

You’ll need to set the trunk dial rules so that it will match the pattern for UK numbers. An example of this would be the following:

9|44XXXXXXXXXXX

This patten will match the number 94401273898765 but will only pass the number after the “9” to the trunk (e.g. 4401273898765).

I suggest reading some FreePBX documentation so that you can become more familiar with dial patterns, FreePBX, and Asterisk in general. There are several “without tears” guide on the internet that you can look for. You may also want to look here for further reading:
http://www.freepbx.org/support/documentation/administration-guide

Put this data in the register string in the freepbx SIP trunk

Make sure to substitute the USERID and PWD they assigned

Place this code in the Peer Details of a SIP trunk named Draytel

type=friend
username=USERID
secret=PW
fromuser=USERID
host=draytel.org
dtmfmode=rfc2833
fromdomain=draytel.org
context=from-pstn
insecure=very
disallow=all
allow=ulaw

Leave the inbound blank (friend peers do double duty)

Create inbound route for DID and outbound route for dialing and you will be all set.

1 Like

Thanks very much for taking the time to come back to me on this. If I want to dial 9 to route to this trunk how should i setup the route. For example if an UK number looks like 01273 898765 how can i set the route so when i dial 9 it knows to go via this trunk?

Sorry to have posted like that, it’s my fault.
I will start by formating what my provider sent to me when I asked them how to configure a SIP Trunk in FreePBX / Asterisk.

I picked apart this configuration and put it into FREEPBX and did not edit any config file by hand. After I did this it broke and would not let me connect a SIP phone.
So what infmation do you need and how can I get at the log files to send you?
I hope this helps.

Setup Guide for Asterisk on DrayTEL:

Outgoing PSTN SIP Trunk ----- The preferred method of configuring Asterisk is by using a combination of the sip.conf and extensions.conf files. The sip.conf file enables you to have much more configuration control over your SIP connection, allowing you to control things such as codec priorities, trunking, etc.

For connection to DrayTEL, a basic sip.conf entry would be:

[general]
register => USERID:[email protected]/USERID

[draytel]
type=friend username=USERID secret=PW fromuser=USERID host=draytel.org dtmfmode=rfc2833 fromdomain=draytel.org context=default insecure=very

The corresponding entry in extensions.conf would be:

exten => USERID,1,Dial(SIP/extension) exten => _0[1-9].,1,Dial(SIP/draytel/${EXTEN}) exten => _00[1-9].,1,Dial(SIP/draytel/${EXTEN})

where USERID is your DrayTEL ID, PW is your DrayTEL password and DrayTEL is the name of the SIP entity created in sip.conf for your DrayTEL account.
SIP to SIP Calls To make free SIP calls to any DrayTEL ID add the following to

extensions.conf:
exten=> _8[1-9].,1,Dial(SIP/${EXTEN}@draytel)

Dialling Other Networks -----------------------
Please configure your extensions.conf locally for other networks.

Incoming PSTN Number -------------------- 1. Create an entry in iax.conf as follows: [DrayTEL Incoming Number] type=friend username=DrayTEL Incoming Number

context=[XXXXXXXX]

  1. Create an entry in extensions.conf as follows: [XXXXXXXX] exten => DrayTEL Incoming Number,1,Dial(SIP/XXX)

  2. Example For example, if your incoming number is: 0870 068 0000:
    iax.conf entry would look like this:

[08700680000]
type=friend username=08700680000 context=default

extensions.conf entry would look like this:

[default] exten => 08700680000,1,Dial(SIP/1001)
As a result, all calls on that number would be routed to a SIP Phone with extension 1001

Why do people insist on providing credentials instead of asking a meaningful question. It just begs for smart ass responses.

Since you posted your message with no formatting I did not have the patience to read the crap from your provider.

Do not modify any config files, one would think the stern warning at the top of the file would be sufficient.

Why don’t you post the user/peer details that broke your server and we can help you correct the syntax.