[asterisk-dev] CDR

Steve Murphy murf at digium.com
Thu Jul 26 11:30:12 CDT 2007


On Thu, 2007-07-26 at 13:12 -0300, Ian Esper wrote:
> I am using 1.4, and it is the rate_engine, the cdr part it does well,
> only this part of the code is not working, this is the part I get the
> price parameters to charge for the call to put it on mysql database.
> 

Ian--

When is your code run? In the hangup extension?

murf

> 
> Em Qui, 2007-07-26 às 10:00 -0600, Steve Murphy escreveu:
> > On Thu, 2007-07-26 at 12:33 -0300, Ian Esper wrote:
> > > Hi,
> > > 
> > > I am working on a cdr, and I can't get the channel, it worked on 1.2,
> > 
> > Then, I assume you are running this code in either 1.4, or trunk?
> > 
> > > here is the code:
> > > 
> > > chan = ast_channel_walk_locked(NULL);
> > >     while (chan && chan->cdr != cdr) {
> > > 	ast_mutex_unlock(&chan->lock);
> > > 	chan = ast_channel_walk_locked(chan);
> > >     }
> > >     if (chan) {
> > > 	dst = pbx_builtin_getvar_helper(chan, "DESTINATION");
> > > 	if (dst && strcmp(dst, cdr->lastdata) == 0) {
> > > 	    dst = pbx_builtin_getvar_helper(chan, "FIRSTLEN");
> > > 	    first = strtoul(dst, &end, 10);
> > > 	    dst = pbx_builtin_getvar_helper(chan, "RESTLEN");
> > > 	    rest = strtoul(dst, &end, 10);
> > > 	    dst = pbx_builtin_getvar_helper(chan, "STARTCOST");
> > > 	    start = strtof(dst, &end);
> > > 	    dst = pbx_builtin_getvar_helper(chan, "PERIODCOST");
> > > 	    each = strtof(dst, &end);
> > > 	    dst = pbx_builtin_getvar_helper(chan, "TRIALCOST");
> > > 	    trial = strtof(dst, &end);
> > > 	}
> > > 	ast_mutex_unlock(&chan->lock);
> > >     }
> > > 
> > > What is wrong and what could I do?
> > 
> > CDR's are always attached to channels, but channels can be masqueraded
> > and zombied in the course of a bridge... usually via transfers. CDR's
> > can also
> > be copied and chained; you are only inspecting the first cdr in the
> > list.
> > 
> > Tell us more about the disappearing CDR. Are transfers/parking/etc
> > involved? Does it always happen? When does it not happen?
> > 
> > murf
> > 
> > 
> > > 
> > > Thanks
> > > 
> > > Ian Esper
> > > 
-- 
Steve Murphy
Software Developer
Digium
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3227 bytes
Desc: not available
Url : http://lists.digium.com/pipermail/asterisk-dev/attachments/20070726/bffa30fa/attachment.bin 


More information about the asterisk-dev mailing list