pax_global_header00006660000000000000000000000064135120513720014511gustar00rootroot0000000000000052 comment=e0ad1ff9c23592c18aa662301c6d19f12a38b6da janus-gateway-0.7.3/000077500000000000000000000000001351205137200142775ustar00rootroot00000000000000janus-gateway-0.7.3/.editorconfig000066400000000000000000000001251351205137200167520ustar00rootroot00000000000000root = true [*] end_of_line = lf indent_style = tab trim_trailing_whitespace = true janus-gateway-0.7.3/.gitattributes000066400000000000000000000000171351205137200171700ustar00rootroot00000000000000*.mulaw binary janus-gateway-0.7.3/.github/000077500000000000000000000000001351205137200156375ustar00rootroot00000000000000janus-gateway-0.7.3/.github/CONTRIBUTING.md000066400000000000000000000026321351205137200200730ustar00rootroot00000000000000Contributing to Janus ===================== If you really want to help, then first of all, thank you! Janus is a project we firmly believe in, and so any contribution is more than welcome to make it better. If you want to open an issue, please make sure that: 1. you actually found a bug: for generic questions, use the [meetecho-janus](http://groups.google.com/d/forum/meetecho-janus) group instead; 2. nobody opened the same bug already (do a search); 3. the issue wasn't already solved; 4. you don't paste a huge amount of text in the issue or comments: use a service like [pastebin](http://pastebin.com/) or similar; 5. you provide a GDB stacktrace if Janus crashed on you, and/or output from AddressSanitizer or Valgrind (more details available [here](http://janus.conf.meetecho.com/docs/debug.html)). If you want to contribute to the project by providing fixes, enhancements, new features or other materials, then just clone the repo, make your changes, push to your fork (good commit messages that explain what changed are welcome!) and submit a pull request. Please make sure that, especially if you're modifying the C code, you follow the same coding style we're using and that you properly comment the code as we usually do ourselves. That said, please beware that we do require all contributors to sign the Contributor License Agreement before we can accept any code. janus-gateway-0.7.3/.github/ISSUE_TEMPLATE.md000066400000000000000000000012521351205137200203440ustar00rootroot00000000000000> If you want to open an issue, please make sure that: > > 1. you actually found a bug: for generic questions, use the [meetecho-janus](http://groups.google.com/d/forum/meetecho-janus) group instead; > 2. nobody opened the same bug already (do a search); > 3. the issue wasn't already solved in master; > 4. you don't paste a huge amount of text in the issue or comments: use a service like [pastebin](http://pastebin.com/) or similar; > 5. you provide a GDB stacktrace if Janus crashed on you, and/or output from AddressSanitizer or Valgrind (more details available [here](http://janus.conf.meetecho.com/docs/debug.html)). > > If so, just remove this text and share your findings! janus-gateway-0.7.3/.gitignore000066400000000000000000000023011351205137200162630ustar00rootroot00000000000000cmdline.c cmdline.h version.c docs/html/ /janus /janus-cfgconv /janus-pp-rec /plugins/*.so /transports/*.so /events/*.so Makefile Makefile.in /build /configure /autom4te.cache /aclocal.m4 /m4 /missing /libtool /depcomp /compile /install-sh /ltmain.sh /config.log /config.guess /config.status /config.sub /*.o /plugins/*.o /plugins/*.lo /plugins/*.la /plugins/.libs /plugins/duktape-deps/*.lo /plugins/duktape-deps/.libs /transports/*.o /transports/*.lo /transports/*.la /transports/.libs /events/*.o /events/*.lo /events/*.la /events/.libs /postprocessing/*.o /postprocessing/pp-cmdline.c /postprocessing/pp-cmdline.h /fuzzers/*.a /fuzzers/*.o /fuzzers/out /conf/janus.cfg.sample /conf/janus.plugin.duktape.cfg.sample /conf/janus.plugin.lua.cfg.sample /conf/janus.plugin.recordplay.cfg.sample /conf/janus.plugin.streaming.cfg.sample /conf/janus.plugin.voicemail.cfg.sample /conf/janus.transport.http.cfg.sample /conf/janus.transport.websockets.cfg.sample /conf/janus.jcfg.sample /conf/janus.plugin.duktape.jcfg.sample /conf/janus.plugin.lua.jcfg.sample /conf/janus.plugin.recordplay.jcfg.sample /conf/janus.plugin.streaming.jcfg.sample /conf/janus.plugin.voicemail.jcfg.sample .deps .dirstamp # OS X .DS_Store janus-gateway-0.7.3/COPYING000066400000000000000000001054071351205137200153410ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. If you modify this Program, or any covered work, by linking or combining it with OpenSSL (or a modified version of that library), containing parts covered by the terms of OpenSSL License, the licensors of this Program grant you additional permission to convey the resulting work. Corresponding Source for a non-source form of such a combination shall include the source code for the parts of openssl used as well as that of the covered work. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 3 of the License, 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 . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . janus-gateway-0.7.3/Makefile.am000066400000000000000000000446021351205137200163410ustar00rootroot00000000000000ACLOCAL_AMFLAGS = -I m4 # FIXME: These should be enabled once the code is safe for them. That requires # some fairly big refactoring though, which can wait. # AM_CFLAGS += -Wshadow -Wstrict-aliasing=2 # FIXME: make docs work with distcheck DISTCHECK_CONFIGURE_FLAGS = --disable-docs --enable-post-processing EXTRA_DIST = $(NULL) CLEANFILES = $(NULL) bin_PROGRAMS = janus headerdir = $(includedir)/janus header_HEADERS = apierror.h config.h log.h debug.h mutex.h record.h \ rtcp.h rtp.h rtpsrtp.h sdp-utils.h ip-utils.h utils.h refcount.h text2pcap.h pluginsheaderdir = $(includedir)/janus/plugins pluginsheader_HEADERS = plugins/plugin.h transportsheaderdir = $(includedir)/janus/transports transportsheader_HEADERS = transports/transport.h eventsheaderdir = $(includedir)/janus/events eventsheader_HEADERS = events/eventhandler.h confdir = $(sysconfdir)/janus conf_DATA = conf/janus.jcfg.sample plugindir = $(libdir)/janus/plugins plugin_LTLIBRARIES = $(NULL) transportdir = $(libdir)/janus/transports transport_LTLIBRARIES = $(NULL) eventdir = $(libdir)/janus/events event_LTLIBRARIES = $(NULL) SUBDIRS = html dist_html_DATA = README.md streamdir = $(datadir)/janus/streams stream_DATA = $(NULL) recordingsdir = $(datadir)/janus/recordings recordings_DATA = $(NULL) luadir = $(datadir)/janus/lua lua_DATA = $(NULL) duktapedir = $(datadir)/janus/duktape duktape_DATA = $(NULL) demosdir = $(datadir)/janus/demos demos_DATA = $(NULL) jsmodulesdir = $(datadir)/janus/javascript jsmodules_DATA = html/janus.js %.sample: %.sample.in $(MKDIR_P) $(@D) $(AM_V_GEN) sed -e "\ s|[@]confdir[@]|$(confdir)|;\ s|[@]plugindir[@]|$(plugindir)|;\ s|[@]transportdir[@]|$(transportdir)|;\ s|[@]eventdir[@]|$(eventdir)|;\ s|[@]recordingsdir[@]|$(recordingsdir)|;\ s|[@]demosdir[@]|$(demosdir)|;\ s|[@]streamdir[@]|$(streamdir)|; \ s|[@]luadir[@]|$(luadir)|; \ s|[@]duktapedir[@]|$(duktapedir)|" \ $< > $@ || rm $@ EXTRA_DIST += conf/janus.jcfg.sample.in CLEANFILES += conf/janus.jcfg.sample ## # Janus ## janus_SOURCES = \ apierror.c \ apierror.h \ auth.c \ auth.h \ cmdline.c \ cmdline.h \ config.c \ config.h \ debug.h \ dtls.c \ dtls.h \ dtls-bio.c \ dtls-bio.h \ events.c \ events.h \ ice.c \ ice.h \ janus.c \ janus.h \ log.c \ log.h \ mutex.h \ record.c \ record.h \ refcount.h \ rtcp.c \ rtcp.h \ rtp.c \ rtp.h \ rtpsrtp.h \ sctp.c \ sctp.h \ sdp.c \ sdp.h \ sdp-utils.c \ sdp-utils.h \ ip-utils.c \ ip-utils.h \ turnrest.c \ turnrest.h \ utils.c \ utils.h \ version.c \ version.h \ text2pcap.c \ text2pcap.h \ plugins/plugin.c \ plugins/plugin.h \ transports/transport.h \ transports/transport.c \ events/eventhandler.h \ $(NULL) janus_CFLAGS = \ $(AM_CFLAGS) \ $(JANUS_CFLAGS) \ -DPLUGINDIR=\"$(plugindir)\" \ -DTRANSPORTDIR=\"$(transportdir)\" \ -DEVENTDIR=\"$(eventdir)\" \ -DCONFDIR=\"$(confdir)\" \ $(BORINGSSL_CFLAGS) \ $(NULL) janus_LDADD = \ $(BORINGSSL_LIBS) \ $(JANUS_LIBS) \ $(JANUS_MANUAL_LIBS) \ $(NULL) dist_man1_MANS = janus.1 bin_PROGRAMS += janus-cfgconv janus_cfgconv_SOURCES = \ janus-cfgconv.c \ config.c \ log.c \ utils.c \ version.c \ $(NULL) janus_cfgconv_CFLAGS = \ $(AM_CFLAGS) \ $(JANUS_CFLAGS) \ $(NULL) janus_cfgconv_LDADD = \ $(JANUS_LIBS) \ $(JANUS_MANUAL_LIBS) \ $(NULL) dist_man1_MANS += janus-cfgconv.1 BUILT_SOURCES = cmdline.c cmdline.h version.c cmdline.h: cmdline.c cmdline.c: janus.c gengetopt --set-package="janus" --set-version="$(VERSION)" < janus.ggo directory = .git dir_target = $(directory)-$(wildcard $(directory)) dir_present = $(directory)-$(directory) dir_absent = $(directory)- if WITH_SOURCE_DATE_EPOCH build_date = $(shell LC_ALL=C date --utc --date="@$(SOURCE_DATE_EPOCH)") else build_date = $(shell date) endif version.c: FORCE | $(dir_target) echo "$(build_date)" | awk 'BEGIN {} {print "const char *janus_build_git_time = \""$$0"\";"} END {} ' >> version.c echo "$(JANUS_VERSION)" | awk 'BEGIN {} {print "int janus_version = "$$0";"} END {} ' >> version.c echo "$(JANUS_VERSION_STRING)" | awk 'BEGIN {} {print "const char *janus_version_string = \""$$0"\";"} END {} ' >> version.c pkg-config --modversion nice | awk 'BEGIN {} {print "const char *libnice_version_string = \""$$0"\";"} END {} ' >> version.c $(dir_present): `which git` rev-parse HEAD | awk 'BEGIN {print "#include \"version.h\""} {print "const char *janus_build_git_sha = \"" $$0"\";"} END {}' > version.c $(dir_absent): echo "not-a-git-repo" | awk 'BEGIN {print "#include \"version.h\""} {print "const char *janus_build_git_sha = \"" $$0"\";"} END {}' > version.c ## # Fuzzers checking ## check-fuzzers: FORCE CC=$(CC) SKIP_JANUS_BUILD=1 LIB_FUZZING_ENGINE=fuzzers/standalone.o ./fuzzers/build.sh ./fuzzers/run.sh rtcp_fuzzer out/rtcp_fuzzer_seed_corpus ./fuzzers/run.sh rtp_fuzzer out/rtp_fuzzer_seed_corpus ./fuzzers/run.sh sdp_fuzzer out/sdp_fuzzer_seed_corpus .PHONY: FORCE FORCE: EXTRA_DIST += janus.ggo CLEANFILES += cmdline.c cmdline.h version.c ## # Transports ## transports_cflags = \ $(AM_CFLAGS) \ $(TRANSPORTS_CFLAGS) \ $(NULL) transports_libadd = \ $(TRANSPORTS_LIBS) \ $(NULL) if ENABLE_REST transport_LTLIBRARIES += transports/libjanus_http.la transports_libjanus_http_la_SOURCES = transports/janus_http.c transports_libjanus_http_la_CFLAGS = $(transports_cflags) $(MHD_CFLAGS) transports_libjanus_http_la_LDFLAGS = $(transports_ldflags) $(MHD_LDFLAGS) $(MHD_LIBS) transports_libjanus_http_la_LIBADD = $(transports_libadd) $(MHD_LDFLAGS) conf_DATA += conf/janus.transport.http.jcfg.sample EXTRA_DIST += conf/janus.transport.http.jcfg.sample endif if ENABLE_WEBSOCKETS transport_LTLIBRARIES += transports/libjanus_websockets.la transports_libjanus_websockets_la_SOURCES = transports/janus_websockets.c transports_libjanus_websockets_la_CFLAGS = $(transports_cflags) transports_libjanus_websockets_la_LDFLAGS = $(transports_ldflags) $(WS_MANUAL_LIBS) transports_libjanus_websockets_la_LIBADD = $(transports_libadd) conf_DATA += conf/janus.transport.websockets.jcfg.sample EXTRA_DIST += conf/janus.transport.websockets.jcfg.sample endif if ENABLE_RABBITMQ transport_LTLIBRARIES += transports/libjanus_rabbitmq.la transports_libjanus_rabbitmq_la_SOURCES = transports/janus_rabbitmq.c transports_libjanus_rabbitmq_la_CFLAGS = $(transports_cflags) transports_libjanus_rabbitmq_la_LDFLAGS = $(transports_ldflags) -lrabbitmq transports_libjanus_rabbitmq_la_LIBADD = $(transports_libadd) conf_DATA += conf/janus.transport.rabbitmq.jcfg.sample EXTRA_DIST += conf/janus.transport.rabbitmq.jcfg.sample endif if ENABLE_MQTT transport_LTLIBRARIES += transports/libjanus_mqtt.la transports_libjanus_mqtt_la_SOURCES = transports/janus_mqtt.c transports_libjanus_mqtt_la_CFLAGS = $(transports_cflags) transports_libjanus_mqtt_la_LDFLAGS = $(transports_ldflags) -lpaho-mqtt3as transports_libjanus_mqtt_la_LIBADD = $(transports_libadd) conf_DATA += conf/janus.transport.mqtt.jcfg.sample EXTRA_DIST += conf/janus.transport.mqtt.jcfg.sample endif if ENABLE_PFUNIX transport_LTLIBRARIES += transports/libjanus_pfunix.la transports_libjanus_pfunix_la_SOURCES = transports/janus_pfunix.c transports_libjanus_pfunix_la_CFLAGS = $(transports_cflags) transports_libjanus_pfunix_la_LDFLAGS = $(transports_ldflags) $(LIBSYSTEMD_LIBS) transports_libjanus_pfunix_la_LIBADD = $(transports_libadd) conf_DATA += conf/janus.transport.pfunix.jcfg.sample EXTRA_DIST += conf/janus.transport.pfunix.jcfg.sample endif if ENABLE_NANOMSG transport_LTLIBRARIES += transports/libjanus_nanomsg.la transports_libjanus_nanomsg_la_SOURCES = transports/janus_nanomsg.c transports_libjanus_nanomsg_la_CFLAGS = $(transports_cflags) transports_libjanus_nanomsg_la_LDFLAGS = $(transports_ldflags) -lnanomsg transports_libjanus_nanomsg_la_LIBADD = $(transports_libadd) conf_DATA += conf/janus.transport.nanomsg.jcfg.sample EXTRA_DIST += conf/janus.transport.nanomsg.jcfg.sample endif ## # Event handlers ## events_cflags = \ $(AM_CFLAGS) \ $(EVENTS_CFLAGS) \ $(NULL) events_libadd = \ $(EVENTS_LIBS) \ $(NULL) if ENABLE_SAMPLEEVH event_LTLIBRARIES += events/libjanus_sampleevh.la events_libjanus_sampleevh_la_SOURCES = events/janus_sampleevh.c events_libjanus_sampleevh_la_CFLAGS = $(events_cflags) events_libjanus_sampleevh_la_LDFLAGS = $(events_ldflags) -lcurl -lm events_libjanus_sampleevh_la_LIBADD = $(events_libadd) conf_DATA += conf/janus.eventhandler.sampleevh.jcfg.sample EXTRA_DIST += conf/janus.eventhandler.sampleevh.jcfg.sample endif if ENABLE_RABBITMQEVH event_LTLIBRARIES += events/libjanus_rabbitmqevh.la events_libjanus_rabbitmqevh_la_SOURCES = events/janus_rabbitmqevh.c events_libjanus_rabbitmqevh_la_CFLAGS = $(events_cflags) events_libjanus_rabbitmqevh_la_LDFLAGS = $(events_ldflags) -lrabbitmq events_libjanus_rabbitmqevh_la_LIBADD = $(events_libadd) conf_DATA += conf/janus.eventhandler.rabbitmqevh.jcfg.sample EXTRA_DIST += conf/janus.eventhandler.rabbitmqevh.jcfg.sample endif if ENABLE_MQTTEVH event_LTLIBRARIES += events/libjanus_mqttevh.la events_libjanus_mqttevh_la_SOURCES = events/janus_mqttevh.c events_libjanus_mqttevh_la_CFLAGS = $(events_cflags) events_libjanus_mqttevh_la_LDFLAGS = $(events_ldflags) -lpaho-mqtt3as events_libjanus_mqttevh_la_LIBADD = $(events_libadd) conf_DATA += conf/janus.eventhandler.mqttevh.jcfg.sample EXTRA_DIST += conf/janus.eventhandler.mqttevh.jcfg.sample endif ## # Plugins ## plugins_cflags = \ $(AM_CFLAGS) \ $(PLUGINS_CFLAGS) \ $(NULL) plugins_libadd = \ $(PLUGINS_LIBS) \ $(NULL) if ENABLE_PLUGIN_AUDIOBRIDGE plugin_LTLIBRARIES += plugins/libjanus_audiobridge.la plugins_libjanus_audiobridge_la_SOURCES = plugins/janus_audiobridge.c plugins_libjanus_audiobridge_la_CFLAGS = $(plugins_cflags) $(OPUS_CFLAGS) plugins_libjanus_audiobridge_la_LDFLAGS = $(plugins_ldflags) $(OPUS_LDFLAGS) $(OPUS_LIBS) plugins_libjanus_audiobridge_la_LIBADD = $(plugins_libadd) $(OPUS_LIBADD) conf_DATA += conf/janus.plugin.audiobridge.jcfg.sample EXTRA_DIST += conf/janus.plugin.audiobridge.jcfg.sample endif if ENABLE_PLUGIN_ECHOTEST plugin_LTLIBRARIES += plugins/libjanus_echotest.la plugins_libjanus_echotest_la_SOURCES = plugins/janus_echotest.c plugins_libjanus_echotest_la_CFLAGS = $(plugins_cflags) plugins_libjanus_echotest_la_LDFLAGS = $(plugins_ldflags) plugins_libjanus_echotest_la_LIBADD = $(plugins_libadd) conf_DATA += conf/janus.plugin.echotest.jcfg.sample EXTRA_DIST += conf/janus.plugin.echotest.jcfg.sample endif if ENABLE_PLUGIN_RECORDPLAY plugin_LTLIBRARIES += plugins/libjanus_recordplay.la plugins_libjanus_recordplay_la_SOURCES = plugins/janus_recordplay.c plugins_libjanus_recordplay_la_CFLAGS = $(plugins_cflags) plugins_libjanus_recordplay_la_LDFLAGS = $(plugins_ldflags) plugins_libjanus_recordplay_la_LIBADD = $(plugins_libadd) conf_DATA += conf/janus.plugin.recordplay.jcfg.sample recordings_DATA += \ plugins/recordings/1234.nfo \ plugins/recordings/rec-sample-audio.mjr \ plugins/recordings/rec-sample-video.mjr EXTRA_DIST += \ conf/janus.plugin.recordplay.jcfg.sample.in \ $(recordings_DATA) CLEANFILES += conf/janus.plugin.recordplay.jcfg.sample endif if ENABLE_PLUGIN_SIP plugin_LTLIBRARIES += plugins/libjanus_sip.la plugins_libjanus_sip_la_SOURCES = plugins/janus_sip.c plugins_libjanus_sip_la_CFLAGS = $(plugins_cflags) $(SOFIA_CFLAGS) plugins_libjanus_sip_la_LDFLAGS = $(plugins_ldflags) $(SOFIA_LDFLAGS) $(SOFIA_LIBS) plugins_libjanus_sip_la_LIBADD = $(plugins_libadd) $(SOFIA_LIBADD) conf_DATA += conf/janus.plugin.sip.jcfg.sample EXTRA_DIST += conf/janus.plugin.sip.jcfg.sample endif if ENABLE_PLUGIN_SIPRE plugin_LTLIBRARIES += plugins/libjanus_sipre.la plugins_libjanus_sipre_la_SOURCES = plugins/janus_sipre.c plugins_libjanus_sipre_la_CFLAGS = $(plugins_cflags) $(LIBRE_CFLAGS) plugins_libjanus_sipre_la_LDFLAGS = $(plugins_ldflags) $(LIBRE_LDFLAGS) $(LIBRE_LIBS) plugins_libjanus_sipre_la_LIBADD = $(plugins_libadd) $(LIBRE_LIBADD) conf_DATA += conf/janus.plugin.sipre.jcfg.sample EXTRA_DIST += conf/janus.plugin.sipre.jcfg.sample endif if ENABLE_PLUGIN_NOSIP plugin_LTLIBRARIES += plugins/libjanus_nosip.la plugins_libjanus_nosip_la_SOURCES = plugins/janus_nosip.c plugins_libjanus_nosip_la_CFLAGS = $(plugins_cflags) plugins_libjanus_nosip_la_LDFLAGS = $(plugins_ldflags) plugins_libjanus_nosip_la_LIBADD = $(plugins_libadd) conf_DATA += conf/janus.plugin.nosip.jcfg.sample EXTRA_DIST += conf/janus.plugin.nosip.jcfg.sample endif if ENABLE_PLUGIN_STREAMING plugin_LTLIBRARIES += plugins/libjanus_streaming.la plugins_libjanus_streaming_la_SOURCES = plugins/janus_streaming.c plugins_libjanus_streaming_la_CFLAGS = $(plugins_cflags) $(LIBCURL_CFLAGS) plugins_libjanus_streaming_la_LDFLAGS = $(plugins_ldflags) $(LIBCURL_LDFLAGS) $(LIBCURL_LIBS) plugins_libjanus_streaming_la_LIBADD = $(plugins_libadd) $(LIBCURL_LIBADD) conf_DATA += conf/janus.plugin.streaming.jcfg.sample stream_DATA += \ plugins/streams/music.mulaw \ plugins/streams/radio.alaw \ plugins/streams/test_gstreamer.sh \ plugins/streams/test_gstreamer_1.sh EXTRA_DIST += \ conf/janus.plugin.streaming.jcfg.sample.in \ $(stream_DATA) CLEANFILES += conf/janus.plugin.streaming.jcfg.sample endif if ENABLE_PLUGIN_VIDEOCALL plugin_LTLIBRARIES += plugins/libjanus_videocall.la plugins_libjanus_videocall_la_SOURCES = plugins/janus_videocall.c plugins_libjanus_videocall_la_CFLAGS = $(plugins_cflags) plugins_libjanus_videocall_la_LDFLAGS = $(plugins_ldflags) plugins_libjanus_videocall_la_LIBADD = $(plugins_libadd) conf_DATA += conf/janus.plugin.videocall.jcfg.sample EXTRA_DIST += conf/janus.plugin.videocall.jcfg.sample endif if ENABLE_PLUGIN_VIDEOROOM plugin_LTLIBRARIES += plugins/libjanus_videoroom.la plugins_libjanus_videoroom_la_SOURCES = plugins/janus_videoroom.c plugins_libjanus_videoroom_la_CFLAGS = $(plugins_cflags) plugins_libjanus_videoroom_la_LDFLAGS = $(plugins_ldflags) plugins_libjanus_videoroom_la_LIBADD = $(plugins_libadd) conf_DATA += conf/janus.plugin.videoroom.jcfg.sample EXTRA_DIST += conf/janus.plugin.videoroom.jcfg.sample endif if ENABLE_PLUGIN_VOICEMAIL plugin_LTLIBRARIES += plugins/libjanus_voicemail.la plugins_libjanus_voicemail_la_SOURCES = plugins/janus_voicemail.c plugins_libjanus_voicemail_la_CFLAGS = $(plugins_cflags) plugins_libjanus_voicemail_la_LDFLAGS = $(plugins_ldflags) -logg plugins_libjanus_voicemail_la_LIBADD = $(plugins_libadd) conf_DATA += conf/janus.plugin.voicemail.jcfg.sample EXTRA_DIST += conf/janus.plugin.voicemail.jcfg.sample.in CLEANFILES += conf/janus.plugin.voicemail.jcfg.sample endif if ENABLE_PLUGIN_TEXTROOM plugin_LTLIBRARIES += plugins/libjanus_textroom.la plugins_libjanus_textroom_la_SOURCES = plugins/janus_textroom.c plugins_libjanus_textroom_la_CFLAGS = $(plugins_cflags) plugins_libjanus_textroom_la_LDFLAGS = $(plugins_ldflags) plugins_libjanus_textroom_la_LIBADD = $(plugins_libadd) conf_DATA += conf/janus.plugin.textroom.jcfg.sample EXTRA_DIST += conf/janus.plugin.textroom.jcfg.sample endif if ENABLE_PLUGIN_LUA plugin_LTLIBRARIES += plugins/libjanus_lua.la plugins_libjanus_lua_la_SOURCES = plugins/janus_lua.c plugins/janus_lua_data.h plugins/janus_lua_extra.c plugins/janus_lua_extra.h plugins_libjanus_lua_la_CFLAGS = $(plugins_cflags) $(LUA_CFLAGS) plugins_libjanus_lua_la_LDFLAGS = $(plugins_ldflags) $(LUA_LDFLAGS) $(LUA_LIBS) plugins_libjanus_lua_la_LIBADD = $(plugins_libadd) $(LUA_LIBADD) conf_DATA += conf/janus.plugin.lua.jcfg.sample lua_DATA += \ plugins/lua/echotest.lua \ plugins/lua/videoroom.lua \ plugins/lua/janus-logger.lua \ plugins/lua/janus-sdp.lua EXTRA_DIST += conf/janus.plugin.lua.jcfg.sample.in endif if ENABLE_PLUGIN_DUKTAPE plugin_LTLIBRARIES += plugins/libjanus_duktape.la plugins_libjanus_duktape_la_SOURCES = plugins/janus_duktape.c \ plugins/janus_duktape_data.h plugins/janus_duktape_extra.c plugins/janus_duktape_extra.h \ plugins/duktape-deps/duktape.c plugins/duktape-deps/duk_config.h plugins/duktape-deps/duktape.h \ plugins/duktape-deps/duk_module_duktape.c plugins/duktape-deps/duk_module_duktape.h \ plugins/duktape-deps/duk_console.c plugins/duktape-deps/duk_console.h plugins_libjanus_duktape_la_CFLAGS = $(plugins_cflags) $(DUKTAPE_CFLAGS) plugins_libjanus_duktape_la_LDFLAGS = $(plugins_ldflags) $(DUKTAPE_LDFLAGS) $(DUKTAPE_LIBS) plugins_libjanus_duktape_la_LIBADD = $(plugins_libadd) $(DUKTAPE_LIBADD) conf_DATA += conf/janus.plugin.duktape.jcfg.sample duktape_DATA += \ plugins/duktape/echotest.js \ plugins/duktape/janus-sdp.js EXTRA_DIST += conf/janus.plugin.duktape.jcfg.sample.in endif ## # Post-processing ## if ENABLE_POST_PROCESSING bin_PROGRAMS += janus-pp-rec janus_pp_rec_SOURCES = \ postprocessing/pp-cmdline.c \ postprocessing/pp-cmdline.h \ postprocessing/pp-g711.c \ postprocessing/pp-g711.h \ postprocessing/pp-g722.c \ postprocessing/pp-g722.h \ postprocessing/pp-h264.c \ postprocessing/pp-h264.h \ postprocessing/pp-opus.c \ postprocessing/pp-opus.h \ postprocessing/pp-opus-silence.h \ postprocessing/pp-rtp.h \ postprocessing/pp-srt.c \ postprocessing/pp-srt.h \ postprocessing/pp-webm.c \ postprocessing/pp-webm.h \ postprocessing/janus-pp-rec.c \ log.c \ version.c \ $(NULL) janus_pp_rec_CFLAGS = \ $(AM_CFLAGS) \ $(POST_PROCESSING_CFLAGS) \ $(NULL) janus_pp_rec_LDADD = \ $(POST_PROCESSING_LIBS) \ $(NULL) BUILT_SOURCES += postprocessing/pp-cmdline.c postprocessing/pp-cmdline.h postprocessing/pp-cmdline.h: postprocessing/pp-cmdline.c postprocessing/pp-cmdline.c: postprocessing/janus-pp-rec.c gengetopt --set-package="janus-pp-rec" --set-version="$(VERSION)" -F postprocessing/pp-cmdline < postprocessing/janus-pp-rec.ggo EXTRA_DIST += postprocessing/janus-pp-rec.ggo CLEANFILES += postprocessing/pp-cmdline.c postprocessing/pp-cmdline.h dist_man1_MANS += postprocessing/janus-pp-rec.1 endif ## # Docs ## if ENABLE_DOCS SUBDIRS += docs endif ## # JavaScript module flavours for janus.js ## if ENABLE_JAVASCRIPT_ES_MODULE jsmodules_DATA += npm/bundles/janus.es.js endif if ENABLE_JAVASCRIPT_UMD_MODULE jsmodules_DATA += npm/bundles/janus.umd.js endif if ENABLE_JAVASCRIPT_IIFE_MODULE jsmodules_DATA += npm/bundles/janus.iife.js endif if ENABLE_JAVASCRIPT_COMMON_JS_MODULE jsmodules_DATA += npm/bundles/janus.cjs.js endif EXTRA_DIST += $(jsmodules_DATA) if ENABLE_JAVASCRIPT_MODULES npm/node_modules/rollup/bin/rollup: npm/package.json cd npm && $(NPM) install && touch node_modules/rollup/bin/rollup npm/bundles/janus.%.js: html/janus.js npm/node_modules/rollup/bin/rollup npm/rollup.config.js npm/module.js cd npm && $(NPM) run rollup -- --o $(patsubst npm/%,%,$@) --f $* endif ## # Configuration ## configs: $(MKDIR_P) $(DESTDIR)$(confdir) $(foreach config,$(conf_DATA),cp "$(CURDIR)/$(config)" "$(DESTDIR)$(confdir)/$(notdir $(basename $(config) .sample))";) ## # Extra cleanup ## clean-local: -rm -f docs/doxygen_sqlite3.db janus-gateway-0.7.3/README.md000066400000000000000000000507661351205137200155740ustar00rootroot00000000000000Janus WebRTC Server =================== Janus is an open source, general purpose, WebRTC server designed and developed by [Meetecho](http://www.meetecho.com). This version of the server is tailored for Linux systems, although it can be compiled for, and installed on, MacOS machines as well. Windows is not supported, but if that's a requirement, Janus is known to work in the "Windows Subsystem for Linux" on Windows 10. For some online demos and documentations, make sure you pay the [project website](https://janus.conf.meetecho.com/) a visit! To discuss Janus with us and other users, there's a Google Group called [meetecho-janus](https://groups.google.com/forum/#!forum/meetecho-janus) that you can use. If you encounter bugs, though, please submit an issue on [github](https://github.com/meetecho/janus-gateway/issues) instead. ## Dependencies To install it, you'll need to satisfy the following dependencies: * [Jansson](http://www.digip.org/jansson/) * [libconfig](https://hyperrealm.github.io/libconfig/) * [libnice](http://nice.freedesktop.org/wiki/) (at least v0.1.13 suggested, master recommended) * [OpenSSL](http://www.openssl.org/) (at least v1.0.1e) * [libsrtp](https://github.com/cisco/libsrtp) (at least v1.5 suggested) * [usrsctp](https://github.com/sctplab/usrsctp) (only needed if you are interested in Data Channels) * [libmicrohttpd](http://www.gnu.org/software/libmicrohttpd/) (only needed if you are interested in REST support for the Janus API) * [libwebsockets](https://libwebsockets.org/) (only needed if you are interested in WebSockets support for the Janus API) * [cmake](http://www.cmake.org/) (only needed if you are interested in WebSockets and/or BoringSSL support, as they make use of it) * [rabbitmq-c](https://github.com/alanxz/rabbitmq-c) (only needed if you are interested in RabbitMQ support for the Janus API or events) * [paho.mqtt.c](https://eclipse.org/paho/clients/c) (only needed if you are interested in MQTT support for the Janus API or events) * [nanomsg](https://nanomsg.org/) (only needed if you are interested in Nanomsg support for the Janus API) * [libcurl](https://curl.haxx.se/libcurl/) (only needed if you are interested in the TURN REST API support) A couple of plugins depend on a few more libraries: * [Sofia-SIP](http://sofia-sip.sourceforge.net/) (only needed for the SIP plugin) * [libopus](http://opus-codec.org/) (only needed for the bridge plugin) * [libogg](http://xiph.org/ogg/) (needed for the voicemail plugin and/or post-processor) * [libcurl](https://curl.haxx.se/libcurl/) (only needed if you are interested in RTSP support in the Streaming plugin or in the sample Event Handler plugin) * [Lua](https://www.lua.org/download.html) (only needed for the Lua plugin) Additionally, you'll need the following libraries and tools: * [GLib](http://library.gnome.org/devel/glib/) * [pkg-config](http://www.freedesktop.org/wiki/Software/pkg-config/) * [gengetopt](http://www.gnu.org/software/gengetopt/) All of those libraries are usually available on most of the most common distributions. Installing these libraries on a recent Fedora, for instance, is very simple: yum install libmicrohttpd-devel jansson-devel \ openssl-devel libsrtp-devel sofia-sip-devel glib2-devel \ opus-devel libogg-devel libcurl-devel pkgconfig gengetopt \ libconfig-devel libtool autoconf automake Notice that you may have to `yum install epel-release` as well if you're attempting an installation on a CentOS machine instead. On Ubuntu or Debian, it would require something like this: aptitude install libmicrohttpd-dev libjansson-dev \ libssl-dev libsrtp-dev libsofia-sip-ua-dev libglib2.0-dev \ libopus-dev libogg-dev libcurl4-openssl-dev liblua5.3-dev \ libconfig-dev pkg-config gengetopt libtool automake * *Note:* please notice that libopus may not be available out of the box on Ubuntu or Debian, unless you're using a recent version (e.g., Ubuntu 14.04 LTS). In that case, you'll have to [install it manually](http://www.opus-codec.org). While `libnice` is typically available in most distros as a package, the version available out of the box in Ubuntu is known to cause problems. As such, we always recommend manually compiling and installing the master version of libnice. Installation of libnice master is quite straightforward: git clone https://gitlab.freedesktop.org/libnice/libnice cd libnice ./autogen.sh ./configure --prefix=/usr make && sudo make install * *Note:* Make sure you remove the distro version first, or you'll cause conflicts between the installations. In case you want to keep both for some reason, for custom installations of libnice you can also run `pkg-config --cflags --libs nice` to make sure Janus can find the right installation. If that fails, you may need to set the `PKG_CONFIG_PATH` environment variable prior to compiling Janus, e.g., `export PKG_CONFIG_PATH=/path/to/libnice/lib/pkgconfig` In case you're interested in compiling the sample Event Handler plugin, you'll need to install the development version of libcurl as well (usually `libcurl-devel` on Fedora/CentOS, `libcurl4-openssl-dev` on Ubuntu/Debian). If your distro ships a pre-1.5 version of libsrtp, you'll have to uninstall that version and [install 1.5.x, 1.6.x or 2.x manually](https://github.com/cisco/libsrtp/releases). In fact, 1.4.x is known to cause several issues with WebRTC. Installation of version 1.5.4 is quite straightforward: wget https://github.com/cisco/libsrtp/archive/v1.5.4.tar.gz tar xfv v1.5.4.tar.gz cd libsrtp-1.5.4 ./configure --prefix=/usr --enable-openssl make shared_library && sudo make install The instructions for version 2.x are practically the same. Notice that the following steps are for version 2.2.0, but there may be more recent versions available: wget https://github.com/cisco/libsrtp/archive/v2.2.0.tar.gz tar xfv v2.2.0.tar.gz cd libsrtp-2.2.0 ./configure --prefix=/usr --enable-openssl make shared_library && sudo make install The Janus configure script autodetects which one you have installed and links to the correct library automatically, choosing 2.x if both are installed. If you want 1.5 or 1.6 to be picked, pass `--disable-libsrtp2` when configuring Janus to force it to use the older version instead. * *Note:* when installing libsrtp, no matter which version, you may need to pass `--libdir=/usr/lib64` to the configure script if you're installing on a x86_64 distribution. If you want to make use of BoringSSL instead of OpenSSL (e.g., because you want to take advantage of `--enable-dtls-settimeout`), you'll have to manually install it to a specific location. Use the following steps: git clone https://boringssl.googlesource.com/boringssl cd boringssl # Don't barf on errors sed -i s/" -Werror"//g CMakeLists.txt # Build mkdir -p build cd build cmake -DCMAKE_CXX_FLAGS="-lrt" .. make cd .. # Install sudo mkdir -p /opt/boringssl sudo cp -R include /opt/boringssl/ sudo mkdir -p /opt/boringssl/lib sudo cp build/ssl/libssl.a /opt/boringssl/lib/ sudo cp build/crypto/libcrypto.a /opt/boringssl/lib/ Once the library is installed, you'll have to pass an additional `--enable-boringssl` flag to the configure script, as by default Janus will be built assuming OpenSSL will be used. By default, Janus expects BoringSSL to be installed in `/opt/boringssl` -- if it's installed in another location, pass the path to the configure script as such: `--enable-boringssl=/path/to/boringssl` If you were using OpenSSL and want to switch to BoringSSL, make sure you also do a `make clean` in the Janus folder before compiling with the new BoringSSL support. If you enabled BoringSSL support and also want Janus to detect and react to DTLS timeouts with faster retransmissions, then pass `--enable-dtls-settimeout` to the configure script too. For what concerns usrsctp, which is needed for Data Channels support, it is usually not available in repositories, so if you're interested in them (support is optional) you'll have to install it manually. It is a pretty easy and standard process: git clone https://github.com/sctplab/usrsctp cd usrsctp ./bootstrap ./configure --prefix=/usr && make && sudo make install * *Note:* you may need to pass `--libdir=/usr/lib64` to the configure script if you're installing on a x86_64 distribution. The same applies for libwebsockets, which is needed for the optional WebSockets support. If you're interested in supporting WebSockets to control Janus, as an alternative (or replacement) to the default plain HTTP REST API, you'll have to install it manually: git clone https://libwebsockets.org/repo/libwebsockets cd libwebsockets # If you want the stable version of libwebsockets, uncomment the next line # git checkout v2.4-stable mkdir build cd build # See https://github.com/meetecho/janus-gateway/issues/732 re: LWS_MAX_SMP cmake -DLWS_MAX_SMP=1 -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_C_FLAGS="-fpic" .. make && sudo make install * *Note:* if libwebsockets.org is unreachable for any reason, replace the first line with this: git clone https://github.com/warmcat/libwebsockets.git The same applies for Eclipse Paho MQTT C client library, which is needed for the optional MQTT support. If you're interested in integrating MQTT channels as an alternative (or replacement) to HTTP and/or WebSockets to control Janus, or as a carrier of Janus Events, you can install the latest version with the following steps: git clone https://github.com/eclipse/paho.mqtt.c.git cd paho.mqtt.c make && sudo make install * *Note:* you may want to set up a different install path for the library, to achieve that, replace the last command by 'sudo prefix=/usr make install'. In case you're interested in Nanomsg support, you'll need to install the related C library. It is usually available as an easily installable package in pretty much all repositories. The following is an example on how to install it on Ubuntu: aptitude install libnanomsg-dev Finally, the same can be said for rabbitmq-c as well, which is needed for the optional RabbitMQ support. In fact, several different versions of the library can be found, and the versions usually available in most distribution repositories are not up-do-date with respect to the current state of the development. As such, if you're interested in integrating RabbitMQ queues as an alternative (or replacement) to HTTP and/or WebSockets to control Janus, you can install the latest version with the following steps: git clone https://github.com/alanxz/rabbitmq-c cd rabbitmq-c git submodule init git submodule update mkdir build && cd build cmake -DCMAKE_INSTALL_PREFIX=/usr .. make && sudo make install * *Note:* you may need to pass `--libdir=/usr/lib64` to the configure script if you're installing on a x86_64 distribution. To conclude, should you be interested in building the Janus documentation as well, you'll need some additional tools too: * [Doxygen](http://www.doxygen.org) * [Graphviz](http://www.graphviz.org/) On Fedora: yum install doxygen graphviz On Ubuntu/Debian: aptitude install doxygen graphviz ## Compile Once you have installed all the dependencies, get the code: git clone https://github.com/meetecho/janus-gateway.git cd janus-gateway Then just use: sh autogen.sh to generate the configure file. After that, configure and compile as usual to start the whole compilation process: ./configure --prefix=/opt/janus make make install Since Janus requires configuration files for both the core and its modules in order to work, you'll probably also want to install the default configuration files to use, which you can do this way: make configs Remember to only do this once, or otherwise a subsequent `make configs` will overwrite any configuration file you may have modified in themeanwhile. If you've installed the above libraries but are not interested, for instance, in Data Channels, WebSockets, MQTT and/or RabbitMQ, you can disable them when configuring: ./configure --disable-websockets --disable-data-channels --disable-rabbitmq --disable-mqtt There are configuration flags for pretty much all external modules and many of the features, so you may want to issue a `./configure --help` to dig through the available options. A summary of what's going to be built will always appear after you do a configure, allowing you to double check if what you need and don't need is there. If Doxygen and graphviz are available, the process can also build the documentation for you. By default the compilation process will not try to build the documentation, so if you instead prefer to build it, use the `--enable-docs` configuration option: ./configure --enable-docs You can also selectively enable/disable other features (e.g., specific plugins you don't care about, or whether or not you want to build the recordings post-processor). Use the --help option when configuring for more info. ### Building on MacOS While most of the above instructions will work when compiling Janus on MacOS as well, there are a few aspects to highlight when doing that. First of all, you can use `brew` to install most of the dependencies: brew install jansson libnice openssl srtp libusrsctp libmicrohttpd \ libwebsockets cmake rabbitmq-c sofia-sip opus libogg curl glib \ libconfig pkg-config gengetopt autoconf automake libtool For what concerns libwebsockets, though, make sure that the installed version is higher than `2.4.1`, or you might encounter the problems described in [this post](https://groups.google.com/forum/#!topic/meetecho-janus/HsFaEXBz4Cg). If `brew` doesn't provide a more recent version, you'll have to install the library manually. Notice that you may need to provide a custom `prefix` and `PKG_CONFIG_PATH` when configuring Janus as well, e.g.: ./configure --prefix=/usr/local/janus PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig Everything else works exactly the same way as on Linux. ## Configure and start To start the server, you can use the `janus` executable. There are several things you can configure, either in a configuration file: /etc/janus/janus.jcfg or on the command line: /bin/janus --help janus 0.7.3 Usage: janus [OPTIONS]... -h, --help Print help and exit -V, --version Print version and exit -b, --daemon Launch Janus in background as a daemon (default=off) -p, --pid-file=path Open the specified PID file when starting Janus (default=none) -N, --disable-stdout Disable stdout based logging (default=off) -L, --log-file=path Log to the specified file (default=stdout only) -i, --interface=ipaddress Interface to use (will be the public IP) -P, --plugins-folder=path Plugins folder (default=./plugins) -C, --config=filename Configuration file to use -F, --configs-folder=path Configuration files folder (default=./conf) -c, --cert-pem=filename DTLS certificate -k, --cert-key=filename DTLS certificate key -K, --cert-pwd=text DTLS certificate key passphrase (if needed) -S, --stun-server=filename STUN server(:port) to use, if needed (e.g., Janus behind NAT, default=none) -1, --nat-1-1=ip Public IP to put in all host candidates, assuming a 1:1 NAT is in place (e.g., Amazon EC2 instances, default=none) -E, --ice-enforce-list=list Comma-separated list of the only interfaces to use for ICE gathering; partial strings are supported (e.g., eth0 or eno1,wlan0, default=none) -X, --ice-ignore-list=list Comma-separated list of interfaces or IP addresses to ignore for ICE gathering; partial strings are supported (e.g., vmnet8,192.168.0.1,10.0.0.1 or vmnet,192.168., default=vmnet) -6, --ipv6-candidates Whether to enable IPv6 candidates or not (experimental) (default=off) -l, --libnice-debug Whether to enable libnice debugging or not (default=off) -f, --full-trickle Do full-trickle instead of half-trickle (default=off) -I, --ice-lite Whether to enable the ICE Lite mode or not (default=off) -T, --ice-tcp Whether to enable ICE-TCP or not (warning: only works with ICE Lite) (default=off) -R, --rfc-4588 Whether to enable RFC4588 retransmissions support or not (default=off) -q, --max-nack-queue=number Maximum size of the NACK queue (in ms) per user for retransmissions -t, --no-media-timer=number Time (in s) that should pass with no media (audio or video) being received before Janus notifies you about this -W, --slowlink-threshold=number Number of lost packets (per s) that should trigger a 'slowlink' Janus API event to users -r, --rtp-port-range=min-max Port range to use for RTP/RTCP (only available if the installed libnice supports it) -B, --twcc-period=number How often (in ms) to send TWCC feedback back to senders, if negotiated (default=1s) -n, --server-name=name Public name of this Janus instance (default=MyJanusInstance) -s, --session-timeout=number Session timeout value, in seconds (default=60) -m, --reclaim-session-timeout=number Reclaim session timeout value, in seconds (default=0) -d, --debug-level=1-7 Debug/logging level (0=disable debugging, 7=maximum debug level; default=4) -D, --debug-timestamps Enable debug/logging timestamps (default=off) -o, --disable-colors Disable color in the logging (default=off) -M, --debug-locks Enable debugging of locks/mutexes (very verbose!) (default=off) -a, --apisecret=randomstring API secret all requests need to pass in order to be accepted by Janus (useful when wrapping Janus API requests in a server, none by default) -A, --token-auth Enable token-based authentication for all requests (default=off) -e, --event-handlers Enable event handlers (default=off) Options passed through the command line have the precedence on those specified in the configuration file. To start the server, simply run: /bin/janus This will start the server, and have it look at the configuration file. Make sure you have a look at all of the configuration files, to tailor Janus to your specific needs: each configuration file is documented, so it shouldn't be hard to make changes according to your requirements. The repo comes with some defaults (assuming you issues `make configs` after installing the server) that tend to make sense for generic deployments, and also includes some sample configurations for all the plugins (e.g., web servers to listen on, conference rooms to create, streaming mountpoints to make available at startup, etc.). To test whether it's working correctly, you can use the demos provided with this package in the `html` folder: these are exactly the same demos available online on the [project website](http://janus.conf.meetecho.com/). Just copy the file it contains in a webserver, or use a userspace webserver to serve the files in the `html` folder (e.g., with php or python), and open the `index.html` page in either Chrome or Firefox. A list of demo pages exploiting the different plugins will be available. Remember to edit the transport/port details in the demo JavaScript files if you changed any transport-related configuration from its defaults. Besides, the demos refer to the pre-configured plugin resources, so if you add some new resources (e.g., a new videoconference) you may have to tweak the demo pages to actually use them. ## Documentation Janus is thoroughly documented. You can find the current documentation, automatically generated with Doxygen, on the [project website](http://janus.conf.meetecho.com/docs/). ## Help us! Any thought, feedback or (hopefully not!) insult is welcome! Developed by [@meetecho](https://github.com/meetecho) janus-gateway-0.7.3/apierror.c000066400000000000000000000037501351205137200162730ustar00rootroot00000000000000#include "apierror.h" const char *janus_get_api_error(int error) { switch(error) { case JANUS_OK: return "Success"; case JANUS_ERROR_UNAUTHORIZED: return "Unauthorized request (wrong or missing secret/token)"; case JANUS_ERROR_UNAUTHORIZED_PLUGIN: return "Unauthorized access to plugin (token is not allowed to)"; case JANUS_ERROR_UNKNOWN: return "Unknown error"; case JANUS_ERROR_TRANSPORT_SPECIFIC: return "Transport specific error"; case JANUS_ERROR_MISSING_REQUEST: return "Missing request"; case JANUS_ERROR_UNKNOWN_REQUEST: return "Unknown request"; case JANUS_ERROR_INVALID_JSON: return "Invalid JSON"; case JANUS_ERROR_INVALID_JSON_OBJECT: return "Invalid JSON Object"; case JANUS_ERROR_MISSING_MANDATORY_ELEMENT: return "Missing mandatory element"; case JANUS_ERROR_INVALID_REQUEST_PATH: return "Invalid path for this request"; case JANUS_ERROR_SESSION_NOT_FOUND: return "Session not found"; case JANUS_ERROR_HANDLE_NOT_FOUND: return "Handle not found"; case JANUS_ERROR_PLUGIN_NOT_FOUND: return "Plugin not found"; case JANUS_ERROR_PLUGIN_ATTACH: return "Error attaching plugin"; case JANUS_ERROR_PLUGIN_MESSAGE: return "Error sending message to plugin"; case JANUS_ERROR_PLUGIN_DETACH: return "Error detaching from plugin"; case JANUS_ERROR_JSEP_UNKNOWN_TYPE: return "Unsupported JSEP type"; case JANUS_ERROR_JSEP_INVALID_SDP: return "Invalid SDP"; case JANUS_ERROR_TRICKE_INVALID_STREAM: return "Invalid stream"; case JANUS_ERROR_INVALID_ELEMENT_TYPE: return "Invalid element type"; case JANUS_ERROR_SESSION_CONFLICT: return "Session ID already in use"; case JANUS_ERROR_UNEXPECTED_ANSWER: return "Unexpected ANSWER (no OFFER)"; case JANUS_ERROR_TOKEN_NOT_FOUND: return "Token not found"; case JANUS_ERROR_WEBRTC_STATE: return "Wrong WebRTC state"; case JANUS_ERROR_NOT_ACCEPTING_SESSIONS: return "Currently not accepting new sessions"; default: return "Unknown error"; } } janus-gateway-0.7.3/apierror.h000066400000000000000000000067471351205137200163110ustar00rootroot00000000000000/*! \file apierror.h * \author Lorenzo Miniero * \copyright GNU General Public License v3 * \brief Janus API errors definition * \details Definition of all the API errors that may occur when invoking * the Janus web-based JSON API. * \todo This code still needs proper hooks in the JavaScript libraries that use the interface. * * \ingroup core * \ref core */ #ifndef _JANUS_API_ERROR_H #define _JANUS_API_ERROR_H /*! \brief Success (no error) */ #define JANUS_OK 0 /*! \brief Unauthorized (can only happen when using apisecret/auth token) */ #define JANUS_ERROR_UNAUTHORIZED 403 /*! \brief Unauthorized access to a plugin (can only happen when using auth token) */ #define JANUS_ERROR_UNAUTHORIZED_PLUGIN 405 /*! \brief Unknown/undocumented error */ #define JANUS_ERROR_UNKNOWN 490 /*! \brief Transport related error */ #define JANUS_ERROR_TRANSPORT_SPECIFIC 450 /*! \brief The request is missing in the message */ #define JANUS_ERROR_MISSING_REQUEST 452 /*! \brief The Janus core does not suppurt this request */ #define JANUS_ERROR_UNKNOWN_REQUEST 453 /*! \brief The payload is not a valid JSON message */ #define JANUS_ERROR_INVALID_JSON 454 /*! \brief The object is not a valid JSON object as expected */ #define JANUS_ERROR_INVALID_JSON_OBJECT 455 /*! \brief A mandatory element is missing in the message */ #define JANUS_ERROR_MISSING_MANDATORY_ELEMENT 456 /*! \brief The request cannot be handled for this webserver path */ #define JANUS_ERROR_INVALID_REQUEST_PATH 457 /*! \brief The session the request refers to doesn't exist */ #define JANUS_ERROR_SESSION_NOT_FOUND 458 /*! \brief The handle the request refers to doesn't exist */ #define JANUS_ERROR_HANDLE_NOT_FOUND 459 /*! \brief The plugin the request wants to talk to doesn't exist */ #define JANUS_ERROR_PLUGIN_NOT_FOUND 460 /*! \brief An error occurring when trying to attach to a plugin and create a handle */ #define JANUS_ERROR_PLUGIN_ATTACH 461 /*! \brief An error occurring when trying to send a message/request to the plugin */ #define JANUS_ERROR_PLUGIN_MESSAGE 462 /*! \brief An error occurring when trying to detach from a plugin and destroy the related handle */ #define JANUS_ERROR_PLUGIN_DETACH 463 /*! \brief The Janus core doesn't support this SDP type */ #define JANUS_ERROR_JSEP_UNKNOWN_TYPE 464 /*! \brief The Session Description provided by the peer is invalid */ #define JANUS_ERROR_JSEP_INVALID_SDP 465 /*! \brief The stream a trickle candidate for does not exist or is invalid */ #define JANUS_ERROR_TRICKE_INVALID_STREAM 466 /*! \brief A JSON element is of the wrong type (e.g., an integer instead of a string) */ #define JANUS_ERROR_INVALID_ELEMENT_TYPE 467 /*! \brief The ID provided to create a new session is already in use */ #define JANUS_ERROR_SESSION_CONFLICT 468 /*! \brief We got an ANSWER to an OFFER we never made */ #define JANUS_ERROR_UNEXPECTED_ANSWER 469 /*! \brief The auth token the request refers to doesn't exist */ #define JANUS_ERROR_TOKEN_NOT_FOUND 470 /*! \brief The current request cannot be handled because of not compatible WebRTC state */ #define JANUS_ERROR_WEBRTC_STATE 471 /*! \brief The server is currently configured not to accept new sessions */ #define JANUS_ERROR_NOT_ACCEPTING_SESSIONS 472 /*! \brief Helper method to get a string representation of an API error code * @param[in] error The API error code * @returns A string representation of the error code */ const char *janus_get_api_error(int error); #endif janus-gateway-0.7.3/auth.c000066400000000000000000000232201351205137200154030ustar00rootroot00000000000000/*! \file auth.c * \author Lorenzo Miniero * \copyright GNU General Public License v3 * \brief Requests authentication * \details Implementation of simple mechanisms for authenticating * requests. * * If enabled (it's disabled by default), each request must contain a * valid token string, * or otherwise the request is rejected with an * error. * * When no \c token_auth_secret is set, Stored-token mode is active. * In this mode the Janus admin API can be used to specify valid string * tokens. Whether tokens should be shared across users or not is * completely up to the controlling application: these tokens are * completely opaque to Janus, and treated as strings, which means * Janus will only check if the token exists or not when asked. * * However, if a secret is set, the Signed-token mode is used. * In this mode, no direct communication between the controlling * application and Janus is necessary. Instead, the application signs * tokens that Janus can verify using the secret key. * * \ingroup core * \ref core */ #include #include #include "auth.h" #include "debug.h" #include "mutex.h" #include "utils.h" /* Hash table to contain the tokens to match */ static GHashTable *tokens = NULL, *allowed_plugins = NULL; static gboolean auth_enabled = FALSE; static janus_mutex mutex; static char *auth_secret = NULL; static void janus_auth_free_token(char *token) { g_free(token); } /* Setup */ void janus_auth_init(gboolean enabled, const char *secret) { if(enabled) { if(secret == NULL) { JANUS_LOG(LOG_INFO, "Stored-Token based authentication enabled\n"); tokens = g_hash_table_new_full(g_str_hash, g_str_equal, (GDestroyNotify)janus_auth_free_token, NULL); allowed_plugins = g_hash_table_new_full(g_str_hash, g_str_equal, (GDestroyNotify)janus_auth_free_token, NULL); auth_enabled = TRUE; } else { JANUS_LOG(LOG_INFO, "Signed-Token based authentication enabled\n"); auth_secret = g_strdup(secret); auth_enabled = TRUE; } } else { JANUS_LOG(LOG_WARN, "Token based authentication disabled\n"); } janus_mutex_init(&mutex); } gboolean janus_auth_is_enabled(void) { return auth_enabled; } gboolean janus_auth_is_stored_mode(void) { return auth_enabled && tokens != NULL; } void janus_auth_deinit(void) { janus_mutex_lock(&mutex); if(tokens != NULL) g_hash_table_destroy(tokens); tokens = NULL; if(allowed_plugins != NULL) g_hash_table_destroy(allowed_plugins); allowed_plugins = NULL; g_free(auth_secret); auth_secret = NULL; janus_mutex_unlock(&mutex); } gboolean janus_auth_check_signature(const char *token, const char *realm) { if (!auth_enabled || auth_secret == NULL) return FALSE; gchar **parts = g_strsplit(token, ":", 2); gchar **data = NULL; /* Token should have exactly one data and one hash part */ if(!parts[0] || !parts[1] || parts[2]) goto fail; data = g_strsplit(parts[0], ",", 3); /* Need at least an expiry timestamp and realm */ if(!data[0] || !data[1]) goto fail; /* Verify timestamp */ gint64 expiry_time = atoi(data[0]); gint64 real_time = janus_get_real_time() / 1000000; if(real_time > expiry_time) goto fail; /* Verify realm */ if(strcmp(data[1], realm)) goto fail; /* Verify HMAC-SHA1 */ unsigned char signature[EVP_MAX_MD_SIZE]; unsigned int len; HMAC(EVP_sha1(), auth_secret, strlen(auth_secret), (const unsigned char*)parts[0], strlen(parts[0]), signature, &len); gchar *base64 = g_base64_encode(signature, len); gboolean result = janus_strcmp_const_time(parts[1], base64); g_strfreev(data); g_strfreev(parts); g_free(base64); return result; fail: g_strfreev(data); g_strfreev(parts); return FALSE; } gboolean janus_auth_check_signature_contains(const char *token, const char *realm, const char *desc) { if (!auth_enabled || auth_secret == NULL) return FALSE; gchar **parts = g_strsplit(token, ":", 2); gchar **data = NULL; /* Token should have exactly one data and one hash part */ if(!parts[0] || !parts[1] || parts[2]) goto fail; data = g_strsplit(parts[0], ",", 0); /* Need at least an expiry timestamp and realm */ if(!data[0] || !data[1]) goto fail; /* Verify timestamp */ gint64 expiry_time = atoi(data[0]); gint64 real_time = janus_get_real_time() / 1000000; if(real_time > expiry_time) goto fail; /* Verify realm */ if(strcmp(data[1], realm)) goto fail; /* Find descriptor */ gboolean result = FALSE; int i = 2; for(i = 2; data[i]; i++) { if (!strcmp(desc, data[i])) { result = TRUE; break; } } if (!result) goto fail; /* Verify HMAC-SHA1 */ unsigned char signature[EVP_MAX_MD_SIZE]; unsigned int len; HMAC(EVP_sha1(), auth_secret, strlen(auth_secret), (const unsigned char*)parts[0], strlen(parts[0]), signature, &len); gchar *base64 = g_base64_encode(signature, len); result = janus_strcmp_const_time(parts[1], base64); g_strfreev(data); g_strfreev(parts); g_free(base64); return result; fail: g_strfreev(data); g_strfreev(parts); return FALSE; } /* Tokens manipulation */ gboolean janus_auth_add_token(const char *token) { if(!auth_enabled || tokens == NULL) { JANUS_LOG(LOG_ERR, "Can't add token, stored-authentication mechanism is disabled\n"); return FALSE; } if(token == NULL) return FALSE; janus_mutex_lock(&mutex); if(g_hash_table_lookup(tokens, token)) { JANUS_LOG(LOG_VERB, "Token already validated\n"); janus_mutex_unlock(&mutex); return TRUE; } char *new_token = g_strdup(token); g_hash_table_insert(tokens, new_token, new_token); janus_mutex_unlock(&mutex); return TRUE; } gboolean janus_auth_check_token(const char *token) { /* Always TRUE if the mechanism is disabled, of course */ if(!auth_enabled) return TRUE; if (tokens == NULL) return janus_auth_check_signature(token, "janus"); janus_mutex_lock(&mutex); if(token && g_hash_table_lookup(tokens, token)) { janus_mutex_unlock(&mutex); return TRUE; } janus_mutex_unlock(&mutex); return FALSE; } GList *janus_auth_list_tokens(void) { /* Always NULL if the mechanism is disabled, of course */ if(!auth_enabled || tokens == NULL) return NULL; janus_mutex_lock(&mutex); GList *list = NULL; if(g_hash_table_size(tokens) > 0) { GHashTableIter iter; gpointer value; g_hash_table_iter_init(&iter, tokens); while (g_hash_table_iter_next(&iter, NULL, &value)) { const char *token = value; list = g_list_append(list, g_strdup(token)); } } janus_mutex_unlock(&mutex); return list; } gboolean janus_auth_remove_token(const char *token) { if(!auth_enabled || tokens == NULL) { JANUS_LOG(LOG_ERR, "Can't remove token, stored-authentication mechanism is disabled\n"); return FALSE; } janus_mutex_lock(&mutex); gboolean ok = token && g_hash_table_remove(tokens, token); /* Also clear the allowed plugins mapping */ GList *list = g_hash_table_lookup(allowed_plugins, token); g_hash_table_remove(allowed_plugins, token); if(list != NULL) g_list_free(list); /* Done */ janus_mutex_unlock(&mutex); return ok; } /* Plugins access */ gboolean janus_auth_allow_plugin(const char *token, janus_plugin *plugin) { if(!auth_enabled || allowed_plugins == NULL) { JANUS_LOG(LOG_ERR, "Can't allow access to plugin, authentication mechanism is disabled\n"); return FALSE; } if(token == NULL || plugin == NULL) return FALSE; janus_mutex_lock(&mutex); if(!g_hash_table_lookup(tokens, token)) { janus_mutex_unlock(&mutex); return FALSE; } GList *list = g_hash_table_lookup(allowed_plugins, token); if(list == NULL) { /* Add the new permission now */ list = g_list_append(list, plugin); char *new_token = g_strdup(token); g_hash_table_insert(allowed_plugins, new_token, list); janus_mutex_unlock(&mutex); return TRUE; } /* We already have a list, update it if needed */ if(g_list_find(list, plugin) != NULL) { JANUS_LOG(LOG_VERB, "Plugin access already allowed for token\n"); janus_mutex_unlock(&mutex); return TRUE; } list = g_list_append(list, plugin); char *new_token = g_strdup(token); g_hash_table_insert(allowed_plugins, new_token, list); janus_mutex_unlock(&mutex); return TRUE; } gboolean janus_auth_check_plugin(const char *token, janus_plugin *plugin) { /* Always TRUE if the mechanism is disabled, of course */ if(!auth_enabled) return TRUE; if (allowed_plugins == NULL) return janus_auth_check_signature_contains(token, "janus", plugin->get_package()); janus_mutex_lock(&mutex); if(!g_hash_table_lookup(tokens, token)) { janus_mutex_unlock(&mutex); return FALSE; } GList *list = g_hash_table_lookup(allowed_plugins, token); if(g_list_find(list, plugin) == NULL) { janus_mutex_unlock(&mutex); return FALSE; } janus_mutex_unlock(&mutex); return TRUE; } GList *janus_auth_list_plugins(const char *token) { /* Always NULL if the mechanism is disabled, of course */ if(!auth_enabled || allowed_plugins == NULL) return NULL; janus_mutex_lock(&mutex); if(!g_hash_table_lookup(tokens, token)) { janus_mutex_unlock(&mutex); return FALSE; } GList *list = NULL; GList *plugins_list = g_hash_table_lookup(allowed_plugins, token); if(plugins_list != NULL) list = g_list_copy(plugins_list); janus_mutex_unlock(&mutex); return list; } gboolean janus_auth_disallow_plugin(const char *token, janus_plugin *plugin) { if(!auth_enabled || allowed_plugins == NULL) { JANUS_LOG(LOG_ERR, "Can't disallow access to plugin, authentication mechanism is disabled\n"); return FALSE; } janus_mutex_lock(&mutex); if(!g_hash_table_lookup(tokens, token)) { janus_mutex_unlock(&mutex); return FALSE; } GList *list = g_hash_table_lookup(allowed_plugins, token); if(list != NULL) { /* Update the list */ list = g_list_remove_all(list, plugin); char *new_token = g_strdup(token); g_hash_table_insert(allowed_plugins, new_token, list); } janus_mutex_unlock(&mutex); return TRUE; } janus-gateway-0.7.3/auth.h000066400000000000000000000107251351205137200154160ustar00rootroot00000000000000/*! \file auth.h * \author Lorenzo Miniero * \copyright GNU General Public License v3 * \brief Requests authentication (headers) * \details Implementation of a simple mechanism for authenticating * requests. If enabled (it's disabled by default), the Janus admin API * can be used to specify valid tokens; each request must then contain * a valid token string, or otherwise the request is rejected with an * error. Whether tokens should be shared across users or not is * completely up to the controlling application: these tokens are * completely opaque to Janus, and treated as strings, which means * Janus will only check if the token exists or not when asked. * * \ingroup core * \ref core */ #ifndef _JANUS_AUTH_H #define _JANUS_AUTH_H #include #include "plugins/plugin.h" /*! \brief Method to initializing the token based authentication * @param[in] enabled Whether the authentication mechanism should be enabled or not * @param[in] secret the secret to validate signed tokens against, or NULL to use stored tokens */ void janus_auth_init(gboolean enabled, const char *secret); /*! \brief Method to check whether the mechanism is enabled or not */ gboolean janus_auth_is_enabled(void); /*! \brief Method to check whether the mechanism is in stored-token mode or not */ gboolean janus_auth_is_stored_mode(void); /*! \brief Method to de-initialize the mechanism */ void janus_auth_deinit(void); /*! \brief Method to check whether a signed token is valid * @param[in] token The token to validate * @param[in] realm The token realm * @returns TRUE if the signature is valid and not expired, FALSE otherwise */ gboolean janus_auth_check_signature(const char *token, const char *realm); /*! \brief Method to verify a signed token contains a descriptor * @param[in] token The token to validate * @param[in] realm The token realm * @param[in] desc The descriptor to search for * @returns TRUE if the token is valid, not expired and contains the descriptor, FALSE otherwise */ gboolean janus_auth_check_signature_contains(const char *token, const char *realm, const char *desc); /*! \brief Method to add a new valid token for authenticating * @param[in] token The new valid token * @returns TRUE if the operation was successful, FALSE otherwise */ gboolean janus_auth_add_token(const char *token); /*! \brief Method to check whether a provided token is valid or not * \note verifies both token signatures and against stored tokens * @param[in] token The token to validate * @returns TRUE if the token is valid, FALSE otherwise */ gboolean janus_auth_check_token(const char *token); /*! \brief Method to return a list of the tokens * \note It's the caller responsibility to free the list and its values * @returns A pointer to a GList instance containing the tokens */ GList *janus_auth_list_tokens(void); /*! \brief Method to invalidate an existing token * @param[in] token The valid to invalidate * @returns TRUE if the operation was successful, FALSE otherwise */ gboolean janus_auth_remove_token(const char *token); /*! \brief Method to allow a token to use a plugin * @param[in] token The token that can now access this plugin * @param[in] plugin Opaque pointer to the janus_plugin instance this token can access * @returns TRUE if the operation was successful, FALSE otherwise */ gboolean janus_auth_allow_plugin(const char *token, janus_plugin *plugin); /*! \brief Method to check whether a provided token can access a specified plugin * \note verifies both token signatures and against stored tokens * @param[in] token The token to check * @param[in] plugin The plugin to check as an opaque pointer to a janus_plugin instance * @returns TRUE if the token is allowed to access the plugin, FALSE otherwise */ gboolean janus_auth_check_plugin(const char *token, janus_plugin *plugin); /*! \brief Method to return a list of the plugins a specific token has access to * \note It's the caller responsibility to free the list (but NOT the values) * @param[in] token The token to get the list for * @returns A pointer to a GList instance containing the liist */ GList *janus_auth_list_plugins(const char *token); /*! \brief Method to disallow a token to use a plugin * @param[in] token The token this operation refers to * @param[in] plugin Opaque pointer to the janus_plugin instance this token can not access anymore * @returns TRUE if the operation was successful, FALSE otherwise */ gboolean janus_auth_disallow_plugin(const char *token, janus_plugin *plugin); #endif janus-gateway-0.7.3/autogen.sh000077500000000000000000000001741351205137200163020ustar00rootroot00000000000000#!/bin/sh srcdir=`dirname $0` test -z "$srcdir" && srcdir=. mkdir -p m4 autoreconf --verbose --force --install || exit 1 janus-gateway-0.7.3/bower.json000066400000000000000000000017301351205137200163110ustar00rootroot00000000000000{ "name": "janus-gateway", "version": "0.7.3", "homepage": "https://github.com/meetecho/janus-gateway", "authors": [ "Lorenzo Miniero ", "Philip Withnall ", "Jack Leigh", "Pierce Lopez ", "Benjamin Trent ", "Dustin Oprea ", "Maurizio Porrato", "Giacomo Vacca", "mrauhu", "Min Wang", "leonuh", "Nicholas Wylie", "Graeme Yeates ", "gatecrasher777", "Damon Oehlman ", "Scott " ], "description": "A javascript library for interacting with the C based Janus WebRTC Server", "main": "./html/janus.js", "license": "GPLv3", "ignore": [ "**/.*", "**/*.alaw", "**/*.mjr", "node_modules", "bower_components", "test", "tests" ], "dependencies": { "webrtc-adapter": "6.4.0" } } janus-gateway-0.7.3/conf/000077500000000000000000000000001351205137200152245ustar00rootroot00000000000000janus-gateway-0.7.3/conf/janus.eventhandler.mqttevh.jcfg.sample000066400000000000000000000046121351205137200246270ustar00rootroot00000000000000# This configures the MQTT event handler. Events are sent either on # one topic or on a topic per event type. # # By default, configuration topics for handle and webrtc event types # with the base topic are configured to /janus/events, e.g.: # /janus/events/handle # /janus/events/webrtc general: { enabled = false # By default the module is not enabled events = "all" # Comma separated list of the events mask you're interested # in. Valid values are none, sessions, handles, jsep, webrtc, # media, plugins, transports, core, external and all. By # default we subscribe to everything (all) json = "indented" # Whether the JSON messages should be indented (default), # plain (no indentation) or compact (no indentation and no spaces) url = "tcp://localhost:1883" # The URL of the MQTT server. Only tcp supported at this time. client_id = "janus.example.com" # Janus client id. You have to configure a unique ID (default: guest). #keep_alive_interval = 20 # Keep connection for N seconds (default: 30) #cleansession = 0 # Clean session flag (default: off) #retain = 0 # Default MQTT retain flag for published events #qos = 1 # Default MQTT QoS for published events #disconnect_timeout = 100 # Seconds to wait before destroying client #username = "guest" # Username for authentication (default: no authentication) #password = "guest" # Password for authentication (default: no authentication) #topic = "/janus/events" # Base topic (default: /janus/events) #addevent = true # Whether we should add the event type to the base topic # Initial message sent to status topic #connect_status = "{\"event\": \"connected\", \"eventhandler\": \"janus.eventhandler.mqttevh\"}" # Message sent after disconnect or as LWT #disconnect_status = "{\"event\": \"disconnected\"}" #will_enabled = false # Whether to enable LWT (default: false) #will_retain = 1 # Whether LWT should be retained (default: 1) #will_qos = 0 # QoS for LWT (default: 0) # Additional parameters if "mqtts://" schema is used #tls_verify_peer = true # Whether peer verification must be enabled #tls_verify_hostname = true # Whether hostname verification must be enabled # Certificates to use when SSL support is enabled, if needed #tls_cacert = "/path/to/cacert.pem" #tls_client_cert = "/path/to/cert.pem" #tls_client_key = "/path/to/key.pem" #tls_ciphers #tls_version } janus-gateway-0.7.3/conf/janus.eventhandler.rabbitmqevh.jcfg.sample000066400000000000000000000027731351205137200254510ustar00rootroot00000000000000# This configures the RabbitMQ event handler. general: { enabled = false # By default the module is not enabled events = "all" # Comma separated list of the events mask you're interested # in. Valid values are none, sessions, handles, jsep, webrtc, # media, plugins, transports, core, external and all. By # default we subscribe to everything (all) grouping = true # Whether events should be sent individually , or if it's ok # to group them. The default is 'yes' to limit the number of # messages json = "indented" # Whether the JSON messages should be indented (default), # plain (no indentation) or compact (no indentation and no spaces) host = "localhost" # The address of the RabbitMQ server #port = 5672 # The port of the RabbitMQ server (5672 by default) #username = "guest" # Username to use to authenticate, if needed #password = "guest" # Password to use to authenticate, if needed #vhost = "/" # Virtual host to specify when logging in, if needed #exchange = "janus-exchange" route_key = "janus-events" # Name of the queue for event messages #ssl_enable = false # Whether ssl support must be enabled #ssl_verify_peer = true # Whether peer verification must be enabled #ssl_verify_hostname = true # Whether hostname verification must be enabled # Certificates to use when SSL support is enabled, if needed #ssl_cacert = "/path/to/cacert.pem" #ssl_cert = "/path/to/cert.pem" #ssl_key = "/path/to/key.pem" } janus-gateway-0.7.3/conf/janus.eventhandler.sampleevh.jcfg.sample000066400000000000000000000040331351205137200251200ustar00rootroot00000000000000# This configures the sample event handler. Since this plugin simply # forwards each event it receives via HTTP POST, you simply need to # configure (i) which events to subscribe to, and (ii) the address of # the web server which will receive the requests. general: { enabled = false # By default the module is not enabled events = "all" # Comma separated list of the events mask you're interested # in. Valid values are none, sessions, handles, jsep, webrtc, # media, plugins, transports, core, external and all. By # default we subscribe to everything (all) grouping = true # Whether events should be sent individually (one per # HTTP POST, JSON object), or if it's ok to group them # (one or more per HTTP POST, JSON array with objects) # The default is 'yes' to limit the number of connections. # Address the plugin will send all events to as HTTP POST # requests with an application/json payload. In case # authentication is required to contact the backend, set # the credentials as well (basic authentication only). json = "indented" # Whether the JSON messages should be indented (default), # plain (no indentation) or compact (no indentation and no spaces) backend = "http://your.webserver.here/and/a/path" #backend_user = "myuser" #backend_pwd = "mypwd" # You can also configure how retransmissions should # happen, after a failed attempt to deliver an event. # Specifically, you can specify how many times a # retransmission should be attempted (default=5) and # which step is used, in milliseconds, for the exponential # backoff before retrying (e.g, if step=100ms, then the # the first retry will happen after 100ms, the second # after 200ms, then 400ms, and so on). If the event cannot # be retransmitted after the maximum number of attemps # is reached, then it's lost. Beware that retransmissions # will also delay pending events and increase the queue. #max_retransmissions = 5 #retransmissions_backoff = 100 } janus-gateway-0.7.3/conf/janus.jcfg.sample.in000066400000000000000000000353201351205137200210670ustar00rootroot00000000000000# General configuration: folders where the configuration and the plugins # can be found, how output should be logged, whether Janus should run as # a daemon or in foreground, default interface to use, debug/logging level # and, if needed, shared apisecret and/or token authentication mechanism # between application(s) and Janus. general: { configs_folder = "@confdir@" # Configuration files folder plugins_folder = "@plugindir@" # Plugins folder transports_folder = "@transportdir@" # Transports folder events_folder = "@eventdir@" # Event handlers folder # The next settings configure logging #log_to_stdout = false # Whether the Janus output should be written # to stdout or not (default=true) #log_to_file = "/path/to/janus.log" # Whether to use a log file or not debug_level = 4 # Debug/logging level, valid values are 0-7 #debug_timestamps = true # Whether to show a timestamp for each log line #debug_colors = false # Whether colors should be disabled in the log #debug_locks = true # Whether to enable debugging of locks (very verbose!) # This is what you configure if you want to launch Janus as a daemon #daemonize = true # Whether Janus should run as a daemon # or not (default=run in foreground) #pid_file = "/path/to/janus.pid" # PID file to create when Janus has been # started, and to destroy at shutdown # There are different ways you can authenticate the Janus and Admin APIs #api_secret = "janusrocks" # String that all Janus requests must contain # to be accepted/authorized by the Janus core. # Useful if you're wrapping all Janus API requests # in your servers (that is, not in the browser, # where you do the things your way) and you # don't want other application to mess with # this Janus instance. #token_auth = true # Enable a token based authentication # mechanism to force users to always provide # a valid token in all requests. Useful if # you want to authenticate requests from web # users. #token_auth_secret = "janus" # Use HMAC-SHA1 signed tokens (with token_auth). Note that # without this, the Admin API MUST # be enabled, as tokens are added and removed # through messages sent there. admin_secret = "janusoverlord" # String that all Janus requests must contain # to be accepted/authorized by the admin/monitor. # only needed if you enabled the admin API # in any of the available transports. # Generic settings #interface = "1.2.3.4" # Interface to use (will be used in SDP) #server_name = "MyJanusInstance"# Public name of this Janus instance # as it will appear in an info request #session_timeout = 60 # How long (in seconds) we should wait before # deciding a Janus session has timed out. A # session times out when no request is received # for session_timeout seconds (default=60s). # Setting this to 0 will disable the timeout # mechanism, which is NOT suggested as it may # risk having orphaned sessions (sessions not # controlled by any transport and never freed). # To avoid timeouts, keep-alives can be used. #candidates_timeout = 45 # How long (in seconds) we should keep hold of # pending (trickle) candidates before discarding # them (default=45s). Notice that setting this # to 0 will NOT disable the timeout, but will # be considered an invalid value and ignored. #reclaim_session_timeout = 0 # How long (in seconds) we should wait for a # janus session to be reclaimed after the transport # is gone. After the transport is gone, a session # times out when no request is received for # reclaim_session_timeout seconds (default=0s). # Setting this to 0 will disable the timeout # mechanism, and sessions will be destroyed immediately # if the transport is gone. #recordings_tmp_ext = "tmp" # The extension for recordings, in Janus, is # .mjr, a custom format we devised ourselves. # By default, we save to .mjr directly. If you'd # rather the recording filename have a temporary # extension while it's being saved, and only # have the .mjr extension when the recording # is over (e.g., to automatically trigger some # external scripts), then uncomment and set the # recordings_tmp_ext property to the extension # to add to the base (e.g., tmp --> .mjr.tmp). #event_loops = 8 # By default, Janus handles each have their own # event loop and related thread for all the media # routing and management. If for some reason you'd # rather limit the number of loop/threads, and # you want handles to share those, you can do that # configuring the event_loops property: this will # spawn the specified amount of threads at startup, # run a separate event loop on each of them, and # add new handles to one of them when attaching. # Notice that, while cutting the number of threads # and possibly reducing context switching, this # might have an impact on the media delivery, # especially if the available loops can't take # care of all the handles and their media in time. # As such, if you want to use this you should # provision the correct value according to the # available resources (e.g., CPUs available). #opaqueid_in_api = true # Opaque IDs set by applications are typically # only passed to event handlers for correlation # purposes, but not sent back to the user or # application in the related Janus API responses # or events; in case you need them to be in the # Janus API too, set this property to 'true'. #hide_dependencies = true # By default, a call to the "info" endpoint of # either the Janus or Admin API now also returns # the versions of the main dependencies (e.g., # libnice, libsrtp, which crypto library is in # use and so on). Should you want that info not # to be disclose, set 'hide_dependencies' to true. # The following is ONLY useful when debugging RTP/RTCP packets, # e.g., to look at unencrypted live traffic with a browser. By # default it is obviously disabled, as WebRTC mandates encryption. #no_webrtc_encryption = true } # Certificate and key to use for DTLS (and passphrase if needed). If missing, # Janus will autogenerate a self-signed certificate to use. Notice that # self-signed certificates are fine for the purpose of WebRTC DTLS # connectivity, for the time being, at least until Identity Providers # are standardized and implemented in browsers. certificates: { #cert_pem = "/path/to/certificate.pem" #cert_key = "/path/to/key.pem" #cert_pwd = "secretpassphrase" } # Media-related stuff: you can configure whether if you want # to enable IPv6 support, if RFC4588 support for retransmissions # should be negotiated or not (off by default), the maximum size # of the NACK queue (in milliseconds, defaults to 500ms) for retransmissions, the # range of ports to use for RTP and RTCP (by default, no range is envisaged), the # starting MTU for DTLS (1200 by default, it adapts automatically), # how much time, in seconds, should pass with no media (audio or # video) being received before Janus notifies you about this (default=1s, # 0 disables these events entirely), how many lost packets should trigger # a 'slowlink' event to users (default=4), and how often, in milliseconds, # to send the Transport Wide Congestion Control feedback information back # to senders, if negotiated (default=1s). Finally, if you're using BoringSSL # you can customize the frequency of retransmissions: OpenSSL has a fixed # value of 1 second (the default), while BoringSSL can override that. Notice # that lower values (e.g., 100ms) will typically get you faster connection # times, but may not work in case the RTT of the user is high: as such, # you should pick a reasonable trade-off (usually 2*max expected RTT). media: { #ipv6 = true #max_nack_queue = 500 #rfc_4588 = true #rtp_port_range = "20000-40000" #dtls_mtu = 1200 #no_media_timer = 1 #slowlink_threshold = 4 #twcc_period = 200 #dtls_timeout = 500 } # NAT-related stuff: specifically, you can configure the STUN/TURN # servers to use to gather candidates if the gateway is behind a NAT, # and srflx/relay candidates are needed. In case STUN is not enough and # this is needed (it shouldn't), you can also configure Janus to use a # TURN server# please notice that this does NOT refer to TURN usage in # browsers, but in the gathering of relay candidates by Janus itself, # e.g., if you want to limit the ports used by a Janus instance on a # private machine. Furthermore, you can choose whether Janus should be # configured to do full-trickle (Janus also trickles its candidates to # users) rather than the default half-trickle (Janus supports trickle # candidates from users, but sends its own within the SDP), and whether # it should work in ICE-Lite mode (by default it doesn't). Finally, # you can also enable ICE-TCP support (beware that it currently *only* # works if you enable ICE Lite as well), choose which interfaces should # be used for gathering candidates, and enable or disable the # internal libnice debugging, if needed. nat: { #stun_server = "stun.voip.eutelia.it" #stun_port = 3478 nice_debug = false #full_trickle = true #ice_lite = true #ice_tcp = true # In case you're deploying Janus on a server which is configured with # a 1:1 NAT (e.g., Amazon EC2), you might want to also specify the public # address of the machine using the setting below. This will result in # all host candidates (which normally have a private IP address) to # be rewritten with the public address provided in the settings. As # such, use the option with caution and only if you know what you're doing. # Make sure you keep ICE Lite disabled, though, as it's not strictly # speaking a publicly reachable server, and a NAT is still involved. #nat_1_1_mapping = "1.2.3.4" # You can configure a TURN server in two different ways: specifying a # statically configured TURN server, and thus provide the address of the # TURN server, the transport (udp/tcp/tls) to use, and a set of valid # credentials to authenticate... #turn_server = "myturnserver.com" #turn_port = 3478 #turn_type = "udp" #turn_user = "myuser" #turn_pwd = "mypassword" # ... or you can make use of the TURN REST API to get info on one or more # TURN services dynamically. This makes use of the proposed standard of # such an API (https://tools.ietf.org/html/draft-uberti-behave-turn-rest-00) # which is currently available in both rfc5766-turn-server and coturn. # You enable this by specifying the address of your TURN REST API backend, # the HTTP method to use (GET or POST) and, if required, the API key Janus # must provide. #turn_rest_api = "http://yourbackend.com/path/to/api" #turn_rest_api_key = "anyapikeyyoumayhaveset" #turn_rest_api_method = "GET" # You can also choose which interfaces should be explicitly used by the # gateway for the purpose of ICE candidates gathering, thus excluding # others that may be available. To do so, use the 'ice_enforce_list' # setting and pass it a comma-separated list of interfaces or IP addresses # to enforce. This is especially useful if the server hosting the gateway # has several interfaces, and you only want a subset to be used. Any of # the following examples are valid: # ice_enforce_list = "eth0" # ice_enforce_list = "eth0,eth1" # ice_enforce_list = "eth0,192.168." # ice_enforce_list = "eth0,192.168.0.1" # By default, no interface is enforced, meaning Janus will try to use them all. #ice_enforce_list = "eth0" # In case you don't want to specify specific interfaces to use, but would # rather tell Janus to use all the available interfaces except some that # you don't want to involve, you can also choose which interfaces or IP # addresses should be excluded and ignored by the gateway for the purpose # of ICE candidates gathering. To do so, use the 'ice_ignore_list' setting # and pass it a comma-separated list of interfaces or IP addresses to # ignore. This is especially useful if the server hosting the gateway # has several interfaces you already know will not be used or will simply # always slow down ICE (e.g., virtual interfaces created by VMware). # Partial strings are supported, which means that any of the following # examples are valid: # ice_ignore_list = "vmnet8,192.168.0.1,10.0.0.1" # ice_ignore_list = "vmnet,192.168." # Just beware that the ICE ignore list is not used if an enforce list # has been configured. By default, Janus ignores all interfaces whose # name starts with 'vmnet', to skip VMware interfaces: ice_ignore_list = "vmnet" } # You can choose which of the available plugins should be # enabled or not. Use the 'disable' directive to prevent Janus from # loading one or more plugins: use a comma separated list of plugin file # names to identify the plugins to disable. By default all available # plugins are enabled and loaded at startup. plugins: { #disable = "libjanus_voicemail.so,libjanus_recordplay.so" } # You can choose which of the available transports should be enabled or # not. Use the 'disable' directive to prevent Janus from loading one # or more transport: use a comma separated list of transport file names # to identify the transports to disable. By default all available # transports are enabled and loaded at startup. transports: { #disable = "libjanus_rabbitmq.so" } # Event handlers allow you to receive live events from Janus happening # in core and/or plugins. Since this can require some more resources, # the feature is disabled by default. Setting broadcast to yes will # enable them. You can then choose which of the available event handlers # should be loaded or not. Use the 'disable' directive to prevent Janus # from loading one or more event handlers: use a comma separated list of # file names to identify the event handlers to disable. By default, if # broadcast is set to yes all available event handlers are enabled and # loaded at startup. Finally, you can choose how often media statistics # (packets sent/received, losses, etc.) should be sent: by default it's # once per second (audio and video statistics sent separately), but may # considered too verbose, or you may want to limit the number of events, # especially if you have many PeerConnections active. To change this, # just set 'stats_period' to the number of seconds that should pass in # between statistics for each handle. Setting it to 0 disables them (but # not other media-related events). events: { #broadcast = true #disable = "libjanus_sampleevh.so" #stats_period = 5 } janus-gateway-0.7.3/conf/janus.plugin.audiobridge.jcfg.sample000066400000000000000000000051051351205137200242320ustar00rootroot00000000000000# room-: { # description = "This is my awesome room" # is_private = true|false (whether this room should be in the public list, default=true) # secret = "" # pin = "" # sampling_rate = (e.g., 16000 for wideband mixing) # audiolevel_ext = true|false (whether the ssrc-audio-level RTP extension must # be negotiated/used or not for new joins, default=true) # audiolevel_event = true|false (whether to emit event to other users or not, default=false) # audio_active_packets = 100 (number of packets with audio level, default=100, 2 seconds) # audio_level_average = 25 (average value of audio level, 127=muted, 0='too loud', default=25) # record = true|false (whether this room should be recorded, default=false) # record_file = "/path/to/recording.wav" (where to save the recording) # # The following lines are only needed if you want the mixed audio # to be automatically forwarded via plain RTP to an external component # (e.g., an ffmpeg script, or a gstreamer pipeline) for processing # By default plain RTP is used, SRTP must be configured if needed # rtp_forward_id = numeric RTP forwarder ID for referencing it via API (optional: random ID used if missing) # rtp_forward_host = "" # rtp_forward_port = port to forward RTP packets of mixed audio to # rtp_forward_ssrc = SSRC to use to use when streaming (optional: stream_id used if missing) # rtp_forward_ptype = payload type to use when streaming (optional: 100 used if missing) # rtp_forward_srtp_suite = length of authentication tag (32 or 80) # rtp_forward_srtp_crypto = "" # rtp_forward_always_on = true|false, whether silence should be forwarded when the room is empty (optional: false used if missing) #} general: { #admin_key = "supersecret" # If set, rooms can be created via API only # if this key is provided in the request #lock_rtp_forward = true # Whether the admin_key above should be # enforced for RTP forwarding requests too #record_tmp_ext = "tmp" # Optional temporary extension to add to filenames # while recording: e.g., setting "tmp" would mean # .wav --> .wav.tmp until the file is closed #events = false # Whether events should be sent to event # handlers (default=true) } room-1234: { description = "Demo Room" secret = "adminpwd" sampling_rate = 16000 record = false #record_file = "/path/to/recording.wav" } janus-gateway-0.7.3/conf/janus.plugin.duktape.jcfg.sample.in000066400000000000000000000021101351205137200240070ustar00rootroot00000000000000# The only things you configure in here are which JavaScipt file to load and, # optionally, the paths to add for searching libraries and a configuration # file, if the script will need it. For what concerns the libraries path, # by default this configuration file adds a path to where the JS samples # have been installed, as it contains a couple of helper libraries the # samples use; should you be interested in adding more, just add other # paths separated by a semicolon. Due to the syntax of the configuration # file, make sure you escape all semicolons with a trailing slash, in case. # The 'config' property is entirely script specific, instead: if your # script will need to rely on an XML configuration file in its initialization, # for instance, then set the 'config' property as the path to the file; # it will be passed, as is, to your script in the init() call. None of # the samples use this property, which is why it's commented out. general: { path = "@duktapedir@" script = "@duktapedir@/echotest.js" #script = "@duktapedir@/videoroom.js" #config = "/path/to/configfile" } janus-gateway-0.7.3/conf/janus.plugin.echotest.jcfg.sample000066400000000000000000000001461351205137200235720ustar00rootroot00000000000000# events = true|false, whether events should be sent to event handlers general: { #events = false } janus-gateway-0.7.3/conf/janus.plugin.lua.jcfg.sample.in000066400000000000000000000020731351205137200231430ustar00rootroot00000000000000# The only things you configure in here are which lua script to load and, # optionally, the paths to add for searching libraries and a configuration # file, if the script will need it. For what concerns the libraries path, # by default this configuration file adds a path to where the Lua samples # have been installed, as it contains a couple of helper libraries the # samples use; should you be interested in adding more, just add other # paths separated by a semicolon. Due to the syntax of the configuration # file, make sure you escape all semicolons with a trailing slash, in case. # The 'config' property is entirely script specific, instead: if your # script will need to rely on an XML configuration file in its initialization, # for instance, then set the 'config' property as the path to the file; # it will be passed, as is, to your script in the init() call. None of # the samples use this property, which is why it's commented out. general: { path = "@luadir@" script = "@luadir@/echotest.lua" #script = "@luadir@/videoroom.lua" #config = "/path/to/configfile" } janus-gateway-0.7.3/conf/janus.plugin.nosip.jcfg.sample000066400000000000000000000007451351205137200231110ustar00rootroot00000000000000general: { # Specify which local IP address to bind to for media. # If not set it will be automatically guessed from the system #local_ip = "1.2.3.4" # Specify which (public) IP address to advertise in the SDP. # If not set, the value above or anything autodetected will be used #sdp_ip = "1.2.3.4" # Range of ports to use for RTP/RTCP (default=10000-60000) rtp_port_range = "20000-40000" # Whether events should be sent to event handlers (default=true) #events = false } janus-gateway-0.7.3/conf/janus.plugin.recordplay.jcfg.sample.in000066400000000000000000000002661351205137200245300ustar00rootroot00000000000000# path = where to place recordings in the file system # events = true|false, whether events should be sent to event handlers general: { path = "@recordingsdir@" #events = false } janus-gateway-0.7.3/conf/janus.plugin.sip.jcfg.sample000066400000000000000000000017641351205137200225560ustar00rootroot00000000000000general: { # Specify which local IP address to bind to for SIP stack and media. # If not set it will be automatically guessed from the system #local_ip = "1.2.3.4" # Specify which (public) IP address to advertise in the SDP. # If not set, the value above or anything autodetected will be used #sdp_ip = "1.2.3.4" # Enable local keep-alives to keep the registration open. Keep-alives are # sent in the form of OPTIONS requests, at the given interval inseconds. # (0 to disable) keepalive_interval = 120 # Indicate if the server is behind NAT. If so, the server will use STUN # to guess its own public IP address and use it in the Contact header of # outgoing requests behind_nat = false # User-Agent string to be used # user_agent = "Cool WebRTC Gateway" # Expiration time for registrations register_ttl = 3600 # Range of ports to use for RTP/RTCP (default=10000-60000) rtp_port_range = "20000-40000" # Whether events should be sent to event handlers (default=true) #events = false } janus-gateway-0.7.3/conf/janus.plugin.sipre.jcfg.sample000066400000000000000000000011651351205137200231000ustar00rootroot00000000000000general: { # Specify which local IP address to bind to for SIP stack and media. # If not set it will be automatically guessed from the system #local_ip = "1.2.3.4" # Specify which (public) IP address to advertise in the SDP. # If not set, the value above or anything autodetected will be used #sdp_ip = "1.2.3.4" # User-Agent string to be used # user_agent = "Cool WebRTC Gateway" # Expiration time for registrations register_ttl = 3600 # Range of ports to use for RTP/RTCP (default=10000-60000) rtp_port_range = "20000-40000" # Whether events should be sent to event handlers (default=true) #events = false } janus-gateway-0.7.3/conf/janus.plugin.streaming.jcfg.sample.in000066400000000000000000000207751351205137200243640ustar00rootroot00000000000000# stream-name: { # type = rtp|live|ondemand|rtsp # rtp = stream originated by an external tool (e.g., gstreamer or # ffmpeg) and sent to the plugin via RTP # live = local file streamed live to multiple listeners # (multiple listeners = same streaming context) # ondemand = local file streamed on-demand to a single listener # (multiple listeners = different streaming contexts) # rtsp = stream originated by an external RTSP feed (only # available if libcurl support was compiled) # id = (if missing, a random one will be generated) # description = This is my awesome stream # is_private = true|false (private streams don't appear when you do a 'list' # request) # secret = # pin = # filename = path to the local file to stream (only for live/ondemand) # audio = true|false (do/don't stream audio) # video = true|false (do/don't stream video) # The following options are only valid for the 'rtp' type: # data = true|false (do/don't stream text via datachannels) # audioport = local port for receiving audio frames # audiortcpport = local port, if any, for receiving and sending audio RTCP feedback # audiomcast = multicast group port for receiving audio frames, if any # audioiface = network interface or IP address to bind to, if any (binds to all otherwise) # audiopt =