<font size=2 face="sans-serif">Are you using cdr_adaptive_odbc.conf to
populate it? If so, there is no Asterisk analog to calldate. You would
need an alias set up. Mine looks like:</font>
<br>
<br><font size=2 face="sans-serif">alias start => calldate</font>
<br>
<br><font size=2 face="sans-serif">so that the start of my call is what
gets logged to the database as the calldate.</font>
<br><font size=2 face="sans-serif"><br>
Kevin Larsen </font>
<br>
<br>
<br>
<br><font size=1 color=#5f5f5f face="sans-serif">From:
</font><font size=1 face="sans-serif">Jairo <jairo@intermol.com.br></font>
<br><font size=1 color=#5f5f5f face="sans-serif">To:
</font><font size=1 face="sans-serif">Asterisk Users Mailing
List - Non-Commercial Discussion <asterisk-users@lists.digium.com>,
</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Date:
</font><font size=1 face="sans-serif">06/11/2013 08:28 AM</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Subject:
</font><font size=1 face="sans-serif">Re: [asterisk-users]
Is uniqueid/sequence a safe CDR table primary key ?</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Sent by:
</font><font size=1 face="sans-serif">asterisk-users-bounces@lists.digium.com</font>
<br>
<hr noshade>
<br>
<br>
<br><font size=3>Hello, <br>
<br>
Still about CDR and MySQL table, should the calldate field be inserted
by Asterisk?</font>
<br>
<br><font size=3>This is the table structure we are using, based on Asterisk
wiki:<br>
</font><font size=3 face="Courier"><br>
mysql> describe cdr;<br>
+-------------+-----------------------+------+-----+---------------------+----------------+<br>
| Field | Type
| Null | Key | Default
| Extra |<br>
+-------------+-----------------------+------+-----+---------------------+----------------+<br>
| id | mediumint(8)
unsigned | NO | PRI | NULL
| auto_increment |<br>
| calldate | datetime
| NO | | 0000-00-00 00:00:00 |
|<br>
| clid | varchar(80)
| NO | |
|
|<br>
| src | varchar(80)
| NO | |
|
|<br>
| dst | varchar(80)
| NO | |
|
|<br>
| dcontext | varchar(80)
| NO | |
|
|<br>
| channel | varchar(80)
| NO | |
|
|<br>
| dstchannel | varchar(80)
| NO | |
|
|<br>
| lastapp | varchar(80)
| NO | |
|
|<br>
| lastdata | varchar(80)
| NO | |
|
|<br>
| duration | int(11)
| NO | | 0
|
|<br>
| billsec | int(11)
| NO | | 0
|
|<br>
| disposition | varchar(45)
| NO | |
|
|<br>
| amaflags | int(11)
| NO | | 0
|
|<br>
| accountcode | varchar(20)
| NO | |
|
|<br>
| uniqueid | varchar(32)
| NO | |
|
|<br>
| userfield | varchar(255)
| NO | |
|
|<br>
| peeraccount | varchar(20)
| NO | |
|
|<br>
| linkedid | varchar(32)
| NO | |
|
|<br>
| sequence | int(11)
| NO | | 0
|
|<br>
+-------------+-----------------------+------+-----+---------------------+----------------+<br>
20 rows in set (0.01 sec)</font>
<br>
<br><font size=3>Thank you!<br>
</font>
<br><font size=3><br>
</font>
<br><font size=3>2013/6/4 Olivier <</font><a href=mailto:oza_4h07@yahoo.fr target=_blank><font size=3 color=blue><u>oza_4h07@yahoo.fr</u></font></a><font size=3>></font>
<br><font size=3>OK, then I'll go with linkedid, uniqueid and sequence
number.<br>
</font>
<br><font size=3>Thanks for sharing this on this list</font>
<br><font size=3><br>
</font>
<br><font size=3>2013/6/3 Matthew Jordan <</font><a href=mailto:mjordan@digium.com target=_blank><font size=3 color=blue><u>mjordan@digium.com</u></font></a><font size=3>></font>
<br><font size=3>On 06/03/2013 11:20 AM, Olivier wrote:<br>
> Hi,<br>
><br>
> When dealing with CDR SQL tables, I always added an auto-incremented<br>
> cdr_id key as a primary key, just in case provided uniqueid key went
wrong.<br>
><br>
> Now I'm facing a situation where I need to insert into a database's<br>
> table and from the dialplan, a reference to the CDR record which is<br>
> currently processed.<br>
><br>
> So my questions are:<br>
><br>
> 1. Can uniqueid/sequence (or uniqueid/sequence/calldate) bundle be<br>
> safely used as CDR's table primary key (ie I cannot have any<br>
> uniqueid/sequence combination from one CDR record to match a past<br>
> uniqueid/sequence combination) ?<br>
</font>
<br><font size=3>Possibly. Things to keep in mind:<br>
<br>
* You can run into uniqueid collisions across multiple systems if you do<br>
not specify a system name in asterisk.conf or do not specify a unique<br>
system name in asterisk.conf.<br>
* You can run into uniqueid collisions if your system clock goes<br>
backwards for any reason (the uniqueid for a channel happens to use a<br>
timestamp for its uniqueness)<br>
<br>
Whether or not this is unique enough will be completely dependent on<br>
your overall system configuration.<br>
<br>
In general, the recommended combination that *should* uniquely specify
a<br>
CDR (when configured correctly) is linkedid (which should be enabled and<br>
added to your schema), uniqueid, and sequence number, with the asterisk<br>
system name specified.<br>
<br>
--<br>
Matthew Jordan<br>
Digium, Inc. | Engineering Manager<br>
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA<br>
Check us out at: </font><a href=http://digium.com/ target=_blank><font size=3 color=blue><u>http://digium.com</u></font></a><font size=3>
& </font><a href=http://asterisk.org/ target=_blank><font size=3 color=blue><u>http://asterisk.org</u></font></a><font size=3><br>
<br>
<br>
<br>
--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by </font><a href="http://www.api-digital.com/" target=_blank><font size=3 color=blue><u>http://www.api-digital.com</u></font></a><font size=3>
--<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
</font><a href=http://www.asterisk.org/hello target=_blank><font size=3 color=blue><u>http://www.asterisk.org/hello</u></font></a><font size=3><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
</font><a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target=_blank><font size=3 color=blue><u>http://lists.digium.com/mailman/listinfo/asterisk-users</u></font></a>
<br>
<br><font size=3><br>
--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by </font><a href="http://www.api-digital.com/" target=_blank><font size=3 color=blue><u>http://www.api-digital.com</u></font></a><font size=3>
--<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
</font><a href=http://www.asterisk.org/hello target=_blank><font size=3 color=blue><u>http://www.asterisk.org/hello</u></font></a><font size=3><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
</font><a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target=_blank><font size=3 color=blue><u>http://lists.digium.com/mailman/listinfo/asterisk-users</u></font></a>
<br><font size=3><br>
<br>
<br>
-- <br>
Jairo Molina Jr∴</font><font size=3 color=blue><u><br>
</u></font><a href=http://www.intermol.com.br/ target=_blank><font size=3 color=blue><u>http://www.intermol.com.br</u></font></a><font size=3>
</font><tt><font size=2>--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by </font></tt><a href="http://www.api-digital.com/"><tt><font size=2>http://www.api-digital.com</font></tt></a><tt><font size=2>
--<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
</font></tt><a href=http://www.asterisk.org/hello><tt><font size=2>http://www.asterisk.org/hello</font></tt></a><tt><font size=2><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
</font></tt><a href="http://lists.digium.com/mailman/listinfo/asterisk-users"><tt><font size=2>http://lists.digium.com/mailman/listinfo/asterisk-users</font></tt></a>
<br>