[asterisk-users] Passing call duration to an AGI Script
Adi Simon
adi.simon at gmail.com
Sun Jun 3 01:40:50 MST 2007
Hi,
What I did is first to dig a bit into the app_dial.c. I saw how the
ANSWEREDTIME variable
is created (end_time - answer_time). Then I added some lines to export the
answer_time variable
as a channel variable. I added these lines right after the answer_time
decleration (line 1426 in ver 1.4.4)
compiled and replaced the module.
char toast2[80];
snprintf(toast2, sizeof(toast2), "%ld",
(long)(answer_time));
pbx_builtin_setvar_helper(chan, "ANSWERTIME", toast2);
This will put the call start time in unix timestamp in the channel variable
ANSWERTIME. That's
all. Hope it's helping.
Adi.
On 6/1/07, Luis Morales <lmorales at sigmadental.net> wrote:
>
> Hi Adi,
>
> My be better if you send us the code about how did you do to catch and
> retrive the data from asterisk.
>
> Regards,
>
> Luis Morales
>
> On Fri, 2007-06-01 at 01:21 +0300, Adi Simon wrote:
> > Hi Martin,
> >
> > Thanks for your reply. Maybe I wasn't clear enough. I am already
> > running AGI periodically
> > inside a call and it runs just fine. I'm using a patch for asterisk
> > (can be found here) to do so. In short i'm using it for a prepaid
> > system that needs to allow more than one prepaid call to run
> > simultaneously.
> >
> > Anyway, I solved my problem by changing the code a bit. I added an AGI
> > variable that holds the timestamp of the call answer time, thus
> > allowing me to use it as an anchor for knowing how much time passed
> > since the beginning of the call.
> >
> > Thanks again,
> >
> > Adi.
> >
> >
> >
> > On 5/31/07, Martin Smith <martins at bebr.ufl.edu> wrote:
> > Hi Adi,
> >
> > AGI is probably best viewed like any other dialplan
> > application (and with DeadAGI something that happens after,
> > but anyway) -- in my opinion. I've seen people do some pretty
> > wild stuff with it, but in the end, when I wonder if the
> > Manager interface or AGI interface is most appropriate for a
> > given task, I ask questions like "Would I want to do this with
> > another application? Is this even possible with another
> > application?".
> >
> > In your case, I'd say you probably couldn't say...
> > periodically execute a dialplan application that runs in the
> > middle of a call without interrupting the call (with AGI,
> > anyway). I'd recommend using the Manager interface and polling
> > for call durations / listening for events and acting on the
> > information you get back (I'd assume the answered duration is
> > one of those values you could poll for).
> >
> > Hope this helps -- others, please jump in if I'm way wrong :)
> >
> > Martin Smith, Systems Developer
> > martins at bebr.ufl.edu
> > Bureau of Economic and Business Research
> > University of Florida
> > (352) 392-0171 Ext. 221
> >
> >
> >
> >
> > ______________________________________________________
> > From: asterisk-users-bounces at lists.digium.com [mailto:
> > asterisk-users-bounces at lists.digium.com] On Behalf Of
> > Adi Simon
> > Sent: Thursday, May 31, 2007 5:54 AM
> > To: asterisk-users at lists.digium.com
> > Subject: [asterisk-users] Passing call duration to an
> > AGI Script
> >
> >
> >
> > Hi,
> >
> > I'm trying to find a way of passing the actual call
> > duration (something like ANSWEREDTIME) to an AGI
> > script that runs periodically during a call. Any
> > ideas?
> >
> > Thanks,
> >
> > Adi.
> >
> >
> > _______________________________________________
> > --Bandwidth and Colocation provided by Easynews.com --
> >
> > asterisk-users mailing list
> > To UNSUBSCRIBE or update options visit:
> > http://lists.digium.com/mailman/listinfo/asterisk-users
> >
> >
> > _______________________________________________
> > --Bandwidth and Colocation provided by Easynews.com --
> >
> > asterisk-users mailing list
> > To UNSUBSCRIBE or update options visit:
> > http://lists.digium.com/mailman/listinfo/asterisk-users
> --
> .-.-.-.-.-.-.-.-.-.-.-.-.--.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
> Sigma Dental Plan
> Jefe de Soporte y Sistemas
> Telf. Oficina : +58(212)2646811
> Cel. : +58(416)4242091
> Caracas, Venezuela
> .-.-.-.-.-.-.-.-.-.-.-.-.--.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
>
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20070603/691ecc82/attachment.htm
More information about the asterisk-users
mailing list