Difference between revisions of "VoIP: Cara Mengkonfigurasi Trunk di Asterisk"

From OnnoWiki
Jump to navigation Jump to search
Line 2: Line 2:
  
  
 +
Disain asterisk memisahkan antara in-bound dan out-bound call.
 +
In-bound call membutuhkan untuk di terima oleh SIP dan di arahkan ke context call plan.
 +
Out-bound call aplikasi dial membutuhkan profile spesifik di konfigurasi SIP atau registrasi ke tujuan.
  
how to configure SIP trunk with Asterisk
 
  
+
==Context==
  
+
Kesulitan utama dalam konfigurasi SIP trunking di asterisk adalah berbagai parameter di sip.conf dan sip_trunk.conf.
  
In order to enable voice call exchange between two PBX the straightforward protocol to use is SIP. It can allows device interconnection, regardless of their respective role, phone, proxy or gateway. This article explains how simply interconnecting two Asterisk PBX and could be used as a template in order to configure a SIP trunk between an Asterisk PBX and any other one available on the market.
+
Pada contoh ini, kita akan membuat dua asterisk server
  
There is a separation by design in Asterisk between in-bound and out-bound calls. An in-bound call requires to be accepted by the SIP stack and oriented towards an call plan context. On the other hand, an out-bound call, the Dial application requires either a specific profile in the SIP configuration or a registration to the counterpart. We use registration when our IP address is dynamically allowed and can change, thus mainly for IP phones.
+
* asterisk-bangkok
 +
* asterisk-paris
  
Context
+
kedua-nya menggunakan IP address statik dalam jaringan yang sama.
  
The main complexity for SIP trunking configuration in Asterisk is the role of each parameter in the sip.conf file and sip_trunk.conf. In order to illustrate this article, we will use two Asterisk servers called respectivelly asterisk-bangkok  and asterisk-paris. They are both using a static IP address and sharing the same IP network (no NAT in the middle to interfere with the SIP protocol). In order to exchange calls between Bangkok and Paris, we have build prefixes in our dial plan, 91 is used to call Bangkok and 98 to call, the routing is really simple.
+
Dalam dial plan
  
Simple configuration
+
* 91 untuk menelepon Bangkok
 +
* 98 untuk menelepon Paris.
 +
 
 +
==Konfigurasi Sederhana==
 +
 
 +
Untuk mengijinkan Paris untuk menelpon Bangkok. Konfigurasi pada masing-masing sip.conf
  
To start with, we need a configuration to allow calls to flow from Paris towards Bangkok. The configurations on both servers are the following, in sip.conf :
 
  
 
Bangkok
 
Bangkok
 
 
 
Paris
 
 
 
  [trunk-bangkok-paris]
 
  [trunk-bangkok-paris]
 
  type=peer
 
  type=peer
 
  host=asterisk-paris
 
  host=asterisk-paris
 
  context=from-asterisk-paris
 
  context=from-asterisk-paris
+
 
 +
Paris
  
 
  [trunk-paris-bangkok]
 
  [trunk-paris-bangkok]
Line 36: Line 41:
 
  host=asterisk-bangkok
 
  host=asterisk-bangkok
  
In the dial plan (extensions.conf) the call is leaving Paris with the following:
+
Pada dial plan (extensions.conf) call akan meninggalkan Paris dengan konfigurasi:
  
 
  exten => _91.,1,Set(CALLERID(num)=98${CALLERID(num)})
 
  exten => _91.,1,Set(CALLERID(num)=98${CALLERID(num)})
 
  exten => _91.,2,Dial(SIP/trunk-paris-bangkok/${EXTEN:2},20,rt)
 
  exten => _91.,2,Dial(SIP/trunk-paris-bangkok/${EXTEN:2},20,rt)
  
In order to respect our multi site dialing plan structure, we modify as the first action the caller identifier by perfixing it with the Paris prefix (98).
+
Agar memungkinkan struktur multi site dialin plan, kita memodifikasi caller ID dengan  menambahkan Prefix Paris (98).
 +
 
  
 
The Dial application is directeing the call to the SIP trunk named trunk-paris-bangkok, defined in the sip.conf file between [ ]. The trunk type is set to peer since we want to direct calls towards a specific IP address, defined in the host parameter, here set to asterisk-bangkok (see DNS or host table for resolution).
 
The Dial application is directeing the call to the SIP trunk named trunk-paris-bangkok, defined in the sip.conf file between [ ]. The trunk type is set to peer since we want to direct calls towards a specific IP address, defined in the host parameter, here set to asterisk-bangkok (see DNS or host table for resolution).
Line 47: Line 53:
 
When a call needs to be established, a SIP INVITE message arrives on the Asterisk based in Bangkok. Asterisk looks in the SIP database for a profile which can accept this call, the IP address is used as the discriminator. The asterisk-paris profile match this requirement. The next action is to direct the call to the specified context and look for an extension match.
 
When a call needs to be established, a SIP INVITE message arrives on the Asterisk based in Bangkok. Asterisk looks in the SIP database for a profile which can accept this call, the IP address is used as the discriminator. The asterisk-paris profile match this requirement. The next action is to direct the call to the specified context and look for an extension match.
  
Call on the reverse path
+
==Call on the reverse path==
  
 
Now that a call can be placed from Paris to Bangkok, we need the reverse configuration in order for Bangkok to be able to call Paris. Required modification to our configuration are in bold below:
 
Now that a call can be placed from Paris to Bangkok, we need the reverse configuration in order for Bangkok to be able to call Paris. Required modification to our configuration are in bold below:
  
 
Bangkok
 
Bangkok
 
 
Paris
 
  
 
  [trunk-bangkok-paris]
 
  [trunk-bangkok-paris]
 
  type=peer
 
  type=peer
 
  host=asterisk-paris
 
  host=asterisk-paris
  context=from-asterisk-paris
+
  context=from-asterisk-paris
 +
 
 +
Paris
  
 
  [trunk-paris-bangkok]
 
  [trunk-paris-bangkok]
Line 71: Line 76:
 
  exten => _98.,2,Dial(SIP/trunk-bangkok-paris/${EXTEN:2},20,rt)
 
  exten => _98.,2,Dial(SIP/trunk-bangkok-paris/${EXTEN:2},20,rt)
  
Authenticated SIP trunk
+
==Authenticated SIP trunk==
  
 
It is sometimes required to authenticate calls routed from one PBX to another. Most of the time the main point is billing or tracking calls. Authenticating each call acts as an approval for the associated fees or constraints. Keep in mind that configuration is at the PBX level and not at the phone level and is not as strong as what we can do with X.509 certificates. Authentication for SIP is using a digest exchange and MD5 as the signature, therefore the secret exchanged between both entities is never exchanged in clear over the network.
 
It is sometimes required to authenticate calls routed from one PBX to another. Most of the time the main point is billing or tracking calls. Authenticating each call acts as an approval for the associated fees or constraints. Keep in mind that configuration is at the PBX level and not at the phone level and is not as strong as what we can do with X.509 certificates. Authentication for SIP is using a digest exchange and MD5 as the signature, therefore the secret exchanged between both entities is never exchanged in clear over the network.
Line 79: Line 84:
 
Bangkok
 
Bangkok
 
 
 
Paris
 
 
 
  [trunk-bangkok-paris]
 
  [trunk-bangkok-paris]
 
  type=peer
 
  type=peer
Line 88: Line 90:
 
  username=trunk-paris-bangkok
 
  username=trunk-paris-bangkok
 
  secret=strong_password
 
  secret=strong_password
+
 
 +
Paris
  
 
  [trunk-paris-bangkok]
 
  [trunk-paris-bangkok]
Line 99: Line 102:
 
The coloured parts should match in both configurations.
 
The coloured parts should match in both configurations.
  
Conclusion
+
==Conclusion==
  
 
A SIP trunk between two Asterisk PBX is as simple and allows to easily expand the IP telephony network. Interfacing an Asterisk with any other SIP PBX will require something similar, this is the case when connecting to an IP telephony provider. We will see in another article how to take care of the NAT issues and the impact on Asterisk configuration and the network infrastructure.
 
A SIP trunk between two Asterisk PBX is as simple and allows to easily expand the IP telephony network. Interfacing an Asterisk with any other SIP PBX will require something similar, this is the case when connecting to an IP telephony provider. We will see in another article how to take care of the NAT issues and the impact on Asterisk configuration and the network infrastructure.

Revision as of 11:54, 20 January 2014

Sumber: http://www.alkia.net/index.php/faqs/137-how-to-configure-sip-trunk-with-asterisk


Disain asterisk memisahkan antara in-bound dan out-bound call. In-bound call membutuhkan untuk di terima oleh SIP dan di arahkan ke context call plan. Out-bound call aplikasi dial membutuhkan profile spesifik di konfigurasi SIP atau registrasi ke tujuan.


Context

Kesulitan utama dalam konfigurasi SIP trunking di asterisk adalah berbagai parameter di sip.conf dan sip_trunk.conf.

Pada contoh ini, kita akan membuat dua asterisk server

  • asterisk-bangkok
  • asterisk-paris

kedua-nya menggunakan IP address statik dalam jaringan yang sama.

Dalam dial plan

  • 91 untuk menelepon Bangkok
  • 98 untuk menelepon Paris.

Konfigurasi Sederhana

Untuk mengijinkan Paris untuk menelpon Bangkok. Konfigurasi pada masing-masing sip.conf


Bangkok

[trunk-bangkok-paris]
type=peer
host=asterisk-paris
context=from-asterisk-paris

Paris

[trunk-paris-bangkok]
type=peer
host=asterisk-bangkok

Pada dial plan (extensions.conf) call akan meninggalkan Paris dengan konfigurasi:

exten => _91.,1,Set(CALLERID(num)=98${CALLERID(num)})
exten => _91.,2,Dial(SIP/trunk-paris-bangkok/${EXTEN:2},20,rt)

Agar memungkinkan struktur multi site dialin plan, kita memodifikasi caller ID dengan menambahkan Prefix Paris (98).


The Dial application is directeing the call to the SIP trunk named trunk-paris-bangkok, defined in the sip.conf file between [ ]. The trunk type is set to peer since we want to direct calls towards a specific IP address, defined in the host parameter, here set to asterisk-bangkok (see DNS or host table for resolution).

When a call needs to be established, a SIP INVITE message arrives on the Asterisk based in Bangkok. Asterisk looks in the SIP database for a profile which can accept this call, the IP address is used as the discriminator. The asterisk-paris profile match this requirement. The next action is to direct the call to the specified context and look for an extension match.

Call on the reverse path

Now that a call can be placed from Paris to Bangkok, we need the reverse configuration in order for Bangkok to be able to call Paris. Required modification to our configuration are in bold below:

Bangkok

[trunk-bangkok-paris]
type=peer
host=asterisk-paris
context=from-asterisk-paris		

Paris

[trunk-paris-bangkok]
type=peer
host=asterisk-bangkok
context=from-asterisk-bangkok

In Bangkok we also need a specific set of action to allow a call, prefixed by 98 to be routed towards Paris:

exten => _98.,1,Set(CALLERID(num)=91${CALLERID(num)})
exten => _98.,2,Dial(SIP/trunk-bangkok-paris/${EXTEN:2},20,rt)

Authenticated SIP trunk

It is sometimes required to authenticate calls routed from one PBX to another. Most of the time the main point is billing or tracking calls. Authenticating each call acts as an approval for the associated fees or constraints. Keep in mind that configuration is at the PBX level and not at the phone level and is not as strong as what we can do with X.509 certificates. Authentication for SIP is using a digest exchange and MD5 as the signature, therefore the secret exchanged between both entities is never exchanged in clear over the network.

Authentication is based on login and password validation. The password is called secret in the configuration and login is called username. The username is not mandatory and can be derived from the configuration, but specifying it is clearer and easier to troubleshoot in case of. Configuration changes are availabe below:

Bangkok

[trunk-bangkok-paris]
type=peer
host=asterisk-paris
context=from-asterisk-paris
username=trunk-paris-bangkok
secret=strong_password

Paris

[trunk-paris-bangkok]
type=peer
context=from-asterisk-bangkok
host=asterisk-bangkok
username=trunk-bangkok-paris
secret=strong_password

The coloured parts should match in both configurations.

Conclusion

A SIP trunk between two Asterisk PBX is as simple and allows to easily expand the IP telephony network. Interfacing an Asterisk with any other SIP PBX will require something similar, this is the case when connecting to an IP telephony provider. We will see in another article how to take care of the NAT issues and the impact on Asterisk configuration and the network infrastructure.



Referensi

Lebih Dalam

OpenSIPS



Pranala Menarik

Latar Belakang

Untuk Pemula

Untuk Peneliti / Pencoba

Untuk Operator

Topik Lanjut

Buku Teknologi VoIP