Добрый день. Пытаюсь поднять Астериск с нуля по вашей статье, предварительно установив астериск, Транк поднят. Но кроме внутренних звонков ничего не работает. Не могу позвонить ни на внешку, ни с внешки на сам номер. Номер не активен. Вот конфиг файла extensions.conf
[general]
static=yes
writeprotect=no[globals]
DIR_RECORDS=/mnt/calls/
CONSOLE=Console/dsp ; Console interface for demo
TRUNK=DAHDI/r1 ; Trunk interface
TRUNKX=DAHDI/r2 ; 2nd trunk interface
TRUNKIAX=IAX2/ASTtest1:test@10.10.10.16:4569 ; IAX trunk interface
TRUNKIAX1=IAX2/ASTtest1:test@10.10.10.16:4569 ; IAX trunk interface
TRUNKBINFONE=IAX2/1112223333:PASSWORD@iax.binfone.com ; IAX trunk interface
SIPtrunk=SIP/1234:PASSWORD@sip.provider.net ; SIP trunk#include extensions-vicidial.conf
;Вешаем трубку
[handup-sip]
exten => _X!,1,HangUp()[default]
include => vicidial-auto
include => vicidial-auto-internal
include => vicidial-auto-phones
include => vicidial-auto-external;Макрос записи разговоров
[macro-recording]
exten
=>s,1,Set(fname=${UNIQUEID}-${STRFTIME(${EPOCH},,%Y-%m-%d-%H_%M)}-${ARG1}-${AR$
exten => s,n,Set(monopt=nice -n 19 /usr/local/bin/lame -b 32 --silent
"${DIR_RECORDS}${fname}.wav" "${DIR_RECORDS}${fname}.mp3" && rm -f
"${DIR_RECORDS}${fname}.wav" && chmod o+r "${DIR_RECORDS}${fname}.mp3");
exten => s,n,Set(CDR(filename)=${fname}.mp3);
exten => s,n,Set(CDR(realdst)=${ARG2});
exten => s,n,MixMonitor(${DIR_RECORDS}${fname}.wav,b,${monopt});
exten => s,n(no),Verbose(Exit record);;Исходящие звонки
[call-out]
;Комната для конференцийexten => 999,1,Answer()
exten => 999,n,ConfBridge(1,confer)
;Номер для записи звуков, окончание записи #
exten => _35X, 1, NoOp()
exten => _35X, n, Wait(2)
exten => _35X, n, Playback(beep)
exten => _35X, n, Record(/tmp/music${EXTEN:2}:wav)
exten => _35X, n, Wait(1)
exten => _35X, n, Playback(/tmp/music${EXTEN:2})
exten => _35X, n, Wait(2)
exten => _35X, n, Hangup()
;Управление голосовой почтой
exten => 500,1,VoiceMailMain()
;Звонок на внутренний номер
exten => _XXX,1,Macro(recording,${CALLERID(num)},${EXTEN})
exten => _XXX,n,Dial(SIP/${EXTEN},15)
exten => _XXX,n,Set(dstNUM=${EXTEN})
exten => _XXX,n,GotoIf($["${SIPPEER(${EXTEN},status)}" = ""]?num-not-exist,1)
exten => _XXX,n,GotoIf($["${SIPPEER(${EXTEN},status):0:2}" =
"UN"]?num-not-connected$
exten => _XXX,n,ChanIsAvail(SIP/${EXTEN},s)
exten => _XXX,n,NoOp(=========== ChanIsAvail STATUS: ${AVAILSTATUS}
===========)
exten => _XXX,n,GoToIf($[${AVAILSTATUS} = 2]?num-BUSY,1)
exten => _XXX,n,GoToIf($[${AVAILSTATUS} = 3]?num-BUSY,1)
exten => _XXX,n,Goto(num-${DIALSTATUS},1)
exten => num-not-exist,1,Wait(2)
exten => num-not-exist,n,Playback(invalid)
exten => num-not-connected,1,Wait(2)
exten => num-not-connected,n,Playback(ss-noservice)
exten => num-BUSY,1,Wait(2)
exten => num-BUSY,n,Playback(vm-isonphone)
exten => num-NOANSWER,1,Wait(2)
exten => num-NOANSWER,n,Voicemail(${dstNUM},u)
exten => num-CHANUNAVAIL,1,Wait(2)
exten => num-CHANUNAVAIL,n,Playback(vm-isunavail)
;Звонок на внешний номер
exten => _XXX.,1,Macro(recording,${CALLERID(num)},${EXTEN})
exten => _XXX.,n,Dial(SIP/${EXTEN}@9698033453) include => handup-sip;Входящие звонки [call-in]
exten => 9698033453,1,Goto(ivr-main,s,1) [ivr-main]
exten => s,1,Answer() exten => s,2,Background(/etc/asterisk/ivr/ivr-main)
exten => s,3,WaitExten(5)
exten => _XXX,1,Macro(recording,${CALLERID(num)},${EXTEN})
exten => _XXX,n,Dial(SIP/${EXTEN},15)
;Задаем переменную для передачи в голосовую почту
exten => _XXX,n,Set(dstNUM=${EXTEN})
;Проверяем статус пира, существует или нет
exten => _XXX,n,GotoIf($["${SIPPEER(${EXTEN},status)}" = ""]?num-not-exist,1)
;Проверяем статус пира, подключен или нет
exten => _XXX,n,GotoIf($["${SIPPEER(${EXTEN},status):0:2}" =
"UN"]?num-not-connected,1)
;Проверяем канал на занятость
exten => _XXX,n,ChanIsAvail(SIP/${EXTEN},s)
;Выводим в лог значение функции ChanIsAvail, нужно только для отладки, можно
удалить$
exten => _XXX,n,NoOp(=========== ChanIsAvail STATUS: ${AVAILSTATUS}
===========)
;Если функция возвращает 2 или 3, значит абонент занят exten =>
_XXX,n,GoToIf($[${AVAILSTATUS} = 2]?num-BUSY,1)
exten => _XXX,n,GoToIf($[${AVAILSTATUS} = 3]?num-BUSY,1)
;Обрабатываем остальные статусы
exten => _XXX,n,Goto(num-${DIALSTATUS},1)
;Если номера не существует говорим "Ошибочный номер, попробуйте еще раз"
exten => num-not-exist,1,Wait(2)
exten => num-not-exist,n,Playback(invalid)
;Если номер не подключен, говорим "Набранный вами номер отключен, проверьте
номер и $
exten => num-not-connected,1,Wait(2)
exten => num-not-connected,n,Playback(ss-noservice)
;Если номер занят,говорим "Занято"
exten => num-BUSY,1,Wait(2)
exten => num-BUSY,n,Playback(vm-isonphone)
;Если номер не отвечает, включаем голосовую почту
exten => num-NOANSWER,1,Wait(2)
exten => num-NOANSWER,n,Voicemail(${dstNUM},u)
;Если еще по какой-то причине будет статус CHANUNAVAIL, говорим, что номер не
доступ$
exten => num-CHANUNAVAIL,1,Wait(2)exten => num-CHANUNAVAIL,n,Playback(vm-isunavail)
;Если в голосовом меню не выбрали внутренний номер, адресуем звонок секретарю
exten => t,1,Macro(recording,${CALLERID(num)},${EXTEN})
exten => t,n,Queue(secretary,t)
[general]
context=trunkinbound ; Default context for incoming calls
allowguest=no ; Allow or reject guest calls (default is yes)
allowoverlap=no ; Disable overlap dialing support. (Default is yes)
;allowtransfer=no ; Disable all transfers (unless enabled in peers or $
;realm=mydomain.tld ; Realm for digest authentication
bindport=5060 ; UDP Port to bind to (SIP standard port is 5060)
bindaddr=0.0.0.0 ; IP address to bind to (0.0.0.0 binds to all)
srvlookup=yes ; Enable DNS SRV lookups on outbound calls
;domain=mydomain.tld ; Set default domain for this host
;pedantic=yes ; Enable checking of tags in headers,
;tos_sip=cs3 ; Sets TOS for SIP packets.
;tos_audio=ef ; Sets TOS for RTP audio packets.
;tos_video=af41 ; Sets TOS for RTP video packets.
;maxexpiry=3600 ; Maximum allowed time of incoming registrations
;minexpiry=60 ; Minimum length of registrations/subscriptions (def$
;defaultexpiry=120 ; Default length of incoming/outgoing registration
;t1min=100 ; Minimum roundtrip time for messages to monitored h$
;notifymimetype=text/plain ; Allow overriding of mime type in MWI NOTIFY
;checkmwi=10 ; Default time between mailbox checks for peers
;buggymwi=no ; Cisco SIP firmware doesn't support the MWI RFC
;vmexten=voicemail ; dialplan extension to reach mailbox sets the
disallow=all ; First disallow all codecs
allow=ulaw ; Allow codecs in order of preference
allow=gsm
mohinterpret=default
mohsuggest=default
language=ru ; Default language setting for all
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=no ; If we should generate in-band ringing always
;useragent=Asterisk PBX ; Allows you to change the user agent string
;promiscredir = no ; If yes, allows 302 or REDIR to non-local SIP addre$
;usereqphone = no ; If yes, ";user=phone" is added to uri that contains
dtmfmode = rfc2833 ; Set default dtmfmode for sending DTMF. Default: rf$
;compactheaders = yes ; send compact sip headers.
videosupport=no ; Turn on support for SIP video. You need to turn th$
;maxcallbitrate=384 ; Maximum bitrate for video calls (default 384 kb/s)
callevents=yes ; generate manager events when sip ua
;alwaysauthreject = yes ; When an incoming INVITE or REGISTER is to be rejec$
callevents=yes ; generate manager events when sip ua
;alwaysauthreject = yes ; When an incoming INVITE or REGISTER is to be rejec$
;g726nonstandard = yes ; If the peer negotiates G726-32 audio, use AAL2 pac$
;matchexterniplocally = yes ; Only substitute the externip or externhost setting$
;regcontext=sipregistrations
rtptimeout=60 ; Terminate call if 60 seconds of no RTP or RTCP act$
;rtpholdtimeout=300 ; Terminate call if 300 seconds of no RTP or RTCP ac$
;rtpkeepalive=<secs> ; Send keepalives in the RTP stream to keep NAT open
;sipdebug = yes ; Turn on SIP debugging by default, from
;recordhistory=yes ; Record SIP history by default
;dumphistory=yes ; Dump SIP history at end of SIP dialogue
;allowsubscribe=no ; Disable support for subscriptions. (Default is yes)
;subscribecontext = default ; Set a specific context for SUBSCRIBE requests
notifyringing = yes ; Notify subscriptions on RINGING state (default: no)
notifyhold = yes ; Notify subscriptions on HOLD state (default: no)
limitonpeers = yes ; Apply call limits on peers only. This will improve
;t38pt_udptl = yes ; Default false
;register => 1234:password@mysipprovider.com
;registertimeout=20 ; retry registration calls every 20 seconds (default)
;registerattempts=10 ; Number of registration attempts before we give up
externip = 5.1.54.203 ; Address that we're going to put in outbound SIP
;externhost=test.test.com ; Alternatively you can specify a domain
;externrefresh=10 ; How often to refresh externhost if
localnet=192.168.0.0/255.255.0.0; All RFC 1918 addresses are local networks
localnet=10.0.0.0/255.0.0.0 ; Also RFC1918
localnet=172.16.0.0/12 ; Another RFC1918 with CIDR notation
localnet=169.254.0.0/255.255.0.0 ;Zero conf local network
nat=no ; Global NAT settings (Affects all peers and users)
canreinvite=no ; Asterisk by default tries to redirect the
;directrtpsetup=yes ; Enable the new experimental direct RTP setup. This$
;rtcachefriends=yes ; Cache realtime friends by adding them to the inter$
;rtsavesysname=yes ; Save systemname in realtime database at registrati$
;rtupdate=yes ; Send registry updates to database using realtime? $
;rtautoclear=yes ; Auto-Expire friends created on the fly on the same$
;ignoreregexpire=yes ; Enabling this setting has two functions:
;domain=mydomain.tld,mydomain-incoming
;domain=1.2.3.4 ; Add IP address as local domain
;allowexternaldomains=no ; Disable INVITE and REFER to non-local domains
;autodomain=yes ; Turn this on to have Asterisk add local host
;fromdomain=mydomain.tld ; When making outbound SIP INVITEs to
jbenable = yes ; Enables the use of a jitterbuffer on the receiving sid$
jbforce = no ; Forces the use of a jitterbuffer on the receive side o$
jbenable = yes ; Enables the use of a jitterbuffer on the receiving sid$
jbforce = no ; Forces the use of a jitterbuffer on the receive side o$
jbmaxsize = 100 ; Max length of the jitterbuffer in milliseconds.
jbresyncthreshold = 1000 ; Jump in the frame timestamps over which the jitterbuff$
jbimpl = fixed ; Jitterbuffer implementation, used on the receiving sid$
jblog = no ; Enables jitterbuffer frame logging. Defaults to "no".
qualify=yes ; By default, qualify all peers at 2000ms
limitonpeer = yes ; enable call limit on a per peer basis, different from limi$
#include sip-vicidial.conf
[authentication]
;Создаем шаблон для телефонов менеджеров
[managers-phones](!)
type=friend
context=call-out
secret=123
host=dynamic
nat=no
qualify=yes
canreinvite=no
callgroup=1
pickupgroup=1
call-limit=1
dtmfmode=auto
disallow=all
allow=alaw
allow=ulaw
allow=g729
allow=g723
allow=g722
;Создаем пользователей менеджеров
[100](managers-phones)
callerid="Number 100" <100>
[101](managers-phones)
callerid="Number 101" <101>
[102](managers-phones)
callerid="Number 102" <102>
[102](managers-phones)
callerid="Number 102" <102>
[103](managers-phones)
callerid="Number 103" <103>
[104](managers-phones)
callerid="Number 104" <104>
[105](managers-phones)
callerid="Number 105" <105>
[106](managers-phones)
callerid="Number 106" <106>
[107](managers-phones)
callerid="Number 107" <107>
[108](managers-phones)
callerid="Number 108" <108>
[109](managers-phones)
callerid="Number 109" <109>
[110](managers-phones)
callerid="Number 110" <110>
;Создаем шаблон для телефонов поддержки
[support-phones](!)
type=friend
context=call-out
secret=456
host=dynamic
nat=no
qualify=yes
canreinvite=no
callgroup=2
pickupgroup=2
call-limit=1
dtmfmode=auto
disallow=all
allow=alaw
allow=ulaw
allow=g729
allow=g723
allow=g722
;Создаем пользователей техподдержки
[111](support-phones)
callerid="Number 111" <111>
[111](support-phones)
callerid="Number 111" <111>
[112](support-phones)
callerid="Number 112" <112>
[113](support-phones)
callerid="Number 113" <113>
[114](support-phones)
callerid="Number 114" <114>
[115](support-phones)
callerid="Number 115" <115>
[116](support-phones)
callerid="Number 116" <116>
[117](support-phones)
callerid="Number 117" <117>
[118](support-phones)
callerid="Number 118" <118>
[119](support-phones)
callerid="Number 119" <119>
[120](support-phones)
callerid="Number 120" <120>
;Создаем шаблон для телефонов топов
[top-phones](!)
type=friend
context=call-out
secret=789
host=dynamic
nat=no
qualify=yes
canreinvite=no
callgroup=3
pickupgroup=3
call-limit=1
dtmfmode=auto
disallow=all
allow=alaw
allow=ulaw
allow=g729
allow=g723
allow=g722
;Создаем пользователей топов
[121](top-phones)
;Создаем пользователей топов
[121](top-phones)
callerid="Number 111" <121>
[122](top-phones)
callerid="Number 122" <122>
[123](top-phones)
callerid="Number 123" <123>
[124](top-phones)
callerid="Number 124" <124>
[125](top-phones)
callerid="Number 125" <125>
[126](top-phones)
callerid="Number 126" <126>
[127](top-phones)
callerid="Number 127" <127>
[128](top-phones)
callerid="Number 128" <128>
[129](top-phones)
callerid="Number 129" <129>
[130](top-phones)
callerid="Number 130" <130>
; register SIP account on remote machine if using SIP trunks
register =>
9698033453@mpbx.sip.beeline.ru:SD221122lk!:9698033453@mpbx.sip.beeline.ru@mpbx.sip.b$
username=9698033453
type=friend
secret=*************
outboundproxy=195.239.174.100
insecure=port,invite
host=mpbx.sip.beeline.ru
fromuser=9698033453
fromdomain=mpbx.sip.beeline.ru
dtmfmode=rfc2833
disallow=all
directmedia=no
defaultuser=9698033453
context=from-trunk
allow=alaw&ulaw
Очень странно. Пытался использовать тег при добавлении сообщения, но сообщение добавилось просто списком. Приношу извинение форумчанам,за не красивое оформление сообщения. Проблема в следующем. Звонки между собой работают в сети, а по другому совсем никак. Посмотрите логи пожалуйста.
[May 10 13:35:42] Asterisk 11.25.3-vici, Copyright (C) 1999 - 2013 Digium, Inc. and others.
[May 10 13:35:42] Created by Mark Spencer <markster@digium.com>
[May 10 13:35:42] Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
[May 10 13:35:42] This is free software, with components licensed under the GNU General Public
[May 10 13:35:42] License version 2 and other licenses; you are welcome to redistribute it under
[May 10 13:35:42] certain conditions. Type 'core show license' for details.
[May 10 13:35:42] =========================================================================
[May 10 13:35:42] Connected to Asterisk 11.25.3-vici currently running on vicibox (pid = 1543)
[May 10 13:35:45] == Using SIP RTP CoS mark 5
[May 10 13:35:45] > 0x7fb698001a90 -- Strict RTP learning after remote address set to: 192.168.0.23:8000
[May 10 13:35:45] -- Executing [89995496380@call-out:1] Macro("SIP/125-0000000f", "recording,125,89995496380") in new stack
[May 10 13:35:45] WARNING[10222][C-0000000e]: app_macro.c:329 _macro_exec: Context 'macro-recording' for macro 'recording' lacks 's' extension, priority 1
[May 10 13:35:45] -- Executing [89995496380@call-out:2] Dial("SIP/125-0000000f", "SIP/89995496380@9698033453") in new stack
[May 10 13:35:45] WARNING[10222][C-0000000e]: chan_sip.c:6066 create_addr: Purely numeric hostname (9698033453), and not a peer--rejecting!
[May 10 13:35:45] WARNING[10222][C-0000000e]: app_dial.c:2455 dial_exec_full: Unable to create channel of type 'SIP' (cause 20 - Subscriber absent)
[May 10 13:35:45] == Everyone is busy/congested at this time (1:0/0/1)
[May 10 13:35:45] -- Auto fallthrough, channel 'SIP/125-0000000f' status is 'CHANUNAVAIL'
И что мне тоже не понятно , sip show peers выдет следующее: 130 пир/имеет вид 9698033453 но я его не активировал нигде.
122 (Unspecified) D No No 0 UNKNOWN
123 (Unspecified) D No No 0 UNKNOWN
124/124 (Unspecified) D No No 0 UNKNOWN
125/125 192.168.0.23 D No No 42410 OK (2 ms)
126/126 192.168.0.196 D No No 43865 OK (4 ms)
127 (Unspecified) D No No 0 UNKNOWN
128 (Unspecified) D No No 0 UNKNOWN
129 (Unspecified) D No No 0 UNKNOWN
130/9698033453 195.239.174.100 No No 5060 OK (34 ms)
2000/2000 (Unspecified) D No No 0 UNKNOWN
beeline1/9698033453 195.239.174.100 No No 5060 OK (37 ms)
34 sip peers [Monitored: 4 online, 30 offline Unmonitored: 0 online, 0 offline]
Ошибка вот в этой строке регистрации:
register => 9698033453@mpbx.sip.beeline.ru:SD221122lk!:9698033453@mpbx.sip.beeline.ru@mpbx.sip.b$
Я вообще не понимаю, что тут написано. Должно быть что-то похожее на это:
register => 9698033453:SD221122lk!@mpbx.sip.beeline.ru/9698033453
И сам пир провайдера вообще никак не назван. Он не работает. Должно быть примерно так:
[num-beeline]
username=9698033453
type=friend
secret=*************
outboundproxy=195.239.174.100
insecure=port,invite
host=mpbx.sip.beeline.ru
fromuser=9698033453
fromdomain=mpbx.sip.beeline.ru
dtmfmode=rfc2833
disallow=all
directmedia=no
defaultuser=9698033453
context=from-trunk
allow=alaw&ulaw
У меня же в статье все это есть в примерах...
буду разбираться. спасибо. сейчас с нуля все еще раз попробую сделать.