Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[asterisk-users] Asterisk Database Handling

Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users
View previous topic :: View next topic  
Author Message
mroth at imminc.com
Guest





PostPosted: Thu May 22, 2008 9:29 am    Post subject: [asterisk-users] Asterisk Database Handling Reply with quote

Douglas Garstang wrote:
Quote:
Quote:
Not at all, just offering a workaround. If your master.csv is
complete and correct then it makes sense to use that data unless
someone can identify your problem and offer a fix.

Unfortunately, not really feesible. I didn't design the system but we
are using CDR's not only for billing purposes, but also to keep state
on users. The state info (in a call, not in a call etc) needs to be
updated in as close to real time as possible. Files won't do it.
Douglas,

I've written a program named replicate that may be of interest to you.
It replicates all writes to a file over a socket. The core of the
program is GNU tail, so it operates nearly in real time (it has
inherited the "--sleep-interval" argument for fine-tuning). I've been
using it in production for over a year to push all writes to the
queue_log to a remote reporting server and it has been rock solid.

It operates almost identically to "tail -F" except every new write to
the file is written over a socket connection. The remote end of the
connection is responsible for sending back an acknowledgment. If it
doesn't, replicate will spool the write to a temporary file on the local
machine. Once the remote end is responding again, the spool file is
written to it. This allows us to have downtime (expected or unexpected)
on the reporting server without losing any queue_log records.

I've never released replicate publicly, because I'm not sure how taking
a program like tail and adapting it to a new purpose is handled by the
GPL. However, I'm sure someone on this list more knowledgeable than
myself can help me understand that issue.

Regards,

Matthew Roth
InterMedia Marketing Solutions
Software Engineer and Systems Developer
Back to top
tilghman at mail.jeffa...
Guest





PostPosted: Thu May 22, 2008 10:05 am    Post subject: [asterisk-users] Asterisk Database Handling Reply with quote

On Thursday 22 May 2008 09:29:24 Matthew J. Roth wrote:
Quote:
It operates almost identically to "tail -F" except every new write to
the file is written over a socket connection. The remote end of the
connection is responsible for sending back an acknowledgment. If it
doesn't, replicate will spool the write to a temporary file on the local
machine. Once the remote end is responding again, the spool file is
written to it. This allows us to have downtime (expected or unexpected)
on the reporting server without losing any queue_log records.

I've never released replicate publicly, because I'm not sure how taking
a program like tail and adapting it to a new purpose is handled by the
GPL. However, I'm sure someone on this list more knowledgeable than
myself can help me understand that issue.

There's no problem, as long as you distribute your program under the GPL,
which means providing the source on demand to anybody to whom you distribute
a binary.

If you want to distribute under another license, then it comes down to how you
developed the code. If you developed the code to work similarly to tail, but
you did not use any tail code (or any other GPL code) directly, then you're
pretty much free to use any license you like. However, if you started off
with the tail codebase and altered it, it is a derivative work, and GPL is the
only way to go.

--
Tilghman
Back to top
abalashov at evaristes...
Guest





PostPosted: Thu May 22, 2008 12:00 pm    Post subject: [asterisk-users] Asterisk Database Handling Reply with quote

A program like netcat?

Matthew J. Roth wrote:
Quote:
Douglas Garstang wrote:
Quote:
Quote:
Not at all, just offering a workaround. If your master.csv is
complete and correct then it makes sense to use that data unless
someone can identify your problem and offer a fix.
Unfortunately, not really feesible. I didn't design the system but we
are using CDR's not only for billing purposes, but also to keep state
on users. The state info (in a call, not in a call etc) needs to be
updated in as close to real time as possible. Files won't do it.
Douglas,

I've written a program named replicate that may be of interest to you.
It replicates all writes to a file over a socket. The core of the
program is GNU tail, so it operates nearly in real time (it has
inherited the "--sleep-interval" argument for fine-tuning). I've been
using it in production for over a year to push all writes to the
queue_log to a remote reporting server and it has been rock solid.

It operates almost identically to "tail -F" except every new write to
the file is written over a socket connection. The remote end of the
connection is responsible for sending back an acknowledgment. If it
doesn't, replicate will spool the write to a temporary file on the local
machine. Once the remote end is responding again, the spool file is
written to it. This allows us to have downtime (expected or unexpected)
on the reporting server without losing any queue_log records.

I've never released replicate publicly, because I'm not sure how taking
a program like tail and adapting it to a new purpose is handled by the
GPL. However, I'm sure someone on this list more knowledgeable than
myself can help me understand that issue.

Regards,

Matthew Roth
InterMedia Marketing Solutions
Software Engineer and Systems Developer


_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
--
Alex Balashov
Evariste Systems
Web : http://www.evaristesys.com/
Tel : (+1) (678) 954-0670
Direct : (+1) (678) 954-0671
Mobile : (+1) (706) 338-8599
Back to top
mroth at imminc.com
Guest





PostPosted: Thu May 22, 2008 12:32 pm    Post subject: [asterisk-users] Asterisk Database Handling Reply with quote

Alex Balashov wrote:
Quote:
A program like netcat?

Alex,

You're not the first person to suggest nc for this purpose. As I
understand it, it's a TCP/UDP swiss army knife so I'm sure it's up to
the task. However, in reading the man page, I don't see any trivial way
to buffer failed writes and retry them when the connection is
reestablished. I'd be glad to hear it if you know of a way. As it is,
I'm assuming that I'd have to write a script around nc to handle such
situations. If that's the case, I'll stick with my program because the
development time is a sunk cost and it "just works" for my particular
application.

Regards,

Matthew Roth
InterMedia Marketing Solutions
Software Engineer and Systems Developer
Back to top
abalashov at evaristes...
Guest





PostPosted: Thu May 22, 2008 12:38 pm    Post subject: [asterisk-users] Asterisk Database Handling Reply with quote

Matthew J. Roth wrote:
Quote:
Alex Balashov wrote:
Quote:
A program like netcat?

Alex,

You're not the first person to suggest nc for this purpose. As I
understand it, it's a TCP/UDP swiss army knife so I'm sure it's up to
the task. However, in reading the man page, I don't see any trivial way
to buffer failed writes and retry them when the connection is
reestablished. I'd be glad to hear it if you know of a way. As it is,
I'm assuming that I'd have to write a script around nc to handle such
situations. If that's the case, I'll stick with my program because the
development time is a sunk cost and it "just works" for my particular
application.

True, true. nc does not have that capability.
--
Alex Balashov
Evariste Systems
Web : http://www.evaristesys.com/
Tel : (+1) (678) 954-0670
Direct : (+1) (678) 954-0671
Mobile : (+1) (706) 338-8599
Back to top
jra at baylink.com
Guest





PostPosted: Thu May 22, 2008 3:43 pm    Post subject: [asterisk-users] Asterisk Database Handling Reply with quote

On Wed, May 21, 2008 at 06:02:07PM -0400, Alex Balashov wrote:
Quote:
Douglas Garstang wrote:
Quote:
We are sending CDR's to MySQL via odbc. It seems that Asterisk is
sometimes dropping CDR's, and they aren't being sent to the database
(they ARE in the Master.csv file though). We suspect that when the MySQL
socket is idle, it gets disconnected, either by the MySQL server or by
our firewall, and when Asterisk goes to send the next CDR over the
socket, does not re-open the database, and drops that CDR. Possibly on
the next call, it connects ok and sends the next CDR.

Isn't there a keepalive option somewhere for cdr_mysql.conf, or failing
that, a keepalive mechanism that can be enabled for TCP connections on
the server side?

In some recent mysql update, the behaviour with which it times out
connections changed, and it bit some other project I follow as well;
MythTV, I think. You might check their mailing list, Doug, for details.

Cheers,
-- jra
--
Jay R. Ashworth Baylink jra at baylink.com
Designer The Things I Think RFC 2100
Ashworth & Associates http://baylink.pitas.com '87 e24
St Petersburg FL USA http://photo.imageinc.us +1 727 647 1274

Those who cast the vote decide nothing.
Those who count the vote decide everything.
-- (Joseph Stalin)
Back to top
jra at baylink.com
Guest





PostPosted: Thu May 22, 2008 3:46 pm    Post subject: [asterisk-users] Asterisk Database Handling Reply with quote

On Thu, May 22, 2008 at 10:05:13AM -0500, Tilghman Lesher wrote:
Quote:
Quote:
I've never released replicate publicly, because I'm not sure how taking
a program like tail and adapting it to a new purpose is handled by the
GPL. However, I'm sure someone on this list more knowledgeable than
myself can help me understand that issue.

There's no problem, as long as you distribute your program under the GPL,
which means providing the source on demand to anybody to whom you distribute
a binary.

If you want to distribute under another license, then it comes down to how you
developed the code. If you developed the code to work similarly to tail, but
you did not use any tail code (or any other GPL code) directly, then you're
pretty much free to use any license you like. However, if you started off
with the tail codebase and altered it, it is a derivative work, and GPL is the
only way to go.

And of course, as long as you don't distribute it[1], then you can do
anything you like with it, GPL or not.

Cheers,
-- jra
[1]for suitable values of 'distribute', which for GPLv2 means "ship",
and for GPLv3/AGPL means "make available through a web service".
--
Jay R. Ashworth Baylink jra at baylink.com
Designer The Things I Think RFC 2100
Ashworth & Associates http://baylink.pitas.com '87 e24
St Petersburg FL USA http://photo.imageinc.us +1 727 647 1274

Those who cast the vote decide nothing.
Those who count the vote decide everything.
-- (Joseph Stalin)
Back to top
mroth at imminc.com
Guest





PostPosted: Sat May 24, 2008 2:35 pm    Post subject: [asterisk-users] Asterisk Database Handling Reply with quote

Tilghman and Jay,

Thanks for the licensing advice. If anyone is interested in replicate,
I'm now ready to distribute it under the GPL.

Regards,

Matthew Roth
InterMedia Marketing Solutions
Software Engineer and Systems Developer
Back to top
bwentdg at pipeline.com
Guest





PostPosted: Sun Jun 01, 2008 5:58 am    Post subject: [asterisk-users] Asterisk Database Handling Reply with quote

OK - but when * goes to "insert" the CDR Record, if the MYSQL connection
has "timed-out"
shouldn't the Interace (I guess the ODBC) return an ERROR condition,
indicating that the
SQL command FAILED ? Shouldn't * recognize that and either RETRY
several times or LOG an Error ???

Jay R. Ashworth wrote:
Quote:
On Wed, May 21, 2008 at 06:02:07PM -0400, Alex Balashov wrote:

Quote:
Douglas Garstang wrote:

Quote:
We are sending CDR's to MySQL via odbc. It seems that Asterisk is
sometimes dropping CDR's, and they aren't being sent to the database
(they ARE in the Master.csv file though). We suspect that when the MySQL
socket is idle, it gets disconnected, either by the MySQL server or by
our firewall, and when Asterisk goes to send the next CDR over the
socket, does not re-open the database, and drops that CDR. Possibly on
the next call, it connects ok and sends the next CDR.

Isn't there a keepalive option somewhere for cdr_mysql.conf, or failing
that, a keepalive mechanism that can be enabled for TCP connections on
the server side?


In some recent mysql update, the behaviour with which it times out
connections changed, and it bit some other project I follow as well;
MythTV, I think. You might check their mailing list, Doug, for details.

Cheers,
-- jra
Back to top
michael_bulk at wildga...
Guest





PostPosted: Mon Jun 02, 2008 6:57 pm    Post subject: [asterisk-users] Asterisk Database Handling Reply with quote

Just wondering, but why are you using ODBC? You can use the native
MySQL driver that compiles in asterisk-addons, removing a layer of
overhead, as well as potential issues with the ODBC driver. Even
better, if you're using a MySQL server on the same system as your
Asterisk box, you can write directly to the socket rather than via IP.

Mik

Al Baker wrote:
Quote:
OK - but when * goes to "insert" the CDR Record, if the MYSQL connection
has "timed-out"
shouldn't the Interace (I guess the ODBC) return an ERROR condition,
indicating that the
SQL command FAILED ? Shouldn't * recognize that and either RETRY
several times or LOG an Error ???

Jay R. Ashworth wrote:
Quote:
On Wed, May 21, 2008 at 06:02:07PM -0400, Alex Balashov wrote:

Quote:
Douglas Garstang wrote:

Quote:
We are sending CDR's to MySQL via odbc. It seems that Asterisk is
sometimes dropping CDR's, and they aren't being sent to the database
(they ARE in the Master.csv file though). We suspect that when the MySQL
socket is idle, it gets disconnected, either by the MySQL server or by
our firewall, and when Asterisk goes to send the next CDR over the
socket, does not re-open the database, and drops that CDR. Possibly on
the next call, it connects ok and sends the next CDR.

Isn't there a keepalive option somewhere for cdr_mysql.conf, or failing
that, a keepalive mechanism that can be enabled for TCP connections on
the server side?

In some recent mysql update, the behaviour with which it times out
connections changed, and it bit some other project I follow as well;
MythTV, I think. You might check their mailing list, Doug, for details.

Cheers,
-- jra



_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users

Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users All times are GMT - 5 Hours
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services