vicidial_log, call_log and cdr

Hello
I am running VERSION: 2.0.95, BUILD: 70402-1157 on Asterisk 1.2.23.
Diguim PRI Card with Zaptel
I have a telephone management system that uses the asterisk cdr to get the call usage for outbound calls, all outbound calls are made through a PRI. I would like the TMS to display the agent name rather than the caller code from vicidial, I can link the call_log to the cdr on uniqueid, but cannot link the cdr or the call_log to the vicidial log to get the agent name in a select statement.
I have also tried to set the userfield in asterisk to the ${CALLERIDNAME} that contains the agent name, but this only works for the internal calls , not the calls that goes through the ZAP channel.
Any help would be greatly appreciated
I am running VERSION: 2.0.95, BUILD: 70402-1157 on Asterisk 1.2.23.
Diguim PRI Card with Zaptel
I have a telephone management system that uses the asterisk cdr to get the call usage for outbound calls, all outbound calls are made through a PRI. I would like the TMS to display the agent name rather than the caller code from vicidial, I can link the call_log to the cdr on uniqueid, but cannot link the cdr or the call_log to the vicidial log to get the agent name in a select statement.
I have also tried to set the userfield in asterisk to the ${CALLERIDNAME} that contains the agent name, but this only works for the internal calls , not the calls that goes through the ZAP channel.
Any help would be greatly appreciated