The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

форумы  помощь  поиск  регистрация  майллист  ВХОД  слежка  RSS
"Asterisk PBX - у кого работает HELP!!! "
Вариант для распечатки  
Пред. тема | След. тема 
Форумы OpenNET: Виртуальная конференция (Public)
Изначальное сообщение [Проследить за развитием треда]

"Asterisk PBX - у кого работает HELP!!! "  
Сообщение от flatciz email on 06-Июн-06, 11:21 
привет, сложно разобраться..стоит Asterisk, в внутр.сети по всем ext звонки-ящики без проблем. Проблема с выводом его наружу...зарегистрился в sipnet.ru
настраивал так..
http://asterisk.org.ru/index.php?option=com_joomlaboard&Itemid=34&func=view&id=480&catid=4
НЕ РАБОТАЕТ!! при звонке на гор.номер тетя говорит что мол "занято, перезвоните позже"
тоесть внутр.звонок толи не уходит в транк, толи что то ссамим транком...
Доков на эту тему мало (ну вообщем не мне рассказывать) ПОМОГИТЕ КТО ЗАНИМАЕТСЯ С PBX Ast.
-------------
лог при звонке на внешний город.
Jun  6 09:48:17 DEBUG[1999] chan_sip.c: Setting NAT on RTP to 0 Jun  6 09:48:17 DEBUG[1999] chan_sip.c: Stopping retransmission on 'F4416467-E058-4B3D-A41D-A749990E338D@10.10.221.222' of Response 4257: Match Found Jun  6 09:48:17 DEBUG[1999] chan_sip.c: Setting NAT on RTP to 0 Jun  6 09:48:17 DEBUG[1999] chan_sip.c: Checking SIP call limits for device 1100 Jun  6 09:48:17 DEBUG[1999] chan_sip.c: build_route: Contact hop: <sip:1100@10.10.221.222:5060>

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing Macro("SIP/1100-2be5", "dialout-trunk|2|94716617||") in new stack

Jun  6 09:48:17 DEBUG[3901] pbx.c: Expression result is '1'

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing GotoIf("SIP/1100-2be5", "1?3:2") in new stack

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Goto (macro-dialout-trunk,s,3)

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing Macro("SIP/1100-2be5", "user-callerid") in new stack

Jun  6 09:48:17 DEBUG[3901] pbx.c: Function result is '1100' Jun  6 09:48:17 DEBUG[3901] pbx.c: Function result is '1100'

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing Set("SIP/1100-2be5", "AMPUSER=1100") in new stack

Jun  6 09:48:17 DEBUG[3901] pbx.c: Function result is '1100' Jun  6 09:48:17 DEBUG[3901] db.c: Unable to find key '1100/emergency_cid' in family 'DEVICE' Jun  6 09:48:17 DEBUG[3901] func_db.c: DB: DEVICE/1100/emergency_cid not found in database. Jun  6 09:48:17 DEBUG[3901] pbx.c: Function result is ''

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing Set("SIP/1100-2be5", "EMERGENCYCID=") in new stack

Jun  6 09:48:17 DEBUG[3901] pbx.c: Function result is '1100'

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing Set("SIP/1100-2be5", "AMPUSERCIDNAME=1100") in new stack

Jun  6 09:48:17 DEBUG[3901] pbx.c: Expression result is '0'

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing GotoIf("SIP/1100-2be5", "0?6") in new stack

Jun  6 09:48:17 DEBUG[3901] pbx.c: Not taking any branch

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing Set("SIP/1100-2be5", "CALLERID(all)="1100" <1100>") in new stack

Jun  6 09:48:17 DEBUG[3901] pbx.c: Function result is '"1100" <1100>'

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing NoOp("SIP/1100-2be5", "Using CallerID "1100" <1100>") in new stack

Jun  6 09:48:17 DEBUG[3901] pbx.c: Function result is '1100'

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing Macro("SIP/1100-2be5", "record-enable|1100|OUT") in new stack

Jun  6 09:48:17 DEBUG[3901] pbx.c: Function result is '0'

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing GotoIf("SIP/1100-2be5", "0 > 0?2:4") in new stack

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Goto (macro-record-enable,s,4)

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing AGI("SIP/1100-2be5", "recordingcheck|20060606-094817|1149572897.16") in new stack

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Launched AGI Script /var/lib/asterisk/agi-bin/recordingcheck

Jun  6 09:48:17 VERBOSE[3901] logger.c:   recordingcheck|20060606-094817|1149572897.16: Outbound recording not enabled

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- AGI Script recordingcheck completed, returning 0

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing NoOp("SIP/1100-2be5", "No recording needed") in new stack

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing Macro("SIP/1100-2be5", "outbound-callerid|2") in new stack

Jun  6 09:48:17 DEBUG[3901] pbx.c: Function result is '1100' Jun  6 09:48:17 DEBUG[3901] pbx.c: Function result is ''

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing Set("SIP/1100-2be5", "USEROUTCID=") in new stack

Jun  6 09:48:17 DEBUG[3901] pbx.c: Expression result is '0'

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing GotoIf("SIP/1100-2be5", "0?4") in new stack

Jun  6 09:48:17 DEBUG[3901] pbx.c: Not taking any branch

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing Set("SIP/1100-2be5", "CALLERID(all)=2124646") in new stack

Jun  6 09:48:17 DEBUG[3901] pbx.c: Expression result is '1'

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing GotoIf("SIP/1100-2be5", "1?6") in new stack

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Goto (macro-outbound-callerid,s,6)

Jun  6 09:48:17 DEBUG[3901] pbx.c: Expression result is '1'

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing GotoIf("SIP/1100-2be5", "1?8") in new stack

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Goto (macro-outbound-callerid,s,8)

Jun  6 09:48:17 DEBUG[3901] pbx.c: Function result is '"" <2124646>'

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing NoOp("SIP/1100-2be5", "CallerID set to "" <2124646>") in new stack

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing Set("SIP/1100-2be5", "GROUP()=OUT_2") in new stack

Jun  6 09:48:17 DEBUG[3901] pbx.c: Function result is '1'

Jun  6 09:48:17 WARNING[3901] ast_expr2.fl: ast_yyerror(): syntax error: syntax error, unexpected $end, expecting TOK_MINUS or TOK_COMPL or TOK_LP or TOKEN; Input:  1 >  

      ^

Jun  6 09:48:17 WARNING[3901] ast_expr2.fl: If you have questions, please refer to doc/README.variables in the asterisk source. Jun  6 09:48:17 DEBUG[3901] pbx.c: Expression result is '0'

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing GotoIf("SIP/1100-2be5", "0?108") in new stack

Jun  6 09:48:17 DEBUG[3901] pbx.c: Not taking any branch

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing Set("SIP/1100-2be5", "DIAL_NUMBER=94716617") in new stack

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing Set("SIP/1100-2be5", "DIAL_TRUNK=2") in new stack

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing AGI("SIP/1100-2be5", "fixlocalprefix") in new stack

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Launched AGI Script /var/lib/asterisk/agi-bin/fixlocalprefix

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- AGI Script fixlocalprefix completed, returning 0

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing Set("SIP/1100-2be5", "OUTNUM=994716617") in new stack

Jun  6 09:48:17 DEBUG[3901] pbx.c: Function result is 'SIP/sipnet'

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing Set("SIP/1100-2be5", "custom=SIP/sipnet") in new stack

Jun  6 09:48:17 DEBUG[3901] pbx.c: Expression result is '0'

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing GotoIf("SIP/1100-2be5", "0?16") in new stack

Jun  6 09:48:17 DEBUG[3901] pbx.c: Not taking any branch

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Executing Dial("SIP/1100-2be5", "SIP/sipnet/994716617|120|W") in new stack

Jun  6 09:48:17 DEBUG[3901] chan_sip.c: Setting NAT on RTP to 0 Jun  6 09:48:17 DEBUG[3901] chan_sip.c: Outgoing Call for 994716617

Jun  6 09:48:17 VERBOSE[3901] logger.c:     -- Called sipnet/994716617

Jun  6 09:48:18 DEBUG[1999] chan_sip.c: (Provisional) Stopping retransmission (but retaining packet) on '2de8f29414ea9216316a96a8533b6f08@sipnet.ru' Request 102: Found Jun  6 09:48:18 DEBUG[1999] chan_sip.c: Acked pending invite 102 Jun  6 09:48:18 DEBUG[1999] chan_sip.c: Stopping retransmission on '2de8f29414ea9216316a96a8533b6f08@sipnet.ru' of Request 102: Match Found Jun  6 09:48:18 DEBUG[1999] chan_sip.c: (Provisional) Stopping retransmission (but retaining packet) on '2de8f29414ea9216316a96a8533b6f08@sipnet.ru' Request 103: Found Jun  6 09:48:18 DEBUG[1999] chan_sip.c: Acked pending invite 103 Jun  6 09:48:18 DEBUG[1999] chan_sip.c: Stopping retransmission on '2de8f29414ea9216316a96a8533b6f08@sipnet.ru' of Request 103: Match Found Jun  6 09:48:18 WARNING[1999] chan_sip.c: Forbidden - wrong password on authentication for INVITE to '"2124646" <sip:2124646@sipnet.ru>;tag=as579805df'

Jun  6 09:48:18 VERBOSE[3901] logger.c:     -- SIP/sipnet-cb1d is circuit-busy

Jun  6 09:48:18 DEBUG[3901] chan_sip.c: update_call_counter(994716617) - decrement call limit counter

Jun  6 09:48:18 VERBOSE[3901] logger.c:   == Everyone is busy/congested at this time (1:0/1/0)

Jun  6 09:48:18 DEBUG[3901] app_dial.c: Exiting with DIALSTATUS=CONGESTION.

Jun  6 09:48:18 VERBOSE[3901] logger.c:     -- Executing Goto("SIP/1100-2be5", "s-CONGESTION|1") in new stack

Jun  6 09:48:18 VERBOSE[3901] logger.c:     -- Goto (macro-dialout-trunk,s-CONGESTION,1)

Jun  6 09:48:18 VERBOSE[3901] logger.c:     -- Executing NoOp("SIP/1100-2be5", "Dial failed due to CONGESTION") in new stack

Jun  6 09:48:18 VERBOSE[3901] logger.c:     -- Executing Macro("SIP/1100-2be5", "outisbusy|") in new stack

Jun  6 09:48:18 VERBOSE[3901] logger.c:     -- Executing Playback("SIP/1100-2be5", "all-circuits-busy-now") in new stack

Jun  6 09:48:18 DEBUG[3901] channel.c: Scheduling timer at 160 sample intervals

Jun  6 09:48:18 VERBOSE[3901] logger.c:     -- Playing 'all-circuits-busy-now' (language 'en')

Jun  6 09:48:18 DEBUG[1999] chan_sip.c: Stopping retransmission on 'F4416467-E058-4B3D-A41D-A749990E338D@10.10.221.222' of Response 4258: Match Found Jun  6 09:48:20 DEBUG[3901] channel.c: Scheduling timer at 0 sample intervals Jun  6 09:48:20 DEBUG[3901] channel.c: Scheduling timer at 0 sample intervals

Jun  6 09:48:20 VERBOSE[3901] logger.c:     -- Executing Playback("SIP/1100-2be5", "pls-try-call-later") in new stack

Jun  6 09:48:20 DEBUG[3901] channel.c: Scheduling timer at 160 sample intervals

Jun  6 09:48:20 VERBOSE[3901] logger.c:     -- Playing 'pls-try-call-later' (language 'en')

Jun  6 09:48:22 DEBUG[3901] channel.c: Scheduling timer at 0 sample intervals Jun  6 09:48:22 DEBUG[3901] channel.c: Scheduling timer at 0 sample intervals

Jun  6 09:48:22 VERBOSE[3901] logger.c:     -- Executing Macro("SIP/1100-2be5", "hangupcall") in new stack

Jun  6 09:48:22 VERBOSE[3901] logger.c:     -- Executing ResetCDR("SIP/1100-2be5", "w") in new stack

Jun  6 09:48:22 DEBUG[3901] cdr_addon_mysql.c: cdr_mysql: inserting a CDR record. Jun  6 09:48:22 DEBUG[3901] cdr_addon_mysql.c: cdr_mysql: SQL command as follows: INSERT INTO cdr (calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid) VALUES ('2006-06-06 09:48:17','2124646','2124646','94716617','from-internal', 'SIP/1100-2be5','SIP/sipnet-cb1d','ResetCDR','w',5,4,'ANSWERED',3,'','1149572897.16')

Jun  6 09:48:22 VERBOSE[3901] logger.c:     -- Executing NoCDR("SIP/1100-2be5", "") in new stack

Jun  6 09:48:22 WARNING[3901] cdr.c: CDR on channel 'SIP/1100-2be5' not posted Jun  6 09:48:22 WARNING[3901] cdr.c: CDR on channel 'SIP/1100-2be5' lacks end

Jun  6 09:48:22 VERBOSE[3901] logger.c:     -- Executing Wait("SIP/1100-2be5", "5") in new stack

Jun  6 09:48:27 VERBOSE[3901] logger.c:     -- Executing Hangup("SIP/1100-2be5", "") in new stack

Jun  6 09:48:27 VERBOSE[3901] logger.c:   == Spawn extension (macro-hangupcall, s, 4) exited non-zero on 'SIP/1100-2be5' in macro 'hangupcall'

Jun  6 09:48:27 VERBOSE[3901] logger.c:   == Spawn extension (macro-hangupcall, s, 4) exited non-zero on 'SIP/1100-2be5' in macro 'outisbusy'

Jun  6 09:48:27 VERBOSE[3901] logger.c:   == Spawn extension (macro-hangupcall, s, 4) exited non-zero on 'SIP/1100-2be5'

Jun  6 09:48:27 DEBUG[3901] chan_sip.c: update_call_counter(1100) - decrement call limit counter Jun  6 09:48:27 DEBUG[1999] chan_sip.c: Stopping retransmission on 'F4416467-E058-4B3D-A41D-A749990E338D@10.10.221.222' of Request 102: Match Found Jun  6 09:53:11 DEBUG[1999] chan_sip.c: Auto destroying call '4441503a203ca06d5d05c6161cd8bf1e@10.10.221.148'

Правка | Высказать мнение | Ответить | Cообщить модератору | Наверх

 Оглавление

Сообщения по теме [Сортировка по времени, UBB]


1. "Asterisk PBX - у кого работает HELP!!! "  
Сообщение от Artem Krivopolenov email on 06-Июн-06, 12:45 
>привет, сложно разобраться..стоит Asterisk, в внутр.сети по всем ext звонки-ящики без проблем.
>Проблема с выводом его наружу...зарегистрился в sipnet.ru
>настраивал так..
>http://asterisk.org.ru/index.php?option=com_joomlaboard&Itemid=34&func=view&id=480&catid=4
>НЕ РАБОТАЕТ!! при звонке на гор.номер тетя говорит что мол "занято, перезвоните
>позже"
>тоесть внутр.звонок толи не уходит в транк, толи что то ссамим транком...
>
>Доков на эту тему мало (ну вообщем не мне рассказывать) ПОМОГИТЕ КТО
>ЗАНИМАЕТСЯ С PBX Ast.
>-------------
>лог при звонке на внешний город.

please, show the extension.conf file's part, regarding SIP connection?

Правка | Высказать мнение | Ответить | Cообщить модератору | Наверх

2. "Asterisk PBX - у кого работает HELP!!! "  
Сообщение от flatciz email on 06-Июн-06, 13:02 
файлы большие, но сокращать побоялся...
extencion.conf и sip_additional.conf (конфигурил через веб интерфейс)

; Asterisk Management Portal (AMP)
; Copyright (C) 2004 Coalescent Systems Inc
; dialparties.agi (http://www.sprackett.com/asterisk/)
; Asterisk::AGI (http://asterisk.gnuinter.net/)
; gsm (http://www.ibiblio.org/pub/Linux/utils/compress/!INDEX.short.html)
; loligo sounds (http://www.loligo.com/asterisk/sounds/)
; mpg123 (http://voip-info.org/wiki-Asterisk+config+musiconhold.conf)
; include extension contexts generated from AMP
#include extensions_additional.conf
; Customizations to this dialplan should be made in extensions_custom.conf
; See extensions_custom.conf.sample for an example
#include extensions_custom.conf

[from-trunk]                            ; just an alias since VoIP shouldn't be called PSTN
include => from-pstn

[from-pstn]
include => from-pstn-custom                     ; create this context in extensions_custom.conf to include customizations
include => ext-did
exten => fax,1,Goto(ext-fax,in_fax,1)


; ############################################################################
; Macros [macro]
; ############################################################################

; Rings one or more extensions.  Handles things like call forwarding and DND
; We don't call dial directly for anything internal anymore.
; ARGS: $TIMER, $OPTIONS, $EXT1, $EXT2, $EXT3, ...
; Use a Macro call such as the following:
;  Macro(dial,$DIAL_TIMER,$DIAL_OPTIONS,$EXT1,$EXT2,$EXT3,...)
[macro-dial]
;exten => s,1,GotoIf($[ "${MACRO_CONTEXT}" = "macro-rg-group" ]?4:2)  ; if this is from rg-group, don't strip prefix
;exten => s,2,GotoIf($["${CALLERID(name):0:${LEN(${RGPREFIX})}}" != "${RGPREFIX}"]?4:3)  ; check for ring-group prefix
;exten => s,3,Set(CALLERID(name)=${CALLERID(name):${LEN(${RGPREFIX})}}) ; strip off prefix
exten => s,1,AGI,dialparties.agi
exten => s,2,NoOp(Returned from dialparties with no extensions to call)
exten => s,3,Set(DIALSTATUS=BUSY)
exten => s,10,Dial(${ds})                               ; dialparties will set the priority to 10 if $ds is not null
exten => s,20,NoOp(Returned from dialparties with hunt groups to dial )
exten => s,21,Set(HuntLoop=0)
exten => s,22,GotoIf($[${HuntMembers} >= 1]?30 )  ; if this is from rg-group, don't strip prefix
exten => s,23,NoOp(Returning there are no members left in the hunt group to ring)

exten => s,30,Set(HuntMember=HuntMember${HuntLoop})
exten => s,31,GotoIf($[$["${CALLTRACE_HUNT}" != "" ] & $["${RingGroupMethod}" = "hunt" ]]?32:35 )  ; Set CAll Trace for Hunt member we are going to call
        exten => s,32,Set(CT_EXTEN=${CUT(ARG3,,$[${HuntLoop} + 1])})
        exten => s,33,Set(DB(CALLTRACE/${CT_EXTEN})=${CALLTRACE_HUNT})
        exten => s,34,Goto(s,42)

exten => s,35,GotoIf($[$["${CALLTRACE_HUNT}" != "" ] & $["${RingGroupMethod}" = "memoryhunt" ]]?36:50 )  ;Set Call Trace for each hunt member we are going to call "Memory groups have multiple members to set CALL TRACE For hence the loop
        exten => s,36,Set(CTLoop=0)
        exten => s,37,GotoIf($[${CTLoop} > ${HuntLoop}]?42 )  ; if this is from rg-group, don't strip prefix
        exten => s,38,Set(CT_EXTEN=${CUT(ARG3,,$[${CTLoop} + 1])})
        exten => s,39,Set(DB(CALLTRACE/${CT_EXTEN})=${CALLTRACE_HUNT})
        exten => s,40,Set(CTLoop=$[1 + ${CTLoop}])
        exten => s,41,Goto(s,37)
exten => s,42,Dial(${${HuntMember}}${ds} ) ; dialparties will set the priority to 20 if $ds is not null and its a hunt group
exten => s,43,Set(HuntLoop=$[1 + ${HuntLoop}])
exten => s,44,Set(HuntMembers=$[${HuntMembers} - 1])
exten => s,45,Goto(s,22)
exten => s,50,DBdel(CALLTRACE/${CT_EXTEN})
exten => s,51,Goto(s,42)


;exten => s,1,GotoIf($[ "${MACRO_CONTEXT}" = "macro-rg-group" ]?4:2)  ; if this is from rg-group, don't strip prefix
;exten => s,2,GotoIf($[${CALLERID(name):0:${LEN(${RGPREFIX})}} != ${RGPREFIX}]?4:3)  ; check for ring-group prefix
;exten => s,3,Set(CALLERID(name)=${CALLERID(name):${LEN(${RGPREFIX})}}) ; strip off prefix
;exten => s,4,AGI,dialparties.agi
;exten => s,5,NoOp(Returned from dialparties with no extensions to call)
;exten => s,6,Set(DIALSTATUS=BUSY)
;exten => s,10,Dial(${ds})                               ; dialparties will set the priority to 10 if $ds is not null

; Ring an extension, if the extension is busy or there is no answer send it
; to voicemail
; ARGS: $VMBOX, $EXT
[macro-exten-vm]
exten => s,1,Macro(user-callerid)
exten => s,2,Set(FROMCONTEXT=exten-vm)
exten => s,3,Macro(record-enable,${ARG2},IN)
exten => s,4,Macro(dial,${RINGTIMER},${DIAL_OPTIONS},${ARG2})
exten => s,5,GotoIf($["${CHANNEL:0:5}" = "Local"]?s-${DIALSTATUS},1) ; if the channel is Local, then do not go to voicemail.  This is primarily to avoid vm for call-forwarded extensions in ring groups
exten => s,6,GotoIf($["${ARG1}" = "novm"]?s-${DIALSTATUS},1) ; no voicemail in use for this extension
exten => s,7,NoOp(Sending to Voicemail box ${ARG2})
exten => s,8,Macro(vm,${ARG1},${DIALSTATUS})
exten => s-BUSY,1,NoOp(Extension is reporting BUSY and has no Voicemail)
exten => s-BUSY,2,Busy()
exten => s-BUSY,3,Wait(60)
exten => s-BUSY,4,NoOp()
exten => _s-.,1,Congestion()

[macro-vm]
exten => s,1,Macro(user-callerid)
exten => s,2,Goto(s-${ARG2},1)
exten => s-BUSY,1,Macro(get-vmcontext,${ARG1})
exten => s-BUSY,2,Voicemail(b${ARG1}@${VMCONTEXT})   ; Voicemail Busy message
exten => s-BUSY,3,Hangup()
exten => _s-.,1,Macro(get-vmcontext,${ARG1})
exten => _s-.,2,Voicemail(u${ARG1}@${VMCONTEXT})     ; Voicemail Unavailable message
exten => _s-.,3,Hangup()
exten => o,1,Background(one-moment-please)      ; 0 during vm message will hangup
exten => o,2,GotoIf($["foo${FROM_DID}" = "foo"]?from-pstn,s,1:from-pstn,${FROM_DID},1)
exten => a,1,Macro(get-vmcontext,${ARG1})
exten => a,2,VoiceMailMain(${ARG1}@${VMCONTEXT})
exten => a,3,Hangup

; get the voicemail context for the user in ARG1
[macro-get-vmcontext]
exten => s,1,Set(VMCONTEXT=${DB(AMPUSER/${ARG1}/voicemail)})
exten => s,2,GotoIf($["foo${VMCONTEXT}" = "foo"]?200:300)
exten => s,200,Set(VMCONTEXT=default)
exten => s,300,NoOp()

; For some reason, if I don't run setCIDname, CALLERID(name) will be blank in my AGI
; ARGS: none
[macro-fixcid]
exten => s,1,Set(CALLERID(name)=${CALLERID(name)})

; Ring groups of phones
; ARGS: comma separated extension list
; 1 - Ring Group Strategy
; 2 - ringtimer
; 3 - prefix
; 4 - extension list
[macro-rg-group]
exten => s,1,Macro(user-callerid)
exten => s,2,GotoIf($["${CALLERID(name):0:${LEN(${RGPREFIX})}}" != "${RGPREFIX}"]?4:3)  ; check for old prefix
exten => s,3,Set(CALLERID(name)=${CALLERID(name):${LEN(${RGPREFIX})}}) ; strip off old prefix
exten => s,4,Set(RGPREFIX=${ARG3})  ; set new prefix
exten => s,5,Set(CALLERID(name)=${RGPREFIX}${CALLERID(name)})  ; add prefix to callerid name
exten => s,6,Set(RecordMethod=Group)  ; set new prefix
exten => s,7,Macro(record-enable,${MACRO_EXTEN},${RecordMethod})
exten => s,8,Set(RingGroupMethod=${ARG1})     ;
exten => s,9,Macro(dial,${ARG2},${DIAL_OPTIONS},${ARG4})
exten => s,10,Set(RingGroupMethod='')     ;


;
; Outgoing channel(s) are busy ... inform the client
;
[macro-outisbusy]
exten => s,1,Playback(all-circuits-busy-now)
exten => s,2,Playback(pls-try-call-later)
exten => s,3,Macro(hangupcall)

; What to do on hangup.
[macro-hangupcall]
exten => s,1,ResetCDR(w)
exten => s,2,NoCDR()
exten => s,3,Wait(5)
exten => s,4,Hangup

[macro-faxreceive]
exten => s,1,Set(FAXFILE=/var/spool/asterisk/fax/${UNIQUEID}.tif)
exten => s,2,Set(EMAILADDR=${FAX_RX_EMAIL})
exten => s,3,rxfax(${FAXFILE})
exten => s,103,Set(EMAILADDR=${FAX_RX_EMAIL})
exten => s,104,Goto(3)

; dialout and strip the prefix
[macro-dialout]
exten => s,1,Macro(user-callerid)
exten => s,2,GotoIf($["${ECID${CALLERID(number)}}" = ""]?5)     ;check for CID override for exten
exten => s,3,Set(CALLERID(all)=${ECID${CALLERID(number)}})
exten => s,4,Goto(7)
exten => s,5,GotoIf($["${OUTCID_${ARG1}}" = ""]?7)         ;check for CID override for trunk
exten => s,6,Set(CALLERID(all)=${OUTCID_${ARG1}})
exten => s,7,Set(length=${LEN(${DIAL_OUT_${ARG1}})})
exten => s,8,Dial(${OUT_${ARG1}}/${ARG2:${length}})
exten => s,9,Congestion
exten => s,109,Macro(outisbusy)


; dialout using default OUT trunk - no prefix
[macro-dialout-default]
exten => s,1,Macro(user-callerid)
exten => s,2,Macro(record-enable,${CALLERID(number)},OUT)
exten => s,3,Macro(outbound-callerid,${ARG1})
exten => s,4,Dial(${OUT}/${ARG1})
exten => s,5,Congestion
exten => s,105,Macro(outisbusy)

; dialout using a trunk, using pattern matching (don't strip any prefix)
; arg1 = trunk number, arg2 = number, arg3 = route password
[macro-dialout-trunk]
exten => s,1,GotoIf($["${ARG3}" = ""]?3:2)    ; arg3 is pattern password
exten => s,2,Authenticate(${ARG3})
exten => s,3,Macro(user-callerid)
exten => s,4,Macro(record-enable,${CALLERID(number)},OUT)
exten => s,5,Macro(outbound-callerid,${ARG1})
exten => s,6,Set(GROUP()=OUT_${ARG1})
exten => s,7,GotoIf($[ ${GROUP_COUNT()} > ${OUTMAXCHANS_${ARG1}} ]?108)
; if we've used up the max channels, continue at (n+101)
exten => s,8,Set(DIAL_NUMBER=${ARG2})
exten => s,9,Set(DIAL_TRUNK=${ARG1})
exten => s,10,AGI(fixlocalprefix) ; this sets DIAL_NUMBER to the proper dial string for this trunk
exten => s,11,Set(OUTNUM=${OUTPREFIX_${ARG1}}${DIAL_NUMBER})  ; OUTNUM is the final dial number
exten => s,12,Set(custom=${CUT(OUT_${ARG1},:,1)})  ; Custom trunks are prefixed with "AMP:"
exten => s,13,GotoIf($["${custom}" = "AMP"]?16)
exten => s,14,Dial(${OUT_${ARG1}}/${OUTNUM}|120|W)  ; Regular Trunk Dial, allow recording.
exten => s,15,Goto(s-${DIALSTATUS},1)

; This is a custom trunk.  Substitute $OUTNUM$ with the actual number and rebuild the dialstring
; example trunks: "AMP:CAPI/XXXXXXXX:b$OUTNUM$,30,r", "AMP:OH323/$OUTNUM$@XX.XX.XX.XX:XXXX"
exten => s,16,Set(pre_num=${CUT(OUT_${ARG1},$,1)})
exten => s,17,Set(the_num=${CUT(OUT_${ARG1},$,2)})  ; this is where we expect to find string OUTNUM
exten => s,18,Set(post_num=${CUT(OUT_${ARG1},$,3)})
exten => s,19,GotoIf($["${the_num}" = "OUTNUM"]?20:21) ; if we didn't find "OUTNUM", then skip to Dial
exten => s,20,Set(the_num=${OUTNUM}) ; replace "OUTNUM" with the actual number to dial
exten => s,21,Dial(${pre_num:4}${the_num}${post_num})
exten => s,22,Goto(s-${DIALSTATUS},1)

exten => s,108,Noop(max channels used up)
exten => s-BUSY,1,NoOp(Trunk is reporting BUSY)
exten => s-BUSY,2,Busy()
exten => s-BUSY,3,Wait(60)
exten => s-BUSY,4,NoOp()

exten => _s-.,1,NoOp(Dial failed due to ${DIALSTATUS})

; Adds a dynamic agent/member to a Queue
; Prompts for call-back number - in not entered, uses CIDNum
[macro-agent-add]
exten => s,1,Wait(1)
exten => s,2,Macro(user-callerid)
exten => s,3,Read(CALLBACKNUM,agent-user)      ; get callback number from user
exten => s,4,GotoIf($["${CALLBACKNUM}" = ""]?5:7))    ; if user just pressed # or timed out, use cidnum
exten => s,5,Set(CALLBACKNUM=${CALLERID(number)})
exten => s,6,GotoIf($["${CALLBACKNUM}" = ""]?2))    ; if still no number, start over
exten => s,7,GotoIf($["${ARG2}" = ""]?9:8))    ; arg2 is queue password
exten => s,8,Authenticate(${ARG2})
exten => s,9,AddQueueMember(${ARG1}|Local/${CALLBACKNUM}@from-internal/n)    ; using chan_local allows us to have agents over trunks
exten => s,10,UserEvent(Agentlogin|Agent: ${CALLBACKNUM})
exten => s,11,Wait(1)
exten => s,12,Playback(agent-loginok)
exten => s,13,Hangup()

; Removes a dynamic agent/member from a Queue
; Prompts for call-back number - in not entered, uses CIDNum
[macro-agent-del]
exten => s,1,Wait(1)
exten => s,2,Macro(user-callerid)
exten => s,3,Read(CALLBACKNUM,agent-user)      ; get callback number from user
exten => s,4,GotoIf($["${CALLBACKNUM}" = ""]?5:7))    ; if user just pressed # or timed out, use cidnum
exten => s,5,Set(CALLBACKNUM=${CALLERID(number)})
exten => s,6,GotoIf($["${CALLBACKNUM}" = ""]?2))    ; if still no number, start over
exten => s,7,RemoveQueueMember(${ARG1}|Local/${CALLBACKNUM}@from-internal/n)
exten => s,8,UserEvent(RefreshQueue)
exten => s,9,Wait(1)
exten => s,10,Playback(agent-loggedoff)
exten => s,11,Hangup()

; arg1 = trunk number, arg2 = number
[macro-dialout-enum]
; This has been violently beaten upon by Rob Thomas, xrobau@gmail.com
; to 1: Be compliant with all the depreciated bits in asterisk 1.2 and
; above, and 2: to give a good shot at attempting to be compliant with
; RFC3761 by honouring the order in which records are returned.
exten => s,1,Macro(user-callerid)
exten => s,n,Macro(record-enable,${CALLERID(number)},OUT)
exten => s,n,Macro(outbound-callerid,${ARG1})
exten => s,n,Set(GROUP()=OUT_${ARG1})
exten => s,n,GotoIf($[ ${GROUP_COUNT()} > ${OUTMAXCHANS_${ARG1} ]?nochans)
exten => s,n,Set(DIAL_NUMBER=${ARG2})
exten => s,n,Set(DIAL_TRUNK=${ARG1})
exten => s,n,AGI(fixlocalprefix)  ; this sets DIAL_NUMBER to the proper dial string for this trunk
exten => s,n,GotoIf($["${DIAL_NUMBER:0:1}" = "+"]?hasplus) ; Skip next line if it already is prefixed by a plus
exten => s,n,Set(DIAL_NUMBER=+${DIAL_NUMBER}) ; Add a plus to the start, becasue ENUMLOOKUP needs it.
; OK, this is now quite complex. To remain compliant, we have to iterate
; through, in order, the returned records. Since we want to make this
; call over the network, we can ignore tel: lines. Even if it's first
; priority.
exten => s,n(hasplus),Set(ENUMCOUNT=${ENUMLOOKUP(${DIAL_NUMBER},ALL,c,e164.org)})  ;  Should e164.org be a var? I think so.
; Now the count may be zero, so if it is, just go to failed
exten => s,n,GotoIf($[ $[ ${ENUMCOUNT} = 0 ] | $[x${ENUMCOUNT} = x ] ]?failed)
; Now, let's start through them.
exten => s,n,Set(ENUMPTR=1)
exten => s,n(startloop),Set(ENUM=${ENUMLOOKUP(${DIAL_NUMBER},ALL,${ENUMPTR},e164.org)})
; Sanity check the return, make sure there's something in there.
exten => s,n,GotoIf($[${LEN(${ENUM})} = 0 ]?continue)
exten => s,n,GotoIf($["${ENUM:0:3}" = "sip" ]?sipuri)
exten => s,n,GotoIf($["${ENUM:0:3}" = "iax" ]?iaxuri)
; It doesn't matter if you don't have h323 enabled, as when it tries to dial, it cares
; about dialstatus and retries if there are any enum results left.
exten => s,n,GotoIf($["${ENUM:0:3}" = "h32" ]?h323uri)
; If we're here, it's not a protocol we know about. Let's increment the pointer
; and if it's more than ENUMCOUNT, we know we've run out of options. We also can
; come here if the enum string we've received is empty, or if the Dial command
; returned CONGESTION or CHANUNAVAIL.
exten => s,n(continue),Set(ENUMPTR=$[${ENUMPTR}+1])
exten => s,n,GotoIf($[${ENUMPTR} > ${ENUMCOUNT}]?failed)
; OK. If we're here, we've still got some enum entries to go through. Back to
; the start with you!
exten => s,n,Goto(startloop)
; If the prefix is 'sip:'...
exten => s,n(sipuri),Set(DIALSTR=SIP/${ENUM:4})
exten => s,n,Goto(dodial)
; If it's IAX2...
exten => s,n(iaxuri),Set(DIALSTR=IAX2/${ENUM:5})
exten => s,n,Goto(dodial)
; Or even if it's H323.
exten => s,n(h323uri),Set(DIALSTR=H323/${ENUM:5})

exten => s,n(dodial),Dial(${DIALSTR})
exten => s,n,NoOp(Dial exited in macro-enum-dialout with ${DIALSTATUS})
; Now, if we're still here, that means the Dial failed for some reason.
; If it's CONGESTION or CHANUNAVAIL we probably want to try again on a
; different channel. However, if it's the last one, we don't have any
; left, and I didn't keep any previous dialstatuses, so hopefully
; someone looking throught the logs would have seen the NoOp's
exten => s,n,GotoIf($["${ENUMPTR}" = "${ENUMCOUNT}"]?noneleft)
exten => s,n,GotoIf($[ $[ "${DIALSTATUS}" = "CHANUNAVAIL" ] | $[ "${DIALSTATUS}" = "CONGESTION" ] ]?continue)
; If we're here, then it's BUSY or NOANSWER or something and well, deal with it.
exten => s,n(noneleft),Goto(s-${DIALSTATUS},1)
; Here are the exit points for the macro.
exten => s,n(failed),NoOp(EnumLookup failed)
exten => s,n,Goto(end)
exten => s,n(nochans),NoOp(max channels used up)
exten => s,n(end),NoOp(Exiting macro-dialout-enum)

exten => s-BUSY,1,NoOp(Trunk is reporting BUSY)
exten => s-BUSY,2,Busy()
exten => s-BUSY,3,Wait(60)
exten => s-BUSY,4,NoOp()

exten => _s-.,1,NoOp(Dial failed due to ${DIALSTATUS})

[macro-record-enable]
exten => s,1,GotoIf(${LEN(${BLINDTRANSFER})} > 0?2:4)
exten => s,2,ResetCDR(w)
exten => s,3,StopMonitor()
exten => s,4,AGI(recordingcheck,${TIMESTAMP},${UNIQUEID})
exten => s,5,Noop(No recording needed)
exten => s,999,Monitor(wav49,${CALLFILENAME}, mb)

;exten => s,3,BackGround(for-quality-purposes)
;exten => s,4,BackGround(this-call-may-be)
;exten => s,5,BackGround(recorded)

; This macro is for dev purposes and just dumps channel/app variables.  Useful when designing new contexts.
[macro-dumpvars]
exten => s,1,Noop(ACCOUNTCODE=${ACCOUNTCODE})
exten => s,2,Noop(ANSWEREDTIME=${ANSWEREDTIME})
exten => s,3,Noop(BLINDTRANSFER=${BLINDTRANSFER})
exten => s,4,Noop(CALLERID=${CALLERID(all)})
exten => s,5,Noop(CALLERID(name)=${CALLERID(name)})
exten => s,6,Noop(CALLERID(number)=${CALLERID(number)})
exten => s,7,Noop(CALLINGPRES=${CALLINGPRES})
exten => s,8,Noop(CHANNEL=${CHANNEL})
exten => s,9,Noop(CONTEXT=${CONTEXT})
exten => s,10,Noop(DATETIME=${DATETIME})
exten => s,11,Noop(DIALEDPEERNAME=${DIALEDPEERNAME})
exten => s,12,Noop(DIALEDPEERNUMBER=${DIALEDPEERNUMBER})
exten => s,13,Noop(DIALEDTIME=${DIALEDTIME})
exten => s,14,Noop(DIALSTATUS=${DIALSTATUS})
exten => s,15,Noop(DNID=${DNID})
exten => s,16,Noop(EPOCH=${EPOCH})
exten => s,17,Noop(EXTEN=${EXTEN})
exten => s,18,Noop(HANGUPCAUSE=${HANGUPCAUSE})
exten => s,19,Noop(INVALID_EXTEN=${INVALID_EXTEN})
exten => s,20,Noop(LANGUAGE=${LANGUAGE})
exten => s,21,Noop(MEETMESECS=${MEETMESECS})
exten => s,22,Noop(PRIORITY=${PRIORITY})
exten => s,23,Noop(RDNIS=${RDNIS})
exten => s,24,Noop(SIPDOMAIN=${SIPDOMAIN})
exten => s,25,Noop(SIP_CODEC=${SIP_CODEC})
exten => s,26,Noop(SIPCALLID=${SIPCALLID})
exten => s,27,Noop(SIPUSERAGENT=${SIPUSERAGENT})
exten => s,28,Noop(TIMESTAMP=${TIMESTAMP})
exten => s,29,Noop(TXTCIDNAME=${TXTCIDNAME})
exten => s,30,Noop(UNIQUEID=${UNIQUEID})
exten => s,31,Noop(TOUCH_MONITOR=${TOUCH_MONITOR})
exten => s,32,Noop(MACRO_CONTEXT=${MACRO_CONTEXT})
exten => s,33,Noop(MACRO_EXTEN=${MACRO_EXTEN})
exten => s,34,Noop(MACRO_PRIORITY=${MACRO_PRIORITY})

[macro-user-logon]
; check device type
exten => s,1,Set(DEVICETYPE=${DB(DEVICE/${CALLERID(number)}/type)})
exten => s,2,GotoIf($["${DEVICETYPE}" = "fixed"]?s-FIXED,1)
; get user's extension
exten => s,3,Set(AMPUSER=${ARG1})
exten => s,4,GotoIf($["${AMPUSER}" = ""]?5:9)
exten => s,5,BackGround(please-enter-your)
exten => s,6,Playback(extension)
exten => s,7,Read(AMPUSER,then-press-pound)
; get user's password and authenticate
exten => s,8,Wait(1)
exten => s,9,Set(AMPUSERPASS=${DB(AMPUSER/${AMPUSER}/password)})
exten => s,10,GotoIf($[${LEN(${AMPUSERPASS})} = 0]?s-NOPASSWORD,1)
; do not continue if the user has already logged onto this device
exten => s,11,Set(DEVICEUSER=${DB(DEVICE/${CALLERID(number)}/user)})
exten => s,12,GotoIf($["${DEVICEUSER}" = "${AMPUSER}"]?s-ALREADYLOGGEDON,1)
exten => s,13,Authenticate(${AMPUSERPASS})
; devices can only be mapped to one user - loggoff anyone else who is here
exten => s,14,Macro(user-logoff)
; map user to device
exten => s,15,Set(AMPUSERDEVICES=${DB(AMPUSER/${AMPUSER}/device)})
exten => s,16,GotoIf($[${LEN(${AMPUSERDEVICES})} = 0]?18)
exten => s,17,Set(AMPUSERDEVICES=${AMPUSERDEVICES}&)
exten => s,18,Set(AMPUSERDEVICES=${AMPUSERDEVICES}${CALLERID(number)})
exten => s,19,Set(DB(AMPUSER/${AMPUSER}/device)=${AMPUSERDEVICES})
; map device to user
exten => s,20,Set(DB(DEVICE/${CALLERID(number)}/user)=${AMPUSER})
; create symlink from dummy device mailbox to user's mailbox
exten => s,21,System(/bin/ln -s /var/spool/asterisk/voicemail/default/${AMPUSER}/ /var/spool/asterisk/voicemail/device/${CALLERID(number)})

exten => s-FIXED,1,NoOp(Device is FIXED and cannot be logged into)
exten => s-FIXED,2,Playback(ha/phone)
exten => s-FIXED,3,SayDigits(${CALLERID(number)})
exten => s-FIXED,4,Playback(is-curntly-unavail)
exten => s-FIXED,5,Playback(vm-goodbye)
exten => s-FIXED,6,Hangup ;TODO should play msg indicated device cannot be logged into

exten => s-ALREADYLOGGEDON,1,NoOp(This device has already been logged into by this user)
exten => s-ALREADYLOGGEDON,2,Playback(vm-goodbye)
exten => s-ALREADYLOGGEDON,3,Hangup ;TODO should play msg indicated device is already logged into

exten => s-NOPASSWORD,1,NoOp(This extension does not exist or no password is set)
exten => s-NOPASSWORD,2,Playback(an-error-has-occured)
exten => s-NOPASSWORD,3,Playback(vm-goodbye)
exten => s-NOPASSWORD,4,Hangup ;TODO should play msg indicated device is already logged into

[macro-user-logoff]
; check device type
exten => s,1,Set(DEVICETYPE=${DB(DEVICE/${CALLERID(number)}/type)})
exten => s,2,GotoIf($["${DEVICETYPE}" = "fixed"]?s-FIXED,1)
; remove entry from user's DEVICE key
; delete the symlink to user's voicemail box
exten => s,3,System(rm -f /var/spool/asterisk/voicemail/device/${CALLERID(number)})
exten => s,4,Set(DEVAMPUSER=${DB(DEVICE/${CALLERID(number)}/user)})
exten => s,5,Set(AMPUSERDEVICES=${DB(AMPUSER/${DEVAMPUSER}/device)})
exten => s,6,AGI(list-item-remove.php,${AMPUSERDEVICES},${CALLERID(number)},AMPUSERDEVICES,&)
; reset user -> device mapping
; users can log onto multiple devices, need to just remove device from value
exten => s,7,Set(DB(AMPUSER/${DEVAMPUSER}/device)=${AMPUSERDEVICES})
; reset device -> user mapping
exten => s,8,Set(DB(DEVICE/${CALLERID(number)}/user)=none)
exten => s,9,Playback(vm-goodbye)

exten => s-FIXED,1,NoOp(Device is FIXED and cannot be logged out of)
exten => s-FIXED,2,Playback(an-error-has-occured)
exten => s-FIXED,3,Playback(vm-goodbye)
exten => s-FIXED,4,Hangup ;TODO should play msg indicated device cannot be logged into

;sets the callerid of the device to that of the logged in user
[macro-user-callerid]
exten => s,1,Set(AMPUSER=${DB(DEVICE/${CALLERID(number)}/user)})
exten => s,2,Set(EMERGENCYCID=${DB(DEVICE/${CALLERID(number)}/emergency_cid)})
exten => s,3,Set(AMPUSERCIDNAME=${DB(AMPUSER/${AMPUSER}/cidname)})
exten => s,4,GotoIf($["${AMPUSERCIDNAME}" = ""]?6)
exten => s,5,Set(CALLERID(all)=\"${AMPUSERCIDNAME}\" <${AMPUSER}>)
exten => s,6,NoOp(Using CallerID ${CALLERID(all)})

; overrides callerid out trunks
; arg1 is trunk
; macro-user-callerid should be called _before_ using this macro
[macro-outbound-callerid]
exten => s,1,Set(USEROUTCID=${DB(AMPUSER/${CALLERID(number)}/outboundcid)})
exten => s,2,GotoIf($["${OUTCID_${ARG1}:1:2}" = ""]?4)  ;check for CID override for trunk (global var)
exten => s,3,Set(CALLERID(all)=${OUTCID_${ARG1}})
exten => s,4,GotoIf($["${USEROUTCID:1:2}" = ""]?6) ; check CID override for extension
exten => s,5,Set(CALLERID(all)=${USEROUTCID})
exten => s,6,GotoIf($["${EMERGENCYROUTE:1:2}" = ""]?8) ; check EMERGENCYROUTE override (set by route)
exten => s,7,Set(CALLERID(all)=${EMERGENCYCID}) ; emergency cid for device
exten => s,8,NoOp(CallerID set to ${CALLERID(all)})

; ############################################################################
; Applications [app]
; ############################################################################
; Moved to external file applications.conf

#include applications.conf


;
; ############################################################################
; Inbound Contexts [from]
; ############################################################################

[from-sip-external]

;give external sip users congestion and hangup
include => from-pstn
;exten => _.,1,Set(TIMEOUT(absolute)=15)
;exten => _.,2,Congestion
;exten => _.,3,Hangup

[from-internal]
;allow phones to use applications
include => app-userlogonoff
include => app-directory
include => app-dnd
include => app-callforward
include => app-callwaiting
include => app-messagecenter
include => app-calltrace
include => parkedcalls
include => from-internal-custom
;allow phones to dial other extensions
include => ext-fax
include => ext-zapbarge
include => ext-record
include => ext-test
;allow phones to access generated contexts
include => from-internal-additional
exten => s,1,Macro(hangupcall)
exten => h,1,Macro(hangupcall)

; ############################################################################
; Extension Contexts [ext]
; ############################################################################

[ext-zapbarge]
exten => 888,1,Macro(user-callerid)
exten => 888,2,Set(GROUP()=${CALLERID(number)})
exten => 888,3,Answer
exten => 888,4,Wait(1)
exten => 888,5,ZapBarge
exten => 888,6,Hangup

[ext-fax]
exten => s,1,Answer
exten => s,2,Goto(in_fax,1)
exten => in_fax,1,GotoIf($["${FAX_RX}" = "system"]?2:analog_fax,1)
exten => in_fax,2,Macro(faxreceive)
exten => in_fax,3,system(tiff2ps -2eaz -w 8.5 -h 11 ${FAXFILE} | ps2pdf - ${FAXFILE}.pdf)
exten => in_fax,4,system(mime-construct --to ${EMAILADDR} --subject "Fax from ${CALLERID(number)} ${CALLERID(name)}" --attachment ${CALLERID(number)}.pdf --type application/pdf --file ${FAXFILE}.pdf)
exten => in_fax,5,system(rm ${FAXFILE} ${FAXFILE}.pdf)
exten => in_fax,6,Hangup
exten => analog_fax,1,GotoIf($["${FAX_RX}" = "disabled"]?3:2)  ;if fax is disabled, just hang up
exten => analog_fax,2,Set(DIAL=${DB(DEVICE/${FAX_RX}/dial)});
exten => analog_fax,3,Dial(${DIAL},20,d)
exten => analog_fax,4,Hangup
;exten => out_fax,1,wait(7)
exten => out_fax,1,txfax(${TXFAX_NAME}|caller)
exten => out_fax,2,Hangup
exten => h,1,Hangup()

[ext-record]
exten => *77,1,Macro(user-callerid)
exten => *77,2,Wait(2)
exten => *77,3,Record(${CALLERID(number)}-ivrrecording:wav)
exten => *77,4,Wait(2)
exten => *77,5,Hangup
exten => *99,1,Macro(user-callerid)
exten => *99,2,Playback(${CALLERID(number)}-ivrrecording)
exten => *99,3,Wait(2)
exten => *99,4,Hangup

;this is where parked calls go if they time-out.  Should probably re-ring
[default]
include => ext-local
exten => s,1,Playback(vm-goodbye)
exten => s,2,Macro(hangupcall)

[ext-test]
exten => 7777,1,Goto(from-pstn,s,1)
exten => 666,1,Goto(ext-fax,in_fax,1)
exten => h,1,Macro(hangupcall)

;echo test
exten => *43,1,Answer
exten => *43,2,Wait(2)
exten => *43,3,Playback(demo-echotest)
exten => *43,4,Echo
exten => *43,5,Playback(demo-echodone)
exten => *43,6,Hangup

---------------------------------------------------------------------
---------------------------------------------------------------------
Файл SIP_ADDITIONAL.CONF
register=2124646:13364test@sipnet.ru/2124646

[1100]
username=1100
type=friend
secret=1100
record_out=Adhoc
record_in=Adhoc
qualify=no
port=5060
nat=never
mailbox=1100@device
host=dynamic
dtmfmode=rfc2833
context=from-internal
canreinvite=no
callgroup=1110
callerid=1100 <1100>

[1101]
username=1101
type=friend
secret=1101
record_out=Adhoc
record_in=Adhoc
qualify=no
port=5060
nat=never
mailbox=1101@device
host=dynamic
dtmfmode=rfc2833
context=from-internal
canreinvite=no
callerid=1101 <1101>

[1102]
username=1102
type=friend
secret=1102
record_out=Adhoc
record_in=Adhoc
qualify=no
port=5060
nat=never
mailbox=1102@device
host=dynamic
dtmfmode=rfc2833
context=from-internal
canreinvite=no
callerid=1102 <1102>

[1103]
username=1103
type=friend
secret=1103
record_out=Adhoc
record_in=Adhoc
qualify=no
port=5060
nat=never
mailbox=1103@device
host=dynamic
dtmfmode=rfc2833
context=from-internal
canreinvite=no
callerid=1103 <1103>

[1104]
username=1104
type=friend
secret=1104
record_out=Adhoc
record_in=Adhoc
qualify=no
port=5060
nat=never
mailbox=1104@device
host=dynamic
dtmfmode=rfc2833
context=from-internal
canreinvite=no
callerid=1104 <1104>

[1105]
username=1105
type=friend
secret=1105
record_out=Adhoc
record_in=Adhoc
qualify=no
port=5060
nat=never
mailbox=1105@device
host=dynamic
dtmfmode=rfc2833
context=from-internal
canreinvite=no
callerid=1105 <1105>

[1106]
username=1106
type=friend
secret=1106
record_out=Adhoc
record_in=Adhoc
qualify=no
port=5060
nat=never
mailbox=1106@device
host=dynamic
dtmfmode=rfc2833
context=from-internal
canreinvite=no
callerid=SNikitin <1106>

[1107]
username=1107
type=friend
secret=1107
record_out=Adhoc
record_in=Adhoc
qualify=no
port=5060
nat=never
mailbox=1107@device
host=dynamic
dtmfmode=rfc2833
context=from-internal
canreinvite=no
callerid=NVarenov <1107>

[1108]
username=1108
type=friend
secret=1108
record_out=Adhoc
record_in=Adhoc
qualify=no
port=5060
nat=never
mailbox=1108@device
host=dynamic
dtmfmode=rfc2833
context=from-internal
canreinvite=no
callerid=ASazonov <1108>

[200]
username=200
type=friend
secret=200
record_out=Adhoc
record_in=Adhoc
qualify=no
port=5060
nat=never
mailbox=200@device
host=dynamic
dtmfmode=rfc2833
context=from-internal
canreinvite=no
callerid=200 <200>

[201]
username=201
type=friend
secret=201
record_out=Adhoc
record_in=Adhoc
qualify=no
port=5060
nat=never
mailbox=201@device
host=dynamic
dtmfmode=rfc2833
context=from-internal
canreinvite=no
callerid=201 <201>

[202]
username=202
type=friend
secret=202
record_out=Adhoc
record_in=Adhoc
qualify=no
port=5060
nat=never
mailbox=202@device
host=dynamic
dtmfmode=rfc2833
context=from-internal
canreinvite=no
callerid=202 <202>

[2124646]
type=user
secret=13364test
context=from-pstn

[sipnet]
username=2124646
type=peer
secret=13364test
insecure=invite
host=sipnet.ru
fromuser=2124646
fromdomain=sipnet.ru
allow=alaw
allow=gsm

Правка | Высказать мнение | Ответить | Cообщить модератору | Наверх

3. "Asterisk PBX - у кого работает HELP!!! "  
Сообщение от flatciz email on 06-Июн-06, 13:26 
забыл добавить extencion_additional.conf

[globals]
#include globals_custom.conf
APP-DIRECTORY = #
APP-DIRECTORY-TOTAL = *411
APP-DND-ON = *78
APP-DND-OFF = *79
APP-MESSAGECENTER = *98
APP-MESSAGECENTER-DIRECT = *97
APP-CALLWAITING-ON = *70
APP-CALLWAITING-OFF = *71
APP-CALLFORWARD-ON = *72
APP-CALLFORWARD-OFF = *73
APP-CALLFORWARD-BUSY-ON = *90
APP-CALLFORWARD-BUSY-OFF = *91
APP-CALLTRACE = *69
APP-USERLOGON = *11
APP-USERLOGOFF = *12
AFTER_INCOMING =
CALLFILENAME = ""
DIALOUTIDS = 2/
DIAL_OPTIONS = tr
DIAL_OUT = 9
DIRECTORY = last
DIRECTORY_OPTS =
FAX =
FAX_RX = system
FAX_RX_EMAIL = root@czins.ru
INCOMING = group-all
IN_OVERRIDE = forcereghours
NULL = ""
OPERATOR =
OUTCID_2 = 2124646
OUTMAXCHANS_2 =
OUTPREFIX_2 = 9
OUT_2 = SIP/sipnet
PARKNOTIFY = SIP/200
RECORDEXTEN = ""
REGDAYS = mon-fri
REGTIME = 7:55-17:05
RINGTIMER = 15
VM_PREFIX = *


;end of [globals]


[ext-meetme]
include => ext-meetme-custom
exten => 1110,1,Set(MEETME_ROOMNUM=1110)
exten => 1110,n,GotoIf($[${DIALSTATUS} = ANSWER]?READPIN)
exten => 1110,n,Answer
exten => 1110,n,Wait(1)
exten => 1110,n(READPIN),Read(PIN,enter-conf-pin-number,,)
exten => 1110,n,GotoIf($[foo${PIN} = foo1110]?USER)
exten => 1110,n,GotoIf($[${PIN} = 1110]?ADMIN)
exten => 1110,n,Playback(conf-invalidpin)
exten => 1110,n,Goto(READPIN)
exten => 1110,n(ADMIN),Set(MEETME_OPTS=aAwqciMs)
exten => 1110,n,Goto(STARTMEETME,1)
exten => 1110,n(USER),Set(MEETME_OPTS=wqciMs)
exten => 1110,n,Goto(STARTMEETME,1)
exten => STARTMEETME,1,MeetMe(${MEETME_ROOMNUM},${MEETME_OPTS},${PIN})
exten => STARTMEETME,n,Hangup
exten => h,1,Hangup

; end of [ext-meetme]


[ext-did]
include => ext-did-custom
exten => 2124646,1,Set(FROM_DID=2124646)
exten => 2124646,n,Goto(ext-local,200,1)

; end of [ext-did]


[ext-local]
include => ext-local-custom
exten => 200,1,Macro(exten-vm,200,200)
exten => 200,hint,SIP/200
exten => ${VM_PREFIX}200,1,Macro(vm,200)
exten => 201,1,Macro(exten-vm,201,201)
exten => 201,hint,SIP/201
exten => ${VM_PREFIX}201,1,Macro(vm,201)
exten => 202,1,Macro(exten-vm,202,202)
exten => 202,hint,SIP/202
exten => ${VM_PREFIX}202,1,Macro(vm,202)
exten => 1100,1,Macro(exten-vm,1100,1100)
exten => 1100,hint,SIP/1100
exten => ${VM_PREFIX}1100,1,Macro(vm,1100)
exten => 1101,1,Macro(exten-vm,novm,1101)
exten => 1101,hint,SIP/1101
exten => 1102,1,Macro(exten-vm,1102,1102)
exten => 1102,hint,SIP/1102
exten => ${VM_PREFIX}1102,1,Macro(vm,1102)
exten => 1103,1,Macro(exten-vm,1103,1103)
exten => 1103,hint,SIP/1103
exten => ${VM_PREFIX}1103,1,Macro(vm,1103)
exten => 1104,1,Macro(exten-vm,1104,1104)
exten => 1104,hint,SIP/1104
exten => ${VM_PREFIX}1104,1,Macro(vm,1104)
exten => 1105,1,Macro(exten-vm,1105,1105)
exten => 1105,hint,SIP/1105
exten => ${VM_PREFIX}1105,1,Macro(vm,1105)
exten => 1106,1,Macro(exten-vm,1106,1106)
exten => 1106,hint,SIP/1106
exten => ${VM_PREFIX}1106,1,Macro(vm,1106)
exten => 1107,1,Macro(exten-vm,1107,1107)
exten => 1107,hint,SIP/1107
exten => ${VM_PREFIX}1107,1,Macro(vm,1107)
exten => 1108,1,Macro(exten-vm,1108,1108)
exten => 1108,hint,SIP/1108
exten => ${VM_PREFIX}1108,1,Macro(vm,1108)

; end of [ext-local]


[outbound-allroutes]
include => outbound-allroutes-custom
include => outrt-001-sipnet-out
exten => foo,1,Noop(bar)

; end of [outbound-allroutes]


[outrt-001-sipnet-out]
include => outrt-001-sipnet-out-custom
exten => _NXXXXXX,1,Macro(dialout-trunk,2,${EXTEN},,)
exten => _NXXXXXX,n,Macro(outisbusy,)
exten => _NXXXXXXX,1,Macro(dialout-trunk,2,${EXTEN},,)
exten => _NXXXXXXX,n,Macro(outisbusy,)
exten => _NXXXXXXXXX,1,Macro(dialout-trunk,2,${EXTEN},,)
exten => _NXXXXXXXXX,n,Macro(outisbusy,)

; end of [outrt-001-sipnet-out]


[from-internal-additional]
include => from-internal-additional-custom
include => ext-group
include => ext-meetme
include => ext-queues
include => ext-local
include => outbound-allroutes
exten => h,1,Hangup

; end of [from-internal-additional]


Правка | Высказать мнение | Ответить | Cообщить модератору | Наверх

4. "Asterisk PBX - у кого работает HELP!!! "  
Сообщение от RomanG (??) on 06-Июн-06, 16:45 
Чесное слово, ТАКОЕ читать просто лень.
Создайте сами руками простой конфиг sip.conf и extensions.conf. попробуйте сделать Dial.
Покажите сюда эти конфиги (это не более 25 строк, уверяю вас), покажите как проходит звонок просто без дебага пока.

Конфиги, генерируемые различными AMP и иже подобными конфигурялками, довольно сложны для понимания, и не только для начинающего.

Правка | Высказать мнение | Ответить | Cообщить модератору | Наверх

5. "Asterisk PBX - у кого работает HELP!!! "  
Сообщение от flatciz email on 07-Июн-06, 09:44 
вовсем разобрался сам спасибо всем.... напутал с излишними префиксами и правилом набора...
сейчас наслаждаюсь бесплатными звонками в питер
Правка | Высказать мнение | Ответить | Cообщить модератору | Наверх

6. "Asterisk PBX - у кого работает HELP!!! "  
Сообщение от RomanG (??) on 07-Июн-06, 11:46 
Ну вот и отлично.
Правка | Высказать мнение | Ответить | Cообщить модератору | Наверх

Архив | Удалить

Индекс форумов | Темы | Пред. тема | След. тема
Оцените тред (1=ужас, 5=супер)? [ 1 | 2 | 3 | 4 | 5 ] [Рекомендовать для помещения в FAQ]




Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру