[Asterisk-Users] Working with an ongoing call

Eivind Trondsen eivind at wingnut.no
Wed Jul 20 01:49:44 MST 2005


Hi list

I plan to implement a prepaid solution where the system needs to check for 
remaining credit periodically during a call. The reason for this is that this 
is a system where the credit pool can be used simultaneously by more people, 
and not only for calling.

I have a problem figuring how to be able to run logic while a call is in 
progress. The L(x:y:z) option to Dial() is good, but not quite what I need. 
In both the dialplan an an AGI the Dial command blocks, so what do I do?

I have not yet tried a multi-threaded AGI, but assume the possibility of 
success with that scenario to be slim...

Ideally; I want to code things like this:

Fetch cost of requested call;
# The reserve functions also supplies total remaining credit
unless (Reserve credit for N seconds) exit with message;
INITIATE CALL;
If answered {
  while(1) {
    Wait for N-x seconds;
    Reserve credit for N seconds;
    if (close to credit limit) PLAY WARNING BEEP;
    else if (out of credit) EXIT WITH MESSAGE;
  }
}    

hangup_trap:
 Commit credit based on actual call length;

EOF

I realize that this probably needs to be done as a combination of dialplan 
logic and AGIs, but my main concern is the ability to

1) send sound to the caller of an ongoing call
2) retain control so the call can be terminated based on a timer (or whatever)

Any tips would be greatly appreciated! Thanks in advance.

-- 
Eivind Trondsen

"People are destined to be party animals,
and the technology will follow"
                         - Linus Torvalds



More information about the asterisk-users mailing list