Поиск по сайту

    Мои услуги на Kwork

Пример конфигурации файлов sip.conf и extensions.conf

[root@asterisk striker]# cat /etc/asterisk/sip.conf

[general]
limitonpeer=yes
context=bogon-calls                 ; Default context for incoming calls
localnet=10.X.X.0/255.255.255.0
externip=XXX.XXX.XXX.XXX

nat=no
rtpstart=16384
rtpend=32766
allowguest=no                  ; Allow or reject guest calls (default is yes)
;match_auth_username=yes        ; if available, match user entry using the
                                ; 'username' field from the authentication line
                                ; instead of the From: field.
allowoverlap=no                 ; Disable overlap dialing support. (Default is yes)
;allowtransfer=no               ; Disable all transfers (unless enabled in peers or users)
                                ; Default is enabled
;realm=mydomain.tld             ; Realm for digest authentication
                                ; defaults to "asterisk". If you set a system name in
                                ; asterisk.conf, it defaults to that system name
                                ; Realms MUST be globally unique according to RFC 3261
                                ; Set this to your host name or domain name
bindport=5060                   ; UDP Port to bind to (SIP standard port for unencrypted UDP
                                ; and TCP sessions is 5060)
                                ; bindport is the local UDP port that Asterisk will listen on
bindaddr=0.0.0.0                ; IP address to bind UDP listen socket to (0.0.0.0 binds to all)
                                ; You can specify port here too, like 123.123.123.123:5080
tcpenable=no                    ; Enable server for incoming TCP connections (default is no)
tcpbindaddr=0.0.0.0             ; IP address for TCP server to bind to (0.0.0.0 binds to all interfaces)
                                ; Optionally add a port number, 192.168.1.1:5062 (default is port 5060)
srvlookup=no                   ; Enable DNS SRV lookups on outbound calls
                                ; Note: Asterisk only uses the first host
                                ; in SRV records
                                ; Disabling DNS SRV lookups disables the
                                ; ability to place SIP calls based on domain
                                ; names to some other SIP users on the Internet
;pedantic=yes                   ; Enable checking of tags in headers,
                                ; international character conversions in URIs
                                ; and multiline formatted headers for strict
                                ; SIP compatibility (defaults to "no")
;disallow=all                   ; First disallow all codecs
;allow=ulaw                     ; Allow codecs in order of preference
;allow=ilbc                     ; see doc/rtp-packetization for framing options
language=ru                    ; Default language setting for all users/peers
                                ; This may also be set for individual users/peers
;relaxdtmf=yes                  ; Relax dtmf handling
;trustrpid = no                 ; If Remote-Party-ID should be trusted
;sendrpid = yes                 ; If Remote-Party-ID should be sent
;progressinband=never           ; If we should generate in-band ringing always
                                ; use 'never' to never use in-band signalling, even in cases
                                ; where some buggy devices might not render it
                                ; Valid values: yes, no, never Default: never
videosupport=no               ; Turn on support for SIP video. You need to turn this on
                                ; in the this section to get any video support at all.
                                ; You can turn it off on a per peer basis if the general
                                ; video support is enabled, but you can't enable it for
                                ; one peer only without enabling in the general section.
callevents=yes                  ; generate manager events when sip ua
                                ; performs events (e.g. hold)
alwaysauthreject = yes         ; When an incoming INVITE or REGISTER is to be rejected,
                                ; for any reason, always reject with '401 Unauthorized'
                                ; instead of letting the requester know whether there was
                                ; a matching user or peer for their request
;--------------------------- SIP DEBUGGING ---------------------------------------------------
;sipdebug = yes                 ; Turn on SIP debugging by default, from
                                ; the moment the channel loads this configuration
;recordhistory=yes              ; Record SIP history by default
                                ; (see sip history / sip no history)
;dumphistory=yes                ; Dump SIP history at end of SIP dialogue
                                ; SIP history is output to the DEBUG logging channel
callcounter = yes              ; Enable call counters on devices. This can be set per
                                ; device too.

;Intertelecom sip
register => login:password@ipaddres/1239854

;Intertelecom sip2
register => login:password@ipaddres/1239855

;Evrotel-trunk
register => login:password@sip0.evro-tel.com.ua


[basic-options](!)                ; a template
        dtmfmode=rfc2833
        context=from-office
        type=friend

[natted-phone](!,basic-options)   ; another template inheriting basic-options
        nat=yes
        canreinvite=no
        host=dynamic

[public-phone](!,basic-options)   ; another template inheriting basic-options
        nat=no
        canreinvite=no

[my-codecs](!)                    ; a template for my preferred codecs
        disallow=all
        allow=ilbc
        allow=g729
        allow=gsm
        allow=g723
        allow=ulaw

[ulaw-phone](!)                   ; and another one for ulaw-only
        disallow=all
        allow=ulaw


; Our mobiles and city phones-----------------------------------------------------------------

[E1:0501198001]
host=IPFROMPROVIDERSIP
type=friend
context=local-phones
insecure=port,invite
disallow=all
allow=alaw
allow=ulaw
qualify=yes

[C:numberphone]
type=friend
host=10.X.X.X
insecure=port,invite
canreinvite=no
;context=from-internal
context=local-phones
qualify=yes

[InTer:numberphone]
type=friend
host=195.128.182.62
user=login
username=login
secret=password
insecure=port,invite
context=local-phones
disallow=all
;allow=g729
allow=gsm
allow=alaw
allow=ulaw
qualify=yes
;nat=force_rport,comedia
dtmfmode=rfc2833
canreinvite=yes
rtpkeepalive=10
fromuser=numberphone
fromdomain=195.128.182.62


[EvTel:numberphone]
type=friend
host=sip0.evro-tel.com.ua
user=login
username=login
secret=password
insecure=port,invite
context=local-phones
disallow=all
allow=alaw
allow=ulaw
qualify=yes
;nat=force_rport,comedia
dtmfmode=rfc2833
canreinvite=yes
rtpkeepalive=10

[500]
context=local-phones
host=dynamic
secret=pass
type=friend
callerid="Abon" <500>
qualify = yes

; Sim bridge numbers--------------queues
[100]
context=local-phones
host=dynamic
secret=pass
type=friend
callerid="Queues_internal" <100>

[101]
context=local-phones
host=dynamic
secret=pass
type=friend
callerid="Fast_Queues" <101>

;---------------------------------------
;sim_bridge_1 10.X.X.X
[203]
context=local-phones
host=dynamic
secret=pass
type=friend
callerid="050XXXXXXX" <203>

;------------------Operator
[107]
context=local-phones
host=dynamic
secret=password
type=friend
callerid="oper_Alexander" <107>
qualify = yes
nat=force_rport,comedia

[root@asterisk disnetern]# cat /etc/asterisk/extensions.conf

[general]
static = yes
writeprotect = yes
clearglobalvars = yes

[globals]

DYNAMIC_FEATURES = apprecord#press0#press1

[default]
include => lan-phones

[bogon-calls]
exten => _X.,1,Congestion

[pstn-incoming]
include => lan-phones

[local-phones]
include => lan-phones

[lan-phones]

;exten => _8.,1,Pickup(${EXTEN:1})

;рабочий вариан исходящих
exten => _099XXXXXXX/120,1,Dial(SIP/302/1${EXTEN})
exten => _095XXXXXXX/120,1,Dial(SIP/302/1${EXTEN})
exten => _050XXXXXXX/120,1,Dial(SIP/302/1${EXTEN})
exten => _066XXXXXXX/120,1,Dial(SIP/302/1${EXTEN})

;рабочие входящие
;mts_kiev_е1
exten => _1234567,1,MixMonitor(/tftpboot/calls/${STRFTIME(${EPOCH},,%d-%m-%Y_%H-%M)}-${CALLERID(num)}.wav)
exten => _1234567,2,Goto(100,2)

;Intertelecom sip
exten => _2345678,1,MixMonitor(/tftpboot/calls/${STRFTIME(${EPOCH},,%d-%m-%Y_%H-%M)}-${CALLERID(num)}.wav)
exten => _2345678,2,Goto(100,2)

;Intertelecom sip2
exten => _3456789,1,MixMonitor(/tftpboot/calls/${STRFTIME(${EPOCH},,%d-%m-%Y_%H-%M)}-${CALLERID(num)}.wav)
exten => _3456789,2,Goto(100,2)

;Evrotel trunk1
exten => _13579,1,MixMonitor(/tftpboot/calls/${STRFTIME(${EPOCH},,%d-%m-%Y_%H-%M)}-${CALLERID(num)}.wav)
exten => _13579,2,Goto(100,2)

;Evrotel trunk2
exten => _135790,1,MixMonitor(/tftpboot/calls/${STRFTIME(${EPOCH},,%d-%m-%Y_%H-%M)}-${CALLERID(num)}.wav)
exten => _135790,2,Goto(100,2)

;Абонентский отдел
exten => _500,1,MixMonitor(/tftpboot/calls/${STRFTIME(${EPOCH},,%d-%m-%Y_%H-%M)}-${CALLERID(num)}.wav)
exten => _500,2,Goto(101,1)

;Перенаправление в очередь для с Абонентского отдела
exten => 101,1,Background(privtstvie)
exten => 101,n,Queue(fastsupport,t)
exten => 101,n,Busy(10)
exten => 101,n,Hangup
;Разрешение звонков между локальными SIP
;exten => _7XX,1,Dial(SIP/${EXTEN})

;Принятие звонков на городской номер
exten => _1XX,1,MixMonitor(/tftpboot/calls/${STRFTIME(${EPOCH},,%d-%m-%Y_%H-%M)}-${CALLERID(num)}.wav)
exten => _1XX,2,Dial(SIP/${EXTEN},20,tT)

;Городские телефоны
exten => 104,2,Dial(SIP/Cisco/${EXTEN},25,tT)
exten => 105,2,Dial(SIP/Cisco/${EXTEN},25,tT)
exten => 106,2,Dial(SIP/Cisco/${EXTEN},25,tT)
exten => 114,2,Dial(SIP/Cisco/${EXTEN},25,tT)

;Звонки с городского
exten => _9,1,MixMonitor(/tftpboot/calls/${STRFTIME(${EPOCH},,%d-%m-%Y_%H-%M)}-${CALLERID(num)}.wav,,/usr/lib/asterisk/wav2mp3.sh /tftpboot/calls/${STRFTIME(${EPOCH},,%d-%m-%Y_%H-%M)}-${CALLERID(num)}.wav /tftpboot/calls/${STRFTIME(${EPOCH},,%d-%m-%Y_%H-%M)}-${CALLERID(num)}.mp3)
exten => _9,2,Dial(SIP/Cisco/${EXTEN},25,tT)
;Перенаправление в  главную очередь
exten => 100,2,SET(TIMEOUT(absolute)=620)
exten => 100,n,NoOp(${CDR(src)})

exten => 100,n,MYSQL(Connect connid XXX.XXX.XXX.XXX mysqllogin mysqlpass mysqltable)
exten => 100,n,MYSQL(Query resultid ${connid} select login,basic_account from users where mobile_telephone like '%${CDR(src)}')
exten => 100,n,MYSQL(Fetch fetchid ${resultid} abon licid)
exten => 100,n,MYSQL(Clear ${resultid})
exten => 100,n,MYSQL(Query resultid ${connid} select TRUNCATE(balance,2), is_blocked from accounts where id like ${licid})
exten => 100,n,MYSQL(Fetch fetchid ${resultid} babos isblok)
exten => 100,n,GotoIf($["${abon}" = ""]?12:11)
exten => 100,n,SET(CALLERID(num)=${abon}_${babos}_${isblok})
exten => 100,n,MYSQL(Clear ${resultid})
exten => 100,n,MYSQL(Disconnect ${connid})
exten => 100,n,Background(privetstvie)
exten => 100,n,Background(please_a)
exten => 100,n,Queue(support,c)
exten => 100,n,Background(quest2_a)
exten => 100,n,WaitExten(4)
exten => 100,n,Hangup()
exten => 0,1,MYSQL(Connect connid XXX.XXX.XXX.XXX mysqllogin mysqlpass mysqltable)
exten => 0,n,MYSQL(Query resultid ${connid} INSERT INTO opinion (`id`, `calldate`, `callerid`, `opinion`) VALUES (NULL, ${EPOCH}, ${CDR(src)}, 3))
exten => 0,n,MYSQL(Clear ${resultid})
exten => 0,n,MYSQL(Disconnect ${connid})
exten => 0,n,Background(thank-you-for-calling&do-svidanija)
exten => 0,n,Hangup()
exten => 1,1,MYSQL(Connect connid XXX.XXX.XXX.XXX mysqllogin mysqlpass mysqltable)
exten => 1,n,MYSQL(Query resultid ${connid} INSERT INTO opinion (`id`, `calldate`, `callerid`, `opinion`) VALUES (NULL, ${EPOCH}, ${CDR(src)}, 4))
exten => 1,n,MYSQL(Clear ${resultid})
exten => 1,n,MYSQL(Disconnect ${connid})
exten => 1,n,Background(thank-you-for-calling&do-svidanija)
exten => 1,n,Hangup()

;messenger
[messages]
exten => _XXX,1,MessageSend(sip:${EXTEN},"${CALLERID(name)}"${MESSAGE(from)})

;auto_caller
[prozvon-dialer]
exten => _XXX,1,Dial(SIP/${EXTEN},60)
exten => _XXX,n,Set(CDR(userfield)=${HASH(SIP_CAUSE,${CDR(dstchannel)})})
exten => _XXX,n,Hangup

[prozvon-informer]
exten => 999,1,Answer
exten => 999,n,Wait(3)
exten => 999,n,Background(no_operators)
exten => 999,n,Hangup

Comments

So empty here ... leave a comment!

Добавить комментарий

Sidebar



Яндекс.Метрика Рейтинг@Mail.ru