<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[Freeswitch-trunk][16974] </title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<div id="header">FreeSWITCH Subversion</div>
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://fisheye.freeswitch.org/changelog/FreeSWITCH?cs=16974">16974</a></dd>
<dt>Author</dt> <dd>nazim</dd>
<dt>Date</dt> <dd>2010-03-12 10:48:13 -0600 (Fri, 12 Mar 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Initial import of xmlcdrd</pre>
<h3>Added Paths</h3>
<ul>
<li>freeswitch/trunk/contrib/nazim/xmlcdrd/</li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdAUTHORS">freeswitch/trunk/contrib/nazim/xmlcdrd/AUTHORS</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdCOPYING">freeswitch/trunk/contrib/nazim/xmlcdrd/COPYING</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdChangeLog">freeswitch/trunk/contrib/nazim/xmlcdrd/ChangeLog</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdINSTALL">freeswitch/trunk/contrib/nazim/xmlcdrd/INSTALL</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdMakefileam">freeswitch/trunk/contrib/nazim/xmlcdrd/Makefile.am</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdNEWS">freeswitch/trunk/contrib/nazim/xmlcdrd/NEWS</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdREADME">freeswitch/trunk/contrib/nazim/xmlcdrd/README</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdbootstrapsh">freeswitch/trunk/contrib/nazim/xmlcdrd/bootstrap.sh</a></li>
<li>freeswitch/trunk/contrib/nazim/xmlcdrd/conf/</li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdconfdb1conf">freeswitch/trunk/contrib/nazim/xmlcdrd/conf/db1.conf</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdconflighttpdconfexample">freeswitch/trunk/contrib/nazim/xmlcdrd/conf/lighttpd.conf.example</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdconfluaexecconfdist">freeswitch/trunk/contrib/nazim/xmlcdrd/conf/luaexec.conf.dist</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdconftestlua">freeswitch/trunk/contrib/nazim/xmlcdrd/conf/test.lua</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdconfxmlcdrconfdist">freeswitch/trunk/contrib/nazim/xmlcdrd/conf/xmlcdr.conf.dist</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdconfigureac">freeswitch/trunk/contrib/nazim/xmlcdrd/configure.ac</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdinstallsh">freeswitch/trunk/contrib/nazim/xmlcdrd/install-sh</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdlogc">freeswitch/trunk/contrib/nazim/xmlcdrd/log.c</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdlogh">freeswitch/trunk/contrib/nazim/xmlcdrd/log.h</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdmainc">freeswitch/trunk/contrib/nazim/xmlcdrd/main.c</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdmissing">freeswitch/trunk/contrib/nazim/xmlcdrd/missing</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdplugc">freeswitch/trunk/contrib/nazim/xmlcdrd/plug.c</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdplugh">freeswitch/trunk/contrib/nazim/xmlcdrd/plug.h</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdplugcommonh">freeswitch/trunk/contrib/nazim/xmlcdrd/plugcommon.h</a></li>
<li>freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/</li>
<li>freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/luaexec/</li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdpluginsluaexecMakefileam">freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/luaexec/Makefile.am</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdpluginsluaexecluaexecc">freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/luaexec/luaexec.c</a></li>
<li>freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/mysqlcdr/</li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdpluginsmysqlcdrMakefileam">freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/mysqlcdr/Makefile.am</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdpluginsmysqlcdrdbcommonc">freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/mysqlcdr/dbcommon.c</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdpluginsmysqlcdrdbcommonh">freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/mysqlcdr/dbcommon.h</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdpluginsmysqlcdrmysqlcdrc">freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/mysqlcdr/mysqlcdr.c</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdplugldrc">freeswitch/trunk/contrib/nazim/xmlcdrd/plugldr.c</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdplugldrh">freeswitch/trunk/contrib/nazim/xmlcdrd/plugldr.h</a></li>
<li>freeswitch/trunk/contrib/nazim/xmlcdrd/scripts/</li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdstmtexpc">freeswitch/trunk/contrib/nazim/xmlcdrd/stmtexp.c</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdstmtexph">freeswitch/trunk/contrib/nazim/xmlcdrd/stmtexp.h</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdstmtexpldrc">freeswitch/trunk/contrib/nazim/xmlcdrd/stmtexpldr.c</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdstmtexpldrh">freeswitch/trunk/contrib/nazim/xmlcdrd/stmtexpldr.h</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdstmtexptabh">freeswitch/trunk/contrib/nazim/xmlcdrd/stmtexptab.h</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdtestxml">freeswitch/trunk/contrib/nazim/xmlcdrd/test.xml</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdurldecodec">freeswitch/trunk/contrib/nazim/xmlcdrd/urldecode.c</a></li>
<li><a href="#freeswitchtrunkcontribnazimxmlcdrdurldecodeh">freeswitch/trunk/contrib/nazim/xmlcdrd/urldecode.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunkcontribnazimxmlcdrdAUTHORS"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/AUTHORS (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/AUTHORS         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/AUTHORS        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+Nazim Aghabayov
+mail-to: nazim.aghabayov at buta-tech.com
+
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdCOPYING"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/COPYING (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/COPYING         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/COPYING        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,471 @@
</span><ins>+ MOZILLA PUBLIC LICENSE
+ Version 1.1
+
+ ---------------
+
+1. Definitions.
+
+ 1.0.1. "Commercial Use" means distribution or otherwise making the
+ Covered Code available to a third party.
+
+ 1.1. "Contributor" means each entity that creates or contributes to
+ the creation of Modifications.
+
+ 1.2. "Contributor Version" means the combination of the Original
+ Code, prior Modifications used by a Contributor, and the Modifications
+ made by that particular Contributor.
+
+ 1.3. "Covered Code" means the Original Code or Modifications or the
+ combination of the Original Code and Modifications, in each case
+ including portions thereof.
+
+ 1.4. "Electronic Distribution Mechanism" means a mechanism generally
+ accepted in the software development community for the electronic
+ transfer of data.
+
+ 1.5. "Executable" means Covered Code in any form other than Source
+ Code.
+
+ 1.6. "Initial Developer" means the individual or entity identified
+ as the Initial Developer in the Source Code notice required by Exhibit
+ A.
+
+ 1.7. "Larger Work" means a work which combines Covered Code or
+ portions thereof with code not governed by the terms of this License.
+
+ 1.8. "License" means this document.
+
+ 1.8.1. "Licensable" means having the right to grant, to the maximum
+ extent possible, whether at the time of the initial grant or
+ subsequently acquired, any and all of the rights conveyed herein.
+
+ 1.9. "Modifications" means any addition to or deletion from the
+ substance or structure of either the Original Code or any previous
+ Modifications. When Covered Code is released as a series of files, a
+ Modification is:
+ A. Any addition to or deletion from the contents of a file
+ containing Original Code or previous Modifications.
+
+ B. Any new file that contains any part of the Original Code or
+ previous Modifications.
+
+ 1.10. "Original Code" means Source Code of computer software code
+ which is described in the Source Code notice required by Exhibit A as
+ Original Code, and which, at the time of its release under this
+ License is not already Covered Code governed by this License.
+
+ 1.10.1. "Patent Claims" means any patent claim(s), now owned or
+ hereafter acquired, including without limitation, method, process,
+ and apparatus claims, in any patent Licensable by grantor.
+
+ 1.11. "Source Code" means the preferred form of the Covered Code for
+ making modifications to it, including all modules it contains, plus
+ any associated interface definition files, scripts used to control
+ compilation and installation of an Executable, or source code
+ differential comparisons against either the Original Code or another
+ well known, available Covered Code of the Contributor's choice. The
+ Source Code can be in a compressed or archival form, provided the
+ appropriate decompression or de-archiving software is widely available
+ for no charge.
+
+ 1.12. "You" (or "Your") means an individual or a legal entity
+ exercising rights under, and complying with all of the terms of, this
+ License or a future version of this License issued under Section 6.1.
+ For legal entities, "You" includes any entity which controls, is
+ controlled by, or is under common control with You. For purposes of
+ this definition, "control" means (a) the power, direct or indirect,
+ to cause the direction or management of such entity, whether by
+ contract or otherwise, or (b) ownership of more than fifty percent
+ (50%) of the outstanding shares or beneficial ownership of such
+ entity.
+
+2. Source Code License.
+
+ 2.1. The Initial Developer Grant.
+ The Initial Developer hereby grants You a world-wide, royalty-free,
+ non-exclusive license, subject to third party intellectual property
+ claims:
+ (a) under intellectual property rights (other than patent or
+ trademark) Licensable by Initial Developer to use, reproduce,
+ modify, display, perform, sublicense and distribute the Original
+ Code (or portions thereof) with or without Modifications, and/or
+ as part of a Larger Work; and
+
+ (b) under Patents Claims infringed by the making, using or
+ selling of Original Code, to make, have made, use, practice,
+ sell, and offer for sale, and/or otherwise dispose of the
+ Original Code (or portions thereof).
+
+ (c) the licenses granted in this Section 2.1(a) and (b) are
+ effective on the date Initial Developer first distributes
+ Original Code under the terms of this License.
+
+ (d) Notwithstanding Section 2.1(b) above, no patent license is
+ granted: 1) for code that You delete from the Original Code; 2)
+ separate from the Original Code; or 3) for infringements caused
+ by: i) the modification of the Original Code or ii) the
+ combination of the Original Code with other software or devices.
+
+ 2.2. Contributor Grant.
+ Subject to third party intellectual property claims, each Contributor
+ hereby grants You a world-wide, royalty-free, non-exclusive license
+
+ (a) under intellectual property rights (other than patent or
+ trademark) Licensable by Contributor, to use, reproduce, modify,
+ display, perform, sublicense and distribute the Modifications
+ created by such Contributor (or portions thereof) either on an
+ unmodified basis, with other Modifications, as Covered Code
+ and/or as part of a Larger Work; and
+
+ (b) under Patent Claims infringed by the making, using, or
+ selling of Modifications made by that Contributor either alone
+ and/or in combination with its Contributor Version (or portions
+ of such combination), to make, use, sell, offer for sale, have
+ made, and/or otherwise dispose of: 1) Modifications made by that
+ Contributor (or portions thereof); and 2) the combination of
+ Modifications made by that Contributor with its Contributor
+ Version (or portions of such combination).
+
+ (c) the licenses granted in Sections 2.2(a) and 2.2(b) are
+ effective on the date Contributor first makes Commercial Use of
+ the Covered Code.
+
+ (d) Notwithstanding Section 2.2(b) above, no patent license is
+ granted: 1) for any code that Contributor has deleted from the
+ Contributor Version; 2) separate from the Contributor Version;
+ 3) for infringements caused by: i) third party modifications of
+ Contributor Version or ii) the combination of Modifications made
+ by that Contributor with other software (except as part of the
+ Contributor Version) or other devices; or 4) under Patent Claims
+ infringed by Covered Code in the absence of Modifications made by
+ that Contributor.
+
+3. Distribution Obligations.
+
+ 3.1. Application of License.
+ The Modifications which You create or to which You contribute are
+ governed by the terms of this License, including without limitation
+ Section 2.2. The Source Code version of Covered Code may be
+ distributed only under the terms of this License or a future version
+ of this License released under Section 6.1, and You must include a
+ copy of this License with every copy of the Source Code You
+ distribute. You may not offer or impose any terms on any Source Code
+ version that alters or restricts the applicable version of this
+ License or the recipients' rights hereunder. However, You may include
+ an additional document offering the additional rights described in
+ Section 3.5.
+
+ 3.2. Availability of Source Code.
+ Any Modification which You create or to which You contribute must be
+ made available in Source Code form under the terms of this License
+ either on the same media as an Executable version or via an accepted
+ Electronic Distribution Mechanism to anyone to whom you made an
+ Executable version available; and if made available via Electronic
+ Distribution Mechanism, must remain available for at least twelve (12)
+ months after the date it initially became available, or at least six
+ (6) months after a subsequent version of that particular Modification
+ has been made available to such recipients. You are responsible for
+ ensuring that the Source Code version remains available even if the
+ Electronic Distribution Mechanism is maintained by a third party.
+
+ 3.3. Description of Modifications.
+ You must cause all Covered Code to which You contribute to contain a
+ file documenting the changes You made to create that Covered Code and
+ the date of any change. You must include a prominent statement that
+ the Modification is derived, directly or indirectly, from Original
+ Code provided by the Initial Developer and including the name of the
+ Initial Developer in (a) the Source Code, and (b) in any notice in an
+ Executable version or related documentation in which You describe the
+ origin or ownership of the Covered Code.
+
+ 3.4. Intellectual Property Matters
+ (a) Third Party Claims.
+ If Contributor has knowledge that a license under a third party's
+ intellectual property rights is required to exercise the rights
+ granted by such Contributor under Sections 2.1 or 2.2,
+ Contributor must include a text file with the Source Code
+ distribution titled "LEGAL" which describes the claim and the
+ party making the claim in sufficient detail that a recipient will
+ know whom to contact. If Contributor obtains such knowledge after
+ the Modification is made available as described in Section 3.2,
+ Contributor shall promptly modify the LEGAL file in all copies
+ Contributor makes available thereafter and shall take other steps
+ (such as notifying appropriate mailing lists or newsgroups)
+ reasonably calculated to inform those who received the Covered
+ Code that new knowledge has been obtained.
+
+ (b) Contributor APIs.
+ If Contributor's Modifications include an application programming
+ interface and Contributor has knowledge of patent licenses which
+ are reasonably necessary to implement that API, Contributor must
+ also include this information in the LEGAL file.
+
+ (c) Representations.
+ Contributor represents that, except as disclosed pursuant to
+ Section 3.4(a) above, Contributor believes that Contributor's
+ Modifications are Contributor's original creation(s) and/or
+ Contributor has sufficient rights to grant the rights conveyed by
+ this License.
+
+ 3.5. Required Notices.
+ You must duplicate the notice in Exhibit A in each file of the Source
+ Code. If it is not possible to put such notice in a particular Source
+ Code file due to its structure, then You must include such notice in a
+ location (such as a relevant directory) where a user would be likely
+ to look for such a notice. If You created one or more Modification(s)
+ You may add your name as a Contributor to the notice described in
+ Exhibit A. You must also duplicate this License in any documentation
+ for the Source Code where You describe recipients' rights or ownership
+ rights relating to Covered Code. You may choose to offer, and to
+ charge a fee for, warranty, support, indemnity or liability
+ obligations to one or more recipients of Covered Code. However, You
+ may do so only on Your own behalf, and not on behalf of the Initial
+ Developer or any Contributor. You must make it absolutely clear than
+ any such warranty, support, indemnity or liability obligation is
+ offered by You alone, and You hereby agree to indemnify the Initial
+ Developer and every Contributor for any liability incurred by the
+ Initial Developer or such Contributor as a result of warranty,
+ support, indemnity or liability terms You offer.
+
+ 3.6. Distribution of Executable Versions.
+ You may distribute Covered Code in Executable form only if the
+ requirements of Section 3.1-3.5 have been met for that Covered Code,
+ and if You include a notice stating that the Source Code version of
+ the Covered Code is available under the terms of this License,
+ including a description of how and where You have fulfilled the
+ obligations of Section 3.2. The notice must be conspicuously included
+ in any notice in an Executable version, related documentation or
+ collateral in which You describe recipients' rights relating to the
+ Covered Code. You may distribute the Executable version of Covered
+ Code or ownership rights under a license of Your choice, which may
+ contain terms different from this License, provided that You are in
+ compliance with the terms of this License and that the license for the
+ Executable version does not attempt to limit or alter the recipient's
+ rights in the Source Code version from the rights set forth in this
+ License. If You distribute the Executable version under a different
+ license You must make it absolutely clear that any terms which differ
+ from this License are offered by You alone, not by the Initial
+ Developer or any Contributor. You hereby agree to indemnify the
+ Initial Developer and every Contributor for any liability incurred by
+ the Initial Developer or such Contributor as a result of any such
+ terms You offer.
+
+ 3.7. Larger Works.
+ You may create a Larger Work by combining Covered Code with other code
+ not governed by the terms of this License and distribute the Larger
+ Work as a single product. In such a case, You must make sure the
+ requirements of this License are fulfilled for the Covered Code.
+
+4. Inability to Comply Due to Statute or Regulation.
+
+ If it is impossible for You to comply with any of the terms of this
+ License with respect to some or all of the Covered Code due to
+ statute, judicial order, or regulation then You must: (a) comply with
+ the terms of this License to the maximum extent possible; and (b)
+ describe the limitations and the code they affect. Such description
+ must be included in the LEGAL file described in Section 3.4 and must
+ be included with all distributions of the Source Code. Except to the
+ extent prohibited by statute or regulation, such description must be
+ sufficiently detailed for a recipient of ordinary skill to be able to
+ understand it.
+
+5. Application of this License.
+
+ This License applies to code to which the Initial Developer has
+ attached the notice in Exhibit A and to related Covered Code.
+
+6. Versions of the License.
+
+ 6.1. New Versions.
+ Netscape Communications Corporation ("Netscape") may publish revised
+ and/or new versions of the License from time to time. Each version
+ will be given a distinguishing version number.
+
+ 6.2. Effect of New Versions.
+ Once Covered Code has been published under a particular version of the
+ License, You may always continue to use it under the terms of that
+ version. You may also choose to use such Covered Code under the terms
+ of any subsequent version of the License published by Netscape. No one
+ other than Netscape has the right to modify the terms applicable to
+ Covered Code created under this License.
+
+ 6.3. Derivative Works.
+ If You create or use a modified version of this License (which you may
+ only do in order to apply it to code which is not already Covered Code
+ governed by this License), You must (a) rename Your license so that
+ the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape",
+ "MPL", "NPL" or any confusingly similar phrase do not appear in your
+ license (except to note that your license differs from this License)
+ and (b) otherwise make it clear that Your version of the license
+ contains terms which differ from the Mozilla Public License and
+ Netscape Public License. (Filling in the name of the Initial
+ Developer, Original Code or Contributor in the notice described in
+ Exhibit A shall not of themselves be deemed to be modifications of
+ this License.)
+
+7. DISCLAIMER OF WARRANTY.
+
+ COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
+ DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
+ THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
+ IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
+ YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
+ COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
+ OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+ ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+
+8. TERMINATION.
+
+ 8.1. This License and the rights granted hereunder will terminate
+ automatically if You fail to comply with terms herein and fail to cure
+ such breach within 30 days of becoming aware of the breach. All
+ sublicenses to the Covered Code which are properly granted shall
+ survive any termination of this License. Provisions which, by their
+ nature, must remain in effect beyond the termination of this License
+ shall survive.
+
+ 8.2. If You initiate litigation by asserting a patent infringement
+ claim (excluding declatory judgment actions) against Initial Developer
+ or a Contributor (the Initial Developer or Contributor against whom
+ You file such action is referred to as "Participant") alleging that:
+
+ (a) such Participant's Contributor Version directly or indirectly
+ infringes any patent, then any and all rights granted by such
+ Participant to You under Sections 2.1 and/or 2.2 of this License
+ shall, upon 60 days notice from Participant terminate prospectively,
+ unless if within 60 days after receipt of notice You either: (i)
+ agree in writing to pay Participant a mutually agreeable reasonable
+ royalty for Your past and future use of Modifications made by such
+ Participant, or (ii) withdraw Your litigation claim with respect to
+ the Contributor Version against such Participant. If within 60 days
+ of notice, a reasonable royalty and payment arrangement are not
+ mutually agreed upon in writing by the parties or the litigation claim
+ is not withdrawn, the rights granted by Participant to You under
+ Sections 2.1 and/or 2.2 automatically terminate at the expiration of
+ the 60 day notice period specified above.
+
+ (b) any software, hardware, or device, other than such Participant's
+ Contributor Version, directly or indirectly infringes any patent, then
+ any rights granted to You by such Participant under Sections 2.1(b)
+ and 2.2(b) are revoked effective as of the date You first made, used,
+ sold, distributed, or had made, Modifications made by that
+ Participant.
+
+ 8.3. If You assert a patent infringement claim against Participant
+ alleging that such Participant's Contributor Version directly or
+ indirectly infringes any patent where such claim is resolved (such as
+ by license or settlement) prior to the initiation of patent
+ infringement litigation, then the reasonable value of the licenses
+ granted by such Participant under Sections 2.1 or 2.2 shall be taken
+ into account in determining the amount or value of any payment or
+ license.
+
+ 8.4. In the event of termination under Sections 8.1 or 8.2 above,
+ all end user license agreements (excluding distributors and resellers)
+ which have been validly granted by You or any distributor hereunder
+ prior to termination shall survive termination.
+
+9. LIMITATION OF LIABILITY.
+
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+ (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
+ DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
+ OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR
+ ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
+ CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
+ WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+ COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+ INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+ LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
+ RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
+ PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
+ EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
+ THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
+
+10. U.S. GOVERNMENT END USERS.
+
+ The Covered Code is a "commercial item," as that term is defined in
+ 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
+ software" and "commercial computer software documentation," as such
+ terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
+ C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
+ all U.S. Government End Users acquire Covered Code with only those
+ rights set forth herein.
+
+11. MISCELLANEOUS.
+
+ This License represents the complete agreement concerning subject
+ matter hereof. If any provision of this License is held to be
+ unenforceable, such provision shall be reformed only to the extent
+ necessary to make it enforceable. This License shall be governed by
+ California law provisions (except to the extent applicable law, if
+ any, provides otherwise), excluding its conflict-of-law provisions.
+ With respect to disputes in which at least one party is a citizen of,
+ or an entity chartered or registered to do business in the United
+ States of America, any litigation relating to this License shall be
+ subject to the jurisdiction of the Federal Courts of the Northern
+ District of California, with venue lying in Santa Clara County,
+ California, with the losing party responsible for costs, including
+ without limitation, court costs and reasonable attorneys' fees and
+ expenses. The application of the United Nations Convention on
+ Contracts for the International Sale of Goods is expressly excluded.
+ Any law or regulation which provides that the language of a contract
+ shall be construed against the drafter shall not apply to this
+ License.
+
+12. RESPONSIBILITY FOR CLAIMS.
+
+ As between Initial Developer and the Contributors, each party is
+ responsible for claims and damages arising, directly or indirectly,
+ out of its utilization of rights under this License and You agree to
+ work with Initial Developer and Contributors to distribute such
+ responsibility on an equitable basis. Nothing herein is intended or
+ shall be deemed to constitute any admission of liability.
+
+13. MULTIPLE-LICENSED CODE.
+
+ Initial Developer may designate portions of the Covered Code as
+ "Multiple-Licensed". "Multiple-Licensed" means that the Initial
+ Developer permits you to utilize portions of the Covered Code under
+ Your choice of the NPL or the alternative licenses, if any, specified
+ by the Initial Developer in the file described in Exhibit A.
+
+EXHIBIT A -Mozilla Public License.
+
+ ``The contents of this file are subject to the Mozilla Public License
+ Version 1.1 (the "License"); you may not use this file except in
+ compliance with the License. You may obtain a copy of the License at
+ http://www.mozilla.org/MPL/
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ License for the specific language governing rights and limitations
+ under the License.
+
+ The Original Code is ______________________________________.
+
+ The Initial Developer of the Original Code is ________________________.
+ Portions created by ______________________ are Copyright (C) ______
+ _______________________. All Rights Reserved.
+
+ Contributor(s): ______________________________________.
+
+ Alternatively, the contents of this file may be used under the terms
+ of the _____ license (the "[___] License"), in which case the
+ provisions of [______] License are applicable instead of those
+ above. If you wish to allow use of your version of this file only
+ under the terms of the [____] License and not to allow others to use
+ your version of this file under the MPL, indicate your decision by
+ deleting the provisions above and replace them with the notice and
+ other provisions required by the [___] License. If you do not delete
+ the provisions above, a recipient may use your version of this file
+ under either the MPL or the [___] License."
+
+ [NOTE: The text of this Exhibit A may differ slightly from the text of
+ the notices in the Source Code files of the Original Code. You should
+ use the text of this Exhibit A rather than the text found in the
+ Original Code Source Code for Your Modifications.]
+
+
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdChangeLog"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/ChangeLog ( => )</h4>
<pre class="diff"><span>
<span class="info">
Added: freeswitch/trunk/contrib/nazim/xmlcdrd/INSTALL
</span><span class="cx">===================================================================
</span></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdMakefileam"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/Makefile.am (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/Makefile.am         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/Makefile.am        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,79 @@
</span><ins>+SHELL = /bin/sh
+VPATH = @srcdir@
+
+confdir = "/etc/xmlcdrd"
+subdirs = @subdirs@
+top_srcdir = @top_srcdir@
+srcdir = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+bindir = $(exec_prefix)/bin
+infodir = $(prefix)/info
+libdir = $(prefix)/lib
+includedir = $(prefix)/include
+mandir = $(prefix)/man/man1
+snapshot = $(srcdir)/../`date +xmlcdr_%Y%m%d_%H%M`
+
+CC = @CC@
+CPPFLAGS = @CPPFLAGS@
+CFLAGS = $(CPPFLAGS) -fPIC -Wall @CFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+INCS = @INCS@
+INSTALL = @INSTALL@
+
+all:
+        $(CC) $(CFLAGS) @with_glib2_flags@ -c stmtexpldr.c
+        $(CC) $(CFLAGS) @with_glib2_flags@ -lconfig -c stmtexp.c
+        $(CC) $(CFLAGS) @with_glib2_flags@ -c plug.c
+        $(CC) $(CFLAGS) @with_glib2_flags@ -c plugldr.c
+        $(CC) $(CFLAGS) -c log.c
+        $(CC) $(CFLAGS) `@with_apreq2_config@ --libs --includes` \
+`@with_apr_config@ --libs --includes --cppflags` @with_glib2_flags@ -c urldecode.c
+
+if BUILDMYSQLCDR
+        $(MAKE) -C plugins/mysqlcdr
+endif
+        
+if BUILDLUAEXEC
+        $(MAKE) -C plugins/luaexec
+endif
+
+        $(CC) $(CFLAGS) \
+ `@with_apreq2_config@ --libs --includes` \
+ `@with_apr_config@ --libs --includes --cppflags --link-ld ` \
+ @with_glib2_flags@ -lglib-2.0 \
+ `@with_xml2_config@ --cflags --libs` \
+ $(LIBS) \
+ stmtexpldr.o stmtexp.o log.o urldecode.o \
+ plugldr.o plug.o \
+-o xmlcdr.fcgi main.c
+
+
+snapshot:
+        -tar --exclude-vcs -zcf $(snapshot).tgz -R $(srcdir) ; fi
+
+install:
+        -cp xmlcdr.fcgi $(bindir)/
+        -if [ ! -d $(confdir) ]; then mkdir $(confdir); fi
+        -cp conf/* $(confdir)/
+
+if BUILDMYSQLCDR
+        $(MAKE) -C plugins/mysqlcdr install
+endif
+
+if BUILDLUAEXEC
+        $(MAKE) -C plugins/luaexec install
+endif
+
+
+clean:
+        -rm -f *.o xmlcdr.fcgi
+
+if BUILDMYSQLCDR
+        $(MAKE) -C plugins/mysqlcdr clean
+endif
+
+if BUILDLUAEXEC
+        $(MAKE) -C plugins/luaexec clean
+endif
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdNEWS"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/NEWS ( => )</h4>
<pre class="diff"><span>
<span class="info">
Added: freeswitch/trunk/contrib/nazim/xmlcdrd/README
</span><span class="cx">===================================================================
</span></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdbootstrapsh"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/bootstrap.sh (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/bootstrap.sh         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/bootstrap.sh        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+#!/bin/sh
+
+aclocal
+autoconf
+autoheader
+automake
+rm -rf autom4te*.cache
+
</ins><span class="cx">Property changes on: freeswitch/trunk/contrib/nazim/xmlcdrd/bootstrap.sh
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:executable
</span><span class="cx"> + *
</span></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdconfdb1conf"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/conf/db1.conf (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/conf/db1.conf         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/conf/db1.conf        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+dbuserid="ddp";
+dbpasswd="password";
+dbschema="ddp";
+dbipaddr="localhost";
+dbipport=3306;
+
+
+stmt_template="insert into cdr (caller_id_number, effective_caller_id_number, destination_number, billsec) values ('$<caller_id_number>','$<effective_caller_id_number>', '$<destination_number>', $<billsec>)";
+
+
+
+
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdconflighttpdconfexample"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/conf/lighttpd.conf.example (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/conf/lighttpd.conf.example         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/conf/lighttpd.conf.example        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,57 @@
</span><ins>+## bind to port (default: 80)
+server.port = 8080
+
+
+server.modules = (
+ "mod_access",
+ "mod_alias",
+ "mod_accesslog",
+ "mod_compress",
+ "mod_fastcgi"
+ )
+
+fastcgi.debug = 1
+server.document-root = "/home/nazim/www/"
+server.errorlog = "/home/nazim/var/log/lighttpd/error.log"
+index-file.names = ( "index.php", "index.html",
+ "index.htm", "default.htm",
+ "index.lighttpd.html" )
+
+accesslog.filename = "/home/nazim/var/log/lighttpd/access.log"
+
+url.access-deny = ( "~", ".inc" )
+static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
+
+server.pid-file = "/home/nazim/var/run/lighttpd.pid"
+dir-listing.encoding = "utf-8"
+server.dir-listing = "enable"
+server.username = "www-data"
+server.groupname = "www-data"
+compress.cache-dir = "/home/nazim/var/cache/lighttpd/compress/"
+compress.filetype = ("text/plain", "text/html", "application/x-javascript", "text/css")
+
+include_shell "/usr/share/lighttpd/create-mime.assign.pl"
+include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
+
+$HTTP["remoteip"] == "127.0.0.1" {
+        alias.url += (
+                "/doc/" => "/usr/share/doc/",
+                "/images/" => "/usr/share/images/"
+        )
+        $HTTP["url"] =~ "^/doc/|^/images/" {
+                dir-listing.activate = "enable"
+        }
+}
+
+fastcgi.server = (
+ "xmlcdr.fcgi" =>
+ ( "localhost" =>
+ (
+ "socket" => "/home/nazim/tmp/lighttpd-cdr-fcgi.socket",
+ "max-procs" => 5,
+ "bin-path" => "/home/nazim/prj/buta/xmlcdr/trunk/xmlcdr.fcgi",
+ "check-local" => "disable"
+ )
+ )
+ )
+
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdconfluaexecconfdist"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/conf/luaexec.conf.dist (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/conf/luaexec.conf.dist         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/conf/luaexec.conf.dist        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+luascript = "/etc/xmlcdrd/test.lua";
+
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdconftestlua"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/conf/test.lua (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/conf/test.lua         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/conf/test.lua        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+--print(xcdr_varget("uuid"), xcdr_varget("billsec"), xcdr_varget("uuid") )
+
+uuid = xcdr_varget("uuid")
+billsec = xcdr_varget("billsec")
+
+
+require "luasql.odbc"
+env = assert(luasql.odbc())
+db_conn = assert(env:connect("ddp") )
+db_conn:execute(string.format("insert into cdr (uuid,billsec) values ('%s', %d)", uuid, billsec))
+
+db_conn:close()
+env:close()
+
+--local file = assert(io.open("output.lua", "w"))
+--file:write("Hello world\n")
+--file:close()
+
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdconfxmlcdrconfdist"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/conf/xmlcdr.conf.dist (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/conf/xmlcdr.conf.dist         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/conf/xmlcdr.conf.dist        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,115 @@
</span><ins>+#Copy this file to /etc/xmlcdrd/xmlcdr.conf
+
+#Variables section
+Variables = (
+
+{
+name = "uuid";
+var_id = "uuid";
+xpath = "/cdr/callflow[@profile_index='1']/caller_profile/uuid";
+}
+,
+{
+name = "context";
+var_id = "context";
+xpath = "/cdr/callflow[@profile_index='1']/caller_profile/context";
+}
+,
+{
+name = "effective_caller_id_number";
+var_id = "effective_caller_id_number";
+xpath = "/cdr/variables/effective_caller_id_number";
+}
+,
+{
+name = "caller_id_number";
+var_id = "caller_id_number";
+xpath = "/cdr/callflow[@profile_index='1']/caller_profile/caller_id_number";
+}
+,
+{
+name = "destination_number";
+var_id = "destination_number";
+xpath = "/cdr/callflow[@profile_index='1']/caller_profile/destination_number";
+}
+,
+{
+name = "profile_destination_number";
+var_id = "profile_destination_number";
+xpath = "/cdr/callflow[@profile_index='1']/caller_profile/originatee/originatee_caller_profile/destination_number";
+}
+,
+{
+name = "callgroup";
+var_id = "callgroup";
+xpath = "/cdr/variables/planeta_callgroup";
+}
+,
+{
+name = "billsec";
+var_id = "billsec";
+xpath = "/cdr/variables/billsec";
+}
+,
+{
+name = "startep";
+var_id = "startep";
+xpath = "/cdr/variables/start_epoch";
+}
+,
+{
+name = "answep";
+var_id = "answep";
+xpath = "/cdr/variables/answer_epoch";
+}
+,
+{
+name = "endep";
+var_id = "endep";
+xpath = "/cdr/variables/end_epoch";
+}
+
+);
+#End of Variables
+
+
+#Plugins directory
+plugin_dir = "/usr/local/lib/xmlcdrd";
+
+
+
+#Plugins section
+Plugins = (
+
+#Plugin declaration
+{
+ #name is a name of so file without the extension
+ name="mysqlcdr";
+
+ #config file for plugin
+ options = "/etc/xmlcdrd/db1.conf";
+ priority = 10;
+
+ #Metrics control plugin execution
+ #Plugin with no metrics defined will be executed everytime
+ Metrics = (
+        {
+ metric = "destination_number";
+ regexp = "^6969.*";
+ }
+ );
+ #end of metrics
+
+},
+{
+ name="luaexec";
+ options="/etc/xmlcdrd/luaexec.conf";
+ priority=20;
+}
+
+#End of plugin declaration
+#You could define multiple plugins
+#Plugin declarations are separated with comma. See libconfig manual for details.
+
+);
+#End of Plugin section
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdconfigureac"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/configure.ac (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/configure.ac         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/configure.ac        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,109 @@
</span><ins>+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ([2.6])
+AC_INIT([xmlcdrd], [0.1], [xmlcdr@buta-tech.com])
+AM_INIT_AUTOMAKE
+AC_CONFIG_SRCDIR([urldecode.c])
+AC_CONFIG_HEADERS([config.h])
+
+# Checks for programs.
+AC_PROG_CC
+AC_PROG_INSTALL
+
+# Checks for libraries.
+
+AC_CHECK_LIB([apreq2], [main])
+
+AC_CHECK_LIB([apr-1], [main])
+
+AC_CHECK_LIB([config], [main])
+
+AC_CHECK_LIB([dl], [main])
+
+AC_CHECK_LIB([fcgi], [main])
+
+AC_CHECK_LIB([pcre], [main])
+
+AC_CHECK_LIB([glib-2.0], [main])
+
+AC_CHECK_LIB([xml2], [main])
+
+# Checks for header files.
+AC_CHECK_HEADERS([malloc.h stdlib.h string.h syslog.h])
+
+#check for library config scripts
+AC_MSG_CHECKING(for apreq2config)
+AC_ARG_WITH(apreq2_config,
+ AC_HELP_STRING([--with-apreq2-config@<:@=PATH@:>@],[Location of apreq2 configuration script.]),
+ [with_apreq2_config="$withval"],[with_apreq2_config="apreq2-config"])
+AC_SUBST(with_apreq2_config)
+
+AC_MSG_CHECKING(for aprconfig)
+AC_ARG_WITH(apr_config,
+ AC_HELP_STRING([--with-apr-config@<:@=PATH@:>@],[Location of apr configuration script.]),
+ [with_apr_config="$withval"],[with_apr_config="apr-1-config"])
+AC_SUBST(with_apr_config)
+
+AC_MSG_CHECKING(for mysqlconfig)
+AC_ARG_WITH(mysql_config,
+ AC_HELP_STRING([--with-mysql-config@<:@=PATH@:>@],[Location of mysql configuration script.]),
+ [with_mysql_config="$withval"],[with_mysql_config="mysql_config"])
+AC_SUBST(with_mysql_config)
+
+AC_MSG_CHECKING(for xml2config)
+AC_ARG_WITH(xml2_config,
+ AC_HELP_STRING([--with-xml2-config@<:@=PATH@:>@],[Location of libxml2 configuration script.]),
+ [with_xml2_config=="$withval"],[with_xml2_config="xml2-config"])
+AC_SUBST(with_xml2_config)
+
+AC_MSG_CHECKING(for glib2 flags)
+AC_ARG_WITH(glib2_flags,
+ AC_HELP_STRING([--with-glib2-flags],[glib2 CFLAGS.]),
+ [with_glib2_flags="$withval"],[with_glib2_flags="-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include"])
+AC_SUBST(with_glib2_flags)
+
+
+#Plugins to build
+
+#mysqlcdr
+domysqlcdr=yes
+
+AC_ARG_ENABLE(mysqlcdr,
+AS_HELP_STRING([--disable-mysqlcdr], [Disable building of mysqlcdr plugin]),
+[if test "$enableval" = "no"; then domysqlcdr="no"; fi],
+[
+domysqlcdr=yes
+]
+)
+
+AM_CONDITIONAL(BUILDMYSQLCDR, test x$domysqlcdr = xyes)
+
+
+#luaexec
+doluaexec=yes
+
+AC_ARG_ENABLE(luaexec,
+AS_HELP_STRING([--disable-luaexec], [Disable building of luaexec plugin]),
+[if test "$enableval" = "no"; then doluaexec="no"; fi],
+[
+doluaexec=yes
+]
+)
+
+AM_CONDITIONAL(BUILDLUAEXEC, test x$doluaexec = xyes)
+
+
+
+# Checks for typedefs, structures, and compiler characteristics.
+
+# Checks for library functions.
+AC_FUNC_MALLOC
+AC_FUNC_REALLOC
+AC_CHECK_FUNCS([memset strchr strdup strstr])
+
+AC_CONFIG_FILES([Makefile
+ plugins/mysqlcdr/Makefile
+ plugins/luaexec/Makefile])
+AC_OUTPUT
+
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdinstallsh"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/install-sh (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/install-sh         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/install-sh        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,520 @@
</span><ins>+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2009-04-28.21; # UTC
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+nl='
+'
+IFS=" ""        $nl"
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit=${DOITPROG-}
+if test -z "$doit"; then
+ doit_exec=exec
+else
+ doit_exec=$doit
+fi
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_glob='?'
+initialize_posix_glob='
+ test "$posix_glob" != "?" || {
+ if (set -f) 2>/dev/null; then
+ posix_glob=
+ else
+ posix_glob=:
+ fi
+ }
+'
+
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
+stripcmd=
+
+src=
+dst=
+dir_arg=
+dst_arg=
+
+copy_on_change=false
+no_target_directory=
+
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
+ or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+ or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+ --help display this help and exit.
+ --version display version info and exit.
+
+ -c (ignored)
+ -C install only if different (preserve the last data modification time)
+ -d create directories instead of installing files.
+ -g GROUP $chgrpprog installed files to GROUP.
+ -m MODE $chmodprog installed files to MODE.
+ -o USER $chownprog installed files to USER.
+ -s $stripprog installed files.
+ -t DIRECTORY install into DIRECTORY.
+ -T report an error if DSTFILE is a directory.
+
+Environment variables override the default commands:
+ CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+ RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+ case $1 in
+ -c) ;;
+
+ -C) copy_on_change=true;;
+
+ -d) dir_arg=true;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+        shift;;
+
+ --help) echo "$usage"; exit $?;;
+
+ -m) mode=$2
+        case $mode in
+         *' '* | *'        '* | *'
+'*         | *'*'* | *'?'* | *'['*)
+         echo "$0: invalid mode: $mode" >&2
+         exit 1;;
+        esac
+        shift;;
+
+ -o) chowncmd="$chownprog $2"
+        shift;;
+
+ -s) stripcmd=$stripprog;;
+
+ -t) dst_arg=$2
+        shift;;
+
+ -T) no_target_directory=true;;
+
+ --version) echo "$0 $scriptversion"; exit $?;;
+
+ --)        shift
+        break;;
+
+ -*)        echo "$0: invalid option: $1" >&2
+        exit 1;;
+
+ *) break;;
+ esac
+ shift
+done
+
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+ # When -d is used, all remaining arguments are directories to create.
+ # When -t is used, the destination is already specified.
+ # Otherwise, the last argument is the destination. Remove it from $@.
+ for arg
+ do
+ if test -n "$dst_arg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dst_arg"
+ shift # fnord
+ fi
+ shift # arg
+ dst_arg=$arg
+ done
+fi
+
+if test $# -eq 0; then
+ if test -z "$dir_arg"; then
+ echo "$0: no input file specified." >&2
+ exit 1
+ fi
+ # It's OK to call `install-sh -d' without argument.
+ # This can happen when creating conditional directories.
+ exit 0
+fi
+
+if test -z "$dir_arg"; then
+ trap '(exit $?); exit' 1 2 13 15
+
+ # Set umask so as not to create temps with too-generous modes.
+ # However, 'strip' requires both read and write access to temps.
+ case $mode in
+ # Optimize common cases.
+ *644) cp_umask=133;;
+ *755) cp_umask=22;;
+
+ *[0-7])
+ if test -z "$stripcmd"; then
+        u_plus_rw=
+ else
+        u_plus_rw='% 200'
+ fi
+ cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+ *)
+ if test -z "$stripcmd"; then
+        u_plus_rw=
+ else
+        u_plus_rw=,u+rw
+ fi
+ cp_umask=$mode$u_plus_rw;;
+ esac
+fi
+
+for src
+do
+ # Protect names starting with `-'.
+ case $src in
+ -*) src=./$src;;
+ esac
+
+ if test -n "$dir_arg"; then
+ dst=$src
+ dstdir=$dst
+ test -d "$dstdir"
+ dstdir_status=$?
+ else
+
+ # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+ # might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ if test ! -f "$src" && test ! -d "$src"; then
+ echo "$0: $src does not exist." >&2
+ exit 1
+ fi
+
+ if test -z "$dst_arg"; then
+ echo "$0: no destination specified." >&2
+ exit 1
+ fi
+
+ dst=$dst_arg
+ # Protect names starting with `-'.
+ case $dst in
+ -*) dst=./$dst;;
+ esac
+
+ # If destination is a directory, append the input filename; won't work
+ # if double slashes aren't ignored.
+ if test -d "$dst"; then
+ if test -n "$no_target_directory"; then
+        echo "$0: $dst_arg: Is a directory" >&2
+        exit 1
+ fi
+ dstdir=$dst
+ dst=$dstdir/`basename "$src"`
+ dstdir_status=0
+ else
+ # Prefer dirname, but fall back on a substitute if dirname fails.
+ dstdir=`
+        (dirname "$dst") 2>/dev/null ||
+        expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+         X"$dst" : 'X\(//\)[^/]' \| \
+         X"$dst" : 'X\(//\)$' \| \
+         X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+        echo X"$dst" |
+         sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+                 s//\1/
+                 q
+                 }
+                 /^X\(\/\/\)[^/].*/{
+                 s//\1/
+                 q
+                 }
+                 /^X\(\/\/\)$/{
+                 s//\1/
+                 q
+                 }
+                 /^X\(\/\).*/{
+                 s//\1/
+                 q
+                 }
+                 s/.*/./; q'
+ `
+
+ test -d "$dstdir"
+ dstdir_status=$?
+ fi
+ fi
+
+ obsolete_mkdir_used=false
+
+ if test $dstdir_status != 0; then
+ case $posix_mkdir in
+ '')
+        # Create intermediate dirs using mode 755 as modified by the umask.
+        # This is like FreeBSD 'install' as of 1997-10-28.
+        umask=`umask`
+        case $stripcmd.$umask in
+         # Optimize common cases.
+         *[2367][2367]) mkdir_umask=$umask;;
+         .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+         *[0-7])
+         mkdir_umask=`expr $umask + 22 \
+         - $umask % 100 % 40 + $umask % 20 \
+         - $umask % 10 % 4 + $umask % 2
+         `;;
+         *) mkdir_umask=$umask,go-w;;
+        esac
+
+        # With -d, create the new directory with the user-specified mode.
+        # Otherwise, rely on $mkdir_umask.
+        if test -n "$dir_arg"; then
+         mkdir_mode=-m$mode
+        else
+         mkdir_mode=
+        fi
+
+        posix_mkdir=false
+        case $umask in
+         *[123567][0-7][0-7])
+         # POSIX mkdir -p sets u+wx bits regardless of umask, which
+         # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+         ;;
+         *)
+         tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+         trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+         if (umask $mkdir_umask &&
+                exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+         then
+         if test -z "$dir_arg" || {
+                 # Check for POSIX incompatibilities with -m.
+                 # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+                 # other-writeable bit of parent directory when it shouldn't.
+                 # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+                 ls_ld_tmpdir=`ls -ld "$tmpdir"`
+                 case $ls_ld_tmpdir in
+                 d????-?r-*) different_mode=700;;
+                 d????-?--*) different_mode=755;;
+                 *) false;;
+                 esac &&
+                 $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+                 ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+                 test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+                 }
+                 }
+         then posix_mkdir=:
+         fi
+         rmdir "$tmpdir/d" "$tmpdir"
+         else
+         # Remove any dirs left behind by ancient mkdir implementations.
+         rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+         fi
+         trap '' 0;;
+        esac;;
+ esac
+
+ if
+ $posix_mkdir && (
+        umask $mkdir_umask &&
+        $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+ )
+ then :
+ else
+
+ # The umask is ridiculous, or mkdir does not conform to POSIX,
+ # or it failed possibly due to a race condition. Create the
+ # directory the slow way, step by step, checking for races as we go.
+
+ case $dstdir in
+        /*) prefix='/';;
+        -*) prefix='./';;
+        *) prefix='';;
+ esac
+
+ eval "$initialize_posix_glob"
+
+ oIFS=$IFS
+ IFS=/
+ $posix_glob set -f
+ set fnord $dstdir
+ shift
+ $posix_glob set +f
+ IFS=$oIFS
+
+ prefixes=
+
+ for d
+ do
+        test -z "$d" && continue
+
+        prefix=$prefix$d
+        if test -d "$prefix"; then
+         prefixes=
+        else
+         if $posix_mkdir; then
+         (umask=$mkdir_umask &&
+         $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+         # Don't fail if two instances are running concurrently.
+         test -d "$prefix" || exit 1
+         else
+         case $prefix in
+         *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+         *) qprefix=$prefix;;
+         esac
+         prefixes="$prefixes '$qprefix'"
+         fi
+        fi
+        prefix=$prefix/
+ done
+
+ if test -n "$prefixes"; then
+        # Don't fail if two instances are running concurrently.
+        (umask $mkdir_umask &&
+         eval "\$doit_exec \$mkdirprog $prefixes") ||
+         test -d "$dstdir" || exit 1
+        obsolete_mkdir_used=true
+ fi
+ fi
+ fi
+
+ if test -n "$dir_arg"; then
+ { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+ { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+ else
+
+ # Make a couple of temp file names in the proper directory.
+ dsttmp=$dstdir/_inst.$$_
+ rmtmp=$dstdir/_rm.$$_
+
+ # Trap to clean up those temp files at exit.
+ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+ # Copy the file name to the temp name.
+ (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+ # and set any options; do chmod last to preserve setuid bits.
+ #
+ # If any of these fail, we abort the whole thing. If we want to
+ # ignore errors from any of these, just make sure not to ignore
+ # errors from the above "$doit $cpprog $src $dsttmp" command.
+ #
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+ { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+ { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+ # If -C, don't bother to copy if it wouldn't change the file.
+ if $copy_on_change &&
+ old=`LC_ALL=C ls -dlL "$dst"        2>/dev/null` &&
+ new=`LC_ALL=C ls -dlL "$dsttmp"        2>/dev/null` &&
+
+ eval "$initialize_posix_glob" &&
+ $posix_glob set -f &&
+ set X $old && old=:$2:$4:$5:$6 &&
+ set X $new && new=:$2:$4:$5:$6 &&
+ $posix_glob set +f &&
+
+ test "$old" = "$new" &&
+ $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+ then
+ rm -f "$dsttmp"
+ else
+ # Rename the file to the real destination.
+ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+ # The rename failed, perhaps because mv can't rename something else
+ # to itself, or perhaps because mv is so ancient that it does not
+ # support -f.
+ {
+        # Now remove or move aside any old file at destination location.
+        # We try this two ways since rm can't unlink itself on some
+        # systems and the destination file might be busy for other
+        # reasons. In this case, the final cleanup might fail but the new
+        # file should still install successfully.
+        {
+         test ! -f "$dst" ||
+         $doit $rmcmd -f "$dst" 2>/dev/null ||
+         { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+         { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+         } ||
+         { echo "$0: cannot unlink or rename $dst" >&2
+         (exit 1); exit 1
+         }
+        } &&
+
+        # Now rename the file to the real destination.
+        $doit $mvcmd "$dsttmp" "$dst"
+ }
+ fi || exit 1
+
+ trap '' 0
+ fi
+done
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
</ins><span class="cx">Property changes on: freeswitch/trunk/contrib/nazim/xmlcdrd/install-sh
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:executable
</span><span class="cx"> + *
</span></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdlogc"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/log.c (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/log.c         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/log.c        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,55 @@
</span><ins>+#include "log.h"
+#include <syslog.h>
+#include <errno.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+void syslog_open (const char *ident, int facility) {
+        openlog(ident, LOG_PID, facility);
+        return;
+}
+
+void syslog_close () {
+        closelog ();
+        return;
+}
+
+void syslog_error (const char *message) {
+        syslog (LOG_ALERT, "error. %s", message);
+}
+
+void syslog_msg (int priority, int echotoconsole, const char *fmt, ...) {
+        int n, size;
+        char *p;
+        va_list ap;
+        
+        size = 100;
+        if (NULL == (p = malloc (size))) {
+                fprintf (stderr, "syslog_msg failed. malloc error %s:%d\r\n", __FILE__, __LINE__);
+                return;
+        }
+
+        while (1) {
+                va_start(ap, fmt);
+                n = vsnprintf (p, size, fmt, ap);
+                va_end(ap);
+
+                if (n > -1 && n < size) {
+                        syslog (priority, "%s", p);
+                        if (echotoconsole) fprintf (stderr, "%s\r\n", p);
+                        free (p);
+                        return;
+                }
+
+                if (n > -1) size = n+1;
+                else size *= 2;
+                
+                if ((p = realloc (p, size)) == NULL) {
+                        fprintf (stderr, "syslog_msg failed. realloc error %s:%d\r\n", __FILE__, __LINE__);
+                        return;
+                }
+         }
+}
+
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdlogh"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/log.h (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/log.h         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/log.h        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+#ifndef LOG_H
+#define LOG_H
+
+#include <stdlib.h>
+
+void syslog_open (const char *ident, int facility);
+void syslog_close (void);
+
+void syslog_msg (int priority, int echotoconsole, const char *fmt, ...);
+void syslog_error (const char *message);
+
+#endif
+
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdmainc"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/main.c (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/main.c         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/main.c        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,332 @@
</span><ins>+#include <fcgi_stdio.h> /* fcgi library; put it first*/
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <syslog.h>
+#include <libxml/tree.h>
+#include <libxml/parser.h>
+#include <libxml/xpath.h>
+#include <libxml/xpathInternals.h>
+#include "log.h"
+#include "urldecode.h"
+#include "stmtexp.h"
+#include "stmtexpldr.h"
+#include "plugldr.h"
+#include "plug.h"
+
+#define STR_MAX 512
+
+#define CONFIG "/etc/xmlcdrd/xmlcdr.conf"
+#define XURL_CDR "cdr"
+
+
+typedef struct
+{
+ xmlDocPtr doc;
+ xmlXPathContextPtr xpathCtx;
+} stmtexp_cb_data_t;
+
+
+
+#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_SAX1_ENABLED)
+
+
+stmtexp_tab_t vex;
+
+
+
+void stmtexp_callback (stmtexp_key_t *key, stmtexp_val_t *val, void *userdata);
+void stmtexp_callback_clean (stmtexp_key_t *key, stmtexp_val_t *val,
+ void *userdata);
+
+int execute_xpath_expression(const char* buf, int buflen);
+
+
+int execute_xpath_expression(const char* buf, int buflen)
+{
+ xmlDocPtr doc;
+ stmtexp_cb_data_t cbd;
+ memset (&cbd, 0x0, sizeof (stmtexp_cb_data_t));
+
+
+ /* Load XML document */
+ doc = xmlParseMemory (buf, buflen);
+
+ if (doc == NULL)
+ {
+ fprintf(stderr, "Error: unable to parse memory\n");
+ return(-1);
+ }
+
+ /* Create xpath evaluation context */
+ cbd.xpathCtx = xmlXPathNewContext(doc);
+ if(cbd.xpathCtx == NULL)
+ {
+ fprintf(stderr,"Error: unable to create new XPath context\n");
+ xmlFreeDoc(doc);
+ return(-1);
+ }
+
+ /*run callback*/
+ stmtexp_foreach_callback (&vex, stmtexp_callback, &cbd);
+
+
+ xmlXPathFreeContext(cbd.xpathCtx);
+ xmlFreeDoc(doc);
+
+ return(0);
+}
+
+
+void stmtexp_callback_clean (stmtexp_key_t *key, stmtexp_val_t *val, void *userdata)
+{
+ if (NULL != val)
+ {
+ if (NULL != val->val)
+ {
+ free (val->val);
+ val->val = NULL;
+ }
+ }
+}
+
+
+void stmtexp_callback (stmtexp_key_t *key, stmtexp_val_t *val, void *userdata)
+{
+ xmlXPathObjectPtr xpathObj;
+ xmlNodePtr cur;
+
+ stmtexp_cb_data_t * cbd = (stmtexp_cb_data_t *) userdata;
+
+
+
+ /* Evaluate xpath expression */
+ xpathObj = xmlXPathEvalExpression((xmlChar*)key->xpath, cbd->xpathCtx);
+ if(xpathObj == NULL)
+ {
+ fprintf(stderr,
+ "Error: unable to evaluate xpath expression \"%s\"\n",
+ key->xpath);
+ return;
+ }
+
+ /* Print results */
+ xmlNodeSetPtr nodes = xpathObj->nodesetval;
+ if (NULL != nodes)
+ {
+ if (0 < nodes->nodeNr)
+ {
+ if (nodes->nodeTab[0])
+ {
+ if(nodes->nodeTab[0]->type == XML_ELEMENT_NODE)
+ {
+ cur = nodes->nodeTab[0];         
+ if(cur->ns)
+ {
+ fprintf(stderr, "= element node \"%s:%s\"\n",
+ cur->ns->href, cur->name);
+ } else
+ {
+ fprintf(stderr, "= element node \"%s\"\n",
+ cur->name);
+ xmlChar *content = xmlNodeGetContent(cur);
+
+ if (NULL != val)
+ {
+ if (NULL != val->val)
+ {
+ free (val->val);
+ val->val = NULL;
+ }
+ val->val = strdup((const char*)content);
+
+ fprintf(stderr, "%s\n", val->val);
+ xmlFree (content);
+ }
+ }
+ }
+ }
+ } else /* if (0 < nodes->nodeNr) */
+ {
+ if (NULL != val)
+ {
+ if (NULL != val->val)
+ {
+ free (val->val);
+ val->val = NULL;
+ }
+ }
+
+ }
+ }
+
+ /* Cleanup */
+ xmlXPathFreeObject(xpathObj);
+
+}
+
+
+
+
+/*
+ *
+ */
+int main(int argc, char** argv)
+{
+
+
+
+ XCDR_PLUGTAB plugtab;
+
+ if (-1 == xcdr_plugldr_load_config(&plugtab, CONFIG))
+ {
+ fprintf (stderr, "Failed to configure plugins from config: '%s'", CONFIG);
+ return -1;
+ }
+
+
+ if (-1 == xcdr_plugldr_load_plugins(&plugtab) )
+ {
+ fprintf (stderr, "Failed to load plugins from config: '%s'", CONFIG);
+ xcdr_plugldr_free_plugins (&plugtab);
+ return -1;
+ }
+
+ if (-1 == stmtexp_load_config (&vex, CONFIG))
+ {
+ fprintf (stderr, "Failed to load vars from config: '%s'", CONFIG);
+ xcdr_plugldr_free_plugins (&plugtab);
+ stmtexp_free (&vex);
+ return -1;
+ }
+
+
+ /* Init libxml */
+ xmlInitParser();
+ LIBXML_TEST_VERSION
+
+
+
+
+ GString * cgi_req_str = g_string_sized_new (102400);
+ GString * cgi_decoded_str = g_string_sized_new (102400);
+ GString * temp = g_string_sized_new (102400);
+
+
+ while (FCGI_Accept() >= 0)
+ {
+ //Set length of received request to 0
+ int cgi_req_len = 0;
+ g_string_set_size (cgi_req_str, 0);
+
+
+ char c;
+ while (EOF != (c = fgetc (stdin)) )
+ {
+ g_string_append_c (cgi_req_str, c);
+ cgi_req_len++;
+ } //~while We have received the full request string
+
+
+ //fprintf (stderr, "%s\n", cgi_req_str->str);
+ stmtexp_foreach_callback (&vex, stmtexp_callback_clean, NULL);
+
+ int decoded_len = cgi_req_len * 3 + 1;
+ g_string_set_size (cgi_decoded_str, decoded_len);
+ memset (cgi_decoded_str->str, 0x0, decoded_len);
+
+
+ int status;
+ if (NULL != urldecode_expand_value (cgi_req_str,
+ XURL_CDR, strlen(XURL_CDR),
+ 1,
+ temp, &status,
+ cgi_decoded_str))
+ {
+ execute_xpath_expression(cgi_decoded_str->str,
+ strlen(cgi_decoded_str->str) );
+
+ /*Dump entire dom tree on stdout*/
+ //fprintf (stderr, "%s\n", cgi_decoded_str->str);
+
+
+ int i;
+ XCDR_PLUGINFO *plug;
+
+ for (i = 0; i < plugtab.tag_count; i ++)
+ {
+ plug = &plugtab.tags[i].plug;
+
+ //If no metrics defined, run anyway
+ if (0 == plugtab.tags[i].metrics.tag_count)
+ {
+ plug->plugin_main(&vex, &plug->state);
+ continue;
+ }
+
+ //match metric regexps
+ int j;
+ int run = 0;
+ for (j = 0; j < plugtab.tags[i].metrics.tag_count; j++)
+ {
+ const char *metric_val =
+ stmtexp_lookup_var (&vex,
+ plugtab.tags[i].metrics.tags[j].metric);
+
+
+
+ //if metric is not found, replace with an empty string.
+ if (NULL == metric_val)
+ {
+ metric_val = "";
+ }
+
+ fprintf (stderr, "metric [%s] '%s':'%s'\n",
+ plugtab.tags[i].metrics.tags[j].metric,
+ plugtab.tags[i].metrics.tags[j].regexp,
+ metric_val);
+
+
+
+ if (-1 <
+ xcdr_plugldr_match_regexp (
+ plugtab.tags[i].metrics.tags[j].regexp,
+ metric_val, strlen(metric_val)) )
+ run = 1;
+ else run = 0;
+ }
+
+ if (0 < run)
+ {
+ fprintf (stderr, "metrics matched\n");
+ plug->plugin_main(&vex, &plug->state);
+ }
+ }
+
+ } else fprintf (stderr, "'%s' not found in '%s'\n",
+ XURL_CDR, cgi_req_str->str);
+
+
+ }
+
+ g_string_free (cgi_req_str, TRUE);
+ g_string_free (cgi_decoded_str, TRUE);
+ g_string_free (temp, TRUE);
+
+ stmtexp_free (&vex);
+ xcdr_plugldr_free_plugins(&plugtab);
+
+ xmlCleanupParser();
+
+
+ return 0;
+}
+
+
+
+#else
+int main(void) {
+ fprintf(stderr, "XPath support not compiled in\n");
+ exit(1);
+}
+#endif
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdmissing"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/missing (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/missing         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/missing        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,376 @@
</span><ins>+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2009-04-28.21; # UTC
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
+# 2008, 2009 Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+fi
+
+run=:
+sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
+sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+ configure_ac=configure.ac
+else
+ configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case $1 in
+--run)
+ # Try to run requested program, and just exit if it succeeds.
+ run=
+ shift
+ "$@" && exit 0
+ # Exit code 63 means version mismatch. This often happens
+ # when the user try to use an ancient version of a tool on
+ # a file that requires a minimum version. In this case we
+ # we should proceed has if the program had been absent, or
+ # if --run hadn't been passed.
+ if test $? = 63; then
+ run=:
+ msg="probably too old"
+ fi
+ ;;
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+ --run try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+ aclocal touch file \`aclocal.m4'
+ autoconf touch file \`configure'
+ autoheader touch file \`config.h.in'
+ autom4te touch the output file, or create a stub one
+ automake touch all \`Makefile.in' files
+ bison create \`y.tab.[ch]', if possible, from existing .[ch]
+ flex create \`lex.yy.c', if possible, from existing .c
+ help2man touch the output file
+ lex create \`lex.yy.c', if possible, from existing .c
+ makeinfo touch the output file
+ tar try tar, gnutar, gtar, then tar without non-portable flags
+ yacc create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
+\`g' are ignored when checking the name.
+
+Send bug reports to <bug-automake@gnu.org>."
+ exit $?
+ ;;
+
+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+ echo "missing $scriptversion (GNU Automake)"
+ exit $?
+ ;;
+
+ -*)
+ echo 1>&2 "$0: Unknown \`$1' option"
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+ ;;
+
+esac
+
+# normalize program name to check for.
+program=`echo "$1" | sed '
+ s/^gnu-//; t
+ s/^gnu//; t
+ s/^g//; t'`
+
+# Now exit if we have it, but it failed. Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program). This is about non-GNU programs, so use $1 not
+# $program.
+case $1 in
+ lex*|yacc*)
+ # Not GNU programs, they don't have --version.
+ ;;
+
+ tar*)
+ if test -n "$run"; then
+ echo 1>&2 "ERROR: \`tar' requires --run"
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ exit 1
+ fi
+ ;;
+
+ *)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ # Could not run --version or --help. This is probably someone
+ # running `$TOOL --version' or `$TOOL --help' to check whether
+ # $TOOL exists and not knowing $TOOL uses missing.
+ exit 1
+ fi
+ ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case $program in
+ aclocal*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acinclude.m4' or \`${configure_ac}'. You might want
+ to install the \`Automake' and \`Perl' packages. Grab them from
+ any GNU archive site."
+ touch aclocal.m4
+ ;;
+
+ autoconf*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`${configure_ac}'. You might want to install the
+ \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
+ archive site."
+ touch configure
+ ;;
+
+ autoheader*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acconfig.h' or \`${configure_ac}'. You might want
+ to install the \`Autoconf' and \`GNU m4' packages. Grab them
+ from any GNU archive site."
+ files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+ test -z "$files" && files="config.h"
+ touch_files=
+ for f in $files; do
+ case $f in
+ *:*) touch_files="$touch_files "`echo "$f" |
+                                 sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+ *) touch_files="$touch_files $f.in";;
+ esac
+ done
+ touch $touch_files
+ ;;
+
+ automake*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+ You might want to install the \`Automake' and \`Perl' packages.
+ Grab them from any GNU archive site."
+ find . -type f -name Makefile.am -print |
+         sed 's/\.am$/.in/' |
+         while read f; do touch "$f"; done
+ ;;
+
+ autom4te*)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them.
+ You can get \`$1' as part of \`Autoconf' from any GNU
+ archive site."
+
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
+        touch $file
+ else
+        test -z "$file" || exec >$file
+        echo "#! /bin/sh"
+        echo "# Created by GNU Automake missing as a replacement of"
+        echo "# $ $@"
+        echo "exit 0"
+        chmod +x $file
+        exit 1
+ fi
+ ;;
+
+ bison*|yacc*)
+ echo 1>&2 "\
+WARNING: \`$1' $msg. You should only need it if
+ you modified a \`.y' file. You may need the \`Bison' package
+ in order for those modifications to take effect. You can get
+ \`Bison' from any GNU archive site."
+ rm -f y.tab.c y.tab.h
+ if test $# -ne 1; then
+ eval LASTARG="\${$#}"
+        case $LASTARG in
+        *.y)
+         SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+         if test -f "$SRCFILE"; then
+         cp "$SRCFILE" y.tab.c
+         fi
+         SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+         if test -f "$SRCFILE"; then
+         cp "$SRCFILE" y.tab.h
+         fi
+         ;;
+        esac
+ fi
+ if test ! -f y.tab.h; then
+        echo >y.tab.h
+ fi
+ if test ! -f y.tab.c; then
+        echo 'main() { return 0; }' >y.tab.c
+ fi
+ ;;
+
+ lex*|flex*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.l' file. You may need the \`Flex' package
+ in order for those modifications to take effect. You can get
+ \`Flex' from any GNU archive site."
+ rm -f lex.yy.c
+ if test $# -ne 1; then
+ eval LASTARG="\${$#}"
+        case $LASTARG in
+        *.l)
+         SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+         if test -f "$SRCFILE"; then
+         cp "$SRCFILE" lex.yy.c
+         fi
+         ;;
+        esac
+ fi
+ if test ! -f lex.yy.c; then
+        echo 'main() { return 0; }' >lex.yy.c
+ fi
+ ;;
+
+ help2man*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+         you modified a dependency of a manual page. You may need the
+         \`Help2man' package in order for those modifications to take
+         effect. You can get \`Help2man' from any GNU archive site."
+
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
+        touch $file
+ else
+        test -z "$file" || exec >$file
+        echo ".ab help2man is required to generate this page"
+        exit $?
+ fi
+ ;;
+
+ makeinfo*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.texi' or \`.texinfo' file, or any other file
+ indirectly affecting the aspect of the manual. The spurious
+ call might also be the consequence of using a buggy \`make' (AIX,
+ DU, IRIX). You might want to install the \`Texinfo' package or
+ the \`GNU make' package. Grab either from any GNU archive site."
+ # The file to touch is that specified with -o ...
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -z "$file"; then
+ # ... or it is the one specified with @setfilename ...
+ infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '
+        /^@setfilename/{
+         s/.* \([^ ]*\) *$/\1/
+         p
+         q
+        }' $infile`
+ # ... or it is derived from the source name (dir/f.texi becomes f.info)
+ test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+ fi
+ # If the file does not exist, the user really needs makeinfo;
+ # let's fail without touching anything.
+ test -f $file || exit 1
+ touch $file
+ ;;
+
+ tar*)
+ shift
+
+ # We have already tried tar in the generic part.
+ # Look for gnutar/gtar before invocation to avoid ugly error
+ # messages.
+ if (gnutar --version > /dev/null 2>&1); then
+ gnutar "$@" && exit 0
+ fi
+ if (gtar --version > /dev/null 2>&1); then
+ gtar "$@" && exit 0
+ fi
+ firstarg="$1"
+ if shift; then
+        case $firstarg in
+        *o*)
+         firstarg=`echo "$firstarg" | sed s/o//`
+         tar "$firstarg" "$@" && exit 0
+         ;;
+        esac
+        case $firstarg in
+        *h*)
+         firstarg=`echo "$firstarg" | sed s/h//`
+         tar "$firstarg" "$@" && exit 0
+         ;;
+        esac
+ fi
+
+ echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+ You may want to install GNU tar or Free paxutils, or check the
+ command line arguments."
+ exit 1
+ ;;
+
+ *)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them. Check the \`README' file,
+ it often tells you about the needed prerequisites for installing
+ this package. You may also peek at any GNU archive site, in case
+ some other package would contain this missing \`$1' program."
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
</ins><span class="cx">Property changes on: freeswitch/trunk/contrib/nazim/xmlcdrd/missing
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:executable
</span><span class="cx"> + *
</span></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdplugc"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/plug.c (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/plug.c         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/plug.c        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,97 @@
</span><ins>+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <dlfcn.h>
+#include "plug.h"
+
+/*returns 0 on success, -1 on error*/
+int plug_init(const char *filename, const char *options,
+ XCDR_PLUGINFO *plug)
+{
+
+ char *error;
+
+ if (NULL == (plug->handle = dlopen(filename, RTLD_LAZY | RTLD_GLOBAL)))
+ {
+ fprintf(stderr, "%s\r\n", dlerror());
+ return -1;
+ }
+
+ //clear any existing dl error.
+ dlerror();
+ *(void **) (&plug->plugin_get_name) = dlsym(plug->handle, "plugin_get_name");
+ if ((error = dlerror()) != NULL)
+ {
+ fprintf(stderr, "%s\n", error);
+ return -1;
+ }
+
+ dlerror();
+ *(void **) (&plug->plugin_get_description) = dlsym(plug->handle, "plugin_get_description");
+ if ((error = dlerror()) != NULL)
+ {
+ fprintf(stderr, "%s\n", error);
+ return -1;
+ }
+
+ dlerror();
+ *(void **) (&plug->plugin_init) = dlsym(plug->handle, "plugin_init");
+ if ((error = dlerror()) != NULL)
+ {
+ fprintf(stderr, "%s\n", error);
+ return -1;
+ }
+
+ dlerror();
+ *(void **) (&plug->plugin_free) = dlsym(plug->handle, "plugin_free");
+ if ((error = dlerror()) != NULL)
+ {
+ fprintf(stderr, "%s\n", error);
+ return -1;
+ }
+
+ dlerror();
+ *(void **) (&plug->plugin_main) = dlsym(plug->handle, "plugin_main");
+ if ((error = dlerror()) != NULL)
+ {
+ fprintf(stderr, "%s\n", error);
+ return -1;
+ }
+
+
+
+ strncpy(plug->name, plug->plugin_get_name(), XCDR_PLUGIN_NAME_LEN_MAX);
+
+ if (-1 == plug->plugin_init(filename, options, &plug->state))
+ {
+ fprintf(stderr, "Failed to load plugin:'%s' InternalName:'%s' Options:'%s'\n", plug->name, filename, options);
+ return -1;
+ }
+
+
+ return 0;
+}
+
+int plug_free(XCDR_PLUGINFO *plug)
+{
+
+ if (NULL != plug->handle)
+ {
+ plug->plugin_free(&plug->state);
+ }
+
+ return 0;
+}
+
+
+int plug_destroy(XCDR_PLUGINFO *plug)
+{
+
+ if (NULL != plug->handle)
+ {
+ return dlclose(plug->handle);
+ }
+
+ return 0;
+}
+
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdplugh"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/plug.h (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/plug.h         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/plug.h        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+#ifndef PLUG_H
+#define PLUG_H
+
+#include "plugcommon.h"
+#include "stmtexptab.h"
+
+
+typedef struct xcdr_plugin_info
+{
+        void *handle;
+        char name [XCDR_PLUGIN_NAME_LEN_MAX];
+
+ XCDR_PLUGSTATE state;
+
+ /*Functions exported by plugin*/
+
+ int (*plugin_init) (const char *filename, const char *options,
+ XCDR_PLUGSTATE *state);
+
+ int (*plugin_free) (XCDR_PLUGSTATE *state);
+
+ char* (*plugin_get_description) (void);
+ char* (*plugin_get_name) (void);
+
+ /*
+ Main function which processes a hash table of variables/values @vex
+ Function returns:
+ PLUG_STATUS_OK
+ PLUG_STATUS_ERR */
+
+ int (*plugin_main) (STMTEXP_TAB *vex, XCDR_PLUGSTATE *state);
+
+ /* ~Functions exported by plugin*/
+
+} XCDR_PLUGINFO, *PXCDR_PLUGINFO;
+
+/* plug_int() calls plugin_init() which initializes
+ XCDR_PLUGSTATE.state used by plugin internally */
+int plug_init (const char *filename, const char *options, XCDR_PLUGINFO *plug);
+
+/* plug_free() calls plugin_free() to deallocate all dynamic resources
+ bound to XCDR_PLUGSTATE.local_vars. Must be invoked before plug_destroy() */
+int plug_free (XCDR_PLUGINFO *plug);
+
+/* plug_destroy() calls library dlclose() AFTER plug_free() */
+int plug_destroy(XCDR_PLUGINFO *plug);
+
+#endif
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdplugcommonh"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/plugcommon.h (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/plugcommon.h         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/plugcommon.h        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+#ifndef PLUGCOMMON_H
+#define PLUGCOMMON_H
+
+
+#define XCDR_PLUGIN_NAME_LEN_MAX 64
+#define XCDR_PLUGIN_FILENAME_LEN_MAX 256
+#define XCDR_PLUGIN_STRMAXLEN 256
+
+
+#define PLUG_STATUS_OK 0
+//#define PLUG_STATUS_STOPPROCESSING_HERE 1
+#define PLUG_STATUS_ERROR -1
+
+
+typedef struct xcdr_plugin_state
+{
+ /* local_vars are initialized by plugin during plugin_init
+ and destroyed in plugin_free
+ */
+ void *local_vars;
+
+} XCDR_PLUGSTATE, *PXCDR_PLUGSTATE;
+
+
+#endif
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdpluginsluaexecMakefileam"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/luaexec/Makefile.am (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/luaexec/Makefile.am         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/luaexec/Makefile.am        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+SHELL = /bin/sh
+CC = @CC@
+
+FLAGS= -W -Wmissing-prototypes -Wstrict-prototypes -g3 -Wall $(CFLAGS)
+
+all:
+        $(CC) $(CFLAGS) \
+        -shared -fPIC -o luaexec.so luaexec.c \
+        -I../../ \
+        @with_glib2_flags@ \
+        -llua -ldl -lglib-2.0 \
+        -lconfig \
+        ../../stmtexpldr.o ../../stmtexp.o ../../log.o
+
+install:
+        -cp luaexec.so $(libdir)/xmlcdrd/
+
+clean:
+        -rm -f *.o luaexec.so
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdpluginsluaexecluaexecc"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/luaexec/luaexec.c (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/luaexec/luaexec.c         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/luaexec/luaexec.c        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,159 @@
</span><ins>+/*
+ plugin_init() accepts single option - absolute name of configuration file to parse.
+*/
+#include "plugcommon.h"
+#include "plug.h"
+#include "stmtexp.h"
+#include "log.h"
+#include <syslog.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <libconfig.h>
+#include <lua.h>
+#include <lauxlib.h>
+#include <lualib.h>
+#include <dlfcn.h>
+
+#define PLUGIN_NAME "lua exec"
+#define PLUGIN_DESC "Lua script wrapper"
+
+#define FILENAME_LEN_MAX 512
+#define STR_LEN_MAX 256
+
+/*that's what lua script would call to get variable*/
+#define LUA_VAR_GET_FUNC "xcdr_varget"
+
+typedef struct luaexec_local_vars
+{
+ char *t;
+
+ int cfgres;
+ config_t cfg;
+ config_setting_t *setting;
+
+
+ luaL_reg *lualibs;
+ int lualibs_count;
+
+ char luascript [FILENAME_LEN_MAX];
+ lua_State *L;
+
+ STMTEXP_TAB *vex;
+
+} LUAEXECVARS;
+
+
+/*Local variables*/
+LUAEXECVARS *vars;
+
+
+
+char * plugin_get_name ()
+{
+
+ return PLUGIN_NAME;
+}
+
+
+
+char * plugin_get_description ()
+{
+
+ return PLUGIN_DESC;
+}
+
+
+static int l_varget (lua_State *L)
+{
+ const char* varid = luaL_checkstring(L, 1);
+
+ const char* val = stmtexp_lookup_var (vars->vex, varid);
+
+ lua_pushstring(L, val);
+
+ return 1;
+}
+
+
+ /**/
+int plugin_init (const char* filename, const char *options, XCDR_PLUGSTATE *state)
+{
+
+ int i;
+
+ vars = calloc (1, sizeof(LUAEXECVARS) );
+ state->local_vars = vars;
+
+
+ if (NULL == vars)
+ {
+ fprintf (stderr,
+ "%s plugin_init(). Can't allocate memory for state vars\n",
+ PLUGIN_NAME);
+ return PLUG_STATUS_ERROR;
+ }
+
+ fprintf (stderr, "%s plugin_init (%s) \n", PLUGIN_NAME, options);
+
+ config_init(&vars->cfg);
+
+ if (!config_read_file(&vars->cfg, options) )
+ {
+ fprintf (stderr, "%s plugin_init (%s). Error parsing: '%s'\n",
+ PLUGIN_NAME, options, options);
+
+ config_destroy(&vars->cfg);
+
+ return PLUG_STATUS_ERROR;
+ }
+
+
+ memset (vars->luascript , 0x0, FILENAME_LEN_MAX);
+
+ const char *t = NULL;
+
+ if (CONFIG_TRUE == config_lookup_string (&vars->cfg, "luascript", &t) )
+ snprintf (vars->luascript, FILENAME_LEN_MAX - 1, "%s", t);
+
+ config_destroy(&vars->cfg);
+ return PLUG_STATUS_OK;
+}
+
+
+int plugin_free (XCDR_PLUGSTATE *state)
+{
+ vars = state->local_vars;
+
+ free (vars);
+
+ return PLUG_STATUS_OK;
+}
+
+
+int plugin_main (STMTEXP_TAB *vex, XCDR_PLUGSTATE *state)
+{
+
+ vars = state->local_vars;
+ vars->vex = vex;
+
+ vars->L = lua_open();
+ luaL_openlibs (vars->L);
+
+ lua_pushcfunction(vars->L, l_varget);
+ lua_setglobal(vars->L, LUA_VAR_GET_FUNC);
+
+
+ if (luaL_loadfile(vars->L, vars->luascript) )
+ fprintf(stderr, "can't load file: %s, %s\n", vars->luascript,
+ lua_tostring(vars->L, -1));
+
+
+ if(lua_pcall(vars->L, 0, 0, 0) )
+ fprintf(stderr, "can't run file: %s, %s\n", vars->luascript,
+ lua_tostring(vars->L, -1));
+
+ lua_close (vars->L);
+
+ return PLUG_STATUS_OK;
+}
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdpluginsmysqlcdrMakefileam"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/mysqlcdr/Makefile.am (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/mysqlcdr/Makefile.am         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/mysqlcdr/Makefile.am        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+SHELL = /bin/sh
+CC = @CC@
+
+FLAGS= -W -Wmissing-prototypes -Wstrict-prototypes -fPIC -g3 -Wall $(CFLAGS)
+
+all:
+        $(CC) $(CFLAGS) -fPIC -W -Wall -I../../ `@with_mysql_config@ --include` -c dbcommon.c
+
+        $(CC) $(CFLAGS) \
+        -shared -fPIC -o mysqlcdr.so mysqlcdr.c \
+        -I../../ \
+        `@with_mysql_config@ --libs --include` \
+        @with_glib2_flags@ \
+        -lconfig -lglib-2.0 \
+        dbcommon.o \
+        ../../stmtexpldr.o ../../stmtexp.o ../../log.o
+
+install:
+        cp mysqlcdr.so $(libdir)/xmlcdrd/
+
+
+clean:
+        -rm -f *.o mysqlcdr.so
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdpluginsmysqlcdrdbcommonc"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/mysqlcdr/dbcommon.c (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/mysqlcdr/dbcommon.c         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/mysqlcdr/dbcommon.c        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,64 @@
</span><ins>+#include <stdio.h>
+#include <syslog.h>
+#include "dbcommon.h"
+#include "string.h"
+#include "log.h"
+
+MYSQL *mysql_do_connect(char *host_name,
+ char *user_name, char *password, char *db_name,
+ unsigned long port_num, char *socket_name,
+ unsigned int flags)
+{
+
+ MYSQL *conn; /* pointer to connection handler */
+
+ conn = mysql_init(NULL); /* allocate, initialize connection handler */
+ if (conn == NULL)
+ {
+ //fprintf (stderr, "mysql_init() failed\n");
+ syslog_error("mysql_init() failed");
+ return (NULL);
+ }
+
+ my_bool reconnect = 1;
+ mysql_options(conn, MYSQL_OPT_RECONNECT, &reconnect);
+
+ if (mysql_real_connect(conn, host_name, user_name, password,
+ db_name, port_num, socket_name, flags) == NULL)
+ {
+ fprintf (stderr, "mysql_real_connect() failed:\nError %u (%s)\n", mysql_errno (conn), mysql_error (conn));
+ //syslog_mysql_error(conn, "error. mysql_real_connect() failed");
+ return (NULL);
+ }
+
+ return (conn);
+}
+
+void mysql_do_disconnect(MYSQL *conn)
+{
+ mysql_close(conn);
+}
+
+void mysql_print_error(MYSQL *conn, char *message)
+{
+
+ if (conn != NULL)
+ {
+ syslog_msg(LOG_ALERT, 1, "MySQL connection error. '%s'. %u (%s)",
+ message, mysql_errno(conn), mysql_error(conn));
+
+ fprintf (stderr, "MySQL connection error. '%s'. %u (%s)",
+ message, mysql_errno(conn), mysql_error(conn));
+ }
+ else
+ {
+ fprintf (stderr, "MySQL connection error. \
+'%s'. Can't get mysql_errno() because connection handler is invalid", message);
+
+ syslog_msg(LOG_ALERT, 0,
+ "MySQL connection error. \
+'%s'. Can't get mysql_errno() because connection handler is invalid", message);
+
+ }
+}
+
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdpluginsmysqlcdrdbcommonh"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/mysqlcdr/dbcommon.h (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/mysqlcdr/dbcommon.h         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/mysqlcdr/dbcommon.h        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+#ifndef DBCOMMON_H
+#define DBCOMMON_H
+
+#include <mysql.h>
+
+
+MYSQL *mysql_do_connect (char *host_name,
+ char *user_name, char *password, char *db_name,
+ unsigned long port_num, char *socket_name, unsigned int flags);
+
+
+void mysql_do_disconnect (MYSQL *conn);
+void mysql_print_error (MYSQL *conn, char *message);
+
+#endif
+
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdpluginsmysqlcdrmysqlcdrc"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/mysqlcdr/mysqlcdr.c (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/mysqlcdr/mysqlcdr.c         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/mysqlcdr/mysqlcdr.c        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,336 @@
</span><ins>+/*
+ plugin_init() accepts single option - absolute name of configuration file to parse.
+*/
+
+#include "plugcommon.h"
+#include "plug.h"
+#include "stmtexp.h"
+#include "log.h"
+#include <syslog.h>
+#include <mysql.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <libconfig.h>
+#include <glib.h>
+
+
+#define PLUGIN_NAME "mysql cdr"
+#define PLUGIN_DESC "MySQL cdr logger"
+
+#define STMT_RETRY_MAX 2
+#define MYSQL_IPPORT 3306
+
+
+
+
+/* Statement expansion */
+#define VARSTART "$<"
+#define VAREND ">"
+
+#define VARSTART_LEN strlen (VARSTART)
+#define VAREND_LEN strlen (VAREND)
+
+#define VARID_LEN 512
+
+#define TEMP_GSTRING_INIT_SIZE 1024
+#define STMT_TEMPLATE_MAX_LEN 40960
+
+typedef struct mysqlcdr_local_vars
+{
+ unsigned int sql_insert_retry_max;
+
+ GString *temp;
+
+ MYSQL *conn;
+ char dbuserid [XCDR_PLUGIN_STRMAXLEN];
+ char dbpasswd [XCDR_PLUGIN_STRMAXLEN];
+ char dbschema [XCDR_PLUGIN_STRMAXLEN];
+ char dbipaddr [XCDR_PLUGIN_STRMAXLEN];
+ unsigned int dbipport;
+ unsigned long dbflags;
+ char stmt_template [STMT_TEMPLATE_MAX_LEN];
+
+ char *t;
+
+ int cfgres;
+ config_t cfg;
+
+} MYSQLCDRVARS;
+
+
+/*Local variables*/
+MYSQLCDRVARS *vars;
+
+
+int mysql_query_retry_on_fail (MYSQL *conn, const char *stmt,
+ unsigned int retrycount)
+{
+
+ unsigned int rc = 0;
+ int res;
+
+ while (rc++ <= retrycount)
+ {
+ res = mysql_query (conn, stmt);
+ if (0 != res)
+ {
+ mysql_print_error (conn, "mysql_query() failed.");
+
+ if (-1 == mysql_ping(conn) )
+ fprintf (stderr, "Connection to db lost\n");
+
+ } else return res;
+
+ }
+
+}
+
+
+
+
+/*Returns NULL if escaping of string fails*/
+const char *mysqlcdr_expand_str (MYSQL *conn, stmtexp_tab_t *vex,
+ const char *src, int srclen)
+{
+ const char *s; //src
+ char *e; //end
+ char varid [VARID_LEN];
+
+ s = src;
+ g_string_set_size (vex->expanded, 0);
+
+ //fprintf (stderr, "mysqlcdr_expand_str '%s'\n", src);
+
+ while (s < src + srclen)
+ {
+ if (NULL != (e = strstr (s, VARSTART)) )
+ {
+ g_string_append_len (vex->expanded, s, e - s);
+ s = e++;
+
+ if (NULL != (e = strstr (s, VAREND)) )
+ {
+
+ /* Remove placeholders VARSTART and VAREND, then lookup */
+ memset (varid, 0x0, VARID_LEN);
+ strncpy (varid, s + VARSTART_LEN, (e - s) - VARSTART_LEN );
+
+ const char* ev = stmtexp_lookup_var (vex, varid);
+ //fprintf (stderr, "---%s\n", ev);
+ if (NULL != ev)
+ {
+ unsigned int ev_len = strlen(ev);
+
+ g_string_set_size (vars->temp, (ev_len * 2) + 1);
+ memset (vars->temp->str, 0x0, (ev_len * 2) + 1);
+
+ unsigned long res = mysql_real_escape_string (
+ conn,
+ vars->temp->str,
+ ev,
+ ev_len
+ );
+
+ /*if length of escaped string is less than input bail out*/
+ if (res < ev_len)
+ return NULL;
+
+ /*append expanded var to destination*/
+ g_string_append (vex->expanded, vars->temp->str);
+ }
+ else
+ {
+ /*variable was not found, skip it*/
+ }
+
+ s = e + 1;
+ //fprintf (stderr, "s: '%s'\n", s);
+
+ }
+ else /*no more signatures found, append the rest of the str*/
+ {
+ if (NULL != s)
+ g_string_append (vex->expanded, s);
+ break;
+ }
+ }
+ else /*no more signatures found, append the rest of the str*/
+ {
+ if (NULL != s)
+ g_string_append (vex->expanded, s);
+ break;
+ }
+ }//while (s < src + src_len)
+
+ return vex->expanded->str;
+
+}
+
+
+
+char * plugin_get_name ()
+{
+
+ return PLUGIN_NAME;
+}
+
+
+
+char * plugin_get_description ()
+{
+
+ return PLUGIN_DESC;
+}
+
+ /**/
+int plugin_init (const char* filename, const char *options, XCDR_PLUGSTATE *state)
+{
+
+ vars = calloc (1, sizeof(MYSQLCDRVARS) );
+ state->local_vars = vars;
+
+
+ if (NULL == vars)
+ {
+ fprintf (stderr,
+ "%s plugin_init(). Can't allocate memory for state vars\n",
+ PLUGIN_NAME);
+ return PLUG_STATUS_ERROR;
+ }
+
+ fprintf (stderr, "%s plugin_init (%s) \n", PLUGIN_NAME, options);
+
+
+ vars->temp = g_string_sized_new (TEMP_GSTRING_INIT_SIZE);
+
+ config_init(&vars->cfg);
+
+ if (!config_read_file(&vars->cfg, options) )
+ {
+ fprintf (stderr, "%s plugin_init (%s). Error parsing: '%s'\n",
+ PLUGIN_NAME, options, options);
+
+ config_destroy(&vars->cfg);
+
+ return PLUG_STATUS_ERROR;
+ }
+
+
+ memset (vars->dbuserid, 0x0, XCDR_PLUGIN_STRMAXLEN);
+ memset (vars->dbpasswd, 0x0, XCDR_PLUGIN_STRMAXLEN);
+ memset (vars->dbipaddr, 0x0, XCDR_PLUGIN_STRMAXLEN);
+ memset (vars->dbschema, 0x0, XCDR_PLUGIN_STRMAXLEN);
+ memset (vars->stmt_template, 0x0, XCDR_PLUGIN_STRMAXLEN);
+
+
+ const char *t = NULL;
+ int it;
+
+ if (CONFIG_TRUE == config_lookup_string (&vars->cfg, "dbuserid", &t) )
+ snprintf (vars->dbuserid, XCDR_PLUGIN_STRMAXLEN, "%s", t);
+
+ if (CONFIG_TRUE == config_lookup_string (&vars->cfg, "dbpasswd", &t) )
+ snprintf (vars->dbpasswd, XCDR_PLUGIN_STRMAXLEN, "%s", t);
+
+ if (CONFIG_TRUE == config_lookup_string (&vars->cfg, "dbipaddr", &t))
+ snprintf (vars->dbipaddr, XCDR_PLUGIN_STRMAXLEN, "%s", t);
+
+ if (CONFIG_TRUE == config_lookup_string (&vars->cfg, "dbschema", &t))
+ snprintf (vars->dbschema, XCDR_PLUGIN_STRMAXLEN, "%s", t);
+
+ if (CONFIG_TRUE == config_lookup_string (&vars->cfg, "stmt_template", &t))
+ snprintf (vars->stmt_template, STMT_TEMPLATE_MAX_LEN, "%s", t);
+
+ if (CONFIG_TRUE != config_lookup_int (&vars->cfg, "dbipport", &vars->dbipport) )
+ vars->dbipport = MYSQL_IPPORT;
+
+ if (CONFIG_TRUE != config_lookup_int (&vars->cfg, "sql_insert_retry_max",
+ &vars->sql_insert_retry_max) )
+ vars->sql_insert_retry_max = STMT_RETRY_MAX;
+
+ if (0 >= vars->sql_insert_retry_max)
+ vars->sql_insert_retry_max = STMT_RETRY_MAX;
+
+
+ config_destroy(&vars->cfg);
+
+ fprintf (stderr, "%s plugin_init (%s). \
+dbschema: %s, dbuserid: %s, dbpasswd: %s, dbipaddr: %s, \
+dbipport: %i \r\n",
+ PLUGIN_NAME, options,
+ vars->dbschema, vars->dbuserid, vars->dbpasswd,
+ vars->dbipaddr, vars->dbipport);
+
+
+ vars->dbflags = 0;
+ vars->conn = (MYSQL *) mysql_do_connect (vars->dbipaddr,
+ vars->dbuserid, vars->dbpasswd,
+ vars->dbschema,
+ vars->dbipport, NULL, vars->dbflags);
+ if (vars->conn == NULL)
+ {
+ fprintf (stderr, "%s plugin_init (%s). Can't connect to db: '%s'",
+ PLUGIN_NAME, options, vars->dbschema);
+
+ syslog_msg (LOG_ALERT, 0, "%s plugin_init (%s). Can't connect to db: '%s'\n",
+ PLUGIN_NAME, options, vars->dbschema);
+
+ return PLUG_STATUS_ERROR;
+ }
+
+ return PLUG_STATUS_OK;
+}
+
+int plugin_free (XCDR_PLUGSTATE *state)
+{
+ vars = state->local_vars;
+
+ mysql_close (vars->conn);
+ g_string_free (vars->temp, TRUE);
+
+ free (vars);
+
+ return PLUG_STATUS_OK;
+}
+
+
+int plugin_main (STMTEXP_TAB *vex, XCDR_PLUGSTATE *state)
+{
+
+ vars = state->local_vars;
+
+ int retr = vars->sql_insert_retry_max;
+ int stmt_done = 0;
+
+ while (retr--)
+ {
+ const char* stmt = mysqlcdr_expand_str (vars->conn, vex, vars->stmt_template,
+ strlen(vars->stmt_template));
+ if (NULL == stmt)
+ {
+ fprintf (stderr, "mysqlcdr_expand_str() returned error. Retrying\n");
+ mysql_ping(vars->conn);
+ }
+ else
+ {
+
+ if (0 != mysql_query_retry_on_fail (vars->conn, stmt, STMT_RETRY_MAX))
+ fprintf (stderr, "Error. '%s' failed. Retrying.\n", stmt);
+ else
+ {
+ fprintf (stderr, "%s\n", stmt);
+ stmt_done = 1;
+ break;
+ }
+ }
+
+ }//~while (retr--)
+
+ if (!stmt_done)
+ {
+ //!FixMe - Failover action. Log to file ... e.t.c
+ }
+
+ return PLUG_STATUS_OK;
+}
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdplugldrc"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/plugldr.c (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/plugldr.c         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/plugldr.c        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,254 @@
</span><ins>+#include <stdio.h>
+#include <syslog.h>
+#include <pcre.h>
+#include <string.h>
+#include <libconfig.h>
+#include "plugcommon.h"
+#include "plugldr.h"
+#include "log.h"
+
+
+#define XCDR_FILE_PATH_MAX 1024
+#define XCDR_STR_LEN_MAX 1024
+
+
+
+int xcdr_plug_ldr_sort_plugins(XCDR_PLUGTAB *plugtab)
+{
+ unsigned int a, b;
+ XCDR_PLUGTAG x;
+
+
+ for (a = 1; a < plugtab->tag_count; ++a)
+ {
+ for (b = plugtab->tag_count - 1; b >= a; --b)
+ {
+ if (plugtab->tags[b - 1].priority > plugtab->tags[b].priority)
+ {
+ x = plugtab->tags[b - 1];
+ plugtab->tags[b - 1] = plugtab->tags[b];
+ plugtab->tags[b] = x;
+ }
+ }
+ }
+
+ return 0;
+}
+
+
+int
+xcdr_plugldr_load_plugins(XCDR_PLUGTAB *plugtab)
+{
+ unsigned int i;
+
+ if (NULL == plugtab->tags || 0 >= plugtab->tag_count)
+ {
+ syslog_msg(LOG_ALERT, 1,
+ "xcdr_plugldr_load_plugins %s:%d No plugins configured",
+ __FILE__, __LINE__);
+ return -1;
+ }
+
+ for (i = 0; i < plugtab->tag_count; i++)
+ {
+
+ if (PLUG_STATUS_ERROR == plug_init(plugtab->tags[i].fname,
+ plugtab->tags[i].options,
+ &plugtab->tags[i].plug))
+ {
+ syslog_msg(LOG_ALERT, 1,
+ "plugldr_load_plugins %s:%d can't load plugin '%s'",
+ __FILE__, __LINE__, plugtab->tags[i].fname);
+ return -1;
+ }
+
+ fprintf(stderr, "plugin: '%s' loaded priority:'%d' options:'%s'\n",
+ plugtab->tags[i].fname, plugtab->tags[i].priority,
+ plugtab->tags[i].options);
+
+ }// ~for (i
+
+ if (1 < plugtab->tag_count)
+ xcdr_plug_ldr_sort_plugins(plugtab);
+
+
+ return 0;
+}
+
+
+
+
+
+int xcdr_plugldr_load_config(XCDR_PLUGTAB *plugtab, const char* config_file)
+{
+
+ config_t cfg;
+ config_setting_t *setting;
+
+ config_init(&cfg);
+
+ fprintf (stderr, "xcdr_plugldr_load_config. Reading config: '%s'\n", config_file);
+
+        if (!config_read_file(&cfg, config_file))
+ {
+                fprintf(stderr, "%s:%d - %s\n",
+ config_file,
+ config_error_line(&cfg),
+ config_error_text(&cfg));
+                config_destroy(&cfg);
+
+                return -1;
+        }
+
+
+ const char *plugin_dir;
+ config_lookup_string (&cfg, "plugin_dir", &plugin_dir);
+
+ setting = config_lookup(&cfg, "Plugins");
+ if(setting != NULL)
+ {
+ int count = config_setting_length(setting);
+ int i;
+
+ plugtab->tags = NULL;
+ plugtab->tag_count = count;
+
+ plugtab->tags = (XCDR_PLUGTAG*)
+ calloc(plugtab->tag_count, sizeof (XCDR_PLUGTAG));
+ if (NULL == plugtab->tags)
+ {
+ config_destroy(&cfg);
+ return -1;
+ }
+
+ for(i = 0; i < count; ++i)
+ {
+ config_setting_t *plugin = config_setting_get_elem(setting, i);
+
+ const char *name, *options;
+ int priority;
+
+ if(!(config_setting_lookup_string(plugin, "name", &name)
+ && config_setting_lookup_string(plugin, "options", &options)
+ && config_setting_lookup_int(plugin, "priority", &priority)))
+ continue;
+
+ fprintf(stderr, " Plugin [%d] %s:\n", i, name);
+ snprintf(plugtab->tags[i].fname, XCDR_PLUGIN_STRMAXLEN - 1,
+ "%s/%s.so", plugin_dir, name);
+
+ snprintf(plugtab->tags[i].options, XCDR_PLUGIN_STRMAXLEN - 1,
+ "%s", options);
+
+ plugtab->tags[i].priority = priority;
+
+ fprintf(stderr, " %u plugin = '%s' options = '%s'\n",
+ plugtab->tags[i].priority,
+ plugtab->tags[i].fname,
+ plugtab->tags[i].options);
+ }
+
+
+ for(i = 0; i < count; ++i)
+ {
+ char metric_name [XCDR_STR_LEN_MAX];
+ snprintf (metric_name, XCDR_STR_LEN_MAX - 1, "Plugins.[%d].Metrics", i);
+ config_setting_t *setting_m = config_lookup(&cfg, metric_name);
+ if (NULL == setting_m)
+ continue;
+
+
+ int metric_count = config_setting_length(setting_m);
+
+ plugtab->tags[i].metrics.tag_count = metric_count;
+
+ plugtab->tags[i].metrics.tags =
+ (XCDR_METRTAG*) calloc(metric_count,
+ sizeof (XCDR_METRTAG));
+
+ int j;
+ const char *name, *regexp;
+ for (j = 0; j < metric_count; j++)
+ {
+ config_setting_t *metric = config_setting_get_elem(setting_m, j);
+
+ if(!(config_setting_lookup_string(metric, "metric", &name)
+ && config_setting_lookup_string(metric, "regexp", &regexp)))
+ continue;
+
+ snprintf (plugtab->tags[i].metrics.tags[j].metric,
+ XCDR_METRIC_ID_MAX,
+ "%s",
+ name);
+
+ snprintf (plugtab->tags[i].metrics.tags[j].regexp,
+ XCDR_METRIC_REGEXP_MAX,
+ "%s",
+ regexp);
+
+ fprintf(stderr, " Loaded metric %s:%s:%d [%s] '%s'\n",
+ plugtab->tags[i].fname,
+ plugtab->tags[i].options,
+ plugtab->tags[i].priority,
+ name, regexp);
+ }
+ }
+ }
+
+ config_destroy(&cfg);
+
+ return 0;
+}
+
+
+
+void
+xcdr_plugldr_free_plugins(XCDR_PLUGTAB *plugtab)
+{
+ unsigned int i;
+
+ if (NULL == plugtab) return;
+
+ for (i = 0; i < plugtab->tag_count; i++)
+ if (NULL != plugtab->tags[i].fname)
+ {
+ plug_free(&plugtab->tags[i].plug);
+ free(plugtab->tags[i].metrics.tags);
+
+ fprintf(stderr, "plugldr_free_plugins %s\n", plugtab->tags[i].fname);
+ }
+
+ if (NULL != plugtab->tags)
+ {
+ free(plugtab->tags);
+ plugtab->tag_count = 0;
+ }
+
+ plugtab->tags = NULL;
+
+ fprintf(stderr, "plugldr_free_plugins done\r\n");
+
+ return;
+}
+
+/*
+ Returns non -negative value on success
+ Negative value on failure
+ */
+int xcdr_plugldr_match_regexp(const char *regexp,
+ const char *text, int text_len)
+{
+ pcre *re;
+ const char *error;
+ int ovector[30];
+ int erroffset;
+ int res;
+
+ re = pcre_compile(regexp, 0, &error, &erroffset, NULL);
+
+ res = pcre_exec(re, NULL, text, text_len, 0, 0, ovector, 30);
+
+ pcre_free (re);
+
+ return res;
+}
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdplugldrh"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/plugldr.h (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/plugldr.h         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/plugldr.h        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,86 @@
</span><ins>+#ifndef PLUGLDR_H
+#define PLUGLDR_H
+
+#include "plug.h"
+
+
+#define XCDR_PLUGLDR_PREPROCESSOR_PLUGIN_TOKEN "preprocessor_plugin"
+#define XCDR_PLUGLDR_PROCESSOR_PLUGIN_TOKEN "processor_plugin"
+#define XCDR_PLUGLDR_FALLBACK_PLUGIN_TOKEN "fallback_plugin"
+#define XCDR_PLUGLDR_PLUGIN_DIR_TOKEN "plugin_dir"
+
+#define XCDR_METRIC_ID_MAX 256
+#define XCDR_METRIC_REGEXP_MAX 256
+
+
+
+typedef struct xcdr_plugin_metric_tag
+{
+ char metric [XCDR_METRIC_ID_MAX];
+ char regexp [XCDR_METRIC_REGEXP_MAX];
+} XCDR_METRTAG, *PXCDR_METRTAG;
+
+
+typedef struct xcdr_metric_table
+{
+        XCDR_METRTAG *tags;
+        unsigned int tag_count;
+} XCDR_METRTAB, *PXCDR_METRTAB;
+
+
+
+
+typedef struct xcdr_plugin_tag
+{
+
+ unsigned int id;
+
+ /*plugin priority in config table*/
+        unsigned int priority;
+
+ /*plugin file name*/
+        char fname [XCDR_PLUGIN_STRMAXLEN];
+
+ /*options passed to plugin*/
+        char options [XCDR_PLUGIN_STRMAXLEN];
+
+
+ /* plugin function pointers*/
+        XCDR_PLUGINFO plug;
+
+ /*table of plugin metrics*/
+ XCDR_METRTAB metrics;
+
+
+} XCDR_PLUGTAG, *PXCDR_PLUGTAG;
+
+
+typedef struct plugin_table
+{
+        XCDR_PLUGTAG *tags;
+        unsigned int tag_count;
+} XCDR_PLUGTAB, *PXCDR_PLUGTAB;
+
+
+/*First configure PLUGTAB table*/
+int xcdr_plugldr_load_config(XCDR_PLUGTAB *plugtab, const char* config_file);
+
+/*Load plugins after successful configuration*/
+int xcdr_plugldr_load_plugins (XCDR_PLUGTAB *plugtab);
+
+
+/*int xcdr_plugldr_match_plugin (const PLUGINCALLINFO *plugci,
+ const XCDR_PLUGTAB *plugtab, XCDR_PLUGINFO **plug,
+ const int startpos);
+*/
+
+void xcdr_plugldr_free_plugins (XCDR_PLUGTAB *plugtab);
+
+int xcdr_plug_ldr_sort_plugins (XCDR_PLUGTAB *plugtab);
+
+int xcdr_plugldr_match_regexp (const char *regexp,
+ const char *text, int text_len);
+
+
+#endif
+
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdstmtexpc"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/stmtexp.c (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/stmtexp.c         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/stmtexp.c        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,144 @@
</span><ins>+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <glib.h>
+#include "stmtexp.h"
+#include "stmtexpldr.h"
+
+
+#define VARSTART "$<"
+#define VAREND ">"
+
+#define VARSTART_LEN strlen (VARSTART)
+#define VAREND_LEN strlen (VAREND)
+
+#define VARID_LEN 512
+
+int stmtexp_load_config (stmtexp_tab_t *vex, const char* config_file)
+{
+ stmtexpldr_init (vex);
+
+ return stmtexpldr_load_config (vex, config_file);
+}
+
+void stmtexp_free (stmtexp_tab_t *vex)
+{
+ stmtexpldr_clear (vex);
+}
+
+void stmtexp_assign_var (stmtexp_tab_t *vex,
+ const char *varid, const char *vartext)
+{
+ stmtexp_key_t t;
+ memset (&t, 0x0, sizeof(stmtexp_key_t) );
+
+ snprintf (t.stmt_var, STMTEXPAND_STRLEN_MAX - 1, "%s", varid);
+
+ stmtexp_val_t *tv = g_hash_table_lookup (vex->ght, &t);
+
+ if (NULL == tv)
+ {
+ /*
+ fprintf (stderr,
+ "Index '%s' is not found. Can't assign var.\n",
+ varid);
+ */
+ return;
+ }
+
+ if (NULL != tv->val)
+ {
+ /*
+ fprintf (stderr, "free old val %s\n", tv->val);
+ */
+ free (tv->val);
+ tv->val = NULL;
+ }
+
+ tv->val = strdup (vartext);
+
+}
+
+const char* stmtexp_lookup_var (stmtexp_tab_t *vex, const char *varid)
+{
+ stmtexp_key_t t;
+ memset (&t, 0x0, sizeof(stmtexp_key_t) );
+
+ snprintf (t.stmt_var, STMTEXPAND_STRLEN_MAX - 1, "%s", varid);
+
+
+ stmtexp_val_t *tv = g_hash_table_lookup (vex->ght, &t);
+
+ //fprintf (stderr, "stmtexp_lookup_var('%s')", varid);
+
+ if (NULL != tv)
+ return tv->val;
+ else return NULL;
+}
+
+
+void stmtexp_foreach_callback (stmtexp_tab_t *vex,
+ stmtexp_foreach_callback_t c,
+ void *data)
+{
+ g_hash_table_foreach (vex->ght, (GHFunc)c, data);
+}
+
+
+const char *stmtexp_expand_str (stmtexp_tab_t *vex,
+ const char *src, int srclen)
+{
+ const char *s; //src
+ char *e; //end
+ char varid [VARID_LEN];
+
+ s = src;
+ g_string_set_size (vex->expanded, 0);
+
+ while (s < src + srclen)
+ {
+ if (NULL != (e = strstr (s, VARSTART)) )
+ {
+ g_string_append_len (vex->expanded, s, e - s);
+ s = e++;
+
+ if (NULL != (e = strstr (s, VAREND)) )
+ {
+
+ /* Remove placeholders VARSTART and VAREND, then lookup */
+ memset (varid, 0x0, VARID_LEN);
+ strncpy (varid, s + VARSTART_LEN, (e - s) - VARSTART_LEN );
+
+ const char* ev = stmtexp_lookup_var (vex, varid);
+ if (NULL != ev)
+ {
+ /*append expanded var to destination*/
+ g_string_append (vex->expanded, ev);
+ }
+ else
+ {
+ /*variable was not found, skip it*/
+ }
+
+ s = e + 1;
+ //fprintf (stderr, "s: '%s'\n", s);
+
+ }
+ else /*no more signatures found, append the rest of the str*/
+ {
+ if (NULL != s)
+ g_string_append (vex->expanded, s);
+ break;
+ }
+ }
+ else /*no more signatures found, append the rest of the str*/
+ {
+ if (NULL != s)
+ g_string_append (vex->expanded, s);
+ break;
+ }
+ }//while (s < src + src_len)
+
+ return vex->expanded->str;
+
+}
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdstmtexph"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/stmtexp.h (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/stmtexp.h         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/stmtexp.h        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,52 @@
</span><ins>+#ifndef STMTEXP_H
+#define STMTEXP_H
+
+#include "stmtexptab.h"
+#include "stmtexpldr.h"
+#include <glib.h>
+
+/*
+ Very simple and slow variable expansion. No text escaping is provided.
+ No recursion checks, so if your expanded var contains variable definition
+ you're in trouble.
+*/
+
+
+/* Callback to modify each key and value */
+typedef void (* stmtexp_foreach_callback_t) (stmtexp_key_t *key,
+ stmtexp_val_t *val,
+ void *userdata);
+
+
+/*
+ Returns:
+ -1 if error occured, any other value on success
+*/
+int stmtexp_load_config (stmtexp_tab_t *vex, const char* config_file);
+
+void stmtexp_free (stmtexp_tab_t *vex);
+
+const char* stmtexp_lookup_var (stmtexp_tab_t *vex, const char *varid);
+
+void stmtexp_foreach_callback (stmtexp_tab_t *vex,
+ stmtexp_foreach_callback_t c,
+ void *data);
+
+void stmtexp_assign_var (stmtexp_tab_t *vex,
+ const char *varid, const char *vartext);
+
+/*
+ @vex - variables to expand
+ Returns:
+ pointer to a static buffer which gets overwritten on next call to the func.
+ NULL on errror
+*/
+const char *stmtexp_expand_str (stmtexp_tab_t * vex,
+ const char *src, int srclen);
+
+
+
+
+#endif
+
+
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdstmtexpldrc"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/stmtexpldr.c (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/stmtexpldr.c         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/stmtexpldr.c        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,218 @@
</span><ins>+#include "stmtexptab.h"
+#include "stmtexpldr.h"
+#include <libconfig.h>
+#include <stdlib.h>
+#include <malloc.h>
+#include <string.h>
+
+
+#define EXPANDED_STR_DEF_LEN 10240
+
+
+
+gboolean stmtexpldr_equal (gconstpointer a, gconstpointer b);
+guint stmtexpldr_str_hash (gconstpointer v);
+void stmtexpldr_destroy_val (gpointer data);
+void stmtexpldr_destroy_key (gpointer data);
+
+
+gboolean stmtexpldr_equal (gconstpointer a, gconstpointer b)
+{
+ const stmtexp_key_t* ta = (stmtexp_key_t *) a;
+ const stmtexp_key_t* tb = (stmtexp_key_t *) b;
+
+ return g_str_equal (ta->stmt_var, tb->stmt_var);
+}
+
+
+guint stmtexpldr_str_hash (gconstpointer v)
+{
+ const stmtexp_key_t* tv = (stmtexp_key_t *) v;
+
+ return (g_str_hash(tv->stmt_var) );
+}
+
+
+void stmtexpldr_destroy_val (gpointer data)
+{
+ if (NULL == data)
+ return;
+
+ stmtexp_val_t * val = (stmtexp_val_t*) data;
+
+ if (NULL != val->val)
+ free (val->val);
+
+ free (val);
+}
+
+void stmtexpldr_destroy_key (gpointer data)
+{
+ if (NULL == data)
+ return;
+
+ stmtexp_key_t * key = (stmtexp_key_t*) data;
+
+ if (NULL != key)
+ free (key);
+}
+
+
+
+void stmtexpldr_init (stmtexp_tab_t *vex)
+{
+ vex->ght = g_hash_table_new_full (g_str_hash, stmtexpldr_equal,
+ stmtexpldr_destroy_key, stmtexpldr_destroy_val);
+
+ vex->expanded = g_string_sized_new (EXPANDED_STR_DEF_LEN);
+}
+
+
+int stmtexpldr_load_config (stmtexp_tab_t *vex, const char* config_file)
+{
+
+ int fret;
+ config_t cfg;
+ config_setting_t *setting;
+
+        config_init(&cfg);
+
+        if (!config_read_file(&cfg, config_file))
+ {
+                fprintf(stderr, "%s:%d - %s\n",
+ config_file,
+ config_error_line(&cfg),
+ config_error_text(&cfg));
+                config_destroy(&cfg);
+
+                return -1;
+        }
+
+
+ setting = config_lookup(&cfg, "Variables");
+ if(setting != NULL)
+ {
+ int count = config_setting_length(setting);
+ printf("%d configured variables:\n", count);
+
+ int i;
+ for(i = 0; i < count; ++i)
+ {
+ config_setting_t *var = config_setting_get_elem(setting, i);
+
+ const char *var_id, *xpath;
+
+ if(!(config_setting_lookup_string(var, "var_id",
+ &var_id)
+ && config_setting_lookup_string(var, "xpath", &xpath))
+ )
+ continue;
+
+ stmtexp_key_t* sk = calloc (1, sizeof(stmtexp_key_t) );
+ if (NULL != sk)
+ {
+ fprintf(stderr, " Variable [%d] '%s':'%s'\n", i,
+ var_id, xpath );
+
+ snprintf (sk->stmt_var, STMTEXPAND_STRLEN_MAX - 1, "%s",
+ var_id);
+
+ snprintf (sk->xpath, STMTEXPAND_STRLEN_MAX - 1, "%s", xpath );
+
+ //add index and value
+ stmtexp_val_t *sv = calloc (1, sizeof(stmtexp_val_t) );
+ g_hash_table_replace (vex->ght, sk, sv);
+ } else
+ {
+ perror ("stmtexpldr_load_config() malloc error\n");
+ fret = -1;
+ break;
+ }
+
+
+ }
+ fret = 0;
+
+ }
+
+
+ config_destroy(&cfg);
+
+ return fret;
+
+/*
+ cfg_t *cfg;
+
+
+ int res;
+ int fret = 0;
+
+ cfg = cfg_init(opts, 0);
+ res = cfg_parse(cfg, config_file);
+
+ printf("Parsing result == %d\n", res);
+ if(res == CFG_FILE_ERROR)
+ {
+ perror(config_file);
+ return -1;
+ } else if(res == CFG_PARSE_ERROR)
+ {
+ fprintf(stderr, "'%s' parse error\n", config_file);
+ return -1;
+ }
+
+ int n = cfg_size(cfg, "var");
+ printf("%d configured variables:\n", n);
+
+ int i;
+ for(i = 0; i < n; i++)
+ {
+ stmtexp_key_t* sk = calloc (1, sizeof(stmtexp_key_t) );
+ if (NULL != sk)
+ {
+ cfg_t *vars = cfg_getnsec(cfg, "var", i);
+
+ printf(" Variable [%d] %s:\n", i, cfg_title(vars) );
+ snprintf (sk->stmt_var, STMTEXPAND_STRLEN_MAX - 1,
+ "%s", cfg_getstr(vars, "var_placeholder") );
+ printf(" Var. Placeholder = %s\n", sk->stmt_var);
+
+
+ snprintf (sk->xpath, STMTEXPAND_STRLEN_MAX - 1,
+ "%s", cfg_getstr(vars, "xpath") );
+ printf(" Var. XPATH = %s\n", sk->xpath);
+
+
+ //add index and value
+ stmtexp_val_t *sv = calloc (1, sizeof(stmtexp_val_t) );
+ g_hash_table_replace (vex->ght, sk, sv);
+ } else
+ {
+ perror ("stmtexpldr_load_config() malloc error\n");
+ fret = -1;
+ break;
+ }
+ }
+
+
+
+ cfg_free(cfg);
+
+
+ return fret;
+*/
+}
+
+
+void stmtexpldr_clear (stmtexp_tab_t *vex)
+{
+ g_hash_table_remove_all (vex->ght);
+}
+
+
+void stmtexpldr_free (stmtexp_tab_t *vex)
+{
+ g_hash_table_destroy (vex->ght);
+ g_string_free (vex->expanded, TRUE);
+}
+
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdstmtexpldrh"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/stmtexpldr.h (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/stmtexpldr.h         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/stmtexpldr.h        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+#ifndef STMTEXPLDR_H
+#define STMTEXPLDR_H
+
+#include "stmtexptab.h"
+
+#define STMTEXPAND_STRLEN_MAX 512
+
+typedef enum
+{
+ STMTEXP_DB_DT_VARCHAR = 1,
+ STMTEXP_DB_DT_INT
+} stmtexp_db_field_dt;
+
+typedef struct
+{
+ /*stmt_var - variable id inside a statement: $<SOMEVAR> */
+ char stmt_var [STMTEXPAND_STRLEN_MAX];
+
+ /*XPATH of value inside the XMLCDR hierarchy*/
+ char xpath [STMTEXPAND_STRLEN_MAX];
+
+} stmtexp_key_t, *pstmtexp_key_t;
+
+typedef struct
+{
+ char *val;
+} stmtexp_val_t, *pstmtexp_val_t;
+
+
+
+void stmtexpldr_init (stmtexp_tab_t *vex);
+
+/* Returns:
+
+ -1 if error occured*/
+int stmtexpldr_load_config (stmtexp_tab_t *vex, const char* config_file);
+
+void stmtexpldr_clear (stmtexp_tab_t *vex);
+
+void stmtexpldr_free (stmtexp_tab_t *vex);
+
+
+
+
+#endif
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdstmtexptabh"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/stmtexptab.h (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/stmtexptab.h         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/stmtexptab.h        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+#ifndef STMTEXPTAB_H
+#define STMTEXPTAB_H
+
+#include <glib.h>
+
+typedef struct
+{
+ GHashTable *ght;
+ GString *expanded;
+} stmtexp_tab_t, *pstmtexp_tab_t, STMTEXP_TAB, *PSTMTEXP_TAB;
+
+
+
+#endif
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdtestxml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/test.xml (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/test.xml         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/test.xml        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,187 @@
</span><ins>+<?xml version="1.0"?>
+<cdr>
+ <variables>
+ <sip_received_ip>192.168.50.21</sip_received_ip>
+ <sip_received_port>39368</sip_received_port>
+ <sip_authorized>true</sip_authorized>
+ <sip_mailbox>1160</sip_mailbox>
+ <sip_auth_username>1160</sip_auth_username>
+
+ <sip_auth_realm>192.168.50.229</sip_auth_realm>
+ <mailbox>1160</mailbox>
+ <record_stereo>true</record_stereo>
+ <accountcode>1160</accountcode>
+ <user_context>default</user_context>
+ <effective_caller_id_name>Michael%20S%20Collins</effective_caller_id_name>
+
+ <effective_caller_id_number>5597993757</effective_caller_id_number>
+ <sip_from_user>1160</sip_from_user>
+ <sip_from_uri>1160%40192.168.50.229</sip_from_uri>
+ <sip_from_host>192.168.50.229</sip_from_host>
+ <sip_from_user_stripped>1160</sip_from_user_stripped>
+ <sip_from_tag>a360bd54</sip_from_tag>
+
+ <sofia_profile_name>internal</sofia_profile_name>
+ <sofia_profile_domain_name>192.168.50.229</sofia_profile_domain_name>
+ <sip_req_user>92137991400</sip_req_user>
+ <sip_req_uri>92137991400%40192.168.50.229</sip_req_uri>
+ <sip_req_host>192.168.50.229</sip_req_host>
+ <sip_to_user>92137991400</sip_to_user>
+
+ <sip_to_uri>92137991400%40192.168.50.229</sip_to_uri>
+ <sip_to_host>192.168.50.229</sip_to_host>
+ <sip_contact_user>1160</sip_contact_user>
+ <sip_contact_port>39368</sip_contact_port>
+ <sip_contact_uri>1160%40192.168.50.21%3A39368</sip_contact_uri>
+ <sip_contact_host>192.168.50.21</sip_contact_host>
+
+ <channel_name>sofia/internal/1160%40192.168.50.229</channel_name>
+ <sip_call_id>NzUyYzU2ZmU0NjQ0NmNkMGExYTNiZjIzMjIwMWNiODc.</sip_call_id>
+ <sip_via_host>192.168.50.21</sip_via_host>
+ <sip_via_port>39368</sip_via_port>
+ <sip_via_rport>39368</sip_via_rport>
+ <max_forwards>70</max_forwards>
+
+ <presence_id>1160%40192.168.50.229</presence_id>
+ <switch_r_sdp>v%3D0%0D%0Ao%3D-%206%202%20IN%20IP4%20192.168.50.21%0D%0As%3DCounterPath%20X-Lite%203.0%0D%0Ac%3DIN%20IP4%20192.168.50.21%0D%0At%3D0%200%0D%0Am%3Daudio%209140%20RTP/AVP%20107%20119%20100%20106%200%20105%2098%208%203%20101%0D%0Aa%3Drtpmap%3A107%20BV32/16000%0D%0Aa%3Drtpmap%3A119%20BV32-FEC/16000%0D%0Aa%3Drtpmap%3A100%20SPEEX/16000%0D%0Aa%3Drtpmap%3A106%20SPEEX-FEC/16000%0D%0Aa%3Drtpmap%3A105%20SPEEX-FEC/8000%0D%0Aa%3Drtpmap%3A98%20iLBC/8000%0D%0Aa%3Drtpmap%3A101%20telephone-event/8000%0D%0Aa%3Dfmtp%3A101%200-15%0D%0Aa%3Dalt%3A1%201%20%3A%20CV3qZAA1%209gFf2/Iz%20192.168.50.21%209140%0D%0A</switch_r_sdp>
+ <remote_media_ip>192.168.50.21</remote_media_ip>
+ <remote_media_port>9140</remote_media_port>
+ <write_codec>PCMU</write_codec>
+ <write_rate>8000</write_rate>
+
+ <open>true</open>
+ <use_profile>nat</use_profile>
+ <numbering_plan>US</numbering_plan>
+ <default_gateway>asterlink.com</default_gateway>
+ <default_area_code>559</default_area_code>
+ <user_name>default</user_name>
+
+ <domain_name>192.168.50.229</domain_name>
+ <local_media_ip>192.168.50.229</local_media_ip>
+ <local_media_port>9140</local_media_port>
+ <current_application>bridge</current_application>
+ <originate_disposition>SUCCESS</originate_disposition>
+ <bridge_channel>OpenZAP/1%3A23/2137991400</bridge_channel>
+
+ <bridge_uuid>e012ce96-7f9c-4194-87fe-5ba86a3930ca</bridge_uuid>
+ <signal_bond>e012ce96-7f9c-4194-87fe-5ba86a3930ca</signal_bond>
+ <sip_nat_detected>true</sip_nat_detected>
+ <endpoint_disposition>ANSWER</endpoint_disposition>
+ <sip_user_agent>X-Lite%20release%201100l%20stamp%2047546</sip_user_agent>
+ <sip_term_status>200</sip_term_status>
+
+ <sip_term_cause>16</sip_term_cause>
+ <hangup_cause>NORMAL_CLEARING</hangup_cause>
+ <start_stamp>2008-07-31%2011%3A35%3A38</start_stamp>
+ <profile_start_stamp>2008-07-31%2011%3A35%3A38</profile_start_stamp>
+ <answer_stamp>2008-07-31%2011%3A35%3A41</answer_stamp>
+ <progress_stamp>2008-07-31%2011%3A35%3A38</progress_stamp>
+
+ <progress_media_stamp>2008-07-31%2011%3A35%3A38</progress_media_stamp>
+ <end_stamp>2008-07-31%2011%3A36%3A17</end_stamp>
+ <start_epoch>1217529338</start_epoch>
+ <start_uepoch>1217529338212616</start_uepoch>
+ <profile_start_epoch>1217529338</profile_start_epoch>
+ <profile_start_uepoch>1217529338212616</profile_start_uepoch>
+
+ <answer_epoch>1217529338</answer_epoch>
+ <answer_uepoch>1217529338452698</answer_uepoch>
+ <end_epoch>1217529377</end_epoch>
+ <end_uepoch>1217529377795951</end_uepoch>
+ <last_app>bridge</last_app>
+ <last_arg>openzap/1/A/2137991400</last_arg>
+
+ <caller_id>%22Mikey%22%20%3C1160%3E</caller_id>
+ <duration>39</duration>
+ <billsec>36</billsec>
+ <progresssec>0</progresssec>
+ <progress_mediasec>0</progress_mediasec>
+ <flow_billsec>39</flow_billsec>
+
+ <mduration>39583</mduration>
+ <billmsec>36267</billmsec>
+ <progressmsec>238</progressmsec>
+ <progress_mediamsec>237955</progress_mediamsec>
+ <flow_billmsec>39583</flow_billmsec>
+ <uduration>39583335</uduration>
+
+ <billusec>36267529</billusec>
+ <progressusec>237955</progressusec>
+ <progress_mediausec>237955</progress_mediausec>
+ <flow_billusec>39583335</flow_billusec>
+ <read_codec>PCMU</read_codec>
+ <read_rate>8000</read_rate>
+
+ </variables>
+ <app_log>
+ <application app_name="set" app_data="open=true"></application>
+ <application app_name="set" app_data="use_profile=nat"></application>
+ <application app_name="set_user" app_data="default@192.168.50.229"></application>
+ <application app_name="db" app_data="insert/spymap/1160/6f32e2f8-38d1-43a7-b6ea-215bbfe6a314"></application>
+ <application app_name="db" app_data="insert/last_dial/1160/92137991400"></application>
+ <application app_name="db" app_data="insert/last_dial/global/6f32e2f8-38d1-43a7-b6ea-215bbfe6a314"></application>
+ <application app_name="record_session" app_data="/mnt/powervault/Databases/XMLCDR/6f32e2f8-38d1-43a7-b6ea-215bbfe6a314__1.wav"></application>
+
+ <application app_name="bridge" app_data="openzap/1/A/2137991400"></application>
+ </app_log>
+ <callflow dialplan="XML" profile_index="1">
+ <extension name="tod_example" number="92137991400">
+ <application app_name="set" app_data="open=true"></application>
+ <application app_name="set" app_data="use_profile=${cond(${acl(${network_addr} rfc1918)} == true ? nat : default)}"></application>
+ <application app_name="set_user" app_data="default@${domain}"></application>
+ <application app_name="db" app_data="insert/spymap/${caller_id_number}/${uuid}"></application>
+ <application app_name="db" app_data="insert/last_dial/${caller_id_number}/${destination_number}"></application>
+
+ <application app_name="db" app_data="insert/last_dial/global/${uuid}"></application>
+ <application app_name="record_session" app_data="/mnt/powervault/Databases/XMLCDR/${uuid}__1.wav"></application>
+ <application app_name="bridge" app_data="openzap/1/A/2137991400"></application>
+ </extension>
+ <caller_profile>
+ <username>1160</username>
+ <dialplan>XML</dialplan>
+ <caller_id_name>Mikey</caller_id_name>
+
+ <ani></ani>
+ <aniii></aniii>
+ <caller_id_number>1160</caller_id_number>
+ <network_addr>192.168.50.21</network_addr>
+ <rdnis></rdnis>
+ <destination_number>92137991400</destination_number>
+ <uuid>6f32e2f8-38d1-43a7-b6ea-215bbfe6a314</uuid>
+
+ <source>mod_sofia</source>
+ <context>default</context>
+ <chan_name>sofia/internal/1160@192.168.50.229</chan_name>
+ <originatee>
+ <originatee_caller_profile>
+ <username>1160</username>
+ <dialplan>XML</dialplan>
+
+ <caller_id_name>Michael S Collins</caller_id_name>
+ <ani></ani>
+ <aniii></aniii>
+ <caller_id_number>5597993757</caller_id_number>
+ <network_addr>192.168.50.21</network_addr>
+ <rdnis></rdnis>
+ <destination_number>1/A/2137991400</destination_number>
+
+ <uuid>e012ce96-7f9c-4194-87fe-5ba86a3930ca</uuid>
+ <source>mod_sofia</source>
+ <context>default</context>
+ <chan_name>OpenZAP/1:23/2137991400</chan_name>
+ </originatee_caller_profile>
+ </originatee>
+ </caller_profile>
+
+ <times>
+ <created_time>1217529338212616</created_time>
+ <profile_created_time>1217529338212616</profile_created_time>
+ <progress_time>1217529338450571</progress_time>
+ <progress_media_time>1217529338452698</progress_media_time>
+ <answered_time>1217529341528422</answered_time>
+
+ <hangup_time>1217529377795951</hangup_time>
+ <transfer_time>0</transfer_time>
+ </times>
+ </callflow>
+</cdr>
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdurldecodec"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/urldecode.c (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/urldecode.c         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/urldecode.c        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,86 @@
</span><ins>+#include <glib.h>
+#include "urldecode.h"
+
+
+
+const char * urldecode_expand_value (GString *url,
+ const char *key, int key_len,
+ int case_sensative,
+ GString *temp, int *status, GString *val)
+{
+ const char *p;
+ char *end;
+ apr_size_t len;
+
+ if ( NULL == key )
+ {
+ *status = URLUTIL_STATUS_INVALID_PARAMS;
+ return NULL;
+ }
+
+ if (0 == strlen(key) || 0 == key_len)
+ {
+ *status = URLUTIL_STATUS_EMPTY_SRCH_KEY;
+ return NULL;
+ }
+        
+ if (strlen((char*)url->str) < key_len )
+ {
+ *status = URLUTIL_STATUS_URL_STR_TOO_SHORT;
+ return NULL;
+ }
+
+
+ //convert key to urlencoded string,
+ //since we are searching for urlencoded keys
+
+ //max length of urlencoded key is 3 * key length
+ len = 3 * key_len + 1;
+ g_string_set_size(temp, len);
+ memset (temp->str, 0x0, len);
+
+ apreq_encode(temp->str, key, key_len );
+ //append '=' to the key_name
+ temp->str [strlen(temp->str)] = '=';
+
+
+ if (0 == case_sensative)
+ {
+ if (NULL == (p = strcasestr ((const char*) url->str, temp->str)) )
+ {
+ *status = URLUTIL_STATUS_SRCH_KEY_NOT_FOUND;
+ return NULL;
+ }
+ } else
+ {
+ if (NULL == (p = strstr ((const char*) url->str, temp->str)) )
+ {
+ *status = URLUTIL_STATUS_SRCH_KEY_NOT_FOUND;
+ return NULL;
+ }
+ } //~else case_sensative
+
+
+ //urlencoded key is found in cgi request string
+ if (NULL == (end = strchr (p, '=')) )
+ {
+ *status = URLUTIL_STATUS_URL_KEY_VAL_BROKEN;
+ return NULL;
+ }
+
+ //get value
+ //if terminating '&' is not found,
+ //then our value ends at the end of the @url string
+ p = ++end;
+ if (NULL == (end = strchr (p, '&')) )
+ end = url->str + strlen(url->str);
+
+ len = 3 * (end - p) + 1;
+ g_string_set_size(val, len);
+ memset (val->str, 0x0, len);
+
+ apreq_decode (val->str, &len, p, end - p);
+
+ return val->str;
+}
+
</ins></span></pre></div>
<a id="freeswitchtrunkcontribnazimxmlcdrdurldecodeh"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/nazim/xmlcdrd/urldecode.h (0 => 16974)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/nazim/xmlcdrd/urldecode.h         (rev 0)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/urldecode.h        2010-03-12 16:48:13 UTC (rev 16974)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+#ifndef URLDECODE_H
+#define URLDECODE_H
+
+
+#include <apreq2/apreq_util.h>
+#include <glib.h>
+
+
+/*
+Status codes
+*/
+
+#define URLUTIL_STATUS_OK 0
+#define URLUTIL_STATUS_MEM_ALLOC_ERR -1
+#define URLUTIL_STATUS_INVALID_PARAMS -2
+#define URLUTIL_STATUS_EMPTY_SRCH_KEY -3
+#define URLUTIL_STATUS_SRCH_KEY_NOT_FOUND -4
+#define URLUTIL_STATUS_URL_STR_TOO_SHORT -5
+#define URLUTIL_STATUS_URL_KEY_VAL_BROKEN -6
+
+
+const char * urldecode_expand_value (GString *url,
+ const char *key, int key_len,
+ int case_sensative,
+ GString *temp, int *status, GString *val);
+
+
+#endif
</ins></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>
</body>
</html>