[asterisk-users] date - outgoing call

Dale Noll dnoll at wi.rr.com
Tue Dec 11 05:45:30 CST 2012


On Mon, Dec 10, 2012 at 11:02 PM, Joseph <syscon780 at gmail.com> wrote:

> On 12/10/12 20:45, Steve Edwards wrote:
>
>> On Mon, 10 Dec 2012, Joseph wrote:
>>
>>  When a call comes in asterisk records the date correctly but when I cake
>>> a
>>> call out I get only something like:
>>> Date: 60
>>> here is an example:
>>>
>>> From:   "7807560785"
>>> To:     "s"
>>> Date:   "2012-12-11 00:46:04"
>>> Status: "ANSWERED"
>>> ----------------
>>>
>>> From:   "5"
>>> To:     "4331235"
>>> Date:   60
>>> Status: 4
>>>
>>
>> What version of Asterisk?
>>
>> Where are you seeing the data you display above?
>>
>> --
>> Thanks in advance,
>> ------------------------------**------------------------------**
>> -------------
>> Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
>> Newline                                              Fax: +1-760-731-3000
>>
>
> I'm using this command to pull the records of the cvs:
> grep -P '\d{4}-\d{2}-\d{2}\s\d{2}:\d{**2}:\d{2}'
> /var/log/asterisk/cdr-csv/*.**csv | cut  -d, -f2,3,10,15 | awk -F","
> {'print "From:\t"$1"\nTo:\t"$2"\nDate:**\t"$3"\nStatus:\t"$4"\n-------**---------\n"'}
> |tail -60
>
> the actual last records in Master.csv is:
> "","5","218","internal","""**Cerra"" <5>","IAX2/192.168.141.1:4569-**
> 4374","SIP/11-00000180","Dial"**,"SIP/11&SIP/321&SIP/218,25,m(**penguin)w","2012-12-11
> 02:58:53","2012-12-11 02:58:59","2012-12-11 03:00:00",67,61,"ANSWERED","**
> DOCUMENTATION","1355194733.**524",""
>
> but with the above command it display:
>
> From:   "5"
> To:     "218"
> Date:   25
> Status: 67
>
> --
> Joseph
>
>
> --
> ______________________________**______________________________**_________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>               http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/**mailman/listinfo/asterisk-**users<http://lists.digium.com/mailman/listinfo/asterisk-users>
>

The problem is not exactly Asterisk, it is how the data being parsed from
the CSV file.  If you look at the data, each field is enclosed with double
quotes. One field in particular may have commas embedded within the double
quotes. For instance, in your data there is one field that looks like this:


"SIP/11&SIP/321&SIP/218,25,m(penguin)w"

Using the 'cut' utility does not take into account the quoiting, so cut
happily chops that one field into three.  This causes the date and status
field numbers to be different (according to cut) and therefore your request
for fields 10 and 15 return the wrong columns.  To compound the issue, some
records do not have the extra commas so you cannot simply change the field
numbers.

I have not spent any real time looking at a way to deal with this using
command line utilities because I read the data from a mysql database.
Another option would be to read the data into a spreadsheet.  You could
also write a script around what you are doing and parts records differently
based on the 'last appliation' such as Dial, Read, Voicemail.

I hope that helps.

Dale
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20121211/10965fb9/attachment.htm>


More information about the asterisk-users mailing list