Откуда: Москва
Сообщений: 3421
|
Re: COST OF THE LAST CALLS
[cost-of-last-calls]
; activate this function
exten => *101,1,Answer
exten => *101,n,Wait(0.5)
exten => *101,n,Authenticate(1234)
exten => *101,n(dbget),DbGet(cost=CALLCOST/${CALLERIDNAME})
exten => *101,n(activated),Playback(accounting)
exten => *101,n,Playback(activated)
exten => *101,n,Wait(1)
exten => *101,n,Hangup
exten => *101,dbget+101,DbPut(CALLCOST/${CALLERIDNAME}=0)
exten => *101,n,Goto(${EXTEN},activated)
; de-activate this function
exten => *102,1,Answer
exten => *102,n,Wait(0.5)
exten => *102,n,Authenticate(1234)
exten => *102,n(dbget),DbGet(cost=CALLCOST/${CALLERIDNAME})
exten => *102,n,DbDel(CALLCOST/${CALLERIDNAME})
exten => *102,n,Playback(accounting)
exten => *102,n,Playback(de-activated)
exten => *102,n,Wait(1)
exten => *102,n,Hangup
exten => *102,dbget+101,Playback(accounting)
exten => *102,n,Playback(is-not-set)
exten => *102,n,Wait(1)
exten => *102,n,Hangup
; tell accounting status
exten => *103,1,Answer
exten => *103,n,Wait(0.5)
exten => *103,n(dbget),DbGet(cost=CALLCOST/${CALLERIDNAME})
exten => *103,n,SetVar(dollars=$[${cost} / 100])
exten => *103,n,SetVar(cents=$[${cost} % 100])
exten => *103,n,Playback(accounting)
exten => *103,n,Playback(is)
exten => *103,n,SayNumber(${dollars})
exten => *103,n,Playback(dollars)
exten => *103,n,Playback(and)
exten => *103,n,SayNumber(${cents})
exten => *103,n,Playback(cents)
exten => *103,n,Goto(${EXTEN},hangup)
exten => *103,dbget+101,Playback(accounting)
exten => *103,n,Playback(is-not-set)
exten => *103,n(hangup),Wait(1)
exten => *103,n,Hangup
; erase accounting
exten => *104,1,Answer
exten => *104,n,Wait(0.5)
exten => *104,n,Authenticate(1234)
exten => *104,n(dbget),DbGet(cost=CALLCOST/${CALLERIDNAME})
exten => *104,n,DbPut(CALLCOST/${CALLERIDNAME}=0)
exten => *104,n,Playback(accounting)
exten => *104,n,Playback(is-set-to)
exten => *104,n,SayNumber(0)
exten => *104,n,Wait(1)
exten => *104,n,Hangup
exten => *104,dbget+101,Playback(accounting)
exten => *104,n,Playback(is-not-set)
exten => *104,n,Wait(1)
exten => *104,n,Hangup
Предложения по рационализации и оптимизации кода?
|