├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── debian ├── changelog ├── compat ├── control ├── copyright ├── docs ├── freeswitch-mod-bcg729.install ├── freeswitch-mod-bcg729.lintian-overrides ├── rules └── source │ └── format └── mod_bcg729.c /.gitignore: -------------------------------------------------------------------------------- 1 | .*.swp 2 | bcg729 3 | *.o 4 | *.so 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MOZILLA PUBLIC LICENSE 2 | Version 1.1 3 | 4 | --------------- 5 | 6 | 1. Definitions. 7 | 8 | 1.0.1. "Commercial Use" means distribution or otherwise making the 9 | Covered Code available to a third party. 10 | 11 | 1.1. "Contributor" means each entity that creates or contributes to 12 | the creation of Modifications. 13 | 14 | 1.2. "Contributor Version" means the combination of the Original 15 | Code, prior Modifications used by a Contributor, and the Modifications 16 | made by that particular Contributor. 17 | 18 | 1.3. "Covered Code" means the Original Code or Modifications or the 19 | combination of the Original Code and Modifications, in each case 20 | including portions thereof. 21 | 22 | 1.4. "Electronic Distribution Mechanism" means a mechanism generally 23 | accepted in the software development community for the electronic 24 | transfer of data. 25 | 26 | 1.5. "Executable" means Covered Code in any form other than Source 27 | Code. 28 | 29 | 1.6. "Initial Developer" means the individual or entity identified 30 | as the Initial Developer in the Source Code notice required by Exhibit 31 | A. 32 | 33 | 1.7. "Larger Work" means a work which combines Covered Code or 34 | portions thereof with code not governed by the terms of this License. 35 | 36 | 1.8. "License" means this document. 37 | 38 | 1.8.1. "Licensable" means having the right to grant, to the maximum 39 | extent possible, whether at the time of the initial grant or 40 | subsequently acquired, any and all of the rights conveyed herein. 41 | 42 | 1.9. "Modifications" means any addition to or deletion from the 43 | substance or structure of either the Original Code or any previous 44 | Modifications. When Covered Code is released as a series of files, a 45 | Modification is: 46 | A. Any addition to or deletion from the contents of a file 47 | containing Original Code or previous Modifications. 48 | 49 | B. Any new file that contains any part of the Original Code or 50 | previous Modifications. 51 | 52 | 1.10. "Original Code" means Source Code of computer software code 53 | which is described in the Source Code notice required by Exhibit A as 54 | Original Code, and which, at the time of its release under this 55 | License is not already Covered Code governed by this License. 56 | 57 | 1.10.1. "Patent Claims" means any patent claim(s), now owned or 58 | hereafter acquired, including without limitation, method, process, 59 | and apparatus claims, in any patent Licensable by grantor. 60 | 61 | 1.11. "Source Code" means the preferred form of the Covered Code for 62 | making modifications to it, including all modules it contains, plus 63 | any associated interface definition files, scripts used to control 64 | compilation and installation of an Executable, or source code 65 | differential comparisons against either the Original Code or another 66 | well known, available Covered Code of the Contributor's choice. The 67 | Source Code can be in a compressed or archival form, provided the 68 | appropriate decompression or de-archiving software is widely available 69 | for no charge. 70 | 71 | 1.12. "You" (or "Your") means an individual or a legal entity 72 | exercising rights under, and complying with all of the terms of, this 73 | License or a future version of this License issued under Section 6.1. 74 | For legal entities, "You" includes any entity which controls, is 75 | controlled by, or is under common control with You. For purposes of 76 | this definition, "control" means (a) the power, direct or indirect, 77 | to cause the direction or management of such entity, whether by 78 | contract or otherwise, or (b) ownership of more than fifty percent 79 | (50%) of the outstanding shares or beneficial ownership of such 80 | entity. 81 | 82 | 2. Source Code License. 83 | 84 | 2.1. The Initial Developer Grant. 85 | The Initial Developer hereby grants You a world-wide, royalty-free, 86 | non-exclusive license, subject to third party intellectual property 87 | claims: 88 | (a) under intellectual property rights (other than patent or 89 | trademark) Licensable by Initial Developer to use, reproduce, 90 | modify, display, perform, sublicense and distribute the Original 91 | Code (or portions thereof) with or without Modifications, and/or 92 | as part of a Larger Work; and 93 | 94 | (b) under Patents Claims infringed by the making, using or 95 | selling of Original Code, to make, have made, use, practice, 96 | sell, and offer for sale, and/or otherwise dispose of the 97 | Original Code (or portions thereof). 98 | 99 | (c) the licenses granted in this Section 2.1(a) and (b) are 100 | effective on the date Initial Developer first distributes 101 | Original Code under the terms of this License. 102 | 103 | (d) Notwithstanding Section 2.1(b) above, no patent license is 104 | granted: 1) for code that You delete from the Original Code; 2) 105 | separate from the Original Code; or 3) for infringements caused 106 | by: i) the modification of the Original Code or ii) the 107 | combination of the Original Code with other software or devices. 108 | 109 | 2.2. Contributor Grant. 110 | Subject to third party intellectual property claims, each Contributor 111 | hereby grants You a world-wide, royalty-free, non-exclusive license 112 | 113 | (a) under intellectual property rights (other than patent or 114 | trademark) Licensable by Contributor, to use, reproduce, modify, 115 | display, perform, sublicense and distribute the Modifications 116 | created by such Contributor (or portions thereof) either on an 117 | unmodified basis, with other Modifications, as Covered Code 118 | and/or as part of a Larger Work; and 119 | 120 | (b) under Patent Claims infringed by the making, using, or 121 | selling of Modifications made by that Contributor either alone 122 | and/or in combination with its Contributor Version (or portions 123 | of such combination), to make, use, sell, offer for sale, have 124 | made, and/or otherwise dispose of: 1) Modifications made by that 125 | Contributor (or portions thereof); and 2) the combination of 126 | Modifications made by that Contributor with its Contributor 127 | Version (or portions of such combination). 128 | 129 | (c) the licenses granted in Sections 2.2(a) and 2.2(b) are 130 | effective on the date Contributor first makes Commercial Use of 131 | the Covered Code. 132 | 133 | (d) Notwithstanding Section 2.2(b) above, no patent license is 134 | granted: 1) for any code that Contributor has deleted from the 135 | Contributor Version; 2) separate from the Contributor Version; 136 | 3) for infringements caused by: i) third party modifications of 137 | Contributor Version or ii) the combination of Modifications made 138 | by that Contributor with other software (except as part of the 139 | Contributor Version) or other devices; or 4) under Patent Claims 140 | infringed by Covered Code in the absence of Modifications made by 141 | that Contributor. 142 | 143 | 3. Distribution Obligations. 144 | 145 | 3.1. Application of License. 146 | The Modifications which You create or to which You contribute are 147 | governed by the terms of this License, including without limitation 148 | Section 2.2. The Source Code version of Covered Code may be 149 | distributed only under the terms of this License or a future version 150 | of this License released under Section 6.1, and You must include a 151 | copy of this License with every copy of the Source Code You 152 | distribute. You may not offer or impose any terms on any Source Code 153 | version that alters or restricts the applicable version of this 154 | License or the recipients' rights hereunder. However, You may include 155 | an additional document offering the additional rights described in 156 | Section 3.5. 157 | 158 | 3.2. Availability of Source Code. 159 | Any Modification which You create or to which You contribute must be 160 | made available in Source Code form under the terms of this License 161 | either on the same media as an Executable version or via an accepted 162 | Electronic Distribution Mechanism to anyone to whom you made an 163 | Executable version available; and if made available via Electronic 164 | Distribution Mechanism, must remain available for at least twelve (12) 165 | months after the date it initially became available, or at least six 166 | (6) months after a subsequent version of that particular Modification 167 | has been made available to such recipients. You are responsible for 168 | ensuring that the Source Code version remains available even if the 169 | Electronic Distribution Mechanism is maintained by a third party. 170 | 171 | 3.3. Description of Modifications. 172 | You must cause all Covered Code to which You contribute to contain a 173 | file documenting the changes You made to create that Covered Code and 174 | the date of any change. You must include a prominent statement that 175 | the Modification is derived, directly or indirectly, from Original 176 | Code provided by the Initial Developer and including the name of the 177 | Initial Developer in (a) the Source Code, and (b) in any notice in an 178 | Executable version or related documentation in which You describe the 179 | origin or ownership of the Covered Code. 180 | 181 | 3.4. Intellectual Property Matters 182 | (a) Third Party Claims. 183 | If Contributor has knowledge that a license under a third party's 184 | intellectual property rights is required to exercise the rights 185 | granted by such Contributor under Sections 2.1 or 2.2, 186 | Contributor must include a text file with the Source Code 187 | distribution titled "LEGAL" which describes the claim and the 188 | party making the claim in sufficient detail that a recipient will 189 | know whom to contact. If Contributor obtains such knowledge after 190 | the Modification is made available as described in Section 3.2, 191 | Contributor shall promptly modify the LEGAL file in all copies 192 | Contributor makes available thereafter and shall take other steps 193 | (such as notifying appropriate mailing lists or newsgroups) 194 | reasonably calculated to inform those who received the Covered 195 | Code that new knowledge has been obtained. 196 | 197 | (b) Contributor APIs. 198 | If Contributor's Modifications include an application programming 199 | interface and Contributor has knowledge of patent licenses which 200 | are reasonably necessary to implement that API, Contributor must 201 | also include this information in the LEGAL file. 202 | 203 | (c) Representations. 204 | Contributor represents that, except as disclosed pursuant to 205 | Section 3.4(a) above, Contributor believes that Contributor's 206 | Modifications are Contributor's original creation(s) and/or 207 | Contributor has sufficient rights to grant the rights conveyed by 208 | this License. 209 | 210 | 3.5. Required Notices. 211 | You must duplicate the notice in Exhibit A in each file of the Source 212 | Code. If it is not possible to put such notice in a particular Source 213 | Code file due to its structure, then You must include such notice in a 214 | location (such as a relevant directory) where a user would be likely 215 | to look for such a notice. If You created one or more Modification(s) 216 | You may add your name as a Contributor to the notice described in 217 | Exhibit A. You must also duplicate this License in any documentation 218 | for the Source Code where You describe recipients' rights or ownership 219 | rights relating to Covered Code. You may choose to offer, and to 220 | charge a fee for, warranty, support, indemnity or liability 221 | obligations to one or more recipients of Covered Code. However, You 222 | may do so only on Your own behalf, and not on behalf of the Initial 223 | Developer or any Contributor. You must make it absolutely clear than 224 | any such warranty, support, indemnity or liability obligation is 225 | offered by You alone, and You hereby agree to indemnify the Initial 226 | Developer and every Contributor for any liability incurred by the 227 | Initial Developer or such Contributor as a result of warranty, 228 | support, indemnity or liability terms You offer. 229 | 230 | 3.6. Distribution of Executable Versions. 231 | You may distribute Covered Code in Executable form only if the 232 | requirements of Section 3.1-3.5 have been met for that Covered Code, 233 | and if You include a notice stating that the Source Code version of 234 | the Covered Code is available under the terms of this License, 235 | including a description of how and where You have fulfilled the 236 | obligations of Section 3.2. The notice must be conspicuously included 237 | in any notice in an Executable version, related documentation or 238 | collateral in which You describe recipients' rights relating to the 239 | Covered Code. You may distribute the Executable version of Covered 240 | Code or ownership rights under a license of Your choice, which may 241 | contain terms different from this License, provided that You are in 242 | compliance with the terms of this License and that the license for the 243 | Executable version does not attempt to limit or alter the recipient's 244 | rights in the Source Code version from the rights set forth in this 245 | License. If You distribute the Executable version under a different 246 | license You must make it absolutely clear that any terms which differ 247 | from this License are offered by You alone, not by the Initial 248 | Developer or any Contributor. You hereby agree to indemnify the 249 | Initial Developer and every Contributor for any liability incurred by 250 | the Initial Developer or such Contributor as a result of any such 251 | terms You offer. 252 | 253 | 3.7. Larger Works. 254 | You may create a Larger Work by combining Covered Code with other code 255 | not governed by the terms of this License and distribute the Larger 256 | Work as a single product. In such a case, You must make sure the 257 | requirements of this License are fulfilled for the Covered Code. 258 | 259 | 4. Inability to Comply Due to Statute or Regulation. 260 | 261 | If it is impossible for You to comply with any of the terms of this 262 | License with respect to some or all of the Covered Code due to 263 | statute, judicial order, or regulation then You must: (a) comply with 264 | the terms of this License to the maximum extent possible; and (b) 265 | describe the limitations and the code they affect. Such description 266 | must be included in the LEGAL file described in Section 3.4 and must 267 | be included with all distributions of the Source Code. Except to the 268 | extent prohibited by statute or regulation, such description must be 269 | sufficiently detailed for a recipient of ordinary skill to be able to 270 | understand it. 271 | 272 | 5. Application of this License. 273 | 274 | This License applies to code to which the Initial Developer has 275 | attached the notice in Exhibit A and to related Covered Code. 276 | 277 | 6. Versions of the License. 278 | 279 | 6.1. New Versions. 280 | Netscape Communications Corporation ("Netscape") may publish revised 281 | and/or new versions of the License from time to time. Each version 282 | will be given a distinguishing version number. 283 | 284 | 6.2. Effect of New Versions. 285 | Once Covered Code has been published under a particular version of the 286 | License, You may always continue to use it under the terms of that 287 | version. You may also choose to use such Covered Code under the terms 288 | of any subsequent version of the License published by Netscape. No one 289 | other than Netscape has the right to modify the terms applicable to 290 | Covered Code created under this License. 291 | 292 | 6.3. Derivative Works. 293 | If You create or use a modified version of this License (which you may 294 | only do in order to apply it to code which is not already Covered Code 295 | governed by this License), You must (a) rename Your license so that 296 | the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", 297 | "MPL", "NPL" or any confusingly similar phrase do not appear in your 298 | license (except to note that your license differs from this License) 299 | and (b) otherwise make it clear that Your version of the license 300 | contains terms which differ from the Mozilla Public License and 301 | Netscape Public License. (Filling in the name of the Initial 302 | Developer, Original Code or Contributor in the notice described in 303 | Exhibit A shall not of themselves be deemed to be modifications of 304 | this License.) 305 | 306 | 7. DISCLAIMER OF WARRANTY. 307 | 308 | COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, 309 | WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, 310 | WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF 311 | DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. 312 | THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE 313 | IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, 314 | YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE 315 | COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER 316 | OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF 317 | ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. 318 | 319 | 8. TERMINATION. 320 | 321 | 8.1. This License and the rights granted hereunder will terminate 322 | automatically if You fail to comply with terms herein and fail to cure 323 | such breach within 30 days of becoming aware of the breach. All 324 | sublicenses to the Covered Code which are properly granted shall 325 | survive any termination of this License. Provisions which, by their 326 | nature, must remain in effect beyond the termination of this License 327 | shall survive. 328 | 329 | 8.2. If You initiate litigation by asserting a patent infringement 330 | claim (excluding declatory judgment actions) against Initial Developer 331 | or a Contributor (the Initial Developer or Contributor against whom 332 | You file such action is referred to as "Participant") alleging that: 333 | 334 | (a) such Participant's Contributor Version directly or indirectly 335 | infringes any patent, then any and all rights granted by such 336 | Participant to You under Sections 2.1 and/or 2.2 of this License 337 | shall, upon 60 days notice from Participant terminate prospectively, 338 | unless if within 60 days after receipt of notice You either: (i) 339 | agree in writing to pay Participant a mutually agreeable reasonable 340 | royalty for Your past and future use of Modifications made by such 341 | Participant, or (ii) withdraw Your litigation claim with respect to 342 | the Contributor Version against such Participant. If within 60 days 343 | of notice, a reasonable royalty and payment arrangement are not 344 | mutually agreed upon in writing by the parties or the litigation claim 345 | is not withdrawn, the rights granted by Participant to You under 346 | Sections 2.1 and/or 2.2 automatically terminate at the expiration of 347 | the 60 day notice period specified above. 348 | 349 | (b) any software, hardware, or device, other than such Participant's 350 | Contributor Version, directly or indirectly infringes any patent, then 351 | any rights granted to You by such Participant under Sections 2.1(b) 352 | and 2.2(b) are revoked effective as of the date You first made, used, 353 | sold, distributed, or had made, Modifications made by that 354 | Participant. 355 | 356 | 8.3. If You assert a patent infringement claim against Participant 357 | alleging that such Participant's Contributor Version directly or 358 | indirectly infringes any patent where such claim is resolved (such as 359 | by license or settlement) prior to the initiation of patent 360 | infringement litigation, then the reasonable value of the licenses 361 | granted by such Participant under Sections 2.1 or 2.2 shall be taken 362 | into account in determining the amount or value of any payment or 363 | license. 364 | 365 | 8.4. In the event of termination under Sections 8.1 or 8.2 above, 366 | all end user license agreements (excluding distributors and resellers) 367 | which have been validly granted by You or any distributor hereunder 368 | prior to termination shall survive termination. 369 | 370 | 9. LIMITATION OF LIABILITY. 371 | 372 | UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT 373 | (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL 374 | DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, 375 | OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR 376 | ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY 377 | CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, 378 | WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER 379 | COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN 380 | INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF 381 | LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY 382 | RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW 383 | PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE 384 | EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO 385 | THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. 386 | 387 | 10. U.S. GOVERNMENT END USERS. 388 | 389 | The Covered Code is a "commercial item," as that term is defined in 390 | 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer 391 | software" and "commercial computer software documentation," as such 392 | terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 393 | C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), 394 | all U.S. Government End Users acquire Covered Code with only those 395 | rights set forth herein. 396 | 397 | 11. MISCELLANEOUS. 398 | 399 | This License represents the complete agreement concerning subject 400 | matter hereof. If any provision of this License is held to be 401 | unenforceable, such provision shall be reformed only to the extent 402 | necessary to make it enforceable. This License shall be governed by 403 | California law provisions (except to the extent applicable law, if 404 | any, provides otherwise), excluding its conflict-of-law provisions. 405 | With respect to disputes in which at least one party is a citizen of, 406 | or an entity chartered or registered to do business in the United 407 | States of America, any litigation relating to this License shall be 408 | subject to the jurisdiction of the Federal Courts of the Northern 409 | District of California, with venue lying in Santa Clara County, 410 | California, with the losing party responsible for costs, including 411 | without limitation, court costs and reasonable attorneys' fees and 412 | expenses. The application of the United Nations Convention on 413 | Contracts for the International Sale of Goods is expressly excluded. 414 | Any law or regulation which provides that the language of a contract 415 | shall be construed against the drafter shall not apply to this 416 | License. 417 | 418 | 12. RESPONSIBILITY FOR CLAIMS. 419 | 420 | As between Initial Developer and the Contributors, each party is 421 | responsible for claims and damages arising, directly or indirectly, 422 | out of its utilization of rights under this License and You agree to 423 | work with Initial Developer and Contributors to distribute such 424 | responsibility on an equitable basis. Nothing herein is intended or 425 | shall be deemed to constitute any admission of liability. 426 | 427 | 13. MULTIPLE-LICENSED CODE. 428 | 429 | Initial Developer may designate portions of the Covered Code as 430 | "Multiple-Licensed". "Multiple-Licensed" means that the Initial 431 | Developer permits you to utilize portions of the Covered Code under 432 | Your choice of the MPL or the alternative licenses, if any, specified 433 | by the Initial Developer in the file described in Exhibit A. 434 | 435 | EXHIBIT A -Mozilla Public License. 436 | 437 | ``The contents of this file are subject to the Mozilla Public License 438 | Version 1.1 (the "License"); you may not use this file except in 439 | compliance with the License. You may obtain a copy of the License at 440 | http://www.mozilla.org/MPL/ 441 | 442 | Software distributed under the License is distributed on an "AS IS" 443 | basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 444 | License for the specific language governing rights and limitations 445 | under the License. 446 | 447 | The Original Code is ______________________________________. 448 | 449 | The Initial Developer of the Original Code is ________________________. 450 | Portions created by ______________________ are Copyright (C) ______ 451 | _______________________. All Rights Reserved. 452 | 453 | Contributor(s): ______________________________________. 454 | 455 | Alternatively, the contents of this file may be used under the terms 456 | of the _____ license (the "[___] License"), in which case the 457 | provisions of [______] License are applicable instead of those 458 | above. If you wish to allow use of your version of this file only 459 | under the terms of the [____] License and not to allow others to use 460 | your version of this file under the MPL, indicate your decision by 461 | deleting the provisions above and replace them with the notice and 462 | other provisions required by the [___] License. If you do not delete 463 | the provisions above, a recipient may use your version of this file 464 | under either the MPL or the [___] License." 465 | 466 | [NOTE: The text of this Exhibit A may differ slightly from the text of 467 | the notices in the Source Code files of the Original Code. You should 468 | use the text of this Exhibit A rather than the text found in the 469 | Original Code Source Code for Your Modifications.] 470 | 471 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | ################################ 2 | ### FreeSwitch headers files found in libfreeswitch-dev ### 3 | FS_INCLUDES=/usr/include/freeswitch 4 | FS_MODULES=/usr/lib/freeswitch/mod 5 | ################################ 6 | 7 | ### END OF CUSTOMIZATION ### 8 | SHELL := /bin/bash 9 | PROC?=$(shell uname -m) 10 | CMAKE := cmake 11 | 12 | CFLAGS=-fPIC -O3 -fomit-frame-pointer -fno-exceptions -Wall -std=c99 -pedantic 13 | 14 | INCLUDES=-I/usr/include -Ibcg729/include -I$(FS_INCLUDES) 15 | LDFLAGS=-lm -Wl,-static -Lbcg729/src -lbcg729 -Wl,-Bdynamic 16 | 17 | all : mod_bcg729.o 18 | $(CC) $(CFLAGS) $(INCLUDES) -shared -Xlinker -x -o mod_bcg729.so mod_bcg729.o $(LDFLAGS) 19 | 20 | mod_bcg729.o: bcg729 mod_bcg729.c 21 | $(CC) $(CFLAGS) $(INCLUDES) -c mod_bcg729.c 22 | 23 | clone_bcg729: 24 | if [ ! -d bcg729 ]; then \ 25 | git clone https://github.com/BelledonneCommunications/bcg729.git; \ 26 | fi 27 | pushd bcg729; git fetch; git checkout 1.1.1; popd; 28 | 29 | bcg729: clone_bcg729 30 | cd bcg729 && $(CMAKE) . -DENABLE_SHARED=NO -DENABLE_STATIC=YES -DCMAKE_POSITION_INDEPENDENT_CODE=YES && make && cd .. 31 | 32 | clean: 33 | rm -f *.o *.so *.a *.la; cd bcg729 && make clean; cd .. 34 | 35 | distclean: clean 36 | rm -fR bcg729 37 | 38 | install: all 39 | /usr/bin/install -c mod_bcg729.so $(INSTALL_PREFIX)/$(FS_MODULES)/mod_bcg729.so 40 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | mod_bcg729 2 | ========== 3 | 4 | FreeSWITCH G.729A module using the opensource bcg729 implementation by Belledonne Communications. 5 | 6 | Simple G.729A codec for FreeSWITCH using the Belledonne Communications G.729A GPLv2 implementation. 7 | Please see http://www.linphone.org/eng/documentation/dev/bcg729.html for further informations. 8 | 9 | The module is a modified version of fsg729 ( https://code.google.com/p/fsg729/ ) which 10 | uses the Intel IPP libraries, updated to use a different codec implementation and get rid of Intel stuff. 11 | 12 | As of Jan 1 2017, G.729 is a royalty free codec: http://www.sipro.com/G729.html 13 | 14 | You can get a faster and supported G.729A codec by purchasing licenses 15 | directly from FreeSWITCH guys http://www.freeswitch.org . 16 | This will have the side effect to support the FreeSWITCH project ;) 17 | 18 | Installation 19 | ============ 20 | You need to have git on your build machine and internet access, since 21 | the Makefile will try to checkout bcg729 sources and build them. 22 | 23 | Edit Makefile and edit FS_INCLUDES, FS_MODULES vars to point where 24 | your FreeSWITCH includes are and where you want to install the module. 25 | 26 | After, just type make and, if build completes without errors, make install . 27 | 28 | Edit autoload_configs/modules.conf.xml , comment out mod_g729 and add mod_bcg729 . 29 | Now restart your FreeSWITCH and you're done. 30 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | freeswitch-mod-bcg729 (0.0.1-1) unstable; urgency=low 2 | 3 | * Initial release 4 | 5 | -- Boris Manojlovic Fri, 30 Oct 2015 13:57:41 +0000 6 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: freeswitch-mod-bcg729 2 | Section: comm 3 | Priority: optional 4 | Maintainer: Boris Manojlovic 5 | Build-Depends: debhelper (>= 9), 6 | # bcg729 strange requirement really :) 7 | libbcg729-dev, 8 | # freeswitch development files 9 | libfreeswitch-dev 10 | Standards-Version: 3.9.5 11 | Homepage: https://github.com/xadhoom/mod_bcg729 12 | Vcs-Git: https://github.com/xadhoom/mod_bcg729.git 13 | Vcs-Browser: https://github.com/xadhoom/mod_bcg729 14 | 15 | Package: freeswitch-mod-bcg729 16 | Architecture: any 17 | Depends: ${shlibs:Depends}, ${misc:Depends}, 18 | freeswitch (>= 1.4.23), 19 | libbcg729-0 20 | Description: Freeswitch G729 module 21 | mod_bcg729 is G729 codec package 22 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: freeswitch-mod-bcg729 3 | Source: 4 | 5 | Files: * 6 | Copyright: 7 | 8 | License: 9 | 10 | 11 | . 12 | 13 | 14 | # If you want to use GPL v2 or later for the /debian/* files use 15 | # the following clauses, or change it to suit. Delete these two lines 16 | Files: debian/* 17 | Copyright: 2015 Boris Manojlovic 18 | License: GPL-2+ 19 | This package is free software; you can redistribute it and/or modify 20 | it under the terms of the GNU General Public License as published by 21 | the Free Software Foundation; either version 2 of the License, or 22 | (at your option) any later version. 23 | . 24 | This package is distributed in the hope that it will be useful, 25 | but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | GNU General Public License for more details. 28 | . 29 | You should have received a copy of the GNU General Public License 30 | along with this program. If not, see 31 | . 32 | On Debian systems, the complete text of the GNU General 33 | Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". 34 | 35 | # Please also look if there are files or directories which have a 36 | # different copyright/license attached and list them here. 37 | # Please avoid to pick license terms that are more restrictive than the 38 | # packaged work, as it may make Debian's contributions unacceptable upstream. 39 | -------------------------------------------------------------------------------- /debian/docs: -------------------------------------------------------------------------------- 1 | README.md 2 | -------------------------------------------------------------------------------- /debian/freeswitch-mod-bcg729.install: -------------------------------------------------------------------------------- 1 | /usr/lib/freeswitch/mod/mod_bcg729.so 2 | -------------------------------------------------------------------------------- /debian/freeswitch-mod-bcg729.lintian-overrides: -------------------------------------------------------------------------------- 1 | # 2 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | export FS_INCLUDES=/usr/include/freeswitch 3 | DH_VERBOSE = 1 4 | export INCLUDES=-I/usr/include -Ibcg729/include -I$(FS_INCLUDES) 5 | export ADD_CFLAGS=-fPIC -O3 -fomit-frame-pointer -fno-exceptions -Wall -std=c99 -pedantic $(INCLUDES) 6 | export ADD_LIBS=-lm -lbcg729 7 | # main packaging script based on dh7 syntax 8 | %: 9 | dh $@ 10 | 11 | 12 | .stamp-build: 13 | fsxs compile --add-cflags="$(ADD_CFLAGS)" mod_bcg729.c 14 | fsxs link --add-libs="$(ADD_LIBS)" mod_bcg729.so mod_bcg729.o 15 | 16 | override_dh_auto_build: .stamp-build 17 | 18 | override_dh_auto_install: 19 | fsxs install --destdir="debian/tmp/" mod_bcg729.so 20 | 21 | override_dh_auto_clean: 22 | rm -f mod_bcg729.o 23 | rm -f mod_bcg729.so 24 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /mod_bcg729.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Version: MPL 1.1 3 | * 4 | * The contents of this file are subject to the Mozilla Public License Version 5 | * 1.1 (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * http://www.mozilla.org/MPL/ 8 | * 9 | * Software distributed under the License is distributed on an "AS IS" basis, 10 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 11 | * for the specific language governing rights and limitations under the 12 | * License. 13 | * 14 | * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application 15 | * 16 | * Portions created by the Initial Developer are Copyright (C) 17 | * the Initial Developer. All Rights Reserved. 18 | * 19 | * Contributor(s): 20 | * 21 | * for fsg729 ( which used IPP media libraries ) 22 | * Matteo Brancaleoni 23 | * 24 | * The bcg729 codec itself is not distributed with this module. 25 | * 26 | * mod_bcg729.c -- G.729 Codec Module 27 | * 28 | */ 29 | 30 | #include "switch.h" 31 | #include "bcg729/encoder.h" 32 | #include "bcg729/decoder.h" 33 | 34 | SWITCH_MODULE_LOAD_FUNCTION(mod_bcg729_load); 35 | SWITCH_MODULE_DEFINITION(mod_bcg729, mod_bcg729_load, NULL, NULL); 36 | 37 | struct bcg729_context { 38 | bcg729DecoderChannelContextStruct *decoder_object; 39 | bcg729EncoderChannelContextStruct *encoder_object; 40 | }; 41 | 42 | static switch_status_t switch_bcg729_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings) 43 | { 44 | struct bcg729_context *context = NULL; 45 | int encoding, decoding; 46 | 47 | encoding = (flags & SWITCH_CODEC_FLAG_ENCODE); 48 | decoding = (flags & SWITCH_CODEC_FLAG_DECODE); 49 | 50 | if (!(encoding || decoding) || (!(context = switch_core_alloc(codec->memory_pool, sizeof(struct bcg729_context))))) { 51 | return SWITCH_STATUS_FALSE; 52 | } else { 53 | /* 54 | if (codec->fmtp_in) { 55 | codec->fmtp_out = switch_core_strdup(codec->memory_pool, codec->fmtp_in); 56 | } 57 | */ 58 | codec->fmtp_out = switch_core_strdup(codec->memory_pool, "annexb=no"); 59 | 60 | if (encoding) { 61 | context->encoder_object = initBcg729EncoderChannel(0); 62 | } 63 | 64 | if (decoding) { 65 | context->decoder_object = initBcg729DecoderChannel(); 66 | } 67 | 68 | codec->private_info = context; 69 | 70 | return SWITCH_STATUS_SUCCESS; 71 | } 72 | } 73 | 74 | static switch_status_t switch_bcg729_destroy(switch_codec_t *codec) 75 | { 76 | struct bcg729_context *context = codec->private_info; 77 | 78 | closeBcg729EncoderChannel(context->encoder_object); 79 | closeBcg729DecoderChannel(context->decoder_object); 80 | 81 | codec->private_info = NULL; 82 | return SWITCH_STATUS_SUCCESS; 83 | } 84 | 85 | static switch_status_t switch_bcg729_encode(switch_codec_t *codec, 86 | switch_codec_t *other_codec, 87 | void *decoded_data, 88 | uint32_t decoded_data_len, 89 | uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate, 90 | unsigned int *flag) 91 | { 92 | struct bcg729_context *context = codec->private_info; 93 | 94 | if (!context) { 95 | return SWITCH_STATUS_FALSE; 96 | } 97 | 98 | if (decoded_data_len % 160 == 0) { 99 | uint32_t new_len = 0; 100 | int16_t *ddp = decoded_data; 101 | uint8_t *edp = encoded_data; 102 | int x; 103 | int loops = (int) decoded_data_len / 160; 104 | 105 | for (x = 0; x < loops && new_len < *encoded_data_len; x++) { 106 | uint8_t frameSize; 107 | bcg729Encoder(context->encoder_object, ddp, edp, &frameSize); 108 | edp += frameSize; 109 | ddp += frameSize * 8; 110 | new_len += frameSize; 111 | } 112 | 113 | if (new_len <= *encoded_data_len) { 114 | *encoded_data_len = new_len; 115 | } else { 116 | switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "buffer overflow!!! %u >= %u\n", new_len, *encoded_data_len); 117 | return SWITCH_STATUS_FALSE; 118 | } 119 | } 120 | return SWITCH_STATUS_SUCCESS; 121 | } 122 | 123 | static switch_status_t switch_bcg729_decode(switch_codec_t *codec, 124 | switch_codec_t *other_codec, 125 | void *encoded_data, 126 | uint32_t encoded_data_len, 127 | uint32_t encoded_rate, 128 | void *decoded_data, 129 | uint32_t *decoded_data_len, 130 | uint32_t *decoded_rate, 131 | unsigned int *flag) 132 | { 133 | struct bcg729_context *context = codec->private_info; 134 | if (!context) { 135 | return SWITCH_STATUS_FALSE; 136 | } 137 | 138 | int framesize; 139 | int x; 140 | uint32_t new_len = 0; 141 | uint8_t *edp = encoded_data; 142 | int16_t *ddp = decoded_data; 143 | 144 | if (encoded_data_len == 0) { /* Native PLC interpolation */ 145 | bcg729Decoder(context->decoder_object, NULL, 0, 1, 0, 0, ddp); 146 | ddp += 80; 147 | decoded_data_len = (uint32_t *) 160; 148 | switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "g729 zero length frame\n"); 149 | return SWITCH_STATUS_SUCCESS; 150 | } 151 | 152 | for(x = 0; x < encoded_data_len && new_len < *decoded_data_len; x += framesize) { 153 | uint8_t isSID = (encoded_data_len - x < 8) ? 1 : 0; 154 | framesize = (isSID==1) ? 2 : 10; 155 | 156 | bcg729Decoder(context->decoder_object, edp, encoded_data_len, 0, isSID, 0, ddp); 157 | ddp += 80; 158 | edp += framesize; 159 | new_len += 160; 160 | } 161 | 162 | if (new_len <= *decoded_data_len) { 163 | *decoded_data_len = new_len; 164 | } else { 165 | switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "buffer overflow!!!\n"); 166 | return SWITCH_STATUS_FALSE; 167 | } 168 | 169 | return SWITCH_STATUS_SUCCESS; 170 | } 171 | 172 | SWITCH_MODULE_LOAD_FUNCTION(mod_bcg729_load) 173 | { 174 | switch_codec_interface_t *codec_interface; 175 | int mpf = 10000, spf = 80, bpf = 160, ebpf = 10, count; 176 | 177 | /* connect my internal structure to the blank pointer passed to me */ 178 | *module_interface = switch_loadable_module_create_module_interface(pool, modname); 179 | 180 | SWITCH_ADD_CODEC(codec_interface, "G.729"); 181 | for (count = 12; count > 0; count--) { 182 | switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, 183 | 18, /* the IANA code number */ 184 | "G729", /* the IANA code name */ 185 | "annexb=no", /* default fmtp to send (can be overridden by the init function) */ 186 | 8000, /* samples transferred per second */ 187 | 8000, /* actual samples transferred per second */ 188 | 8000, /* bits transferred per second */ 189 | mpf * count, /* number of microseconds per frame */ 190 | spf * count, /* number of samples per frame */ 191 | bpf * count, /* number of bytes per frame decompressed */ 192 | ebpf * count, /* number of bytes per frame compressed */ 193 | 1, /* number of channels represented */ 194 | count * 10, /* number of frames per network packet */ 195 | switch_bcg729_init, /* function to initialize a codec handle using this implementation */ 196 | switch_bcg729_encode, /* function to encode raw data into encoded data */ 197 | switch_bcg729_decode, /* function to decode encoded data into raw data */ 198 | switch_bcg729_destroy); /* deinitalize a codec handle using this implementation */ 199 | } 200 | /* indicate that the module should continue to be loaded */ 201 | return SWITCH_STATUS_SUCCESS; 202 | } 203 | 204 | /* For Emacs: 205 | * Local Variables: 206 | * mode:c 207 | * indent-tabs-mode:t 208 | * tab-width:4 209 | * c-basic-offset:4 210 | * End: 211 | * For VIM: 212 | * vim:set softtabstop=4 shiftwidth=4 tabstop=4: 213 | */ 214 | --------------------------------------------------------------------------------