Summary:ASTERISK-06712: Bad chars in incoming callerid my cause cdr_csv records with illegal format
Reporter:Ezio Vernacotola (ezio)Labels:
Date Opened:2006-04-06 05:39:38Date Closed:2006-04-06 12:47:34
Versions:Frequency of
Description:I'm experiencing sometimes bad callerid in sip calls received from an our customer. If the callerid contains '"' or ',' the format of generated cdr_csv record is not correct and my be difficult parsing. This is clearly a bad bug of the sip peer, not of asterisk, but asterisk should be more robust in handling such eventuality.


In this example (private data changed) my python csv library thinks there is one more field:

"exxxxx","†�v�8x,Ú","9053331xxxx","wholesale-in",""v�8x,"<†�v�8x,Ú>","SIP/212.34.xxx.xxx-b7b5e408","Zap/3-1","Dial","Zap/g1/009053331xxxxx","2006-04-06 10:24:14","2006-04-06 10:24:27","2006-04-06 10:29:27","313","300","ANSWERED","DOCUMENTATION","1144311854.186630","","009053331xxxxx","redirect","Turkey-Mobile-Others"
Comments:By: Andrey S Pankov (casper) 2006-04-06 08:48:00

set verbose 4, set debug 4, sip debug, then upload :)

By: Olle Johansson (oej) 2006-04-06 09:39:42

We do not need a SIP debug really. What do you think we should do with this kind of Caller ID's ?

By: Ezio Vernacotola (ezio) 2006-04-06 09:55:31

I prefer don't full debug my system waiting that the peer send the bad callerid because is a busy in production sip-pstn gateway and the problem occours randomly one or two times in a day.

I think that may be sufficient escape double quotes in "append_string" of cdr/cdr_csv.c adding another double quote.

I don't kwnow rfc sip standard, but a more drastic solution is to drop, replace, or escape every char ouside the allowed set.

By: Olle Johansson (oej) 2006-04-06 10:50:43

You can handle this with dialplan functions and remove the " from the caller id name before the call ends up in the cdr. We will have to discuss valid characters longterm, but short term, I think you can fix this in the dial plan.

By: Ezio Vernacotola (ezio) 2006-04-06 12:43:57

Trying to look better at what chars I must remove from callerid found that the problem came from the comma ',' not the double quote. The double quote is added by  asterisk.

Blanking in the diaplan every caller id that contains commas should work. Thanks.

By: Olle Johansson (oej) 2006-04-06 12:47:22

No fix needed. thanks!