[asterisk-users] Dialed Number missing from the CDR when usingcall files.

Michael Collins mcollins at fcnetwork.com
Sat Dec 30 13:42:11 MST 2006


> I think the CDR generator of the Asterisk
> needs change to record the complete information.
> 

Agreed.  However, there are still challenges here.  First, you could use
the custom_csv to create your own CDR layout that includes the dialed
number, but you'd still need to come up with a way to get that into
MySQL.  (As far as I know, there isn't a custom_mysql module.)

Second, when using a .call file (or the manager interface's Originate
action) the 'Dial' action is executed BEFORE entry into the dialplan, so
if it fails, nothing in your dialplan is executed and you get a somewhat
complete CDR, except there's nothing in the CDRUserField.

If you aren't worried about calls failing then you can use the
CDRUserField to store the dialed number.  I'm using Trixbox and the
MySQL stuff is already configured to store the uniqueid and the CDR
userfield.

The call file will need something like this:
SetVar: dialednum=5551212

Then you'll need a dialplan entry like so:
exten => s,n,SetCDRUserField(${dialednum})

This is a workaround that a lot of people use because they don't need
the CDR userfield for anything special.  Personally, I put tons of stuff
in the userfield and just delimit my items, like this:
exten => s,n,SetCDRUserField(${dialednum})
exten => s,n,AppendCDRUserField(:${firstname})
exten => s,n,AppendCDRUserField(:${lastname})
exten => s,n,AppendCDRUserField(:${misc1})
exten => s,n,AppendCDRUserField(:${misc2})

Then I'll have a field at the end of the CDR that looks like this:
"5551212:firstname:lastname:misc1:misc2"

Technically I use the cdr-csv for my CDR's, but Trixbox turns on MySQL
automatically so I get MySQL CDR's also.  (I just manually clean them
out every month or so.)

HtH helps!  Let us know if you make any progress.

-MC


More information about the asterisk-users mailing list