[asterisk-dev] CDR

Ian Esper ian at bratech.com.br
Thu Jul 26 10:33:42 CDT 2007


Hi,

I am working on a cdr, and I can't get the channel, it worked on 1.2,
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?

Thanks

Ian Esper





More information about the asterisk-dev mailing list