Unnecessary semicolon when using CDR function


I am trying to update the userfield column in the CDR tables like that:

exten => _***.,1,Set(CDR(userfield)=${CALLERID(num)})

After checking the cdr record I see that a semicolon is inserted to the table itself:

mysql> select userfield from cdr where uniqueid=1511191570.85486;


| userfield |


|           |

| ;2000     |

I do not see any problem with the dialplan:

exten => _***.,1,Set(CDR(userfield)=${CALLERID(num)})

Any ideas?

Thank you,

Daniel Friedman

Trixton LTD.

Without more information this is a bit of a guess, but looking at the CDR source code it appears when the CDR’s public record gets created it copies party_a’s and party_b’s userfields into a single shared userfield where party_a and party_b userfield information is separated by a “;” (semi-colon). Something like the following:


My guess is you are setting the userfield on party_b and party_a’s user field is unset, so when the two are “merged” into a single user field you could get something like what you are seeing. Using the above format, essentially the following:

1 Like

Hello @kharwell,

Thank you for your answer. Here is my code:

exten => _**.,1,Set(CDR(userfield)=${CALLERID(num)})
exten => _**.,n,Pickup(${EXTEN:2})
exten => _**.,n,Hangup

This is a simple dialplan to setup the callerid in the CDR before picking up a channel.

Any suggestions of improving it?

Thank you,

Daniel Friedman
Trixton LTD.

I’m not really sure. I mean based on the source code, and this documentation I found it appears things are working correctly.

As I said in the previous post. It looks like you are only setting Party B’s userfield so when they are concatenated the field appears to begin with a semicolon.

You could use the FILTER or REPLACE functions to get rid of the unwanted character.