Progetto

Generale

Profilo

Actions

AsteriskConfig » Cronologia » Versione 29

« Precedente | Versione 29/30 (diff) | Successivo »
Amministratore Truelite, 28-06-2010 17:31


TracNav(TOC)

Configurare Asterisk & C su Debian


Il primo passo per la realizzazione di un centralino telefonico basato su Asterisk è quello che riguarda la configurazione del supporto delle schede di telefonia (che questa sia un PSTN tradizionale, ISDN o un flusso primario) con cui il programma si interfaccia. Questo ovviamente dipende dal tipo di hardware che si utilizza, ed in molti casi esistono anche diversi supporti alternativi per lo stesso hardware. 

<pre>

h3. Configurazione per l'uso di "mISDN":http://www.misdn.org

<pre>
<pre>
card=1,hfcpci
te_ptmp=1
poll=128
dsp_poll=128
dsp_options=0
dtmfthreshold=100
debug=0
</pre>
mentre nel caso di due schede multiporta è:
<pre>
card=1,0x8
card=2,0x8
te_ptmp=1,2,3,4,5,6,7,8
nt_ptp=9,10,11,12,13,14,15,16
poll=128
dsp_poll=128
dsp_options=0
dtmfthreshold=100
debug=0
</pre>
<pre>

Quello della modalità di uso delle porte è uno dei passi fondamentali per la configurazione di un centralino, specie nel caso si usino schede multiporta. Si deve tenere presente che una porta in modalità TE consente di collegarsi ad un terminale di rete (vale a dire ad una borchia ISDN), mentre una porta in modalità NT consente il collegamento ad essa di un terminale, come un centralino telefonico classico o un telefono ISDN. L'uso delle modalità PTP (_point to point_) o PTMP (_point to multi point_) dipende anche questo da come si esegue il collegamento (vedi XXX).

<pre>
<pre>
<?xml version="1.0"?>
<mISDNconf>
    <module poll="128" debug="0" timer="no">hfcmulti</module>
    <module debug="0" options="0">mISDN_dsp</module>
    <devnode user="root" group="root" mode="644">mISDN</devnode>
    <card type="hfcpci">
        <port mode="te" link="ptmp">1</port>
    </card>
</mISDNconf>
</pre>
per il primo caso, mentre per il secondo:
<pre>
<?xml version="1.0"?>
<mISDNconf>
    <module poll="128" debug="0" timer="no">hfcmulti</module>
    <module debug="0" options="0">mISDN_dsp</module>
    <devnode user="root" group="root" mode="644">mISDN</devnode>
    <card type="BN8S0">
        <port mode="te" link="ptmp">1</port>
        <port mode="te" link="ptmp">2</port>
        <port mode="te" link="ptmp">3</port>
        <port mode="te" link="ptmp">4</port>
        <port mode="te" link="ptmp">5</port>
        <port mode="te" link="ptmp">6</port>
        <port mode="te" link="ptmp">7</port>
        <port mode="te" link="ptmp">8</port>
    </card>
    <card type="BN8S0">
        <port mode="nt" link="ptm">1</port>
        <port mode="nt" link="ptm">2</port>
        <port mode="nt" link="ptm">3</port>
        <port mode="nt" link="ptm">4</port>
        <port mode="nt" link="ptm">5</port>
        <port mode="nt" link="ptm">6</port>
        <port mode="nt" link="ptm">7</port>
        <port mode="nt" link="ptm">8</port>
    </card>
</mISDNconf>
</pre>

<pre>

<pre>

<pre>

<pre>

<pre>
<pre>
parker*CLI> misdn show stacks 
BEGIN STACK_LIST:
** Port 1 Type TE Prot. PMP L2Link DOWN L1Link:DOWN Blocked:0  Debug:1
</pre>
mentre nella configurazione con due schede [[OctoBRI]] si avrà:
<pre>
hancock*CLI> misdn show stacks
BEGIN STACK_LIST:
** Port 1 Type TE Prot. PMP L2Link DOWN L1Link:DOWN Blocked:0  Debug:1
** Port 2 Type TE Prot. PMP L2Link DOWN L1Link:DOWN Blocked:0  Debug:1
** Port 3 Type TE Prot. PMP L2Link DOWN L1Link:DOWN Blocked:0  Debug:1
** Port 4 Type TE Prot. PMP L2Link DOWN L1Link:DOWN Blocked:0  Debug:1
** Port 5 Type TE Prot. PMP L2Link DOWN L1Link:DOWN Blocked:0  Debug:1
** Port 6 Type TE Prot. PMP L2Link DOWN L1Link:DOWN Blocked:0  Debug:1
** Port 7 Type TE Prot. PMP L2Link DOWN L1Link:DOWN Blocked:0  Debug:1
** Port 8 Type TE Prot. PMP L2Link DOWN L1Link:DOWN Blocked:0  Debug:1
** Port 9 Type NT Prot. PMP L2Link UP L1Link:UP Blocked:0  Debug:1
** Port 10 Type NT Prot. PMP L2Link UP L1Link:UP Blocked:0  Debug:1
** Port 11 Type NT Prot. PMP L2Link DOWN L1Link:DOWN Blocked:0  Debug:1
** Port 12 Type NT Prot. PMP L2Link DOWN L1Link:DOWN Blocked:0  Debug:1
** Port 13 Type NT Prot. PMP L2Link DOWN L1Link:DOWN Blocked:0  Debug:1
** Port 14 Type NT Prot. PMP L2Link DOWN L1Link:DOWN Blocked:0  Debug:1
** Port 15 Type NT Prot. PMP L2Link DOWN L1Link:DOWN Blocked:0  Debug:1
** Port 16 Type NT Prot. PMP L2Link DOWN L1Link:DOWN Blocked:0  Debug:1
</pre>

<pre>
<pre>
exten => _.,1,Goto(mainmenu,s,1)
</pre>
che corrisponde ad un numero qualunque.

<pre>

<pre>
<pre>
P[ 1] channel with stid:0 for one second still in use!
P[ 1] I IND :NEW_CHANNEL oad:3471032433 dad:557879597 pid:2 state:none
</pre>
<pre>

Un esempio del contenuto del file, in cui si sono mostrate solo le parti modificate rispetto all'installazione standard, potrebbe essere il seguente:
<pre>
[general] 
misdn_init=/etc/misdn-init.conf
debug=1
...
[default]
context=default
language=it
echocancel=yes
...
[isdn]
ports=1
context=misdn
;always_immediate=yes
msns=557879597
</pre>

<pre>

<pre>
<pre>
# Autogenerated by /usr/sbin/genzaptelconf -- do not hand edit
# Zaptel Configuration File
#
# This file is parsed by the Zaptel Configurator, ztcfg
#

# It must be in the module loading order

# Span 1: WCTDM/0 "Wildcard TDM400P REV I Board 1" 
fxsks=1
fxsks=2
fxoks=3
fxoks=4

# Global data

loadzone        = it
defaultzone     = it
</pre>
<pre>

<pre>
<pre>
[channels]

language=it

signalling=fxo_ks
echocancel=yes ; You can set this to 32, 64, or 128, tweak to your needs.
echocancelwhenbridged=yes
echotraining=yes ; Asterisk trains to the beginning of the call, number is in ms
group=1
context=truelite-firenze ; Points to the default context of your extensions.conf
callerid=<101>
mailbox = 101
channel => 4

signalling=fxs_ks
relaxdtmf=yes
echocancel=yes
echocancelwhenbridged=yes
echotraining=yes
group=2
rxgain=6.0
context=incoming-pstn
callprogress=yes
busydetect=yes
callerid=asreceived
usecallerid=yes
hidecallerid=no
threewaycalling=yes
transfer=yes
channel => 1-2

</pre>

h3. Configurazione dei telefoni SIP

<pre>

||*Chiave*||*Default*||*Significato*||
<pre>
<pre>
<pre>

Per ciascun account SIP si dovrà poi creare una sezione, in cui impostare tutti i parametri, con qualcosa del tipo:
<pre>
[piccardi]
type=friend            ; either "friend" (peer+user), "peer" or "user" 
mailbox=104            ; mailbox 104 in voicemail, or 104@default for context "default" 
username=piccardi        ; username usually matches the section title 
secret=pwdultrasec        ; a password to connect to server
host=dynamic            ; or the IP for static but private IP address 
context=truelite-firenze    ; context for calls
Callgroup=1
pickupgroup=1
</pre>

fatto questo occorrerà impostare i singoli telefoni [[VoIP]] per utilizzare il relativo account, questo dipende ovviamente dal tipo di telefono e dal modello, ed in genere viene fatto tramite l'interfaccia web degli stessi.

h3. Configurazione per effettuare chiamate SIP da dietro un NAT

<pre>
<pre>
exten => XXX,N,Dial(SIP/user@host.name.com)
</pre>
che girerà via SIP la chiamata. Il problema è che il protocollo non funziona bene quando il client è posto dietro un firewall che effettua una traslazione degli indirizzi (il NAT) come avviene comunemente per un centralino posto nella propria rete interna. 

<pre>
<pre>
externip = MIO.IND.IP.PUBB
localnet=192.168.1.0/24
nat=yes
</pre>

h3. Configurazione per la selezione automatica delle chiamate in uscita con ENUM

<pre>

DA FARE

<pre>

<pre>
<pre>
exten => s,1,LDAPget(CIDNAME=interno)
</pre>
<pre>
<pre>
[interno]
host = localhost        ; hostname server LDAP
version = 3            ; LDAP version, must be 3
user =                ; DN for binding, empty to anonymous bind
pass =                ; password for binding
base = ou=Contacts,dc=truelite,dc=it            ; search base
filter = (&(objectClass=person)(companyPhone=%s))    ; search filter
attribute = cn                        ; search result
convert = UTF-8, ISO-8859-1
</pre>
<pre>

<pre>

h3. Configurazione di un fax pass-trough

Nella versione 1.4 Asterisk non supporta la ricezione dei fax, è però possibile configurare la modalità di trasmissione degli stessi in passaggio attraverso una chiamata SIP, in modo da poterli inviare ad un convertitore [[VoIP]]/PSTN cui attaccare un ricevitore fax con una normale linea analogica. 

<pre>
<pre>
[general]
...
t38pt_udptl = yes
...
</pre>

Inoltre in molti casi si possono avere dei timeout o errori nella connessione al convertitore, pertanto è consigliata la seguente configurazione per l'accont SIP cui è collegato il fax:
<pre>
[fax]
context=internal
type=friend
dtmfmode=inband
host=dynamic
canreinvite=no
insecure=port
disallow=all
allow=alaw
allow=ulaw
</pre>

Aggiornato da Amministratore Truelite quasi 14 anni fa · 29 revisions