Table of Contents

Soubory Asterisku

/etc/asterisk/ - adresář s konfiguračními soubory

Druhy zápisu konfigurace

Jednoduchý:
[Session]
Object 1 => op1,op2,op3
Object 2=> op1b,op2b,op3b
Objektový s dědičností:
[Session]
op1 = bas
op2 = adv
object=>1          //object1(op1=bas, op2=adv)
op1 = int
object => 2        //object2(op1=int, op2=adv)
Kontextový objektový:
[entity1]
op1=value1
op2=value2
[entity2]
op1=value3
op2=value4

Soubory

asterisk.conf users.conf

sip.conf
[general]
port = 5060
context = lab
disallow = all
allow = alaw
dtmfmode = auto

[6000]
type = friend
username = 6000
userid = well
host = dynamic

[6001]
type = friend
username = 6001
userid = linksys
host = dynamic

[6002]
type = friend
username = 6002
userid = well2
host = dynamic
extensions.conf
[general]
static = yes
writeprotect = yes

[globals]

[lab]
exten => 1000,1,Answer
exten => 1000,n,Playback(demo-echotest)
exten => 1000,n,Echo()
exten => 1000,n,Hangup()

exten => 6000,1,Dial(SIP/6000,5)
exten => 6000,n,Goto(s-${DIALSTATUS},1)

exten => 6001,1,Dial(SIP/6001,5)
exten => 6001,n,Goto(s-${DIALSTATUS},1)

exten => 6002,1,Dial(SIP/6002,5)
exten => 6002,n,Goto(s-${DIALSTATUS},1)

exten => s-NOANSWER,1,Playback(nbdy-avail-to-take-call)
exten => s-NOANSWER,2,Playback(pls-try-call-later)
exten => s-NOANSWER,3,Hangup()
exten => s-BUSY,1,Playback(the-party-you-are-calling)
exten => s-BUSY,2,Playback(is-curntly-busy)
exten => s-BUSY,3,Hangup()
exten => s-CHANUNAVAIL,1,Playback(pbx-invalid)
exten => s-CHANUNAVAIL,2,Hangup()

Logování

CLI> logger show channels 
Channel                              Type     Status    Configuration 
-------                              ----     ------    ------------- 
/var/log/asterisk/messages           File     Enabled     - Warning Notice Error 
                                     Console  Enabled     - Warning Notice Error 

CLI> logger rotate 
   == Parsing '/etc/asterisk/logger.conf': Found 
Asterisk Event Logger restarted 
Asterisk Queue Logger restarted

/etc/asterisk/sip.conf

[general]

[general]
bindport = 5060
bindaddr = 10.1.30.45
context = dummy
disallow = all
allow = ulaw
maxexpirey = 120
defaultexpirey = 80
allowguest=no
alwaysauthreject=yes
srvlookup=yes
register => login:secret@domain:port/9999

[6000]
type=friend
secret=#MySecret1#7
host=10.1.30.50
context=from-internal

[6001]
type=friend
secret=Mys3cr3t#
host=dynamic
context=from-internal
defaultip=10.1.30.17

[siptrunk]
username=login
type=peer
secret=secret
port=5060
insecure=invite
host=dominio
fromuser=login
fromdomain=domain
dtmfmode=rfc2833
context=from-sip
disallow=all
allow=ilbc
allow=alaw
allow=g729

/etc/asterisk/extensions.conf

[general]

[globals]

exten=9000,1,set(GLOBAL(RINGTIME)=4)
exten=9000,n,Noop(${GLOBAL(RINGTIME)})
exten=9000,n,hangup()

Extension patterns:

Priority format:

Asterisk Special extensions:

Použití těchto extenzí může změnit obsah CDR - v poli dst nemusí být volané číslo. Proto je dobré použít volbu g ve funkci dial() a zvážit použití funkcí resetcdr(w) či nocdr().

Proměnné:

Channel-specific:

exten=9001,1,dumnpchan()   ;vypis dostupnych promennych

Environment-specific

Application-specific

Práce s proměnnými:

Funkce:

Výrazy:

$[expression1 operator expression2] $[${I}+100]

Matematické operátory

Logické operátory

Regulární výrazy

Operátory rovnosti

Podmínka

Priorita operátorů str.57 (75)

Další:

Huntgroup - vse najednou

Huntgroup - postupne po 15s