VoIP: Cara Mengkonfigurasi Trunk di Asterisk

From OnnoWiki
Revision as of 11:54, 20 January 2014 by Onnowpurbo (talk | contribs)
Jump to navigation Jump to search

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