Help for Asterisk and outbound and incoming calls

Hi everybody,
could someone send me a sip.conf and an extension.conf for a working configuration with asterisk and making outbound and incoming calls because I have a lot of problems configuring it to call with xlite.Here is my configuration.

This config is working for outbound and i don t know how lol, because I don t understand the link between the sip.conf and the extension.conf.
If I don t put context=sipgateFX and if I don t put my [sipid] between the brackets of the sip.conf it doesn t work.
In fact, I d like someone to explain me the link between the two fiiles.for example if I have to create a context called my provider and if i have to write [my provider] in the sip.conf.
I count on you because I m novice at Linux and novice in voip and asterisk so it s getting really hard for me to make it work.
I just need a sample configuration working and some explications.The last thing i want to ask is that when i call outbound test number the sound is great,but when a computer from a lan calls me in the lan 9mynumber, the sound is laggy and bad.

exten => _9.,1,Dial(SIP/${EXTEN:1}@1234567,30,tr)
exten => _9.,2,Playback(invalid)
exten => _9.,3,Hangup

register =>


Basically sip.conf is where you describe your sip parameters and your sip devices. All devices being sip gateways, phones, etc must have an entry in your sip.conf file.

extensions.conf is basically the dial plan of Asterisk. After the initial setup in extensions.conf, you will notice most lines start with a number => type line. The number is the number dialled and the information to the right after => is the action to take. It gets more complicated, but that is the basic design.

You will notice in extensions, many of the extensions are grouped and the group heading in square brackets is the context.

In your device descriptions in sip.conf (each device is named inside square brackets there also], you will see there is a context parameter. If it is missing, the context will be the default context parameter described at the top of the sip.conf file.

When a sip phone dials a number, Asterisk will look in the extensions file for any matching entries inside the context area of the sip device’s context.

Once again this can get complicated because a context in the extensions.conf file can include another context.

However, once you understand this, you will realise that Asterisk is very simple and easy to understand. When you use AMP to manage asterisk, the extensions.conf file begins to look very complicated because it is full of macros and tricky stuff. The sip.conf, extensions.conf and others are split into more files with includes to call them up with AMP, so lookout for files like extensions_additional.conf, etc.

Hope this helps.


I gather from your sip.conf that you are using NAT, i.e. that your Asterisk is NOT your router, but is on your LAN behind your router.

I have found that this does not work very well, especially with SIP providers like Sipgate.

In my setup, my Asterisk box is connected directly to my ADSL modem, and has my public IP address, thus I can put NAT=no everywhere and save myself a whole lot of headaches.

I also do not using phone numbers for the SIP account names because this makes the extensions.conf much less readable. Thus I would not use [1234567] but [sipgate1], so the dial command in extensions.conf becomes,

    exten => _9.,1,Dial(SIP/${EXTEN:1}@sipgate1,30,tr)

Finally, since your sipgate account definition in sip.conf specifies inbound as the context, and you append 0221355335719 to the “register” statement, if I understand the docs correctly, you need to have a line like

  exten => 0221355335719,1,....

in the [inbound] context in order to match and process incoming calls from this account. I am not sure that the ‘s’ extension in [inbound] will match this. My own register statements do not append a local extension, all incoming calls (from sipgate, broadvoice, voipbuster, zap, etc.) start processing at [inbound] s,1.

I also helps to have a terminal with “asterisk -r” open while making inbound calls so you can see what asterisk is doing – usually you can figure out from that where you and asterisk disagree on what an extension line means :smile: