Hi,
Thx for your reply. I read that book and try to understand the behavior of extentions.conf. Any way i have edited the extentions.conf. But it dosen’t work correctly. I’m not good in programming. Please help me to fix this problem.
Extentions.conf
; dialout using default OUT trunk - no prefix
[macro-dialout-default]
exten => s,1,Macro(user-callerid,SKIPTTL)
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,Playtones(congestion)
exten => s,6,Congestion(5)
exten => s,105,Macro(outisbusy)
[macro-dialout-trunk-predial-hook]
; this macro intentionally left blank so it may be safely overwritten for any custom
; requirements that an installation may have.
;
; MACRO RETURN CODE: ${PREDIAL_HOOK_RET}
; if set to “BYPASS” then this trunk will be skipped
;
exten => s,n,macro(dialanalog)
[macro-dialanalog]
exten => s,1,NoOp
exten => s,n(clear), Dial(${DIALOUTANALOG}|${ARG2}|M(dialanalogcont^${ARG1}))
exten => s,clear+101, Set(MACRO_OFFSET=100)
[macro-dialanalogcont]
exten => s,1,NoOp
exten => s,n(silence), WaitForSilence(100)
exten => s,n, GotoIf($"${WAITSTATUS}" = “SILENCE”?silence) ; Loop if silence is detected
exten => s,n(realdial),SendDTMF(${ARG1})
exten => s,n, Goto(end)
exten => s,n(end), Macro(record-on)
; This macro is for dev purposes and just dumps channel/app variables. Useful when designing new contexts.
[macro-dumpvars]
I called that macro under macro-dialout-trunk-predial-hook. Below is the debug message.
Registered SIP ‘100’ at 192.168.1.3 port 22560
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– Executing [0772328091@from-internal:1] Macro(“SIP/100-00000000”, “user-callerid,SKIPTTL,”) in new stack
– Executing [s@macro-user-callerid:1] Set(“SIP/100-00000000”, “AMPUSER=100”) in new stack
– Executing [s@macro-user-callerid:2] GotoIf(“SIP/100-00000000”, “0?report”) in new stack
– Executing [s@macro-user-callerid:3] ExecIf(“SIP/100-00000000”, “1?Set(REALCALLERIDNUM=100)”) in new stack
– Executing [s@macro-user-callerid:4] Set(“SIP/100-00000000”, “AMPUSER=100”) in new stack
– Executing [s@macro-user-callerid:5] Set(“SIP/100-00000000”, “AMPUSERCIDNAME=sam”) in new stack
– Executing [s@macro-user-callerid:6] GotoIf(“SIP/100-00000000”, “0?report”) in new stack
– Executing [s@macro-user-callerid:7] Set(“SIP/100-00000000”, “AMPUSERCID=100”) in new stack
– Executing [s@macro-user-callerid:8] Set(“SIP/100-00000000”, “CALLERID(all)=“sam” <100>”) in new stack
– Executing [s@macro-user-callerid:9] GotoIf(“SIP/100-00000000”, “1?continue”) in new stack
– Goto (macro-user-callerid,s,18)
– Executing [s@macro-user-callerid:18] NoOp(“SIP/100-00000000”, “Using CallerID “sam” <100>”) in new stack
– Executing [0772328091@from-internal:2] Set(“SIP/100-00000000”, “_NODEST=”) in new stack
– Executing [0772328091@from-internal:3] Macro(“SIP/100-00000000”, “record-enable,100,OUT,”) in new stack
– Executing [s@macro-record-enable:1] GotoIf(“SIP/100-00000000”, “1?check”) in new stack
– Goto (macro-record-enable,s,4)
– Executing [s@macro-record-enable:4] AGI(“SIP/100-00000000”, “recordingcheck,20100419-080133,1271644293.0”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/recordingcheck
recordingcheck,20100419-080133,1271644293.0: Outbound recording not enabled
– <SIP/100-00000000>AGI Script recordingcheck completed, returning 0
– Executing [s@macro-record-enable:5] MacroExit(“SIP/100-00000000”, “”) in new stack
– Executing [0772328091@from-internal:4] Macro(“SIP/100-00000000”, “dialout-trunk,1,0772328091,”) in new stack
– Executing [s@macro-dialout-trunk:1] Set(“SIP/100-00000000”, “DIAL_TRUNK=1”) in new stack
– Executing [s@macro-dialout-trunk:2] GosubIf(“SIP/100-00000000”, “0?sub-pincheck,s,1”) in new stack
– Executing [s@macro-dialout-trunk:3] GotoIf(“SIP/100-00000000”, “0?disabletrunk,1”) in new stack
– Executing [s@macro-dialout-trunk:4] Set(“SIP/100-00000000”, “DIAL_NUMBER=0772328091”) in new stack
– Executing [s@macro-dialout-trunk:5] Set(“SIP/100-00000000”, “DIAL_TRUNK_OPTIONS=tr”) in new stack
– Executing [s@macro-dialout-trunk:6] Set(“SIP/100-00000000”, “OUTBOUND_GROUP=OUT_1”) in new stack
– Executing [s@macro-dialout-trunk:7] GotoIf(“SIP/100-00000000”, “0?nomax”) in new stack
– Executing [s@macro-dialout-trunk:8] GotoIf(“SIP/100-00000000”, “0?chanfull”) in new stack
– Executing [s@macro-dialout-trunk:9] GotoIf(“SIP/100-00000000”, “0?skipoutcid”) in new stack
– Executing [s@macro-dialout-trunk:10] Set(“SIP/100-00000000”, “DIAL_TRUNK_OPTIONS=”) in new stack
– Executing [s@macro-dialout-trunk:11] Macro(“SIP/100-00000000”, “outbound-callerid,1”) in new stack
– Executing [s@macro-outbound-callerid:1] ExecIf(“SIP/100-00000000”, “0?Set(CALLERPRES()=)”) in new stack
– Executing [s@macro-outbound-callerid:2] ExecIf(“SIP/100-00000000”, “0?Set(REALCALLERIDNUM=100)”) in new stack
– Executing [s@macro-outbound-callerid:3] GotoIf(“SIP/100-00000000”, “1?normcid”) in new stack
– Goto (macro-outbound-callerid,s,6)
– Executing [s@macro-outbound-callerid:6] Set(“SIP/100-00000000”, “USEROUTCID=”) in new stack
– Executing [s@macro-outbound-callerid:7] Set(“SIP/100-00000000”, “EMERGENCYCID=”) in new stack
– Executing [s@macro-outbound-callerid:8] Set(“SIP/100-00000000”, “TRUNKOUTCID=0812222240”) in new stack
– Executing [s@macro-outbound-callerid:9] GotoIf(“SIP/100-00000000”, “1?trunkcid”) in new stack
– Goto (macro-outbound-callerid,s,12)
– Executing [s@macro-outbound-callerid:12] ExecIf(“SIP/100-00000000”, “1?Set(CALLERID(all)=0812222240)”) in new stack
– Executing [s@macro-outbound-callerid:13] ExecIf(“SIP/100-00000000”, “0?Set(CALLERID(all)=)”) in new stack
– Executing [s@macro-outbound-callerid:14] ExecIf(“SIP/100-00000000”, “0?Set(CALLERPRES()=prohib_passed_screen)”) in new stack
– Executing [s@macro-dialout-trunk:12] ExecIf(“SIP/100-00000000”, “1?AGI(fixlocalprefix)”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/fixlocalprefix
== fixlocalprefix: Dialpattern XXXXXXXXXX matched. 0772328091 -> 0772328091
– <SIP/100-00000000>AGI Script fixlocalprefix completed, returning 0
– Executing [s@macro-dialout-trunk:13] Set(“SIP/100-00000000”, “OUTNUM=0772328091”) in new stack
– Executing [s@macro-dialout-trunk:14] Set(“SIP/100-00000000”, “custom=DAHDI/g0”) in new stack
– Executing [s@macro-dialout-trunk:15] ExecIf(“SIP/100-00000000”, “0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^))”) in new stack
– Executing [s@macro-dialout-trunk:16] Macro(“SIP/100-00000000”, “dialout-trunk-predial-hook,”) in new stack
– Executing [s@macro-dialout-trunk-predial-hook:1] Macro(“SIP/100-00000000”, “dialanalog”) in new stack
– Executing [s@macro-dialanalog:1] NoOp(“SIP/100-00000000”, “”) in new stack
– Executing [s@macro-dialanalog:2] Dial(“SIP/100-00000000”, “|0772328091|M(dialanalogcont^)”) in new stack
== Spawn extension (macro-dialanalog, s, 2) exited non-zero on ‘SIP/100-00000000’ in macro ‘dialanalog’
== Spawn extension (macro-dialout-trunk-predial-hook, s, 1) exited non-zero on ‘SIP/100-00000000’ in macro ‘dialout-trunk-predial-hook’
== Spawn extension (macro-dialout-trunk, s, 16) exited non-zero on ‘SIP/100-00000000’ in macro ‘dialout-trunk’
== Spawn extension (from-internal, 0772328091, 4) exited non-zero on ‘SIP/100-00000000’
– Executing [h@from-internal:1] Macro(“SIP/100-00000000”, “hangupcall”) in new stack
– Executing [s@macro-hangupcall:1] GotoIf(“SIP/100-00000000”, “1?skiprg”) in new stack
– Goto (macro-hangupcall,s,4)
– Executing [s@macro-hangupcall:4] GotoIf(“SIP/100-00000000”, “1?skipblkvm”) in new stack
– Goto (macro-hangupcall,s,7)
– Executing [s@macro-hangupcall:7] GotoIf(“SIP/100-00000000”, “1?theend”) in new stack
– Goto (macro-hangupcall,s,9)
– Executing [s@macro-hangupcall:9] Hangup(“SIP/100-00000000”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 9) exited non-zero on ‘SIP/100-00000000’ in macro ‘hangupcall’
== Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/100-00000000’
pbx*CLI>