Hi,
At this moment client call to my system, where I answer it and prompt for number to dial. After that when call is done I have to get duration of that call and debit clients’ account.
This scenario I have done but is one more thing to do, namely if a callee disconnect I need give to client possibility to place another call.
Problem is if I use g option in Dial application then i lose ability to check duration of last call
Below is simplified my current dialplan
[CALLING_CARDS]
;the whole thing start here
exten => s,1,Noop(Wersja 3)
same => n(NUMBER),GoSub(func-GETNUMBER,s,1)
same => n,GoSub(func-PLACECALL,s,1)
same => n,Hangup
[func-GETNUMBER]
;here I get number for caller
exten => s,1,Noop(Pobieranie numeru telefonu)
same => n,Agi(get_audio.sh,podaj numer telefonu na który chcesz zadzwonić i zatwierdź kratką)
same => n,Read(CPB,${AUDIO_FILENAME},20)
same => n,Return
[func-PLACECALL]
exten => s,1,Noop(Dzwonie na podany numer telefonu)
same => n,Dial(local/${CPB}@func-DIALNUMBER,55,L(${CALLLIMIT})) ;if i put g option here i cant get amount of time of call
same => n,Noop(ZADZWONILEM, MOJ STAN TO: ${DIALSTATUS})
same => n,Goto(STATE-${DIALSTATUS},1)
same => n,Hangup
exten => i,1,Noop(Cos sie wydarzylo)
same => n,GoSub(sub-TTS,s,1(nie można zrealizować tego połączenie))
same => n,Return
exten => STATE-ANSWER,1,Noop(Polaczenie zwrocilo stan ODEBRANY)
same => n,Noop(${ANSWEREDSTATUS})
same => n,Noop(${CDR(billsec)})
same => n,Noop(${CDR(start)})
same => n,Noop(${CDR(answer)})
; same => n,GoSub(func-DEBITCARD,s,1)
; same => n,GoSub(sub-TTS,s,1(proszę wykonać następne połączenia))
same => n,Hangup
exten => STATE-BUSY,1,Noop(Polaczenie zwrocilo stan ZAJETY)
same => n,GoSub(sub-TTS,s,1(numer obecnie jest zajęty. proszę spróbować później))
same => n,Return
exten => h,1,Noop(Naliczanie oplaty za polaczenie)
;here i get amount of seconds of call - if I dont use g option in dial application
same => n,Noop(Czas: ${CDR(billsec)})
same => n,Return
[func-DIALNUMBER]
exten => _X.,1,Noop(Dzwonie taaaam)
same => n,Dial(PJSIP/${EXTEN}@monster-02)