How to connect my sip provider to freepbx

hey i’m new here .
do you know how i can connect my sip trunk to freepbx, i have a voip account in Switch2voip but I don’t know how to link my voip account to freepbx.

i search on internet but when I get to: connectivity -> Trunks and I have to edit and fill in peer details I don’t understand anything (sorry for my level), there are several ways to fill in “PEER details” on the internet and I don’t know which one to use, I just want to call people who have a phone number (I don’t even want to receive calls just to send them) but I’m blocked here. If someone could help me please

https://wiki.freepbx.org/

1 Like

I took a look at


and the documentation is badly messed up. In particular the domains sip.switch2voip.us and sipusa.switch2voip.us don’t resolve. When you set up your account, did they send you any information, or is there any trunk information when you log in? If so, please post details (except your username and password, of course).

Otherwise, we can try using the IP addresses listed in

Confirm that your PBX is otherwise working (you can call between extensions ok).

hi, forget what I wrote on the post above, I looked at the link you sent me (the link of my SIP provider)

And I applied what was on it, I went to the Freepbx panel -> connectivity -> trunk and I did : add a SIP trunk (chan_sip)

in outbound CallerID I put a random number : +33651615161

Then in Outgoing -> PEER details I put :

username=(my username)
type=peer
secret=(my password)
progressinband=never
port=5060
nat=auto
insecure=very
ignoresdpversion=yes
host=213.166.103.6
dtmfmode=rfc2833
context=from-trunk
canreinvite=no
allow=g729&g711&g723
qualify=no
fromuser=+33651615161

And finally in Incoming -> Registration string I put :

username:password@(this is not a space I just can’t put a link)213.166.103.6/+33651615161

And I recorded (sorry for this long pavement), does it look good (just to call, not to receive call)

There is also a message when I want to modify the trunk I created:

WARNING: This trunk is not used by any route!

This trunk will not be able to be used for outbound calls until a route is setup that uses it.

Click on Outbound Routes to configure the routes.

And now I don’t know what to do ? if you could help me please

And what should I do with this ? (this is the end of the “tutorial” of my SIP provider knowing that I am in France):

Dial Plan in Asterisk

Your USA dialplan should look something like this:

exten => _91.,1,Set(callerid(num)=+1XXXXXXXXXX)
exten => _91.,2,Set(callerid(ani)=Phone number)
exten => _91.,3,AGI(agi://127.0.0.1:4577/call_log)
exten => _91.,4,Dial(sip/${EXTEN:1}@Switch2Voip,55,o)
exten => _91,5,Hangup

Asterisk United Kingdom Dial Plan

If you are also dialing to the UK and you want to use both USA and UK dialplans then your Asterisk dialplan for UK and USA should look like this:

Make sure you change the prefix on your UK campaign to 8 and leave 9 for USA. Copy evertything below this line and paste it on your dialer trunk configuration.

exten => _91.,1,Set(callerid(num)=+15555555555)
exten => _91.,2,Set(callerid(ani)=Phone number)
exten => _91.,3,AGI(agi://127.0.0.1:4577/call_log)
exten => _91.,4,Dial(sip/${EXTEN:1}@Switch2Voip,55,o)
exten => _91,5,Hangup

exten => _8011.,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _8011.,2,Dial(sip/${EXTEN:1}@Switch2Voip,55,o)
exten => _8011.,3,Hangup

Create an Outbound Route with just one Dial Pattern:
In match pattern, put
XXXX.
Leave prepend, prefix and CallerID all blank.
In Trunk Sequence for Matched Routes, put your switch2voip trunk.
This will send any number with more than 4 digits to the trunk.
Dial in the format that switch2voip uses; see

Hi, thanks again for your reply.

I didn’t understand your last sentence “This will send any number with more than 4 digits to the trunk.
Dial in the format that switch2voip uses; see”

Otherwise I followed what you said but the configuration does not want to save, I put back everything you wrote each time and as soon as I put save it updates and I come back to the page to add outgoing routes.
(Ps: I only put the information you said to put so maybe I forgot to put important information) .

Go to Connectivity -> Outbound Routes.
Click Add Outbound Route.
Fill in a Route Name (for example, switch2voip).
Under Trunk Sequence for Matched Routes, select your trunk from the pull-down menu.
Click the Dial Patterns tab.
In the match pattern field, type
XXXX.
leave everything else blank and press Submit. If you get an error, post details. Otherwise, click Apply Config.

Then, test by calling from your device. For US or Canada, dial e.g. 18004377950 (a test that will read back your number). For France, dial e.g. 01133651615161

ok it worked but before calling I have to connect my SIP provider with Linphone?

And also small problem that I apply the configuration this message appears:

There was an error during reload: Unknown Error. Please Run: fwconsole reload --verbose

Unknown Error. Please Run: fwconsole reload --verbose

I ran the command and everything went well and when I try to apply the configuration again there is the same message…
And 2 critical errors appear in the dashboard:

‘fwconsole reload’ failed, config not applied
Trying to edit user asterisk, when I’m running as www-data

Failed to copy from module agi-bin
Retrieve conf failed to copy file(s) from a module’s agi-bin dir: copy(/var/lib/asterisk/agi-bin/recordings.agi): failed to open stream: Permission not granted
copy(/var/lib/asterisk/agi-bin/attendedtransfer-rec-restart.php): failed to open stream: Permission not granted

I know how to remove these critical errors but I don’t know if it applies the configuration I made before.
To remove the errors I have to do every time:

sudo fwconsole chown
sudo fwconsole reload

but every time I have to apply the configuration it does this …

FreePBX does not normally have a www-data user. If you built Asterisk and FreePBX yourself, there may have been problems with the script you used or recipe you followed. Someone new to FreePBX should normally install the distro:

which avoids these problems. If you have a good reason for building it yourself, please post details.

You can of course connect Linphone directly to switch2voip without using FreePBX or Asterisk at all. If your application doesn’t require a PBX, there is no reason to use it. If you need a PBX, Linphone should be registered as a PBX extension. If you have two or more devices configured properly as extensions, you should be able to call between them without using a trunk.

Also, I’m curious why you chose switch2voip as a provider. Why doesn’t the line included with your Orange / SFR / Free / Bouygues broadband meet your needs? Which countries will you be calling? Fixed or mobiles?

the only reason I installed asterisk and freepbx manually may seem silly but it’s because I didn’t know that a ready-made version existed and I had already started when I learned about it so I wasn’t going to waste so much effort…

But reassure me the problem of the application of config does not pose a problem if I use the commands that I indicated to you each time?

And now I have finished all the configurations to connect my SIP provider to FreePBX? Is freepbx (Asterisk) configured so that I can call to cell phones?

To use Linphone I guess I have to connect it to Freepbx (Asterisk) and my SIP provider I guess?

Do you have a link that explains step by step how to do this? I don’t want to ask you any more questions, you’ve already helped me a lot, thanks again for this.

For information if I chose Switch2voip it’s because according to me it’s a good SIP provider for what I want to do and I want to call in France from cell phones

Please flag this comment off-topic, but wait an hour or two :rofl:

1 Like

Sorry, I have no idea, because I don’t know what you have set up. But if your Outbound Route and Trunk are working the way you would like, then IMO it’s fine.

Please explain in more detail what you are trying to accomplish. In France (and most other developed countries), most mobile plans that include a reasonable amount of data come with unlimited domestic talk and text. For calling within France you don’t need VoIP at all.

hey, just can you confirm me that all the settings I had to do to connect my SIP provider to freepbx are finished?

To use Linphone I have to do some things on Freepbx? if you have a link please

okay to make it simple if I chose switch2voip it’s because they accept payment in bitcoin and I want to remain anonymous… so I let your overflowing imagination understand what kind of thing I can do .

Anyone ever get that feeling of deja vu? Eerie.

HeHe, I am just waiting for the ‘spoof’ bit . . .

I think he spoofed a copy of AsteriskNow (built on Ubuntu) into existence.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.