[Asterisk-Users] Working with an ongoing call
Adam Goryachev
mailinglists at websitemanagers.com.au
Wed Jul 20 06:05:58 MST 2005
On Wed, 2005-07-20 at 10:49 +0200, Eivind Trondsen wrote:
> 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.
Use the manager API to terminate the call if their credit reaches zero,
connect and process active channels on an regular basis (as needed), use
the AGI to reduce the credit by the needed amount at the end of the call
(from h extension, or g option to Dial).
Regards,
Adam
--
--
Adam Goryachev
Website Managers
Ph: +61 2 9345 4395 adam at websitemanagers.com.au
Fax: +61 2 9345 4396 www.websitemanagers.com.au
More information about the asterisk-users
mailing list