Страница 1 из 1

Asterisk + Oktell

Добавлено: 2014-04-01 8:14:28
exad
Добрый день!
Начну с описания задачи. Есть PBX1 (Asterisk 1.8+Debian 7+chan_sccp-b) и есть PBX2 (OKTELL).
Суть в следующем, PBX2 является главным VOIP сервером организации, но он не поддерживает Cisco фоны без перепрошивки в SIP.
Я настроил PBX1, все прекрасно работает но внутри PBX1. Для теста создал внутренние номера все звонится между собой на ура. Вот только у меня беда с пониманием организации диалплана для PBX1. Нужно чтоб телефоны подключенные к PBX1 без проблем звонили на телефоны PBX2 и куда угодно через PBX2. Что для этого сделано: Учетная запись (SIP) на PBX2. В sip.conf я прописал ее,

Код: Выделить всё

register => timur-aster:timur-aster!@192.168.120.23
[oktell]
type=friend
secret=timur-aster!
username=timur-aster
host=192.168.120.23
dtmfmode=rfc2833
canreinvite=no
disallow=all
allow=ulaw
allow=alaw
allow=gsm
insecure=port,invite
fromdomain=192.168.120.23
context=incoming
по команде из CLI sip show registry пишет

Код: Выделить всё

Host                                    dnsmgr Username       Refresh State                Reg.Time
192.168.120.23:5060                     N      timur-aster        345 Registered           Tue, 01 Apr 2014 08:57:20
1 SIP registrations.
Мой sip.conf

Код: Выделить всё

[general]
context=default 
allowguest=no    
allowoverlap=no  
alwaysauthreject=no    
useragent=Orgue de Barbaris      
defaultexpiry=360        
callevents=yes  
limitonpeer=yes 
tcpenable=yes   
rtptimeout=60    
language=ru     
bindport=5060    
bindaddr=192.168.170.171         
srvlookup=yes
allow=alaw     
;allow=g729
;allow=g723
allow=ulaw
dtmfmode=rfc2833        
rtpholdtimeout=300
rtpkeepalive=5

register => timur-aster:timur-aster!@192.168.120.23

[oktell]
type=friend
secret=timur-aster!
username=timur-aster
host=192.168.120.23
dtmfmode=rfc2833
canreinvite=no
disallow=all
allow=ulaw
allow=alaw
allow=gsm
insecure=port,invite
fromdomain=192.168.120.23
context=incoming
;###########;
;extetnsions:
;###########;

[103]
type=friend
host=dynamic
username=103
secret=exad339923
;remotesecret=exad339923
nat=no
canreinvite=no
context=office
callerid="Test1" <103>
allow=gsm
allow=ulaw
allow=alaw

[104]
type=friend
host=dynamic
username=104
secret=exad339923
;remotesecret=exad339923
nat=no
canreinvite=no
context=office
callerid="Test2" <104>
allow=gsm
allow=ulaw
allow=alaw
Мой extensions.conf (по сути стандартный)

Код: Выделить всё

[general]
static=yes
writeprotect=yes
clearglobalvars=no
[globals]
CONSOLE=Console/dsp				; Console interface for demo
;CONSOLE=DAHDI/1
;CONSOLE=Phone/phone0
IAXINFO=guest					; IAXtel username/password
;IAXINFO=myuser:mypass
TRUNK=DAHDI/G2					; Trunk interface
TRUNKMSD=1					; MSD digits to strip (usually 1 or 0)
;TRUNK=IAX2/user:pass@provider
;FREENUMDOMAIN=mydomain.com                     ; domain to send on outbound
;[context]
;exten => someexten,{priority|label{+|-}offset}[(alias)],application(arg1,arg2,...)
;include => daytime,9:00-17:00,mon-fri,*,*
;include => weekend,*,sat-sun,*,*
;include => weeknights,17:02-8:58,mon-fri,*,*
;ignorepat => 9
[dundi-e164-canonical]
;include => stdexten
;exten => 12564286000,1,Gosub(6000,stdexten(IAX2/foo))
;exten => 12564286000,n,Goto(default,s,1)	; exited Voicemail
;exten => _125642860XX,1,Dial(IAX2/otherbox/${EXTEN:7})
[dundi-e164-customers]
;exten => _12564286000,1,Dial(SIP/customer1)
;exten => _12564286001,1,Dial(IAX2/customer2)
[dundi-e164-via-pstn]
;exten => _1256428XXXX,1,Dial(DAHDI/G2/${EXTEN:7}) ; Expose all of 256-428
;exten => _1256325XXXX,1,Dial(DAHDI/G2/${EXTEN:7}) ; Ditto for 256-325
[dundi-e164-local]
include => dundi-e164-canonical
include => dundi-e164-customers
include => dundi-e164-via-pstn
[dundi-e164-switch]
switch => DUNDi/e164
[dundi-e164-lookup]
include => dundi-e164-local
include => dundi-e164-switch
[macro-dundi-e164]
exten => s,1,Goto(${ARG1},1)
include => dundi-e164-lookup
[iaxtel700]
exten => _91700XXXXXXX,1,Dial(IAX2/${GLOBAL(IAXINFO)}@iaxtel.com/${EXTEN:1}@iaxtel)
[iaxprovider]
;switch => IAX2/user:[key]@myserver/mycontext
[trunkint]
exten => _9011.,1,Macro(dundi-e164,${EXTEN:4})
exten => _9011.,n,Dial(${GLOBAL(TRUNK)}/${FILTER(0-9,${EXTEN:${GLOBAL(TRUNKMSD)}})})
[trunkld]
exten => _91NXXNXXXXXX,1,Macro(dundi-e164,${EXTEN:1})
exten => _91NXXNXXXXXX,n,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
[trunklocal]
exten => _9NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
[trunktollfree]
exten => _91800NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
exten => _91888NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
exten => _91877NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
exten => _91866NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
[international]
ignorepat => 9
include => longdistance
include => trunkint
[longdistance]
ignorepat => 9
include => local
include => trunkld
[local]
ignorepat => 9
include => default
include => trunklocal
include => iaxtel700
include => trunktollfree
include => iaxprovider
include => parkedcalls
[outbound-freenum]
exten => _X*X!,1,Goto(outbound-freenum2,${EXTEN},1)
exten => _XX*X!,1,Goto(outbound-freenum2,${EXTEN},1)
exten => _XXX*X!,1,Goto(outbound-freenum2,${EXTEN},1)
exten => _XXXX*X!,1,Goto(outbound-freenum2,${EXTEN},1)
exten => _XXXXX*X!,1,Goto(outbound-freenum2,${EXTEN},1)
exten => _XXXXXX*X!,1,Goto(outbound-freenum2,${EXTEN},1)
[outbound-freenum2]
exten => _X!,1,Verbose(2,Performing ISN lookup for ${EXTEN})
same => n,Set(SUFFIX=${CUT(EXTEN,*,2-)})                                ; make sure the suffix is all digits as well
same => n,GotoIf($["${FILTER(0-9,${SUFFIX})}" != "${SUFFIX}"]?fn-CONGESTION,1)
same => n,Set(TIMEOUT(absolute)=10800)
same => n,Set(isnresult=${ENUMLOOKUP(${EXTEN},sip,,1,freenum.org)})     ; perform our lookup with freenum.org
same => n,GotoIf($["${isnresult}" != ""]?from)
same => n,Set(DIALSTATUS=CONGESTION)
same => n,Goto(fn-CONGESTION,1)
same => n(from),Set(__SIPFROMUSER=${CALLERID(num)})
same => n,GotoIf($["${GLOBAL(FREENUMDOMAIN)}" = ""]?dial)               ; check if we set the FREENUMDOMAIN global variable in [global]
same => n,Set(__SIPFROMDOMAIN=${GLOBAL(FREENUMDOMAIN)})                 ;    if we did set it, then we'll use it for our outbound dialing domain
same => n(dial),Dial(SIP/${isnresult},40)
same => n,Goto(fn-${DIALSTATUS},1)
exten => fn-BUSY,1,Busy()
exten => _f[n]-.,1,NoOp(ISN: ${DIALSTATUS})
same => n,Congestion()
[macro-trunkdial]
exten => s,1,Dial(${ARG1})
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s-NOANSWER,1,Hangup
exten => s-BUSY,1,Hangup
exten => _s-.,1,NoOp
[stdexten]
exten => _X.,50000(stdexten),NoOp(Start stdexten)
exten => _X.,n,Set(LOCAL(ext)=${EXTEN})
exten => _X.,n,Set(LOCAL(dev)=${ARG1})
exten => _X.,n,Set(LOCAL(cntx)=${ARG2})
exten => _X.,n,Set(LOCAL(mbx)=${ext}${IF($[!${ISNULL(${cntx})}]?@${cntx})})
exten => _X.,n,Dial(${dev},20)				; Ring the interface, 20 seconds maximum
exten => _X.,n,Goto(stdexten-${DIALSTATUS},1)		; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
exten => stdexten-NOANSWER,1,Voicemail(${mbx},u)	; If unavailable, send to voicemail w/ unavail announce
exten => stdexten-NOANSWER,n,Return()			; If they press #, return to start
exten => stdexten-BUSY,1,Voicemail(${mbx},b)		; If busy, send to voicemail w/ busy announce
exten => stdexten-BUSY,n,Return()			; If they press #, return to start
exten => _stde[x]te[n]-.,1,Goto(stdexten-NOANSWER,1)	; Treat anything else as no answer
exten => a,1,VoicemailMain(${mbx})			; If they press *, send the user into VoicemailMain
exten => a,n,Return()
[stdPrivacyexten]
exten => _X.,60000(stdPrivacyexten),NoOp(Start stdPrivacyexten)
exten => _X.,n,Set(LOCAL(ext)=${ARG1})
exten => _X.,n,Set(LOCAL(dev)=${ARG2})
exten => _X.,n,Set(LOCAL(dontcntx)=${ARG3})
exten => _X.,n,Set(LOCAL(tortcntx)=${ARG4})
exten => _X.,n,Set(LOCAL(cntx)=${ARG5})
exten => _X.,n,Set(LOCAL(mbx)="${ext}"$["${cntx}" ? "@${cntx}" :: ""])
exten => _X.,n,Dial(${dev},20,p)			; Ring the interface, 20 seconds maximum, call screening
exten => _X.,n,Goto(stdexten-${DIALSTATUS},1)		; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
exten => stdexten-NOANSWER,1,Voicemail(${mbx},u)	; If unavailable, send to voicemail w/ unavail announce
exten => stdexten-NOANSWER,n,NoOp(Finish stdPrivacyexten NOANSWER)
exten => stdexten-NOANSWER,n,Return()			; If they press #, return to start
exten => stdexten-BUSY,1,Voicemail(${mbx},b)		; If busy, send to voicemail w/ busy announce
exten => stdexten-BUSY,n,NoOp(Finish stdPrivacyexten BUSY)
exten => stdexten-BUSY,n,Return()			; If they press #, return to start
exten => stdexten-DONTCALL,1,Goto(${dontcntx},s,1)	; Callee chose to send this call to a polite "Don't call again" script.
exten => stdexten-TORTURE,1,Goto(${tortcntx},s,1)	; Callee chose to send this call to a telemarketer torture script.
exten => _stde[x]te[n]-.,1,Goto(stdexten-NOANSWER,1)	; Treat anything else as no answer
exten => a,1,VoicemailMain(${mbx})		; If they press *, send the user into VoicemailMain
exten => a,n,Return
[macro-page];
exten => s,1,ChanIsAvail(${ARG1},s)			; s is for ANY call
exten => s,n,GoToIf($[${AVAILSTATUS} = "1"]?autoanswer:fail)
exten => s,n(autoanswer),Set(_ALERT_INFO="RA")			; This is for the PolyComs
exten => s,n,SIPAddHeader(Call-Info: Answer-After=0)	; This is for the Grandstream, Snoms, and Others
exten => s,n,NoOp()					; Add others here and Post on the Wiki!!!!
exten => s,n,Dial(${ARG1})
exten => s,n(fail),Hangup
[demo]
include => stdexten
exten => s,1,Wait(1)			; Wait a second, just for fun
exten => s,n,Answer			; Answer the line
exten => s,n,Set(TIMEOUT(digit)=5)	; Set Digit Timeout to 5 seconds
exten => s,n,Set(TIMEOUT(response)=10)	; Set Response Timeout to 10 seconds
exten => s,n(restart),BackGround(demo-congrats)	; Play a congratulatory message
exten => s,n(instruct),BackGround(demo-instruct)	; Play some instructions
exten => s,n,WaitExten			; Wait for an extension to be dialed.
exten => 2,1,BackGround(demo-moreinfo)	; Give some more information.
exten => 2,n,Goto(s,instruct)
exten => 3,1,Set(LANGUAGE()=fr)		; Set language to french
exten => 3,n,Goto(s,restart)		; Start with the congratulations
exten => 1000,1,Goto(default,s,1)
exten => 1234,1,Playback(transfer,skip)		; "Please hold while..."
exten => 1234,n,Gosub(${EXTEN},stdexten(${GLOBAL(CONSOLE)}))
exten => 1234,n,Goto(default,s,1)		; exited Voicemail
exten => 1235,1,Voicemail(1234,u)		; Right to voicemail
exten => 1236,1,Dial(Console/dsp)		; Ring forever
exten => 1236,n,Voicemail(1234,b)		; Unless busy
exten => #,1,Playback(demo-thanks)	; "Thanks for trying the demo"
exten => #,n,Hangup			; Hang them up.
exten => t,1,Goto(#,1)			; If they take too long, give up
exten => i,1,Playback(invalid)		; "That's not valid, try again"
exten => 500,1,Playback(demo-abouttotry); Let them know what's going on
exten => 500,n,Dial(IAX2/guest@pbx.digium.com/s@default)	; Call the Asterisk demo
exten => 500,n,Playback(demo-nogo)	; Couldn't connect to the demo site
exten => 500,n,Goto(s,6)		; Return to the start over message.
exten => 600,1,Playback(demo-echotest)	; Let them know what's going on
exten => 600,n,Echo			; Do the echo test
exten => 600,n,Playback(demo-echodone)	; Let them know it's over
exten => 600,n,Goto(s,6)		; Start over
exten => 76245,1,Macro(page,SIP/Grandstream1)
exten => _7XXX,1,Macro(page,SIP/${EXTEN})
exten => 7999,1,Set(TIMEOUT(absolute)=60)
exten => 7999,2,Page(Local/Grandstream1@page&Local/Xlite1@page&Local/1234@page/n,d)
exten => 8500,1,VoicemailMain
exten => 8500,n,Goto(s,6)
;exten => 1265,1,Dial(Phone/phone0,15)
;exten => 1265,n,Goto(s,5)
[page]
exten => _X.,1,Macro(page,SIP/${EXTEN})
;[mainmenu]
;exten => s,1,Answer
;exten => s,n,Background(thanks)		; "Thanks for calling press 1 for sales, 2 for support, ..."
;exten => s,n,WaitExten
;exten => 1,1,Goto(submenu,s,1)
;exten => 2,1,Hangup
;include => default
;[submenu]
;exten => s,1,Ringing					; Make them comfortable with 2 seconds of ringback
;exten => s,n,Wait,2
;exten => s,n,Background(submenuopts)	; "Thanks for calling the sales department.  Press 1 for steve, 2 for..."
;exten => s,n,WaitExten
;exten => 1,1,Goto(default,steve,1)
;exten => 2,1,Goto(default,mark,2)
[default]
include => demo
;exten => _41X.,1,Dial(SIP/${FILTER(0-9,${EXTEN:2})}@sipprovider,,r)
;exten => 6245,hint,SIP/Grandstream1&SIP/Xlite1(Joe Schmoe) ; Channel hints for presence
;exten => 6245,1,Dial(SIP/Grandstream1,20,rt)	; permit transfer
;exten => 6245,n(dial),Dial(${HINT},20,rtT)	; Use hint as listed
;exten => 6245,n,Voicemail(6245,u)		; Voicemail (unavailable)
;exten => 6245,s+1,Hangup			; s+1, same as n
;exten => 6245,dial+101,Voicemail(6245,b)	; Voicemail (busy)
;exten => 6361,1,Dial(IAX2/JaneDoe,,rm)		; ring without time limit
;exten => 6389,1,Dial(MGCP/aaln/1@192.168.0.14)
;exten => 6390,1,Dial(JINGLE/caller/callee) ; Dial via jingle using labels
;exten => 6391,1,Dial(JINGLE/asterisk@digium.com/mogorman@astjab.org) ;Dial via jingle using asterisk as the transport and calling mogorman.
;exten => 6394,1,Dial(Local/6275/n)		; this will dial ${MARK}
exten => 102,1,Dial(SCCP/102)
exten => 103,1,Dial(SIP/103)
include => office

;#################;
;#####   #   #####;
;###     #      ##;
;#       #       #;
;#       ####    #;
;#		 #;
;###	       ###;
;#####       #####;
;#################;


[office] 
exten => _102,1,Dial(SCCP/102,30) 
exten => _103,1,Dial(SIP/103,30) 
exten => _104,1,Dial(SIP/104,30)
exten => _ZXX,1,Dial(SIP/oktell,30)

;#3#
;[acme-internal]
;exten => s,1,Answer()
;exten => s,n(exten),Background(vm-enter-num-to-call)
;exten => s,n,WaitExten(5)
;exten => s,n(goodbye),Playback(vm-goodbye)
;exten => s,n(end),Hangup()
;include => trunkint
;include => trunkld
;include => trunklocal
;include => acme-extens
;exten => 777,1,DISA(no-password,acme-incoming)
;[acme-extens]
;include => stdexten
;exten => 111,1,Gosub(111,stdexten(SIP/pete_1,acme))
;exten => 111,n,Goto(s,exten)
;exten => 112,1,Gosub(112,stdexten(SIP/nancy_1,acme))
;exten => 112,n,Goto(s,end)
; [acme-internal]
; ...
; exten => 777,1,Gosub(time)
; exten => 777,n,Hangup()
;
; ...
; include => time
;
; Note: if you're geographically spread out, you can have SIP extensions
; specify their own local timezone in sip.conf as:
;
; [boi]
; type=friend
; context=acme-internal
; callerid="Boise Ofc. <2083451111>"
; ...
; ; use system-wide default timezone of MST7MDT
;
; [lws]
; type=friend
; context=acme-internal
; callerid="Lewiston Ofc. <2087431111>"
; ...
; setvar=timezone=PST8PDT
;
; "timezone" isn't a 'reserved' name in any way, and other places where
; the timezone is significant (e.g. calls to "SayUnixTime()", etc) will
; require modification as well.  Note that voicemail.conf already has
; a mechanism for timezones.
;
[time]
exten => _X.,30000(time),NoOp(Time: ${EXTEN} ${timezone})
exten => _X.,n,Wait(0.25)
exten => _X.,n,Answer()
; the amount of delay is set for English; you may need to adjust this time
; for other languages if there's no pause before the synchronizing beep.
exten => _X.,n,Set(FUTURETIME=$[${EPOCH} + 12])
exten => _X.,n,SayUnixTime(${FUTURETIME},Zulu,HNS)
exten => _X.,n,SayPhonetic(z)
; use the timezone associated with the extension (sip only), or system-wide
; default if one hasn't been set.
exten => _X.,n,SayUnixTime(${FUTURETIME},${timezone},HNS)
exten => _X.,n,Playback(spy-local)
exten => _X.,n,WaitUntil(${FUTURETIME})
exten => _X.,n,Playback(beep)
exten => _X.,n,Return()

[ani]
exten => _X.,40000(ani),NoOp(ANI: ${EXTEN})
exten => _X.,n,Wait(0.25)
exten => _X.,n,Answer()
exten => _X.,n,Playback(vm-from)
exten => _X.,n,SayDigits(${CALLERID(ani)})
exten => _X.,n,Wait(1.25)
exten => _X.,n,SayDigits(${CALLERID(ani)})	; playback again in case of missed digit
exten => _X.,n,Return()
Информацию по этому поводу гуглил. Ничего подходящего для себя (по крайней мере я так решил) не нашел.