luci-0.10: merge luci-pbx source

This commit is contained in:
Jo-Philipp Wich 2011-12-07 21:28:39 +00:00
parent 63b1f034f7
commit 96a7817515
58 changed files with 3880 additions and 0 deletions

View file

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
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.
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.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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 <http://www.gnu.org/licenses/>.
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:
<program> Copyright (C) <year> <name of author>
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
<http://www.gnu.org/licenses/>.
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
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View file

@ -0,0 +1,7 @@
This file pertains to the sounds files included in root/etc/pbx-asterisk/sounds
Recorded by:
Allison Smith (http://www.theivrvoice.com)
Financial Contributions by:
Digium, Inc. (http://www.digium.com)

View file

@ -0,0 +1,312 @@
This file pertains to the sounds files included in root/etc/pbx-asterisk/sounds
LICENSE FOR VOICE PROMPT FILES
------------------------------
The voice prompt files distributed herewith are Copyright (C) 2003-2008
Allison Smith, and provided under terms of the following License. For
more information, or to purchase custom voice prompt files, please
visit:
http://www.digium.com/ivr or http://www.theasteriskvoice.com
LICENSE
-------
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS
CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS
PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE
WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS
PROHIBITED.
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND
AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS
LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU
THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH
TERMS AND CONDITIONS.
1. Definitions.
a. "Collective Work" means a work, such as a periodical issue,
anthology or encyclopedia, in which the Work in its entirety in
unmodified form, along with one or more other contributions,
constituting separate and independent works in themselves, are
assembled into a collective whole. A work that constitutes a
Collective Work will not be considered a Derivative Work (as defined
below) for the purposes of this License.
b. "Creative Commons Compatible License" means a license that is
listed at http://creativecommons.org/compatiblelicenses that has been
approved by Creative Commons as being essentially equivalent to this
License, including, at a minimum, because that license: (i) contains
terms that have the same purpose, meaning and effect as the License
Elements of this License; and, (ii) explicitly permits the relicensing
of derivatives of works made available under that license under this
License or either a Creative Commons unported license or a Creative
Commons jurisdiction license with the same License Elements as this
License.
c. "Derivative Work" means a work based upon the Work or upon the Work
and other pre-existing works, such as a translation, musical
arrangement, dramatization, fictionalization, motion picture version,
sound recording, art reproduction, abridgment, condensation, or any
other form in which the Work may be recast, transformed, or adapted,
except that a work that constitutes a Collective Work will not be
considered a Derivative Work for the purpose of this License. For the
avoidance of doubt, where the Work is a musical composition or sound
recording, the synchronization of the Work in timed-relation with a
moving image ("synching") will be considered a Derivative Work for the
purpose of this License.
d. "License Elements" means the following high-level license
attributes as selected by Licensor and indicated in the title of this
License: Attribution, ShareAlike.
e. "Licensor" means the individual, individuals, entity or entities
that offers the Work under the terms of this License.
f. "Original Author" means the individual, individuals, entity or
entities who created the Work.
g. "Work" means the copyrighted voice prompt files recorded by Allison
Smith for Asterisk and distributed with this License.
h. "You" means an individual or entity exercising rights under this
License who has not previously violated the terms of this License with
respect to the Work, or who has received express permission from the
Licensor to exercise rights under this License despite a previous
violation.
2. Fair Use Rights.
Nothing in this license is intended to reduce, limit, or restrict any
rights arising from fair use, first sale or other limitations on the
exclusive rights of the copyright owner under copyright law or other
applicable laws.
3. License Grant.
Subject to the terms and conditions of this License, Licensor hereby
grants You a worldwide, royalty-free, non-exclusive, perpetual (for
the duration of the applicable copyright) license to exercise the
rights in the Work as stated below:
a. to reproduce the Work, to incorporate the Work into one or more
Collective Works, and to reproduce the Work as incorporated in the
Collective Works;
b. to create and reproduce Derivative Works provided that any such
Derivative Work, including any translation in any medium, takes
reasonable steps to clearly label, demarcate or otherwise identify
that changes were made to the original Work. For example, a
translation could be marked "The original work was translated from
English to Spanish," or a modification could indicate "The original
work has been modified.";
c. to distribute copies or phonorecords of, display publicly, perform
publicly, and perform publicly by means of a digital audio
transmission the Work including as incorporated in Collective Works;
d. to distribute copies or phonorecords of, display publicly, perform
publicly, and perform publicly by means of a digital audio
transmission Derivative Works.
e. For the avoidance of doubt, where the Work is a musical
composition:
i. Performance Royalties Under Blanket Licenses. Licensor waives the
exclusive right to collect, whether individually or, in the event
that Licensor is a member of a performance rights society
(e.g. ASCAP, BMI, SESAC), via that society, royalties for the public
performance or public digital performance e.g. webcast) of the Work.
ii.Mechanical Rights and Statutory Royalties. Licensor waives the
exclusive right to collect, whether individually or via a music
rights agency or designated agent (e.g. Harry Fox Agency), royalties
for any phonorecord You create from the Work ("cover version") and
distribute, subject to the compulsory license created by 17 USC
Section 115 of the US Copyright Act (or the equivalent in other
jurisdictions).
f. Webcasting Rights and Statutory Royalties. For the avoidance of
doubt, where the Work is a sound recording, Licensor waives the
exclusive right to collect, whether individually or via a
performance-rights society (e.g. SoundExchange), royalties for the
public digital performance (e.g. webcast) of the Work, subject to the
compulsory license created by 17 USC Section 114 of the US Copyright
Act (or the equivalent in other jurisdictions).
The above rights may be exercised in all media and formats whether now
known or hereafter devised. The above rights include the right to make
such modifications as are technically necessary to exercise the rights
in other media and formats. All rights not expressly granted by
Licensor are hereby reserved.
4. Restrictions.
The license granted in Section 3 above is expressly made subject to
and limited by the following restrictions:
a. You may distribute, publicly display, publicly perform, or publicly
digitally perform the Work only under the terms of this License, and
You must include a copy of, or the Uniform Resource Identifier for,
this License with every copy or phonorecord of the Work You
distribute, publicly display, publicly perform, or publicly digitally
perform. You may not offer or impose any terms on the Work that
restrict the terms of this License or the ability of a recipient of
the Work to exercise of the rights granted to that recipient under the
terms of the License. You may not sublicense the Work. You must keep
intact all notices that refer to this License and to the disclaimer of
warranties. When You distribute, publicly display, publicly perform,
or publicly digitally perform the Work, You may not impose any
technological measures on the Work that restrict the ability of a
recipient of the Work from You to exercise of the rights granted to
that recipient under the terms of the License. This Section 4(a)
applies to the Work as incorporated in a Collective Work, but this
does not require the Collective Work apart from the Work itself to be
made subject to the terms of this License. If You create a Collective
Work, upon notice from any Licensor You must, to the extent
practicable, remove from the Collective Work any credit as required by
Section 4(c), as requested. If You create a Derivative Work, upon
notice from any Licensor You must, to the extent practicable, remove
from the Derivative Work any credit as required by Section 4(c), as
requested.
b. You may distribute, publicly display, publicly perform, or publicly
digitally perform a Derivative Work only under: (i) the terms of this
License; (ii) a later version of this License with the same License
Elements as this License; (iii) either the Creative Commons (Unported)
license or a Creative Commons jurisdiction license (either this or a
later license version) that contains the same License Elements as this
License (e.g. Attribution-ShareAlike 3.0 (Unported)); (iv) a Creative
Commons Compatible License. If you license the Derivative Work under
one of the licenses mentioned in (iv), you must comply with the terms
of that license. If you license the Derivative Work under the terms of
any of the licenses mentioned in (i), (ii) or (iii) (the "Applicable
License"), you must comply with the terms of the Applicable License
generally and with the following provisions: (I) You must include a
copy of, or the Uniform Resource Identifier for, the Applicable
License with every copy or phonorecord of each Derivative Work You
distribute, publicly display, publicly perform, or publicly digitally
perform; (II) You may not offer or impose any terms on the Derivative
Works that restrict the terms of the Applicable License or the ability
of a recipient of the Work to exercise the rights granted to that
recipient under the terms of the Applicable License; (III) You must
keep intact all notices that refer to the Applicable License and to
the disclaimer of warranties; and, (IV) when You distribute, publicly
display, publicly perform, or publicly digitally perform the Work, You
may not impose any technological measures on the Derivative Work that
restrict the ability of a recipient of the Derivative Work from You to
exercise the rights granted to that recipient under the terms of the
Applicable License. This Section 4(b) applies to the Derivative Work
as incorporated in a Collective Work, but this does not require the
Collective Work apart from the Derivative Work itself to be made
subject to the terms of the Applicable License.
c. If You distribute, publicly display, publicly perform, or publicly
digitally perform the Work (as defined in Section 1 above) or any
Derivative Works (as defined in Section 1 above) or Collective Works
(as defined in Section 1 above), You must, unless a request has been
made pursuant to Section 4(a), keep intact all copyright notices for
the Work and provide, reasonable to the medium or means You are
utilizing: (i) the name of the Original Author (or pseudonym, if
applicable) if supplied, and/or (ii) if the Original Author and/or
Licensor designate another party or parties (e.g. a sponsor institute,
publishing entity, journal) for attribution ("Attribution Parties") in
Licensor's copyright notice, terms of service or by other reasonable
means, the name of such party or parties; the title of the Work if
supplied; to the extent reasonably practicable, the Uniform Resource
Identifier, if any, that Licensor specifies to be associated with the
Work, unless such URI does not refer to the copyright notice or
licensing information for the Work; and, consistent with Section 3(b)
in the case of a Derivative Work, a credit identifying the use of the
Work in the Derivative Work (e.g., "French translation of the Work by
Original Author," or "Screenplay based on original Work by Original
Author"). The credit required by this Section 4(c) may be implemented
in any reasonable manner; provided, however, that in the case of a
Derivative Work or Collective Work, at a minimum such credit will
appear, if a credit for all contributing authors of the Derivative
Work or Collective Work appears, then as part of these credits and in
a manner at least as prominent as the credits for the other
contributing authors. For the avoidance of doubt, You may only use the
credit required by this Section for the purpose of attribution in the
manner set out above and, by exercising Your rights under this
License, You may not implicitly or explicitly assert or imply any
connection with, sponsorship or endorsement by the Original Author,
Licensor and/or Attribution Parties, as appropriate, of You or Your
use of the Work, without the separate, express prior written
permission of the Original Author, Licensor and/or Attribution
Parties.
5. Representations, Warranties and Disclaimer.
UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING,
LICENSOR OFFERS THE WORK AS-IS AND ONLY TO THE EXTENT OF ANY RIGHTS
HELD IN THE LICENSED WORK BY THE LICENSOR. THE LICENSOR MAKES NO
REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK,
EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT
LIMITATION, WARRANTIES OF TITLE, MARKETABILITY, MERCHANTIBILITY,
FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF
LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF
ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW
THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY
TO YOU.
6. Limitation on Liability.
EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL
LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL,
INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT
OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
7. Termination.
a. This License and the rights granted hereunder will terminate
automatically upon any breach by You of the terms of this
License. Individuals or entities who have received Derivative Works or
Collective Works from You under this License, however, will not have
their licenses terminated provided such individuals or entities remain
in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8
will survive any termination of this License.
b. Subject to the above terms and conditions, the license granted here
is perpetual (for the duration of the applicable copyright in the
Work). Notwithstanding the above, Licensor reserves the right to
release the Work under different license terms or to stop distributing
the Work at any time; provided, however that any such election will
not serve to withdraw this License (or any other license that has
been, or is required to be, granted under the terms of this License),
and this License will continue in full force and effect unless
terminated as stated above.
8. Miscellaneous.
a. Each time You distribute or publicly digitally perform the Work (as
defined in Section 1 above) or a Collective Work (as defined in
Section 1 above), the Licensor offers to the recipient a license to
the Work on the same terms and conditions as the license granted to
You under this License.
b. Each time You distribute or publicly digitally perform a Derivative
Work, Licensor offers to the recipient a license to the original Work
on the same terms and conditions as the license granted to You under
this License.
c. If any provision of this License is invalid or unenforceable under
applicable law, it shall not affect the validity or enforceability of
the remainder of the terms of this License, and without further action
by the parties to this agreement, such provision shall be reformed to
the minimum extent necessary to make such provision valid and
enforceable.
d. No term or provision of this License shall be deemed waived and no
breach consented to unless such waiver or consent shall be in writing
and signed by the party to be charged with such waiver or consent.
e. This License constitutes the entire agreement between the parties
with respect to the Work licensed here. There are no understandings,
agreements or representations with respect to the Work not specified
here. Licensor shall not be bound by any additional provisions that
may appear in any communication from You. This License may not be
modified without the mutual written agreement of the Licensor and You.

View file

@ -0,0 +1,4 @@
PO = pbx
include ../../build/config.mk
include ../../build/module.mk

View file

@ -0,0 +1,29 @@
--[[
Copyright 2011 Iordan Iordanov <iiordanov (AT) gmail.com>
This file is part of luci-pbx.
luci-pbx 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.
luci-pbx 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 luci-pbx. If not, see <http://www.gnu.org/licenses/>.
]]--
module("luci.controller.pbx", package.seeall)
function index()
entry({"admin", "services", "pbx"}, cbi("pbx"), "PBX", 80)
entry({"admin", "services", "pbx", "pbx-google"}, cbi("pbx-google"), "Google Accounts", 1)
entry({"admin", "services", "pbx", "pbx-voip"}, cbi("pbx-voip"), "SIP Accounts", 2)
entry({"admin", "services", "pbx", "pbx-users"}, cbi("pbx-users"), "User Accounts", 3)
entry({"admin", "services", "pbx", "pbx-calls"}, cbi("pbx-calls"), "Call Routing", 4)
entry({"admin", "services", "pbx", "pbx-advanced"}, cbi("pbx-advanced"), "Advanced Settings", 6)
end

View file

@ -0,0 +1,291 @@
--[[
Copyright 2011 Iordan Iordanov <iiordanov (AT) gmail.com>
This file is part of luci-pbx.
luci-pbx 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.
luci-pbx 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 luci-pbx. If not, see <http://www.gnu.org/licenses/>.
]]--
if nixio.fs.access("/etc/init.d/asterisk") then
server = "asterisk"
elseif nixio.fs.access("/etc/init.d/freeswitch") then
server = "freeswitch"
else
server = ""
end
appname = "PBX"
modulename = "pbx-advanced"
defaultbindport = 5060
defaultrtpstart = 19850
defaultrtpend = 19900
-- Returns all the network related settings, including a constructed RTP range
function get_network_info()
externhost = m.uci:get(modulename, "advanced", "externhost")
ipaddr = m.uci:get("network", "lan", "ipaddr")
bindport = m.uci:get(modulename, "advanced", "bindport")
rtpstart = m.uci:get(modulename, "advanced", "rtpstart")
rtpend = m.uci:get(modulename, "advanced", "rtpend")
if bindport == nil then bindport = defaultbindport end
if rtpstart == nil then rtpstart = defaultrtpstart end
if rtpend == nil then rtpend = defaultrtpend end
if rtpstart == nil or rtpend == nil then
rtprange = nil
else
rtprange = rtpstart .. "-" .. rtpend
end
return bindport, rtprange, ipaddr, externhost
end
-- If not present, insert empty rules in the given config & section named PBX-SIP and PBX-RTP
function insert_empty_sip_rtp_rules(config, section)
-- Add rules named PBX-SIP and PBX-RTP if not existing
found_sip_rule = false
found_rtp_rule = false
m.uci:foreach(config, section,
function(s1)
if s1._name == 'PBX-SIP' then
found_sip_rule = true
elseif s1._name == 'PBX-RTP' then
found_rtp_rule = true
end
end)
if found_sip_rule ~= true then
newrule=m.uci:add(config, section)
m.uci:set(config, newrule, '_name', 'PBX-SIP')
end
if found_rtp_rule ~= true then
newrule=m.uci:add(config, section)
m.uci:set(config, newrule, '_name', 'PBX-RTP')
end
end
-- Delete rules in the given config & section named PBX-SIP and PBX-RTP
function delete_sip_rtp_rules(config, section)
-- Remove rules named PBX-SIP and PBX-RTP
commit = false
m.uci:foreach(config, section,
function(s1)
if s1._name == 'PBX-SIP' or s1._name == 'PBX-RTP' then
m.uci:delete(config, s1['.name'])
commit = true
end
end)
-- If something changed, then we commit the config.
if commit == true then m.uci:commit(config) end
end
-- Deletes QoS rules associated with this PBX.
function delete_qos_rules()
delete_sip_rtp_rules ("qos", "classify")
end
function insert_qos_rules()
-- Insert empty PBX-SIP and PBX-RTP rules if not present.
insert_empty_sip_rtp_rules ("qos", "classify")
-- Get the network information
bindport, rtprange, ipaddr, externhost = get_network_info()
-- Iterate through the QoS rules, and if there is no other rule with the same port
-- range at the priority service level, insert this rule.
commit = false
m.uci:foreach("qos", "classify",
function(s1)
if s1._name == 'PBX-SIP' then
if s1.ports ~= bindport or s1.target ~= "Priority" or s1.proto ~= "udp" then
m.uci:set("qos", s1['.name'], "ports", bindport)
m.uci:set("qos", s1['.name'], "proto", "udp")
m.uci:set("qos", s1['.name'], "target", "Priority")
commit = true
end
elseif s1._name == 'PBX-RTP' then
if s1.ports ~= rtprange or s1.target ~= "Priority" or s1.proto ~= "udp" then
m.uci:set("qos", s1['.name'], "ports", rtprange)
m.uci:set("qos", s1['.name'], "proto", "udp")
m.uci:set("qos", s1['.name'], "target", "Priority")
commit = true
end
end
end)
-- If something changed, then we commit the qos config.
if commit == true then m.uci:commit("qos") end
end
-- This function is a (so far) unsuccessful attempt to manipulate the firewall rules from here
-- Need to do more testing and eventually move to this mode.
function maintain_firewall_rules()
-- Get the network information
bindport, rtprange, ipaddr, externhost = get_network_info()
commit = false
-- Only if externhost is set, do we control firewall rules.
if externhost ~= nil and bindport ~= nil and rtprange ~= nil then
-- Insert empty PBX-SIP and PBX-RTP rules if not present.
insert_empty_sip_rtp_rules ("firewall", "rule")
-- Iterate through the firewall rules, and if the dest_port and dest_ip setting of the\
-- SIP and RTP rule do not match what we want configured, set all the entries in the rule\
-- appropriately.
m.uci:foreach("firewall", "rule",
function(s1)
if s1._name == 'PBX-SIP' then
if s1.dest_port ~= bindport then
m.uci:set("firewall", s1['.name'], "dest_port", bindport)
m.uci:set("firewall", s1['.name'], "src", "wan")
m.uci:set("firewall", s1['.name'], "proto", "udp")
m.uci:set("firewall", s1['.name'], "target", "ACCEPT")
commit = true
end
elseif s1._name == 'PBX-RTP' then
if s1.dest_port ~= rtprange then
m.uci:set("firewall", s1['.name'], "dest_port", rtprange)
m.uci:set("firewall", s1['.name'], "src", "wan")
m.uci:set("firewall", s1['.name'], "proto", "udp")
m.uci:set("firewall", s1['.name'], "target", "ACCEPT")
commit = true
end
end
end)
else
-- We delete the firewall rules if one or more of the necessary parameters are not set.
sip_rule_name=nil
rtp_rule_name=nil
-- First discover the configuration names of the rules.
m.uci:foreach("firewall", "rule",
function(s1)
if s1._name == 'PBX-SIP' then
sip_rule_name = s1['.name']
elseif s1._name == 'PBX-RTP' then
rtp_rule_name = s1['.name']
end
end)
-- Then, using the names, actually delete the rules.
if sip_rule_name ~= nil then
m.uci:delete("firewall", sip_rule_name)
commit = true
end
if rtp_rule_name ~= nil then
m.uci:delete("firewall", rtp_rule_name)
commit = true
end
end
-- If something changed, then we commit the firewall config.
if commit == true then m.uci:commit("firewall") end
end
m = Map (modulename, translate("Advanced Settings"),
translate("This section contains settings that do not need to be changed under \
normal circumstances. In addition, here you can configure your system \
for use with remote SIP devices, and resolve call quality issues by enabling \
the insertion of QoS rules."))
-- Recreate the voip server config, and restart necessary services after changes are commited
-- to the advanced configuration. The firewall must restart because of "Remote Usage".
function m.on_after_commit(self)
-- Make sure firewall rules are in place
maintain_firewall_rules()
-- If insertion of QoS rules is enabled
if m.uci:get(modulename, "advanced", "qos_enabled") == "yes" then
insert_qos_rules()
else
delete_qos_rules()
end
luci.sys.call("/etc/init.d/pbx-" .. server .. " restart 1\>/dev/null 2\>/dev/null")
luci.sys.call("/etc/init.d/" .. server .. " restart 1\>/dev/null 2\>/dev/null")
luci.sys.call("/etc/init.d/firewall restart 1\>/dev/null 2\>/dev/null")
end
-----------------------------------------------------------------------------
s = m:section(NamedSection, "advanced", "settings", translate("Advanced Settings"))
s.anonymous = true
s:tab("general", translate("General Settings"))
s:tab("remote_usage", translate("Remote Usage"),
translatef("You can use your SIP devices/softphones with this system from a remote location \
as well, as long as your Internet Service Provider gives you a public IP. \
You will be able to call other local users for free (e.g. other Analog Telephone Adapters (ATAs)) \
and use your VoIP providers to make calls as if you were local to the PBX. \
After configuring this tab, go back to where users are configured and see the new \
Server and Port setting you need to configure the remote SIP devices with. Please note that if this \
PBX is not running on your router/gateway, you will need to configure port forwarding (NAT) on your \
router/gateway. Please forward the ports below (SIP port and RTP range) to the IP address of the \
device running this PBX."))
s:tab("qos", translate("QoS Settings"),
translate("If you experience jittery or high latency audio during heavy downloads, you may want \
to enable QoS. QoS prioritizes traffic to and from your network for specified ports and IP \
addresses, resulting in better latency and throughput for sound in our case. If enabled below, \
a QoS rule for this service will be configured by the PBX automatically, but you must visit the \
QoS configuration page (Network->QoS) to configure other critical QoS settings like Download \
and Upload speed."))
ringtime = s:taboption("general", Value, "ringtime", translate("Number of Seconds to Ring"),
translate("Set the number of seconds to ring users upon incoming calls before hanging up \
or going to voicemail, if the voicemail is installed and enabled."))
ringtime.default = 30
ua = s:taboption("general", Value, "useragent", translate("User Agent String"),
translate("This is the name that the VoIP server will use to identify itself when \
registering to VoIP (SIP) providers. Some providers require this to a specific \
string matching a hardware SIP device."))
ua.default = appname
h = s:taboption("remote_usage", Value, "externhost", translate("Domain/IP Address/Dynamic Domain"),
translate("You can enter your domain name, external IP address, or dynamic domain name here \
Please keep in mind that if your IP address is dynamic and it changes your configuration \
will become invalid. Hence, it's recommended to set up Dynamic DNS in this case."))
h.datatype = "hostname"
p = s:taboption("remote_usage", Value, "bindport", translate("External SIP Port"),
translate("Pick a random port number between 6500 and 9500 for the service to listen on. \
Do not pick the standard 5060, because it is often subject to brute-force attacks. \
When finished, (1) click \"Save and Apply\", and (2) click the \"Restart VoIP Service\" \
button above. Finally, (3) look in the \"SIP Device/Softphone Accounts\" section for \
updated Server and Port settings for your SIP Devices/Softphones."))
p.datatype = "port"
p = s:taboption("remote_usage", Value, "rtpstart", translate("RTP Port Range Start"),
translate("RTP traffic carries actual voice packets. This is the start of the port range \
that will be used for setting up RTP communication. It's usually OK to leave this \
at the default value."))
p.datatype = "port"
p.default = defaultrtpstart
p = s:taboption("remote_usage", Value, "rtpend", translate("RTP Port Range End"))
p.datatype = "port"
p.default = defaultrtpend
p = s:taboption("qos", ListValue, "qos_enabled", translate("Insert QoS Rules"))
p:value("yes", translate("Yes"))
p:value("no", translate("No"))
p.default = "yes"
return m

View file

@ -0,0 +1,353 @@
--[[
Copyright 2011 Iordan Iordanov <iiordanov (AT) gmail.com>
This file is part of luci-pbx.
luci-pbx 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.
luci-pbx 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 luci-pbx. If not, see <http://www.gnu.org/licenses/>.
]]--
if nixio.fs.access("/etc/init.d/asterisk") then
server = "asterisk"
elseif nixio.fs.access("/etc/init.d/freeswitch") then
server = "freeswitch"
else
server = ""
end
modulename = "pbx-calls"
voipmodulename = "pbx-voip"
googlemodulename = "pbx-google"
usersmodulename = "pbx-users"
allvalidaccounts = {}
nallvalidaccounts = 0
validoutaccounts = {}
nvalidoutaccounts = 0
validinaccounts = {}
nvalidinaccounts = 0
allvalidusers = {}
nallvalidusers = 0
validoutusers = {}
nvalidoutusers = 0
-- Checks whether the entered extension is valid syntactically.
function is_valid_extension(exten)
return (exten:match("[#*+0-9NXZ]+$") ~= nil)
end
m = Map (modulename, translate("Call Routing"),
translate("This is where you indicate which Google/SIP accounts are used to call what \
country/area codes, which users can use what SIP/Google accounts, how incoming \
calls are routed, what numbers can get into this PBX with a password, and what \
numbers are blacklisted."))
-- Recreate the config, and restart services after changes are commited to the configuration.
function m.on_after_commit(self)
luci.sys.call("/etc/init.d/pbx-" .. server .. " restart 1\>/dev/null 2\>/dev/null")
luci.sys.call("/etc/init.d/" .. server .. " restart 1\>/dev/null 2\>/dev/null")
end
-- Add Google accounts to all valid accounts, and accounts valid for incoming and outgoing calls.
m.uci:foreach(googlemodulename, "gtalk_jabber",
function(s1)
-- Add this provider to list of valid accounts.
if s1.username ~= nil and s1.name ~= nil then
allvalidaccounts[s1.name] = s1.username
nallvalidaccounts = nallvalidaccounts + 1
if s1.make_outgoing_calls == "yes" then
-- Add provider to the associative array of valid outgoing accounts.
validoutaccounts[s1.name] = s1.username
nvalidoutaccounts = nvalidoutaccounts + 1
end
if s1.register == "yes" then
-- Add provider to the associative array of valid outgoing accounts.
validinaccounts[s1.name] = s1.username
nvalidinaccounts = nvalidinaccounts + 1
end
end
end)
-- Add SIP accounts to all valid accounts, and accounts valid for incoming and outgoing calls.
m.uci:foreach(voipmodulename, "voip_provider",
function(s1)
-- Add this provider to list of valid accounts.
if s1.defaultuser ~= nil and s1.host ~= nil and s1.name ~= nil then
allvalidaccounts[s1.name] = s1.defaultuser .. "@" .. s1.host
nallvalidaccounts = nallvalidaccounts + 1
if s1.make_outgoing_calls == "yes" then
-- Add provider to the associative array of valid outgoing accounts.
validoutaccounts[s1.name] = s1.defaultuser .. "@" .. s1.host
nvalidoutaccounts = nvalidoutaccounts + 1
end
if s1.register == "yes" then
-- Add provider to the associative array of valid outgoing accounts.
validinaccounts[s1.name] = s1.defaultuser .. "@" .. s1.host
nvalidinaccounts = nvalidinaccounts + 1
end
end
end)
-- Add Local User accounts to all valid users, and users allowed to make outgoing calls.
m.uci:foreach(usersmodulename, "local_user",
function(s1)
-- Add user to list of all valid users.
if s1.defaultuser ~= nil then
allvalidusers[s1.defaultuser] = true
nallvalidusers = nallvalidusers + 1
if s1.can_call == "yes" then
validoutusers[s1.defaultuser] = true
nvalidoutusers = nvalidoutusers + 1
end
end
end)
----------------------------------------------------------------------------------------------------
-- If there are no accounts configured, or no accounts enabled for outgoing calls, display a warning.
-- Otherwise, display the usual help text within the section.
if nallvalidaccounts == 0 then
text = translate("NOTE: There are no Google or SIP provider accounts configured.")
elseif nvalidoutaccounts == 0 then
text = translate("NOTE: There are no Google or SIP provider accounts enabled for outgoing calls.")
else
text = translate("If you have more than one account that can make outgoing calls, you \
should enter a list of phone numbers and/or prefixes in the following fields for each \
provider listed. Invalid prefixes are removed silently, and only 0-9, X, Z, N, #, *, \
and + are valid characters. The letter X matches 0-9, Z matches 1-9, and N matches 2-9. \
For example to make calls to Germany through a provider, you can enter 49. To make calls \
to North America, you can enter 1NXXNXXXXXX. If one of your providers can make \"local\" \
calls to an area code like New York's 646, you can enter 646NXXXXXX for that \
provider. You should leave one account with an empty list to make calls with \
it by default, if no other provider's prefixes match. The system will automatically \
replace an empty list with a message that the provider dials all numbers not matched by another \
provider's prefixes. Be as specific as possible (i.e. 1NXXNXXXXXX is better than 1). Please note \
all international dial codes are discarded (e.g. 00, 011, 010, 0011). Entries can be made in a \
space-separated list, and/or one per line by hitting enter after every one.")
end
s = m:section(NamedSection, "outgoing_calls", "call_routing", translate("Outgoing Calls"), text)
s.anonymous = true
for k,v in pairs(validoutaccounts) do
patterns = s:option(DynamicList, k, v)
-- If the saved field is empty, we return a string
-- telling the user that this account would dial any exten.
function patterns.cfgvalue(self, section)
value = self.map:get(section, self.option)
if value == nil then
return {translate("Dials numbers unmatched elsewhere")}
else
return value
end
end
-- Write only valid extensions into the config file.
function patterns.write(self, section, value)
newvalue = {}
nindex = 1
for index, field in ipairs(value) do
val = luci.util.trim(value[index])
if is_valid_extension(val) == true then
newvalue[nindex] = val
nindex = nindex + 1
end
end
DynamicList.write(self, section, newvalue)
end
end
----------------------------------------------------------------------------------------------------
-- If there are no accounts configured, or no accounts enabled for incoming calls, display a warning.
-- Otherwise, display the usual help text within the section.
if nallvalidaccounts == 0 then
text = translate("NOTE: There are no Google or SIP provider accounts configured.")
elseif nvalidinaccounts == 0 then
text = translate("NOTE: There are no Google or SIP provider accounts enabled for incoming calls.")
else
text = translate("For each provider enabled for incoming calls, here you can restrict which users to\
ring on incoming calls. If the list is empty, the system will indicate that all users \
enabled for incoming calls will ring. Invalid usernames will be rejected \
silently. Also, entering a username here overrides the user's setting to not receive \
incoming calls. This way, you can make certain users ring only for specific providers. \
Entries can be made in a space-separated list, and/or one per line by hitting enter after \
every one.")
end
s = m:section(NamedSection, "incoming_calls", "call_routing", translate("Incoming Calls"), text)
s.anonymous = true
for k,v in pairs(validinaccounts) do
users = s:option(DynamicList, k, v)
-- If the saved field is empty, we return a string
-- telling the user that this account would dial any exten.
function users.cfgvalue(self, section)
value = self.map:get(section, self.option)
if value == nil then
return {translate("Rings users enabled for incoming calls")}
else
return value
end
end
-- Write only valid user names.
function users.write(self, section, value)
newvalue = {}
nindex = 1
for index, field in ipairs(value) do
trimuser = luci.util.trim(value[index])
if allvalidusers[trimuser] == true then
newvalue[nindex] = trimuser
nindex = nindex + 1
end
end
DynamicList.write(self, section, newvalue)
end
end
----------------------------------------------------------------------------------------------------
-- If there are no user accounts configured, no user accounts enabled for outgoing calls,
-- display a warning. Otherwise, display the usual help text within the section.
if nallvalidusers == 0 then
text = translate("NOTE: There are no local user accounts configured.")
elseif nvalidoutusers == 0 then
text = translate("NOTE: There are no local user accounts enabled for outgoing calls.")
else
text = translate("For each user enabled for outgoing calls you can restrict what providers the user \
can use for outgoing calls. By default all users can use all providers. To show up in the list \
below the user should be allowed to make outgoing calls in the \"User Accounts\" page. Enter VoIP \
providers in the format username@some.host.name, as listed in \"Outgoing Calls\" above. It's \
easiest to copy and paste the providers from above. Invalid entries, including providers not \
enabled for outgoing calls, will be rejected silently. Entries can be made in a space-separated \
list, and/or one per line by hitting enter after every one.")
end
s = m:section(NamedSection, "providers_user_can_use", "call_routing",
translate("Providers Used for Outgoing Calls"), text)
s.anonymous = true
for k,v in pairs(validoutusers) do
providers = s:option(DynamicList, k, k)
-- If the saved field is empty, we return a string
-- telling the user that this account would dial any exten.
function providers.cfgvalue(self, section)
value = self.map:get(section, self.option)
if value == nil then
return {translate("Uses providers enabled for outgoing calls")}
else
newvalue = {}
-- Convert internal names to user@host values.
for i,v in ipairs(value) do
newvalue[i] = validoutaccounts[v]
end
return newvalue
end
end
-- Cook the new values prior to entering them into the config file.
-- Also, enter them only if they are valid.
function providers.write(self, section, value)
cookedvalue = {}
cindex = 1
for index, field in ipairs(value) do
cooked = string.gsub(luci.util.trim(value[index]), "%W", "_")
if validoutaccounts[cooked] ~= nil then
cookedvalue[cindex] = cooked
cindex = cindex + 1
end
end
DynamicList.write(self, section, cookedvalue)
end
end
----------------------------------------------------------------------------------------------------
s = m:section(TypedSection, "callthrough_numbers", translate("Call-through Numbers"),
translate("Designate numbers that are allowed to call through this system and which user's \
privileges it will have."))
s.anonymous = true
s.addremove = true
num = s:option(DynamicList, "callthrough_number_list", translate("Call-through Numbers"))
num.datatype = "uinteger"
p = s:option(ListValue, "enabled", translate("Enabled"))
p:value("yes", translate("Yes"))
p:value("no", translate("No"))
p.default = "yes"
user = s:option(Value, "defaultuser", translate("User Name"),
translate("The number(s) specified above will be able to dial out with this user's providers. \
Invalid usernames, including users not enabled for outgoing calls, are dropped silently. \
Please verify that the entry was accepted."))
function user.write(self, section, value)
trimuser = luci.util.trim(value)
if allvalidusers[trimuser] == true then
Value.write(self, section, trimuser)
end
end
pwd = s:option(Value, "pin", translate("PIN"),
translate("Your PIN disappears when saved for your protection. It will be changed \
only when you enter a value different from the saved one. Leaving the PIN \
empty is possible, but please beware of the security implications."))
pwd.password = true
pwd.rmempty = false
-- We skip reading off the saved value and return nothing.
function pwd.cfgvalue(self, section)
return ""
end
-- We check the entered value against the saved one, and only write if the entered value is
-- something other than the empty string, and it differes from the saved value.
function pwd.write(self, section, value)
local orig_pwd = m:get(section, self.option)
if value and #value > 0 and orig_pwd ~= value then
Value.write(self, section, value)
end
end
----------------------------------------------------------------------------------------------------
s = m:section(NamedSection, "blacklisting", "call_routing", translate("Blacklisted Numbers"),
translate("Enter phone numbers that you want to decline calls from automatically. \
You should probably omit the country code and any leading zeroes, but please \
experiment to make sure you are blocking numbers from your desired area successfully."))
s.anonymous = true
b = s:option(DynamicList, "blacklist1", translate("Dynamic List of Blacklisted Numbers"),
translate("Specify numbers individually here. Press enter to add more numbers."))
b.cast = "string"
b.datatype = "uinteger"
b = s:option(Value, "blacklist2", translate("Space-Separated List of Blacklisted Numbers"),
translate("Copy-paste large lists of numbers here."))
b.template = "cbi/tvalue"
b.rows = 3
return m

View file

@ -0,0 +1,122 @@
--[[
Copyright 2011 Iordan Iordanov <iiordanov (AT) gmail.com>
This file is part of luci-pbx.
luci-pbx 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.
luci-pbx 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 luci-pbx. If not, see <http://www.gnu.org/licenses/>.
]]--
if nixio.fs.access("/etc/init.d/asterisk") then
server = "asterisk"
elseif nixio.fs.access("/etc/init.d/freeswitch") then
server = "freeswitch"
else
server = ""
end
modulename = "pbx-google"
googlemodulename = "pbx-google"
defaultstatus = "dnd"
defaultstatusmessage = "PBX online, may lose messages"
m = Map (modulename, translate("Google Accounts"),
translate("This is where you set up your Google (Talk and Voice) Accounts, in order to start \
using them for dialing and receiving calls (voice chat and real phone calls). Please \
make at least one voice call using the Google Talk plugin installable through the \
GMail interface, and then log out from your account everywhere. Click \"Add\" \
to add as many accounts as you wish."))
-- Recreate the config, and restart services after changes are commited to the configuration.
function m.on_after_commit(self)
-- Create a field "name" for each account that identifies the account in the backend.
commit = false
m.uci:foreach(modulename, "gtalk_jabber",
function(s1)
if s1.username ~= nil then
name=string.gsub(s1.username, "%W", "_")
if s1.name ~= name then
m.uci:set(modulename, s1['.name'], "name", name)
commit = true
end
end
end)
if commit == true then m.uci:commit(modulename) end
luci.sys.call("/etc/init.d/pbx-" .. server .. " restart 1\>/dev/null 2\>/dev/null")
luci.sys.call("/etc/init.d/asterisk restart 1\>/dev/null 2\>/dev/null")
end
-----------------------------------------------------------------------------
s = m:section(TypedSection, "gtalk_jabber", translate("Google Voice/Talk Accounts"))
s.anonymous = true
s.addremove = true
s:option(Value, "username", translate("Email"))
pwd = s:option(Value, "secret", translate("Password"),
translate("When your password is saved, it disappears from this field and is not displayed \
for your protection. The previously saved password will be changed only when you \
enter a value different from the saved one."))
pwd.password = true
pwd.rmempty = false
-- We skip reading off the saved value and return nothing.
function pwd.cfgvalue(self, section)
return ""
end
-- We check the entered value against the saved one, and only write if the entered value is
-- something other than the empty string, and it differes from the saved value.
function pwd.write(self, section, value)
local orig_pwd = m:get(section, self.option)
if value and #value > 0 and orig_pwd ~= value then
Value.write(self, section, value)
end
end
p = s:option(ListValue, "register",
translate("Enable Incoming Calls (set Status below)"),
translate("When somebody starts voice chat with your GTalk account or calls the GVoice, \
number (if you have Google Voice), the call will be forwarded to any users \
that are online (registered using a SIP device or softphone) and permitted to \
receive the call. If you have Google Voice, you must go to your GVoice settings and \
forward calls to Google chat in order to actually receive calls made to your \
GVoice number. If you have trouble receiving calls from GVoice, experiment \
with the Call Screening option in your GVoice Settings. Finally, make sure no other \
client is online with this account (browser in gmail, mobile/desktop Google Talk \
App) as it may interfere."))
p:value("yes", translate("Yes"))
p:value("no", translate("No"))
p.default = "yes"
p = s:option(ListValue, "make_outgoing_calls", translate("Enable Outgoing Calls"),
translate("Use this account to make outgoing calls as configured in the \"Call Routing\" section."))
p:value("yes", translate("Yes"))
p:value("no", translate("No"))
p.default = "yes"
st = s:option(ListValue, "status", translate("Google Talk Status"))
st:depends("register", "yes")
st:value("dnd", translate("Do Not Disturb"))
st:value("away", translate("Away"))
st:value("available", translate("Available"))
st.default = defaultstatus
stm = s:option(Value, "statusmessage", translate("Google Talk Status Message"),
translate("Avoid using anything but alpha-numeric characters, space, comma, and period."))
stm:depends("register", "yes")
stm.default = defaultstatusmessage
return m

View file

@ -0,0 +1,133 @@
--[[
Copyright 2011 Iordan Iordanov <iiordanov (AT) gmail.com>
This file is part of luci-pbx.
luci-pbx 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.
luci-pbx 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 luci-pbx. If not, see <http://www.gnu.org/licenses/>.
]]--
if nixio.fs.access("/etc/init.d/asterisk") then
server = "asterisk"
elseif nixio.fs.access("/etc/init.d/freeswitch") then
server = "freeswitch"
else
server = ""
end
modulename = "pbx-users"
modulenamecalls = "pbx-calls"
modulenameadvanced = "pbx-advanced"
m = Map (modulename, translate("User Accounts"),
translate("Here you must configure at least one SIP account, that you \
will use to register with this service. Use this account either in an Analog Telephony \
Adapter (ATA), or in a SIP software like CSipSimple, Linphone, or Sipdroid on your \
smartphone, or Ekiga, Linphone, or X-Lite on your computer. By default, all SIP accounts \
will ring simultaneously if a call is made to one of your VoIP provider accounts or GV \
numbers."))
-- Recreate the config, and restart services after changes are commited to the configuration.
function m.on_after_commit(self)
luci.sys.call("/etc/init.d/pbx-" .. server .. " restart 1\>/dev/null 2\>/dev/null")
luci.sys.call("/etc/init.d/" .. server .. " restart 1\>/dev/null 2\>/dev/null")
end
externhost = m.uci:get(modulenameadvanced, "advanced", "externhost")
bindport = m.uci:get(modulenameadvanced, "advanced", "bindport")
ipaddr = m.uci:get("network", "lan", "ipaddr")
-----------------------------------------------------------------------------
s = m:section(NamedSection, "server", "user", translate("Server Setting"))
s.anonymous = true
if ipaddr == nil or ipaddr == "" then
ipaddr = "(IP address not static)"
end
if bindport ~= nil then
just_ipaddr = ipaddr
ipaddr = ipaddr .. ":" .. bindport
end
s:option(DummyValue, "ipaddr", translate("Server Setting for Local SIP Devices"),
translate("Enter this IP (or IP:port) in the Server/Registrar setting of SIP devices you will \
use ONLY locally and never from a remote location.")).default = ipaddr
if externhost ~= nil then
if bindport ~= nil then
just_externhost = externhost
externhost = externhost .. ":" .. bindport
end
s:option(DummyValue, "externhost", translate("Server Setting for Remote SIP Devices"),
translate("Enter this hostname (or hostname:port) in the Server/Registrar setting of SIP \
devices you will use from a remote location (they will work locally too).")
).default = externhost
end
if bindport ~= nil then
s:option(DummyValue, "bindport", translate("Port Setting for SIP Devices"),
translatef("If setting Server/Registrar to %s or %s does not work for you, try setting \
it to %s or %s and entering this port number in a separate field that specifies the \
Server/Registrar port number. Beware that some devices have a confusing \
setting that sets the port where SIP requests originate from on the SIP \
device itself (the bind port). The port specified on this page is NOT this bind port \
but the port this service listens on.",
ipaddr, externhost, just_ipaddr, just_externhost)).default = bindport
end
-----------------------------------------------------------------------------
s = m:section(TypedSection, "local_user", translate("SIP Device/Softphone Accounts"))
s.anonymous = true
s.addremove = true
s:option(Value, "fullname", translate("Full Name"),
translate("You can specify a real name to show up in the Caller ID here."))
du = s:option(Value, "defaultuser", translate("User Name"),
translate("Use (four to five digit) numeric user name if you are connecting normal telephones \
with ATAs to this system (so they can dial user names)."))
du.datatype = "uciname"
pwd = s:option(Value, "secret", translate("Password"),
translate("Your password disappears when saved for your protection. It will be changed \
only when you enter a value different from the saved one."))
pwd.password = true
pwd.rmempty = false
-- We skip reading off the saved value and return nothing.
function pwd.cfgvalue(self, section)
return ""
end
-- We check the entered value against the saved one, and only write if the entered value is
-- something other than the empty string, and it differes from the saved value.
function pwd.write(self, section, value)
local orig_pwd = m:get(section, self.option)
if value and #value > 0 and orig_pwd ~= value then
Value.write(self, section, value)
end
end
p = s:option(ListValue, "ring", translate("Receives Incoming Calls"))
p:value("yes", translate("Yes"))
p:value("no", translate("No"))
p.default = "yes"
p = s:option(ListValue, "can_call", translate("Makes Outgoing Calls"))
p:value("yes", translate("Yes"))
p:value("no", translate("No"))
p.default = "yes"
return m

View file

@ -0,0 +1,116 @@
--[[
Copyright 2011 Iordan Iordanov <iiordanov (AT) gmail.com>
This file is part of luci-pbx.
luci-pbx 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.
luci-pbx 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 luci-pbx. If not, see <http://www.gnu.org/licenses/>.
]]--
if nixio.fs.access("/etc/init.d/asterisk") then
server = "asterisk"
elseif nixio.fs.access("/etc/init.d/freeswitch") then
server = "freeswitch"
else
server = ""
end
modulename = "pbx-voip"
m = Map (modulename, translate("SIP Accounts"),
translate("This is where you set up your SIP (VoIP) accounts ts like Sipgate, SipSorcery, \
the popular Betamax providers, and any other providers with SIP settings in order to start \
using them for dialing and receiving calls (SIP uri and real phone calls). Click \"Add\" to \
add as many accounts as you wish."))
-- Recreate the config, and restart services after changes are commited to the configuration.
function m.on_after_commit(self)
commit = false
-- Create a field "name" for each account that identifies the account in the backend.
m.uci:foreach(modulename, "voip_provider",
function(s1)
if s1.defaultuser ~= nil and s1.host ~= nil then
name=string.gsub(s1.defaultuser.."_"..s1.host, "%W", "_")
if s1.name ~= name then
m.uci:set(modulename, s1['.name'], "name", name)
commit = true
end
end
end)
if commit == true then m.uci:commit(modulename) end
luci.sys.call("/etc/init.d/pbx-" .. server .. " restart 1\>/dev/null 2\>/dev/null")
luci.sys.call("/etc/init.d/" .. server .. " restart 1\>/dev/null 2\>/dev/null")
end
-----------------------------------------------------------------------------
s = m:section(TypedSection, "voip_provider", translate("SIP Provider Accounts"))
s.anonymous = true
s.addremove = true
s:option(Value, "defaultuser", translate("User Name"))
pwd = s:option(Value, "secret", translate("Password"),
translate("When your password is saved, it disappears from this field and is not displayed \
for your protection. The previously saved password will be changed only when you \
enter a value different from the saved one."))
pwd.password = true
pwd.rmempty = false
-- We skip reading off the saved value and return nothing.
function pwd.cfgvalue(self, section)
return ""
end
-- We check the entered value against the saved one, and only write if the entered value is
-- something other than the empty string, and it differes from the saved value.
function pwd.write(self, section, value)
local orig_pwd = m:get(section, self.option)
if value and #value > 0 and orig_pwd ~= value then
Value.write(self, section, value)
end
end
h = s:option(Value, "host", translate("SIP Server/Registrar"))
h.datatype = "host"
p = s:option(ListValue, "register", translate("Enable Incoming Calls (Register via SIP)"),
translate("This option should be set to \"Yes\" if you have a DID \(real telephone number\) \
associated with this SIP account or want to receive SIP uri calls through this \
provider."))
p:value("yes", translate("Yes"))
p:value("no", translate("No"))
p.default = "yes"
p = s:option(ListValue, "make_outgoing_calls", translate("Enable Outgoing Calls"),
translate("Use this account to make outgoing calls."))
p:value("yes", translate("Yes"))
p:value("no", translate("No"))
p.default = "yes"
from = s:option(Value, "fromdomain",
translate("SIP Realm (needed by some providers)"))
from.optional = true
from.datatype = "host"
port = s:option(Value, "port", translate("SIP Server/Registrar Port"))
port.optional = true
port.datatype = "port"
op = s:option(Value, "outboundproxy", translate("Outbound Proxy"))
op.optional = true
op.datatype = "host"
return m

View file

@ -0,0 +1,115 @@
--[[
Copyright 2011 Iordan Iordanov <iiordanov (AT) gmail.com>
This file is part of luci-pbx.
luci-pbx 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.
luci-pbx 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 luci-pbx. If not, see <http://www.gnu.org/licenses/>.
]]--
modulename = "pbx"
if nixio.fs.access("/etc/init.d/asterisk") then
server = "asterisk"
elseif nixio.fs.access("/etc/init.d/freeswitch") then
server = "freeswitch"
else
server = ""
end
-- Returns formatted output of string containing only the words at the indices
-- specified in the table "indices".
function format_indices(string, indices)
if indices == nil then
return "Error: No indices to format specified.\n"
end
-- Split input into separate lines.
lines = luci.util.split(luci.util.trim(string), "\n")
-- Split lines into separate words.
splitlines = {}
for lpos,line in ipairs(lines) do
splitlines[lpos] = luci.util.split(luci.util.trim(line), "%s+", nil, true)
end
-- For each split line, if the word at all indices specified
-- to be formatted are not null, add the formatted line to the
-- gathered output.
output = ""
for lpos,splitline in ipairs(splitlines) do
loutput = ""
for ipos,index in ipairs(indices) do
if splitline[index] ~= nil then
loutput = loutput .. string.format("%-40s", splitline[index])
else
loutput = nil
break
end
end
if loutput ~= nil then
output = output .. loutput .. "\n"
end
end
return output
end
m = Map (modulename, translate("PBX Main Page"),
translate("This configuration page allows you to configure a phone system (PBX) service which \
permits making phone calls through multiple Google and SIP (like Sipgate, \
SipSorcery, and Betamax) accounts and sharing them among many SIP devices. \
Note that Google accounts, SIP accounts, and local user accounts are configured in the \
\"Google Accounts\", \"SIP Accounts\", and \"User Accounts\" sub-sections. \
You must add at least one User Account to this PBX, and then configure a SIP device or \
softphone to use the account, in order to make and receive calls with your Google/SIP \
accounts. Configuring multiple users will allow you to make free calls between all users, \
and share the configured Google and SIP accounts. If you have more than one Google and SIP \
accounts set up, you should probably configure how calls to and from them are routed in \
the \"Call Routing\" page. If you're interested in using your own PBX from anywhere in the \
world, then visit the \"Remote Usage\" section in the \"Advanced Settings\" page."))
-----------------------------------------------------------------------------------------
s = m:section(NamedSection, "connection_status", "main",
translate("PBX Service Status"))
s.anonymous = true
s:option (DummyValue, "status", translate("Service Status"))
sts = s:option(DummyValue, "_sts")
sts.template = "cbi/tvalue"
sts.rows = 20
function sts.cfgvalue(self, section)
if server == "asterisk" then
regs = luci.sys.exec("asterisk -rx 'sip show registry' | sed 's/peer-//'")
jabs = luci.sys.exec("asterisk -rx 'jabber show connections' | grep onnected")
usrs = luci.sys.exec("asterisk -rx 'sip show users'")
chan = luci.sys.exec("asterisk -rx 'core show channels'")
return format_indices(regs, {1, 5}) ..
format_indices(jabs, {2, 4}) .. "\n" ..
format_indices(usrs, {1} ) .. "\n" .. chan
elseif server == "freeswitch" then
return "Freeswitch is not supported yet.\n"
else
return "Neither Asterisk nor FreeSwitch discovered, please install Asterisk, as Freeswitch is not supported yet.\n"
end
end
return m

View file

@ -0,0 +1 @@
config 'main' 'connection_status'

View file

@ -0,0 +1,5 @@
config 'settings' 'advanced'
option 'useragent' 'PBX'
option 'ringtime' '30'
option 'rtpstart' '19850'
option 'rtpend' '19900'

View file

@ -0,0 +1,7 @@
config 'call_routing' 'outgoing_calls'
config 'call_routing' 'incoming_calls'
config 'call_routing' 'providers_user_can_use'
config 'call_routing' 'blacklisting'

View file

@ -0,0 +1 @@
config 'user' 'server'

View file

@ -0,0 +1,701 @@
#!/bin/sh /etc/rc.common
#
# Copyright 2011 Iordan Iordanov <iiordanov (AT) gmail.com>
#
# This file is part of luci-pbx.
#
# luci-pbx 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.
#
# luci-pbx 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 luci-pbx. If not, see <http://www.gnu.org/licenses/>.
. /etc/functions.sh
START=60
# Some global variables
MODULENAME=pbx
USERAGENT="PBX"
HANGUPCNTXT=hangup-call-context
GTALKUNVL=unavailable
ASTUSER=nobody
ASTGROUP=nogroup
ASTDIRSRECURSIVE="/var/run/asterisk /var/log/asterisk /var/spool/asterisk"
ASTDIRS="/usr/lib/asterisk"
ASTSOUNDSDIR="/usr/lib/asterisk/sounds"
TEMPLATEDIR=/etc/${MODULENAME}-asterisk
PBXSOUNDSDIR=$TEMPLATEDIR/sounds
VMTEMPLATEDIR=/etc/${MODULENAME}-voicemail
VMSOUNDSDIR=$VMTEMPLATEDIR/sounds
ASTERISKDIR=/etc/asterisk
WORKDIR=/tmp/$MODULENAME.$$
MD5SUMSFILE=/tmp/$MODULENAME-sums.$$
TMPL_ASTERISK=$TEMPLATEDIR/asterisk.conf.TEMPLATE
TMPL_GTALK=$TEMPLATEDIR/gtalk.conf.TEMPLATE
TMPL_INDICATIONS=$TEMPLATEDIR/indications.conf.TEMPLATE
TMPL_LOGGER=$TEMPLATEDIR/logger.conf.TEMPLATE
TMPL_MANAGER=$TEMPLATEDIR/manager.conf.TEMPLATE
TMPL_MODULES=$TEMPLATEDIR/modules.conf.TEMPLATE
TMPL_RTP=$TEMPLATEDIR/rtp.conf.TEMPLATE
TMPL_EXTCTHRUCHECKHDR=$TEMPLATEDIR/extensions_disa-check_header.conf.TEMPLATE
TMPL_EXTCTHRUCHECK=$TEMPLATEDIR/extensions_disa-check.conf.TEMPLATE
TMPL_EXTCTHRUCHECKFTR=$TEMPLATEDIR/extensions_disa-check_footer.conf.TEMPLATE
TMPL_EXTCTHRUHDR=$TEMPLATEDIR/extensions_disa_header.conf.TEMPLATE
TMPL_EXTCTHRU=$TEMPLATEDIR/extensions_disa.conf.TEMPLATE
TMPL_EXTENSIONS=$TEMPLATEDIR/extensions.conf.TEMPLATE
TMPL_EXTVMDISABLED=$TEMPLATEDIR/extensions_voicemail_disabled.conf.TEMPLATE
TMPL_EXTVMENABLED=$TEMPLATEDIR/extensions_voicemail_enabled.conf.TEMPLATE
TMPL_EXTBLKLIST=$TEMPLATEDIR/extensions_blacklist.conf.TEMPLATE
TMPL_EXTBLKLISTFTR=$TEMPLATEDIR/extensions_blacklist_footer.conf.TEMPLATE
TMPL_EXTBLKLISTHDR=$TEMPLATEDIR/extensions_blacklist_header.conf.TEMPLATE
TMPL_EXTDEFAULT=$TEMPLATEDIR/extensions_default.conf.TEMPLATE
TMPL_EXTDEFAULTUSER=$TEMPLATEDIR/extensions_default_user.conf.TEMPLATE
TMPL_EXTINCNTXTSIP=$TEMPLATEDIR/extensions_incoming_context_sip.conf.TEMPLATE
TMPL_EXTINCNTXTGTALKHDR=$TEMPLATEDIR/extensions_incoming_context_gtalk_header.conf.TEMPLATE
TMPL_EXTINCNTXTGTALK=$TEMPLATEDIR/extensions_incoming_context_gtalk.conf.TEMPLATE
TMPL_EXTUSERCNTXT=$TEMPLATEDIR/extensions_user_context.conf.TEMPLATE
TMPL_EXTUSERCNTXTFTR=$TEMPLATEDIR/extensions_user_context_footer.conf.TEMPLATE
TMPL_EXTUSERCNTXTHDR=$TEMPLATEDIR/extensions_user_context_header.conf.TEMPLATE
TMPL_EXTOUTHDR=$TEMPLATEDIR/extensions_default_outgoing_header.conf.TEMPLATE
TMPL_EXTOUTGTALK=$TEMPLATEDIR/extensions_outgoing_gtalk.conf.TEMPLATE
TMPL_EXTOUTLOCAL=$TEMPLATEDIR/extensions_outgoing_dial_local_user.conf.TEMPLATE
TMPL_EXTOUTSIP=$TEMPLATEDIR/extensions_outgoing_sip.conf.TEMPLATE
TMPL_JABBER=$TEMPLATEDIR/jabber.conf.TEMPLATE
TMPL_JABBERUSER=$TEMPLATEDIR/jabber_users.conf.TEMPLATE
TMPL_SIP=$TEMPLATEDIR/sip.conf.TEMPLATE
TMPL_SIPPEER=$TEMPLATEDIR/sip_peer.TEMPLATE
TMPL_SIPREG=$TEMPLATEDIR/sip_registration.TEMPLATE
TMPL_SIPUSR=$TEMPLATEDIR/sip_user.TEMPLATE
TMPL_MSMTPDEFAULT=$VMTEMPLATEDIR/pbx-msmtprc-defaults.TEMPLATE
TMPL_MSMTPACCOUNT=$VMTEMPLATEDIR/pbx-msmtprc-account.TEMPLATE
TMPL_MSMTPAUTH=$VMTEMPLATEDIR/pbx-msmtprc-account-auth.TEMPLATE
TMPL_MSMTPACCTDFLT=$VMTEMPLATEDIR/pbx-msmtprc-account-default.TEMPLATE
INCLUDED_FILES="$WORKDIR/extensions_blacklist.conf $WORKDIR/extensions_callthrough.conf\
$WORKDIR/extensions_incoming.conf $WORKDIR/extensions_incoming_gtalk.conf\
$WORKDIR/extensions_user.conf $WORKDIR/jabber_users.conf\
$WORKDIR/sip_peers.conf $WORKDIR/sip_registrations.conf\
$WORKDIR/sip_users.conf $WORKDIR/extensions_voicemail.conf\
$WORKDIR/extensions_default.conf"
# In this string, we concatenate all local users enabled to receive calls
# readily formatted for the Dial command.
localusers_to_ring=""
# In this string, we keep a list of all users that are enabled for outgoing
# calls. It is used at the end to create the user contexts.
localusers_can_dial=""
# In this string, we put together a space-separated list of provider names
# (alphanumeric, with all non-alpha characters replaced with underscores),
# which will be used to dial out by default (whose outgoing contexts will
# be included in users' contexts by default.
outbound_providers=""
# Copies the template files which we don't edit.
copy_unedited_templates_over()
{
cp $TMPL_ASTERISK $WORKDIR/asterisk.conf
cp $TMPL_GTALK $WORKDIR/gtalk.conf
cp $TMPL_INDICATIONS $WORKDIR/indications.conf
cp $TMPL_LOGGER $WORKDIR/logger.conf
cp $TMPL_MANAGER $WORKDIR/manager.conf
cp $TMPL_MODULES $WORKDIR/modules.conf
# If this file isn't present at this stage, voicemail is disabled.
[ ! -f $WORKDIR/extensions_voicemail.conf ] && \
cp $TMPL_EXTVMDISABLED $WORKDIR/extensions_voicemail.conf
}
# Touches all the included files, to prevent asterisk from refusing to
# start if a config item is missing and an included config file isn't created.
create_included_files()
{
touch $INCLUDED_FILES
}
# Puts together all the extensions.conf related configuration.
pbx_create_extensions_config()
{
local ringtime
config_get ringtime advanced ringtime
sed "s/|RINGTIME|/$ringtime/" $TMPL_EXTENSIONS > $WORKDIR/extensions.conf
mv $WORKDIR/inext.TMP $WORKDIR/extensions_incoming.conf
cp $TMPL_EXTINCNTXTGTALKHDR $WORKDIR/extensions_incoming_gtalk.conf
cat $WORKDIR/outextgtalk.TMP >> $WORKDIR/extensions_incoming_gtalk.conf 2>/dev/null
rm -f $WORKDIR/outextgtalk.TMP
mv $WORKDIR/blacklist.TMP $WORKDIR/extensions_blacklist.conf
mv $WORKDIR/userext.TMP $WORKDIR/extensions_user.conf
cp $TMPL_EXTCTHRUHDR $WORKDIR/extensions_callthrough.conf
cat $WORKDIR/callthrough.TMP >> $WORKDIR/extensions_callthrough.conf 2>/dev/null
rm -f $WORKDIR/callthrough.TMP
cat $TMPL_EXTCTHRUCHECKHDR >> $WORKDIR/extensions_callthrough.conf 2>/dev/null
cat $WORKDIR/callthroughcheck.TMP >> $WORKDIR/extensions_callthrough.conf 2>/dev/null
rm -f $WORKDIR/callthroughcheck.TMP
cat $TMPL_EXTCTHRUCHECKFTR >> $WORKDIR/extensions_callthrough.conf 2>/dev/null
rm -f $WORKDIR/outext-*.TMP
rm -f $WORKDIR/localext.TMP
sed "s/|LOCALUSERS|/$localusers_to_ring/g" $TMPL_EXTDEFAULT \
> $WORKDIR/extensions_default.conf
cat $WORKDIR/inextuser.TMP >> $WORKDIR/extensions_default.conf
rm -f $WORKDIR/inextuser.TMP
}
# Puts together all the sip.conf related configuration.
pbx_create_sip_config()
{
mv $WORKDIR/sip_regs.TMP $WORKDIR/sip_registrations.conf
mv $WORKDIR/sip_peers.TMP $WORKDIR/sip_peers.conf
mv $WORKDIR/sip_users.TMP $WORKDIR/sip_users.conf
}
# Creates the jabber.conf related config
pbx_create_jabber_config()
{
cp $TMPL_JABBER $WORKDIR/jabber.conf
mv $WORKDIR/jabber.TMP $WORKDIR/jabber_users.conf
}
# Gets rid of any config files from $ASTERISKDIR not found in $WORKDIR.
clean_up_asterisk_config_dir()
{
for f in $ASTERISKDIR/* ; do
basef="`basename $f`"
if [ ! -e "$WORKDIR/$basef" ] ; then
rm -rf "$f"
fi
done
}
# Compares md5sums of the config files in $WORKDIR to those
# in $ASTERISKDIR, and copies only changed files over to reduce
# wear on flash in embedded devices.
compare_configs_and_copy_changed()
{
# First, compute md5sums of the config files in $WORKDIR.
cd $WORKDIR/
md5sum * > $MD5SUMSFILE
# Now, check the files in $ASTERISKDIR against the md5sums.
cd $ASTERISKDIR/
changed_files="`md5sum -c $MD5SUMSFILE 2>/dev/null | fgrep ": FAILED" | awk -F: '{print $1}'`"
rm -f $MD5SUMSFILE
[ -z "$changed_files" ] && return
# Now copy over the changed files.
for f in $changed_files ; do
cp "$WORKDIR/$f" "$ASTERISKDIR/$f"
done
}
# Calls the functions that create the final config files
# Calls the function which compares which files have changed
# Puts the final touches on $ASTERISKDIR
# Gets rid of $WORKDIR
pbx_assemble_and_copy_config()
{
mkdir -p $ASTERISKDIR
copy_unedited_templates_over
create_included_files
pbx_create_extensions_config
pbx_create_sip_config
pbx_create_jabber_config
touch $WORKDIR/features.conf
# At this point, $WORKDIR should contain a complete, working config.
clean_up_asterisk_config_dir
compare_configs_and_copy_changed
[ ! -d $ASTERISKDIR/manager.d ] && mkdir -p $ASTERISKDIR/manager.d/
# Get rid of the working directory
rm -rf $WORKDIR/
}
# Creates configuration for a user and adds it to the temporary file that holds
# all users configured so far.
pbx_add_user()
{
local fullname
local defaultuser
local secret
local ring
local can_call
config_get fullname $1 fullname
config_get defaultuser $1 defaultuser
config_get secret $1 secret
config_get ring $1 ring
config_get can_call $1 can_call
[ -z "$defaultuser" -o -z "$secret" ] && return
[ -z "$fullname" ] && fullname="$defaultuser"
sed "s/|DEFAULTUSER|/$defaultuser/g" $TMPL_SIPUSR > $WORKDIR/sip_user.tmp
if [ "$can_call" = "yes" ] ; then
# Add user to list of all users that are allowed to make calls.
localusers_can_dial="$localusers_can_dial $defaultuser"
sed -i "s/|CONTEXTNAME|/$defaultuser/g" $WORKDIR/sip_user.tmp
else
sed -i "s/|CONTEXTNAME|/$HANGUPCNTXT/g" $WORKDIR/sip_user.tmp
fi
# Add this user's configuration to the temp file containing all user configs.
sed "s/|FULLNAME|/$fullname/" $WORKDIR/sip_user.tmp |\
sed "s/|SECRET|/$secret/g" >> $WORKDIR/sip_users.TMP
if [ "$ring" = "yes" ] ; then
if [ -z "$localusers_to_ring" ] ; then
localusers_to_ring="SIP\/$defaultuser"
else
localusers_to_ring="$localusers_to_ring\&SIP\/$defaultuser"
fi
fi
# Add configuration which allows local users to call each other.
sed "s/|DEFAULTUSER|/$defaultuser/g" $TMPL_EXTOUTLOCAL >> $WORKDIR/localext.TMP
# Add configuration which puts calls to users through the default
# context, so that blacklists and voicemail take effect for this user.
sed "s/|DEFAULTUSER|/$defaultuser/g" $TMPL_EXTDEFAULTUSER >> $WORKDIR/inextuser.TMP
rm -f $WORKDIR/sip_user.tmp
}
# Creates configuration for a Google account, and adds it to the temporary file that holds
# all accounts configured so far.
# Also creates the outgoing extensions which are used in users' outgoing contexts.
pbx_add_jabber()
{
local username
local secret
local numprefix
local register
local make_outgoing_calls
local name
local users_to_ring
local status
local statusmessage
config_get username $1 username
config_get secret $1 secret
config_get numprefix $1 numprefix
config_get register $1 register
config_get make_outgoing_calls $1 make_outgoing_calls
config_get name $1 name
config_get status $1 status
config_get statusmessage $1 statusmessage
[ -z "$username" -o -z "$secret" ] && return
# Construct a jabber entry for this provider.
sed "s/|USERNAME|/$username/g" $TMPL_JABBERUSER |\
sed "s/|NAME|/$name/g" > $WORKDIR/jabber.tmp
if [ "$register" = yes ] ; then
# If this provider is enabled for incoming calls, we need to set the
# status of the user to something other than unavailable in order to receive calls.
sed -i "s/|STATUS|/$status/g" $WORKDIR/jabber.tmp
sed -i "s/|STATUSMESSAGE|/\"$statusmessage\"/g" $WORKDIR/jabber.tmp
users_to_ring="`uci -q get ${MODULENAME}-calls.incoming_calls.$name`"
# If no users have been specified to ring, we ring all users enabled for incoming calls.
if [ -z "$users_to_ring" ] ; then
users_to_ring=$localusers_to_ring
else
# Else, we cook up a string formatted for the Dial command
# with the specified users (SIP/user1&SIP/user2&...). We do it
# with set, shift and a loop in order to be more tolerant of ugly whitespace
# messes entered by users.
set $users_to_ring
users_to_ring="SIP\/$1" && shift
for u in $@ ; do users_to_ring=$users_to_ring\\\&SIP\\\/$u ; done
fi
# Now, we add this account to the gtalk incoming context.
sed "s/|USERNAME|/$username/g" $TMPL_EXTINCNTXTGTALK |\
sed "s/|LOCALUSERS|/$users_to_ring/g" >> $WORKDIR/outextgtalk.TMP
else
sed -i "s/|STATUS|/$GTALKUNVL/g" $WORKDIR/jabber.tmp
sed -i "s/|STATUSMESSAGE|/\"\"/g" $WORKDIR/jabber.tmp
fi
# Add this account's configuration to the temp file containing all account configs.
sed "s/|SECRET|/$secret/g" $WORKDIR/jabber.tmp >> $WORKDIR/jabber.TMP
# If this provider is enabled for outgoing calls.
if [ "$make_outgoing_calls" = "yes" ] ; then
numprefix="`uci -q get ${MODULENAME}-calls.outgoing_calls.$name`"
# If no prefixes are specified, then we use "X" which matches any prefix.
[ -z "$numprefix" ] && numprefix="X"
for p in $numprefix ; do
sed "s/|NUMPREFIX|/$p/g" $TMPL_EXTOUTGTALK |\
sed "s/|NAME|/$name/g" >> $WORKDIR/outext-$name.TMP
done
# Add this provider to the list of enabled outbound providers.
if [ -z "$outbound_providers" ] ; then
outbound_providers="$name"
else
outbound_providers="$outbound_providers $name"
fi
fi
rm -f $WORKDIR/jabber.tmp
}
# Creates configuration for a SIP provider account, and adds it to the temporary file that holds
# all accounts configured so far.
# Also creates the outgoing extensions which are used in users' outgoing contexts.
pbx_add_peer()
{
local defaultuser
local secret
local host
local fromdomain
local register
local numprefix
local make_outgoing_calls
local name
local users_to_ring
local port
local outboundproxy
config_get defaultuser $1 defaultuser
config_get secret $1 secret
config_get host $1 host
config_get port $1 port
config_get outbountproxy $1 outboundproxy
config_get fromdomain $1 fromdomain
config_get register $1 register
config_get numprefix $1 numprefix
config_get make_outgoing_calls $1 make_outgoing_calls
config_get name $1 name
[ -z "$defaultuser" -o -z "$secret" -o -z "$host" ] && return
[ -z "$fromdomain" ] && fromdomain=$host
[ -n "$port" ] && port="port=$port"
[ -n "$outboundproxy" ] && outboundproxy="outboundproxy=$outboundproxy"
# Construct a sip peer entry for this provider.
sed "s/|DEFAULTUSER|/$defaultuser/" $TMPL_SIPPEER > $WORKDIR/sip_peer.tmp
sed -i "s/|NAME|/$name/" $WORKDIR/sip_peer.tmp
sed -i "s/|FROMUSER|/$defaultuser/" $WORKDIR/sip_peer.tmp
sed -i "s/|SECRET|/$secret/" $WORKDIR/sip_peer.tmp
sed -i "s/|HOST|/$host/" $WORKDIR/sip_peer.tmp
sed -i "s/|PORT|/$port/" $WORKDIR/sip_peer.tmp
sed -i "s/|OUTBOUNDPROXY|/$outboundproxy/" $WORKDIR/sip_peer.tmp
# Add this account's configuration to the temp file containing all account configs.
sed "s/|FROMDOMAIN|/$host/" $WORKDIR/sip_peer.tmp >> $WORKDIR/sip_peers.TMP
# If this provider is enabled for incoming calls.
if [ "$register" = "yes" ] ; then
# Then we create a registration string for this provider.
sed "s/|DEFAULTUSER|/$defaultuser/g" $TMPL_SIPREG > $WORKDIR/sip_reg.tmp
sed -i "s/|SECRET|/$secret/g" $WORKDIR/sip_reg.tmp
sed "s/|NAME|/$name/g" $WORKDIR/sip_reg.tmp >> $WORKDIR/sip_regs.TMP
users_to_ring="`uci -q get ${MODULENAME}-calls.incoming_calls.$name`"
# If no users have been specified to ring, we ring all users enabled for incoming calls.
if [ -z "$users_to_ring" ] ; then
users_to_ring=$localusers_to_ring
else
# Else, we cook up a string formatted for the Dial command
# with the specified users (SIP/user1&SIP/user2&...). We do it
# with set, shift and a loop in order to be more tolerant of ugly whitespace
# messes entered by users.
set $users_to_ring
users_to_ring="SIP\/$1" && shift
for u in $@ ; do users_to_ring=$users_to_ring\\\&SIP\\\/$u ; done
fi
# And we create an incoming calls context for this provider.
sed "s/|NAME|/$name/g" $TMPL_EXTINCNTXTSIP |\
sed "s/|LOCALUSERS|/$users_to_ring/g" >> $WORKDIR/inext.TMP
fi
# If this provider is enabled for outgoing calls.
if [ "$make_outgoing_calls" = "yes" ] ; then
numprefix="`uci -q get ${MODULENAME}-calls.outgoing_calls.$name`"
# If no prefixes are specified, then we use "X" which matches any prefix.
[ -z "$numprefix" ] && numprefix="X"
for p in $numprefix ; do
sed "s/|NUMPREFIX|/$p/g" $TMPL_EXTOUTSIP |\
sed "s/|NAME|/$name/g" >> $WORKDIR/outext-$name.TMP
done
# Add this provider to the list of enabled outbound providers.
if [ -z "$outbound_providers" ] ; then
outbound_providers="$name"
else
outbound_providers="$outbound_providers $name"
fi
fi
rm -f $WORKDIR/sip_peer.tmp
rm -f $WORKDIR/sip_reg.tmp
}
# For all local users enabled for outbound calls, creates a context
# containing the extensions for Google and SIP accounts this user is
# allowed to use.
pbx_create_user_contexts()
{
local providers
for u in $localusers_can_dial ; do
sed "s/|DEFAULTUSER|/$u/g" $TMPL_EXTUSERCNTXTHDR >> $WORKDIR/userext.TMP
cat $WORKDIR/localext.TMP >> $WORKDIR/userext.TMP
providers="`uci -q get ${MODULENAME}-calls.providers_user_can_use.$u`"
[ -z "$providers" ] && providers="$outbound_providers"
# For each provider, cat the contents of outext-$name.TMP into the user's outgoing calls extension
for p in $providers ; do
[ -f $WORKDIR/outext-$p.TMP ] && cat $WORKDIR/outext-$p.TMP >> $WORKDIR/userext.TMP
done
cat $TMPL_EXTUSERCNTXTFTR >> $WORKDIR/userext.TMP
done
}
# Creates the blacklist context which hangs up on blacklisted numbers.
pbx_add_blacklist()
{
local blacklist1
local blacklist2
config_get blacklist1 blacklisting blacklist1
config_get blacklist2 blacklisting blacklist2
# We create the blacklist context no matter whether the blacklist
# actually contains entries or not, since the PBX will send calls
# to the context for a check against the list anyway.
cp $TMPL_EXTBLKLISTHDR $WORKDIR/blacklist.TMP
for n in $blacklist1 $blacklist2 ; do
sed "s/|BLACKLISTITEM|/$n/g" $TMPL_EXTBLKLIST >> $WORKDIR/blacklist.TMP
done
cat $TMPL_EXTBLKLISTFTR >> $WORKDIR/blacklist.TMP
}
# Creates the callthrough context which allows specified numbers to get
# into the PBX and dial out as the configured user.
pbx_add_callthrough()
{
local callthrough_number_list
local defaultuser
local pin
local enabled
config_get callthrough_number_list $1 callthrough_number_list
config_get defaultuser $1 defaultuser
config_get pin $1 pin
config_get enabled $1 enabled
[ "$enabled" = "no" ] && return
[ "$defaultuser" = "" ] && return
for callthrough_number in $callthrough_number_list ; do
sed "s/|NUMBER|/$callthrough_number/g" $TMPL_EXTCTHRUCHECK >> $WORKDIR/callthroughcheck.TMP
sed "s/|NUMBER|/$callthrough_number/g" $TMPL_EXTCTHRU |\
sed "s/|DEFAULTUSER|/$defaultuser/" |\
sed "s/|PIN|/$pin/" >> $WORKDIR/callthrough.TMP
done
}
# Creates sip.conf from its template.
pbx_cook_sip_template()
{
local useragent
local externhost
local bindport
config_get useragent advanced useragent
config_get externhost advanced externhost
config_get bindport advanced bindport
[ -z "$useragent" ] && useragent="$USERAGENT"
sed "s/|USERAGENT|/$useragent/g" $TMPL_SIP > $WORKDIR/sip.conf
if [ -z "$externhost" ] ; then
sed -i "s/externhost=|EXTERNHOST|//g" $WORKDIR/sip.conf
else
sed -i "s/|EXTERNHOST|/$externhost/g" $WORKDIR/sip.conf
fi
if [ -z "$bindport" ] ; then
sed -i "s/bindport=|BINDPORT|//g" $WORKDIR/sip.conf
else
sed -i "s/|BINDPORT|/$bindport/g" $WORKDIR/sip.conf
fi
}
# Creates rtp.conf from its template.
pbx_cook_rtp_template()
{
local rtpstart
local rtpend
config_get rtpstart advanced rtpstart
config_get rtpend advanced rtpend
sed "s/|RTPSTART|/$rtpstart/" $TMPL_RTP |\
sed "s/|RTPEND|/$rtpend/" > $WORKDIR/rtp.conf
}
# Links any sound files found in $PBXSOUNDSDIR and $VMSOUNDSDIR
# into $ASTSOUNDSDIR for use by Asterisk. Does not overwrite files.
pbx_link_sounds()
{
mkdir -p $ASTSOUNDSDIR
for dir in $PBXSOUNDSDIR $VMSOUNDSDIR ; do
if [ -d $dir ] ; then
for f in $dir/* ; do
ln -s $f $ASTSOUNDSDIR 2>/dev/null
done
fi
done
}
# Makes sure the ownership of specified directories is proper.
pbx_fix_ownership()
{
chown $ASTUSER:$ASTGROUP $ASTDIRS
chown $ASTUSER:$ASTGROUP -R $ASTDIRSRECURSIVE
}
# Creates voicemail config if installed and enabled.
pbx_configure_voicemail()
{
local enabled
local global_timeout
local global_email_addresses
local smtp_tls
local smtp_server
local smtp_port
local smtp_auth
local smtp_user
local smtp_password
config_get enabled global_voicemail enabled
# First check if voicemail is enabled.
[ "$enabled" != "yes" ] && return
config_get global_timeout global_voicemail global_timeout
#config_get global_email_addresses global_voicemail global_email_addresses
config_get smtp_auth voicemail_smtp smtp_auth
config_get smtp_tls voicemail_smtp smtp_tls
config_get smtp_server voicemail_smtp smtp_server
config_get smtp_port voicemail_smtp smtp_port
config_get smtp_user voicemail_smtp smtp_user
config_get smtp_password voicemail_smtp smtp_password
sed "s/|AUTH|/$smtp_auth/" $TMPL_MSMTPDEFAULT |\
sed "s/|TLS|/$smtp_tls/" > $WORKDIR/pbx-msmtprc
sed "s/|HOST|/$smtp_server/" $TMPL_MSMTPACCOUNT |\
sed "s/|PORT|/$smtp_port/" >> $WORKDIR/pbx-msmtprc
if [ "$smtp_auth" = "on" ] ; then
sed "s/|USER|/$smtp_user/" $TMPL_MSMTPAUTH |\
sed "s/|PASSWORD|/$smtp_password/" >> $WORKDIR/pbx-msmtprc
fi
cat $TMPL_MSMTPACCTDFLT >> $WORKDIR/pbx-msmtprc
[ ! -f /etc/pbx-msmtprc ] && cp $WORKDIR/pbx-msmtprc /etc/pbx-msmtprc
diff -q $WORKDIR/pbx-msmtprc /etc/pbx-msmtprc 1>/dev/null \
|| mv $WORKDIR/pbx-msmtprc /etc/pbx-msmtprc
chmod 600 /etc/pbx-msmtprc
# Copy over the extensions file which has voicemail enabled.
cp $TMPL_EXTVMENABLED $WORKDIR/extensions_voicemail.conf
}
start() {
mkdir -p $WORKDIR
# Create the users.
config_load ${MODULENAME}-users
config_foreach pbx_add_user local_user
# Create configuration for each google account.
config_unset
config_load ${MODULENAME}-google
config_foreach pbx_add_jabber gtalk_jabber
# Create configuration for each voip provider.
config_unset
config_load ${MODULENAME}-voip
config_foreach pbx_add_peer voip_provider
# Create the user contexts, and phone blacklist.
config_unset
config_load ${MODULENAME}-calls
pbx_create_user_contexts
pbx_add_blacklist
config_foreach pbx_add_callthrough callthrough_numbers
# Prepare sip.conf using settings from the "advanced" section.
config_unset
config_load ${MODULENAME}-advanced
pbx_cook_sip_template
pbx_cook_rtp_template
# Prepare voicemail config.
config_unset
config_load ${MODULENAME}-voicemail
pbx_configure_voicemail
# Assemble the configuration, and copy changed files over.
config_unset
config_load ${MODULENAME}-advanced
pbx_assemble_and_copy_config
# Link sound files
pbx_link_sounds
# Enforce ownership of specified files and directories.
pbx_fix_ownership
}

View file

@ -0,0 +1,17 @@
[directories]
astetcdir => /etc/asterisk
astmoddir => /usr/lib/asterisk/modules
astvarlibdir => /usr/lib/asterisk
astdbdir => /usr/lib/asterisk
astkeydir => /usr/lib/asterisk
astdatadir => /usr/lib/asterisk
astagidir => /usr/lib/asterisk/agi-bin
astspooldir => /var/spool/asterisk
astrundir => /var/run/asterisk
astlogdir => /var/log/asterisk
[options]
languageprefix = yes
dumpcore = no
runuser = nobody
rungroup = nogroup

View file

@ -0,0 +1,24 @@
[general]
static = yes
writeprotect = yes
clearglobalvars = no
[globals]
RINGTIME => |RINGTIME|
[default]
[context-user-hangup-call-context]
exten => s,1,Hangup()
exten => _X.,1,Hangup()
[context-catch-all]
exten => _[!-~].,1,Dial(SIP/${EXTEN},60,r)
#include extensions_default.conf
#include extensions_voicemail.conf
#include extensions_incoming.conf
#include extensions_incoming_gtalk.conf
#include extensions_blacklist.conf
#include extensions_callthrough.conf
#include extensions_user.conf

View file

@ -0,0 +1 @@
exten => s,n,Gotoif($[ "${CALLERID(NUM)}" = "|BLACKLISTITEM|" ]?context-user-hangup,s,1)

View file

@ -0,0 +1,2 @@
exten => s,n,Goto(${SOURCECONTEXT},${SOURCEEXTEN},doneblacklist)

View file

@ -0,0 +1,3 @@
[blacklist-call-context]
exten => s,1,Noop()

View file

@ -0,0 +1,9 @@
[default-incoming-call-context]
exten => s,1,NoOp(${CALLERID})
exten => s,n,Set(SOURCECONTEXT=default-incoming-call-context)
exten => s,n,Set(SOURCEEXTEN=s)
exten => s,n,Goto(blacklist-call-context,s,1)
exten => s,n(doneblacklist),NoOp()
exten => s,n,Goto(disa-check-call-context,s,1)
exten => s,n(donedisacheck),Dial(|LOCALUSERS|,${RINGTIME},r)
exten => s,n,Goto(context-voicemail,s,1)

View file

@ -0,0 +1 @@
exten => |DEFAULTUSER|,1,Goto(default-incoming-call-context,s,1)

View file

@ -0,0 +1 @@
exten => s,n,Gotoif($[ "${CALLERID(NUM)}" =~ ".*|NUMBER|" ]?disa-call-context,|NUMBER|,1)

View file

@ -0,0 +1 @@
exten => s,n,Goto(${SOURCECONTEXT},${SOURCEEXTEN},donedisacheck)

View file

@ -0,0 +1,2 @@
[disa-check-call-context]
exten => s,1,Noop()

View file

@ -0,0 +1,6 @@
exten => |NUMBER|,1,Noop()
exten => |NUMBER|,n,Set(TIMEOUT(digit)=7)
exten => |NUMBER|,n,Set(TIMEOUT(response)=21)
exten => |NUMBER|,n,Authenticate(|PIN|)
exten => |NUMBER|,n,DISA(no-password,context-user-|DEFAULTUSER|)

View file

@ -0,0 +1 @@
[disa-call-context]

View file

@ -0,0 +1,13 @@
exten => |USERNAME|,1,NoOp(${CALLERID})
same => n,Set(CALLERID(name)=${CUT(CALLERID(name),@,1)})
same => n,GotoIf($["${CALLERID(name):0:2}" != "+1"]?notrim)
same => n,Set(CALLERID(name)=${CALLERID(name):2})
same => n(notrim),Set(CALLERID(number)=${CALLERID(name)})
same => n,Set(SOURCECONTEXT=context-incoming-gtalk)
same => n,Set(SOURCEEXTEN=|USERNAME|)
same => n,Goto(blacklist-call-context,s,1)
same => n(doneblacklist),NoOp()
same => n,Goto(disa-check-call-context,s,1)
same => n(donedisacheck),Dial(|LOCALUSERS|,${RINGTIME},D(:w11111111))
same => n,Goto(context-voicemail,s,1)

View file

@ -0,0 +1,10 @@
[context-incoming-|NAME|]
exten => s,1,NoOp(${CALLERID})
exten => s,n,Set(SOURCECONTEXT=context-incoming-|NAME|)
exten => s,n,Set(SOURCEEXTEN=s)
exten => s,n,Goto(blacklist-call-context,s,1)
exten => s,n(doneblacklist),NoOp()
exten => s,n,Goto(disa-check-call-context,s,1)
exten => s,n(donedisacheck),Dial(|LOCALUSERS|,${RINGTIME},r)
exten => s,n,Goto(context-voicemail,s,1)

View file

@ -0,0 +1 @@
exten => |DEFAULTUSER|,1,Dial(SIP/|DEFAULTUSER|,${RINGTIME},r)

View file

@ -0,0 +1,9 @@
exten => _|NUMPREFIX|,1,Dial(Gtalk/gtalk-|NAME|/${EXTEN}@voice.google.com,60)
exten => _+|NUMPREFIX|,1,Dial(Gtalk/gtalk-|NAME|/${EXTEN:1}@voice.google.com,60)
exten => _|NUMPREFIX|.,1,Dial(Gtalk/gtalk-|NAME|/${EXTEN}@voice.google.com,60)
exten => _+|NUMPREFIX|.,1,Dial(Gtalk/gtalk-|NAME|/${EXTEN:1}@voice.google.com,60)
exten => _00|NUMPREFIX|.,1,Dial(Gtalk/gtalk-|NAME|/${EXTEN:2}@voice.google.com,60)
exten => _011|NUMPREFIX|.,1,Dial(Gtalk/gtalk-|NAME|/${EXTEN:3}@voice.google.com,60)
exten => _010|NUMPREFIX|.,1,Dial(Gtalk/gtalk-|NAME|/${EXTEN:3}@voice.google.com,60)
exten => _0011|NUMPREFIX|.,1,Dial(Gtalk/gtalk-|NAME|/${EXTEN:4}@voice.google.com,60)

View file

@ -0,0 +1,2 @@
exten => |PATTERN|,1,Dial(Gtalk/gtalk-|NAME|/${EXTEN|SYMBOLSTOREMOVE|}@voice.google.com,60)

View file

@ -0,0 +1 @@
exten => |PATTERN|,1,Dial(SIP/${EXTEN|SYMBOLSTOREMOVE|}@peer-|NAME|,60,r)

View file

@ -0,0 +1,8 @@
exten => _|NUMPREFIX|,1,Dial(SIP/${EXTEN}@peer-|NAME|,60,r)
exten => _+|NUMPREFIX|,1,Dial(SIP/${EXTEN}@peer-|NAME|,60,r)
exten => _|NUMPREFIX|.,1,Dial(SIP/${EXTEN}@peer-|NAME|,60,r)
exten => _+|NUMPREFIX|.,1,Dial(SIP/${EXTEN:1}@peer-|NAME|,60,r)
exten => _00|NUMPREFIX|.,1,Dial(SIP/${EXTEN:2}@peer-|NAME|,60,r)
exten => _011|NUMPREFIX|.,1,Dial(SIP/${EXTEN:3}@peer-|NAME|,60,r)
exten => _010|NUMPREFIX|.,1,Dial(SIP/${EXTEN:3}@peer-|NAME|,60,r)
exten => _0011|NUMPREFIX|.,1,Dial(SIP/${EXTEN:4}@peer-|NAME|,60,r)

View file

@ -0,0 +1,2 @@
include => context-voicemail-record-greeting
include => context-catch-all

View file

@ -0,0 +1,3 @@
[context-user-|DEFAULTUSER|]

View file

@ -0,0 +1,4 @@
[context-voicemail-record-greeting]
[context-voicemail]
exten => s,1,Hangup()

View file

@ -0,0 +1,15 @@
[context-voicemail-record-greeting]
exten => *789,1,Wait(2)
exten => *789,n,Playback(/etc/pbx-voicemail/greeting)
exten => *789,n,Wait(5)
exten => *789,n,Record(/etc/pbx-voicemail/greeting:WAV,20,90,k)
exten => *789,n,Wait(2)
exten => *789,n,Playback(/etc/pbx-voicemail/greeting)
[context-voicemail]
exten => s,1,Wait(2)
exten => s,2,Playback(/etc/pbx-voicemail/greeting)
exten => s,3,Wait(2)
exten => s,n,Record(/tmp/voicemail%d:WAV,20,180,k)
exten => h,1,System(/etc/pbx-voicemail/pbx-send-voicemail '${RECORDED_FILE}.WAV' '${CALLERID(all)}' &)

View file

@ -0,0 +1,10 @@
[general]
context=context-incoming-gtalk
allowguest=yes
allowguests=yes
bindaddr=0.0.0.0
[guest]
disallow=all
allow=ulaw
context=context-incoming-gtalk

View file

@ -0,0 +1,733 @@
; indications.conf
; Configuration file for location specific tone indications
; used by the pbx_indications module.
;
; NOTE:
; When adding countries to this file, please keep them in alphabetical
; order according to the 2-character country codes!
;
; The [general] category is for certain global variables.
; All other categories are interpreted as location specific indications
;
;
[general]
country=us ; default location
; [example]
; description = string
; The full name of your country, in English.
; alias = iso[,iso]*
; List of other countries 2-letter iso codes, which have the same
; tone indications.
; ringcadence = num[,num]*
; List of durations the physical bell rings.
; dial = tonelist
; Set of tones to be played when one picks up the hook.
; busy = tonelist
; Set of tones played when the receiving end is busy.
; congestion = tonelist
; Set of tones played when there is some congestion (on the network?)
; callwaiting = tonelist
; Set of tones played when there is a call waiting in the background.
; dialrecall = tonelist
; Not well defined; many phone systems play a recall dial tone after hook
; flash.
; record = tonelist
; Set of tones played when call recording is in progress.
; info = tonelist
; Set of tones played with special information messages (e.g., "number is
; out of service")
; 'name' = tonelist
; Every other variable will be available as a shortcut for the "PlayList" command
; but will not be used automatically by Asterisk.
;
;
; The tonelist itself is defined by a comma-separated sequence of elements.
; Each element consist of a frequency (f) with an optional duration (in ms)
; attached to it (f/duration). The frequency component may be a mixture of two
; frequencies (f1+f2) or a frequency modulated by another frequency (f1*f2).
; The implicit modulation depth is fixed at 90%, though.
; If the list element starts with a !, that element is NOT repeated,
; therefore, only if all elements start with !, the tonelist is time-limited,
; all others will repeat indefinitely.
;
; concisely:
; element = [!]freq[+|*freq2][/duration]
; tonelist = element[,element]*
;
; Please note that SPACES ARE NOT ALLOWED in tone lists!
;
[at]
description = Austria
ringcadence = 1000,5000
; Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf
dial = 420
busy = 420/400,0/400
ring = 420/1000,0/5000
congestion = 420/200,0/200
callwaiting = 420/40,0/1960
dialrecall = 420
; RECORDTONE - not specified
record = 1400/80,0/14920
info = 950/330,1450/330,1850/330,0/1000
stutter = 380+420
[au]
description = Australia
; Reference http://www.acif.org.au/__data/page/3303/S002_2001.pdf
; Normal Ring
ringcadence = 400,200,400,2000
; Distinctive Ring 1 - Forwarded Calls
; 400,400,200,200,400,1400
; Distinctive Ring 2 - Selective Ring 2 + Operator + Recall
; 400,400,200,2000
; Distinctive Ring 3 - Multiple Subscriber Number 1
; 200,200,400,2200
; Distinctive Ring 4 - Selective Ring 1 + Centrex
; 400,2600
; Distinctive Ring 5 - Selective Ring 3
; 400,400,200,400,200,1400
; Distinctive Ring 6 - Multiple Subscriber Number 2
; 200,400,200,200,400,1600
; Distinctive Ring 7 - Multiple Subscriber Number 3 + Data Privacy
; 200,400,200,400,200,1600
; Tones
dial = 413+438
busy = 425/375,0/375
ring = 413+438/400,0/200,413+438/400,0/2000
; XXX Congestion: Should reduce by 10 db every other cadence XXX
congestion = 425/375,0/375,420/375,0/375
callwaiting = 425/200,0/200,425/200,0/4400
dialrecall = 413+438
; Record tone used for Call Intrusion/Recording or Conference
record = !425/1000,!0/15000,425/360,0/15000
info = 425/2500,0/500
; Other Australian Tones
; The STD "pips" indicate the call is not an untimed local call
std = !525/100,!0/100,!525/100,!0/100,!525/100,!0/100,!525/100,!0/100,!525/100
; Facility confirmation tone (eg. Call Forward Activated)
facility = 425
; Message Waiting "stutter" dialtone
stutter = 413+438/100,0/40
; Ringtone for calls to Telstra mobiles
ringmobile = 400+450/400,0/200,400+450/400,0/2000
[bg]
; Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf
description = Bulgaria
ringcadence = 1000,4000
;
dial = 425
busy = 425/500,0/500
ring = 425/1000,0/4000
congestion = 425/250,0/250
callwaiting = 425/150,0/150,425/150,0/4000
dialrecall = !425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425
record = 1400/425,0/15000
info = 950/330,1400/330,1800/330,0/1000
stutter = 425/1500,0/100
[br]
description = Brazil
ringcadence = 1000,4000
dial = 425
busy = 425/250,0/250
ring = 425/1000,0/4000
congestion = 425/250,0/250,425/750,0/250
callwaiting = 425/50,0/1000
; Dialrecall not used in Brazil standard (using UK standard)
dialrecall = 350+440
; Record tone is not used in Brazil, use busy tone
record = 425/250,0/250
; Info not used in Brazil standard (using UK standard)
info = 950/330,1400/330,1800/330
stutter = 350+440
[be]
description = Belgium
; Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf
ringcadence = 1000,3000
dial = 425
busy = 425/500,0/500
ring = 425/1000,0/3000
congestion = 425/167,0/167
callwaiting = 1400/175,0/175,1400/175,0/3500
; DIALRECALL - not specified
dialrecall = !350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440"
; RECORDTONE - not specified
record = 1400/500,0/15000
info = 900/330,1400/330,1800/330,0/1000
stutter = 425/1000,0/250
[ch]
description = Switzerland
; Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf
ringcadence = 1000,4000
dial = 425
busy = 425/500,0/500
ring = 425/1000,0/4000
congestion = 425/200,0/200
callwaiting = 425/200,0/200,425/200,0/4000
; DIALRECALL - not specified
dialrecall = !425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425
; RECORDTONE - not specified
record = 1400/80,0/15000
info = 950/330,1400/330,1800/330,0/1000
stutter = 425+340/1100,0/1100
[cl]
description = Chile
; According to specs from Telefonica CTC Chile
ringcadence = 1000,3000
dial = 400
busy = 400/500,0/500
ring = 400/1000,0/3000
congestion = 400/200,0/200
callwaiting = 400/250,0/8750
dialrecall = !400/100,!0/100,!400/100,!0/100,!400/100,!0/100,400
record = 1400/500,0/15000
info = 950/333,1400/333,1800/333,0/1000
stutter = !400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,400
[cn]
description = China
; Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf
ringcadence = 1000,4000
dial = 450
busy = 450/350,0/350
ring = 450/1000,0/4000
congestion = 450/700,0/700
callwaiting = 450/400,0/4000
dialrecall = 450
record = 950/400,0/10000
info = 450/100,0/100,450/100,0/100,450/100,0/100,450/400,0/400
; STUTTER - not specified
stutter = 450+425
[cz]
description = Czech Republic
; Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf
ringcadence = 1000,4000
dial = 425/330,0/330,425/660,0/660
busy = 425/330,0/330
ring = 425/1000,0/4000
congestion = 425/165,0/165
callwaiting = 425/330,0/9000
; DIALRECALL - not specified
dialrecall = !425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425/330,0/330,425/660,0/660
; RECORDTONE - not specified
record = 1400/500,0/14000
info = 950/330,0/30,1400/330,0/30,1800/330,0/1000
; STUTTER - not specified
stutter = 425/450,0/50
[de]
description = Germany
; Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf
ringcadence = 1000,4000
dial = 425
busy = 425/480,0/480
ring = 425/1000,0/4000
congestion = 425/240,0/240
callwaiting = !425/200,!0/200,!425/200,!0/5000,!425/200,!0/200,!425/200,!0/5000,!425/200,!0/200,!425/200,!0/5000,!425/200,!0/200,!425/200,!0/5000,!425/200,!0/200,!425/200,0
; DIALRECALL - not specified
dialrecall = !425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425
; RECORDTONE - not specified
record = 1400/80,0/15000
info = 950/330,1400/330,1800/330,0/1000
stutter = 425+400
[dk]
description = Denmark
; Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf
ringcadence = 1000,4000
dial = 425
busy = 425/500,0/500
ring = 425/1000,0/4000
congestion = 425/200,0/200
callwaiting = !425/200,!0/600,!425/200,!0/3000,!425/200,!0/200,!425/200,0
; DIALRECALL - not specified
dialrecall = !425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425
; RECORDTONE - not specified
record = 1400/80,0/15000
info = 950/330,1400/330,1800/330,0/1000
; STUTTER - not specified
stutter = 425/450,0/50
[ee]
description = Estonia
; Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf
ringcadence = 1000,4000
dial = 425
busy = 425/300,0/300
ring = 425/1000,0/4000
congestion = 425/200,0/200
; CALLWAIT not in accordance to ITU
callwaiting = 950/650,0/325,950/325,0/30,1400/1300,0/2600
; DIALRECALL - not specified
dialrecall = 425/650,0/25
; RECORDTONE - not specified
record = 1400/500,0/15000
; INFO not in accordance to ITU
info = 950/650,0/325,950/325,0/30,1400/1300,0/2600
; STUTTER not specified
stutter = !425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425
[es]
description = Spain
ringcadence = 1500,3000
dial = 425
busy = 425/200,0/200
ring = 425/1500,0/3000
congestion = 425/200,0/200,425/200,0/200,425/200,0/600
callwaiting = 425/175,0/175,425/175,0/3500
dialrecall = !425/200,!0/200,!425/200,!0/200,!425/200,!0/200,425
record = 1400/500,0/15000
info = 950/330,0/1000
dialout = 500
[fi]
description = Finland
ringcadence = 1000,4000
dial = 425
busy = 425/300,0/300
ring = 425/1000,0/4000
congestion = 425/200,0/200
callwaiting = 425/150,0/150,425/150,0/8000
dialrecall = 425/650,0/25
record = 1400/500,0/15000
info = 950/650,0/325,950/325,0/30,1400/1300,0/2600
stutter = 425/650,0/25
[fr]
description = France
; Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf
ringcadence = 1500,3500
; Dialtone can also be 440+330
dial = 440
busy = 440/500,0/500
ring = 440/1500,0/3500
; CONGESTION - not specified
congestion = 440/250,0/250
callwait = 440/300,0/10000
; DIALRECALL - not specified
dialrecall = !350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440
; RECORDTONE - not specified
record = 1400/500,0/15000
info = !950/330,!1400/330,!1800/330
stutter = !440/100,!0/100,!440/100,!0/100,!440/100,!0/100,!440/100,!0/100,!440/100,!0/100,!440/100,!0/100,440
[gr]
description = Greece
ringcadence = 1000,4000
dial = 425/200,0/300,425/700,0/800
busy = 425/300,0/300
ring = 425/1000,0/4000
congestion = 425/200,0/200
callwaiting = 425/150,0/150,425/150,0/8000
dialrecall = 425/650,0/25
record = 1400/400,0/15000
info = !950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0
stutter = 425/650,0/25
[hu]
description = Hungary
; Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf
ringcadence = 1250,3750
dial = 425
busy = 425/300,0/300
ring = 425/1250,0/3750
congestion = 425/300,0/300
callwaiting = 425/40,0/1960
dialrecall = 425+450
; RECORDTONE - not specified
record = 1400/400,0/15000
info = !950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0
stutter = 350+375+400
[il]
description = Israel
ringcadence = 1000,3000
dial = 414
busy = 414/500,0/500
ring = 414/1000,0/3000
congestion = 414/250,0/250
callwaiting = 414/100,0/100,414/100,0/100,414/600,0/3000
dialrecall = !414/100,!0/100,!414/100,!0/100,!414/100,!0/100,414
record = 1400/500,0/15000
info = 1000/330,1400/330,1800/330,0/1000
stutter = !414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,414
[in]
description = India
ringcadence = 400,200,400,2000
dial = 400*25
busy = 400/750,0/750
ring = 400*25/400,0/200,400*25/400,0/2000
congestion = 400/250,0/250
callwaiting = 400/200,0/100,400/200,0/7500
dialrecall = !350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440
record = 1400/500,0/15000
info = !950/330,!1400/330,!1800/330,0/1000
stutter = !350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440
[it]
description = Italy
; Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf
ringcadence = 1000,4000
dial = 425/200,0/200,425/600,0/1000
busy = 425/500,0/500
ring = 425/1000,0/4000
congestion = 425/200,0/200
callwaiting = 425/400,0/100,425/250,0/100,425/150,0/14000
dialrecall = 470/400,425/400
record = 1400/400,0/15000
info = !950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0
stutter = 470/400,425/400
[lt]
description = Lithuania
ringcadence = 1000,4000
dial = 425
busy = 425/350,0/350
ring = 425/1000,0/4000
congestion = 425/200,0/200
callwaiting = 425/150,0/150,425/150,0/4000
; DIALRECALL - not specified
dialrecall = 425/500,0/50
; RECORDTONE - not specified
record = 1400/500,0/15000
info = !950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0
; STUTTER - not specified
stutter = !425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425
[jp]
description = Japan
ringcadence = 1000,2000
dial = 400
busy = 400/500,0/500
ring = 400+15/1000,0/2000
congestion = 400/500,0/500
callwaiting = 400+16/500,0/8000
dialrecall = !400/200,!0/200,!400/200,!0/200,!400/200,!0/200,400
record = 1400/500,0/15000
info = !950/330,!1400/330,!1800/330,0
stutter = !400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,400
[mx]
description = Mexico
ringcadence = 2000,4000
dial = 425
busy = 425/250,0/250
ring = 425/1000,0/4000
congestion = 425/250,0/250
callwaiting = 425/200,0/600,425/200,0/10000
dialrecall = !350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440
record = 1400/500,0/15000
info = 950/330,0/30,1400/330,0/30,1800/330,0/1000
stutter = !350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440
[my]
description = Malaysia
ringcadence = 2000,4000
dial = 425
busy = 425/500,0/500
ring = 425/400,0/200
congestion = 425/500,0/500
[nl]
description = Netherlands
; Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf
ringcadence = 1000,4000
; Most of these 425's can also be 450's
dial = 425
busy = 425/500,0/500
ring = 425/1000,0/4000
congestion = 425/250,0/250
callwaiting = 425/500,0/9500
; DIALRECALL - not specified
dialrecall = 425/500,0/50
; RECORDTONE - not specified
record = 1400/500,0/15000
info = 950/330,1400/330,1800/330,0/1000
stutter = 425/500,0/50
[no]
description = Norway
ringcadence = 1000,4000
dial = 425
busy = 425/500,0/500
ring = 425/1000,0/4000
congestion = 425/200,0/200
callwaiting = 425/200,0/600,425/200,0/10000
dialrecall = 470/400,425/400
record = 1400/400,0/15000
info = !950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0
stutter = 470/400,425/400
[nz]
description = New Zealand
;NOTE - the ITU has different tonesets for NZ, but according to some residents there,
; this is, indeed, the correct way to do it.
ringcadence = 400,200,400,2000
dial = 400
busy = 400/250,0/250
ring = 400+450/400,0/200,400+450/400,0/2000
congestion = 400/375,0/375
callwaiting = !400/200,!0/3000,!400/200,!0/3000,!400/200,!0/3000,!400/200
dialrecall = !400/100!0/100,!400/100,!0/100,!400/100,!0/100,400
record = 1400/425,0/15000
info = 400/750,0/100,400/750,0/100,400/750,0/100,400/750,0/400
stutter = !400/100!0/100,!400/100,!0/100,!400/100,!0/100,!400/100!0/100,!400/100,!0/100,!400/100,!0/100,400
unobtainable = 400/75,0/100,400/75,0/100,400/75,0/100,400/75,0/400
[ph]
; reference http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf
description = Philippines
ringcadence = 1000,4000
dial = 425
busy = 480+620/500,0/500
ring = 425+480/1000,0/4000
congestion = 480+620/250,0/250
callwaiting = 440/300,0/10000
; DIALRECALL - not specified
dialrecall = !350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440
; RECORDTONE - not specified
record = 1400/500,0/15000
; INFO - not specified
info = !950/330,!1400/330,!1800/330,0
; STUTTER - not specified
stutter = !350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440
[pl]
description = Poland
ringcadence = 1000,4000
dial = 425
busy = 425/500,0/500
ring = 425/1000,0/4000
congestion = 425/500,0/500
callwaiting = 425/150,0/150,425/150,0/4000
; DIALRECALL - not specified
dialrecall = 425/500,0/50
; RECORDTONE - not specified
record = 1400/500,0/15000
; 950/1400/1800 3x0.33 on 1.0 off repeated 3 times
info = !950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000
; STUTTER - not specified
stutter = !425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425
[pt]
description = Portugal
ringcadence = 1000,5000
dial = 425
busy = 425/500,0/500
ring = 425/1000,0/5000
congestion = 425/200,0/200
callwaiting = 440/300,0/10000
dialrecall = 425/1000,0/200
record = 1400/500,0/15000
info = 950/330,1400/330,1800/330,0/1000
stutter = !425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425
[ru]
; References:
; http://www.minsvyaz.ru/site.shtml?id=1806
; http://www.aboutphone.info/lib/gost/45-223-2001.html
description = Russian Federation / ex Soviet Union
ringcadence = 1000,4000
dial = 425
busy = 425/350,0/350
ring = 425/1000,0/4000
congestion = 425/175,0/175
callwaiting = 425/200,0/5000
record = 1400/400,0/15000
info = 950/330,1400/330,1800/330,0/1000
dialrecall = 425/400,0/40
stutter = !425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425
[se]
description = Sweden
ringcadence = 1000,5000
dial = 425
busy = 425/250,0/250
ring = 425/1000,0/5000
congestion = 425/250,0/750
callwaiting = 425/200,0/500,425/200,0/9100
dialrecall = !425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425
record = 1400/500,0/15000
info = !950/332,!0/24,!1400/332,!0/24,!1800/332,!0/2024,!950/332,!0/24,!1400/332,!0/24,!1800/332,!0/2024,!950/332,!0/24,!1400/332,!0/24,!1800/332,!0/2024,!950/332,!0/24,!1400/332,!0/24,!1800/332,!0/2024,!950/332,!0/24,!1400/332,!0/24,!1800/332,0
stutter = !425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425
; stutter = 425/320,0/20 ; Real swedish standard, not used for now
[sg]
description = Singapore
; Singapore
; Reference: http://www.ida.gov.sg/idaweb/doc/download/I397/ida_ts_pstn1_i4r2.pdf
; Frequency specs are: 425 Hz +/- 20Hz; 24 Hz +/- 2Hz; modulation depth 100%; SIT +/- 50Hz
ringcadence = 400,200,400,2000
dial = 425
ring = 425*24/400,0/200,425*24/400,0/2000 ; modulation should be 100%, not 90%
busy = 425/750,0/750
congestion = 425/250,0/250
callwaiting = 425*24/300,0/200,425*24/300,0/3200
stutter = !425/200,!0/200,!425/600,!0/200,!425/200,!0/200,!425/600,!0/200,!425/200,!0/200,!425/600,!0/200,!425/200,!0/200,!425/600,!0/200,425
info = 950/330,1400/330,1800/330,0/1000 ; not currently in use acc. to reference
dialrecall = 425*24/500,0/500,425/500,0/2500 ; unspecified in IDA reference, use repeating Holding Tone A,B
record = 1400/500,0/15000 ; unspecified in IDA reference, use 0.5s tone every 15s
; additionally defined in reference
nutone = 425/2500,0/500
intrusion = 425/250,0/2000
warning = 425/624,0/4376 ; end of period tone, warning
acceptance = 425/125,0/125
holdinga = !425*24/500,!0/500 ; followed by holdingb
holdingb = !425/500,!0/2500
[th]
description = Thailand
ringcadence = 1000,4000
; Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf
dial = 400*50
busy = 400/500,0/500
ring = 420/1000,0/5000
congestion = 400/300,0/300
callwaiting = 1000/400,10000/400,1000/400
; DIALRECALL - not specified - use special dial tone instead.
dialrecall = 400*50/400,0/100,400*50/400,0/100
; RECORDTONE - not specified
record = 1400/500,0/15000
; INFO - specified as an announcement - use special information tones instead
info = 950/330,1400/330,1800/330
; STUTTER - not specified
stutter = !400/200,!0/200,!400/600,!0/200,!400/200,!0/200,!400/600,!0/200,!400/200,!0/200,!400/600,!0/200,!400/200,!0/200,!400/600,!0/200,400
[uk]
description = United Kingdom
ringcadence = 400,200,400,2000
; These are the official tones taken from BT SIN350. The actual tones
; used by BT include some volume differences so sound slightly different
; from Asterisk-generated ones.
dial = 350+440
; Special dial is the intermittent dial tone heard when, for example,
; you have a divert active on the line
specialdial = 350+440/750,440/750
; Busy is also called "Engaged"
busy = 400/375,0/375
; "Congestion" is the Beep-bip engaged tone
congestion = 400/400,0/350,400/225,0/525
; "Special Congestion" is not used by BT very often if at all
specialcongestion = 400/200,1004/300
unobtainable = 400
ring = 400+450/400,0/200,400+450/400,0/2000
callwaiting = 400/100,0/4000
; BT seem to use "Special Call Waiting" rather than just "Call Waiting" tones
specialcallwaiting = 400/250,0/250,400/250,0/250,400/250,0/5000
; "Pips" used by BT on payphones. (Sounds wrong, but this is what BT claim it
; is and I've not used a payphone for years)
creditexpired = 400/125,0/125
; These two are used to confirm/reject service requests on exchanges that
; don't do voice announcements.
confirm = 1400
switching = 400/200,0/400,400/2000,0/400
; This is the three rising tones Doo-dah-dee "Special Information Tone",
; usually followed by the BT woman saying an appropriate message.
info = 950/330,0/15,1400/330,0/15,1800/330,0/1000
; Not listed in SIN350
record = 1400/500,0/60000
stutter = 350+440/750,440/750
[us]
description = United States / North America
ringcadence = 2000,4000
dial = 350+440
busy = 480+620/500,0/500
ring = 440+480/2000,0/4000
congestion = 480+620/250,0/250
callwaiting = 440/300,0/10000
dialrecall = !350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440
record = 1400/500,0/15000
info = !950/330,!1400/330,!1800/330,0
stutter = !350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440
[us-old]
description = United States Circa 1950/ North America
ringcadence = 2000,4000
dial = 600*120
busy = 500*100/500,0/500
ring = 420*40/2000,0/4000
congestion = 500*100/250,0/250
callwaiting = 440/300,0/10000
dialrecall = !600*120/100,!0/100,!600*120/100,!0/100,!600*120/100,!0/100,600*120
record = 1400/500,0/15000
info = !950/330,!1400/330,!1800/330,0
stutter = !600*120/100,!0/100,!600*120/100,!0/100,!600*120/100,!0/100,!600*120/100,!0/100,!600*120/100,!0/100,!600*120/100,!0/100,600*120
[tw]
description = Taiwan
; http://nemesis.lonestar.org/reference/telecom/signaling/dialtone.html
; http://nemesis.lonestar.org/reference/telecom/signaling/busy.html
; http://www.iproducts.com.tw/ee/kylink/06ky-1000a.htm
; http://www.pbx-manufacturer.com/ky120dx.htm
; http://www.nettwerked.net/tones.txt
; http://www.cisco.com/univercd/cc/td/doc/product/tel_pswt/vco_prod/taiw_sup/taiw2.htm
;
; busy tone 480+620Hz 0.5 sec. on ,0.5 sec. off
; reorder tone 480+620Hz 0.25 sec. on,0.25 sec. off
; ringing tone 440+480Hz 1 sec. on ,2 sec. off
;
ringcadence = 1000,4000
dial = 350+440
busy = 480+620/500,0/500
ring = 440+480/1000,0/2000
congestion = 480+620/250,0/250
callwaiting = 350+440/250,0/250,350+440/250,0/3250
dialrecall = 300/1500,0/500
record = 1400/500,0/15000
info = !950/330,!1400/330,!1800/330,0
stutter = !350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440
[ve]
; Tone definition source for ve found on
; Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf
description = Venezuela / South America
ringcadence = 1000,4000
dial = 425
busy = 425/500,0/500
ring = 425/1000,0/4000
congestion = 425/250,0/250
callwaiting = 400+450/300,0/6000
dialrecall = 425
record = 1400/500,0/15000
info = !950/330,!1440/330,!1800/330,0/1000
[za]
description = South Africa
; http://www.cisco.com/univercd/cc/td/doc/product/tel_pswt/vco_prod/safr_sup/saf02.htm
; (definitions for other countries can also be found there)
; Note, though, that South Africa uses two switch types in their network --
; Alcatel switches -- mainly in the Western Cape, and Siemens elsewhere.
; The former use 383+417 in dial, ringback etc. The latter use 400*33
; I've provided both, uncomment the ones you prefer
ringcadence = 400,200,400,2000
; dial/ring/callwaiting for the Siemens switches:
dial = 400*33
ring = 400*33/400,0/200,400*33/400,0/2000
callwaiting = 400*33/250,0/250,400*33/250,0/250,400*33/250,0/250,400*33/250,0/250
; dial/ring/callwaiting for the Alcatel switches:
; dial = 383+417
; ring = 383+417/400,0/200,383+417/400,0/2000
; callwaiting = 383+417/250,0/250,383+417/250,0/250,383+417/250,0/250,383+417/250,0/250
congestion = 400/250,0/250
busy = 400/500,0/500
dialrecall = 350+440
; XXX Not sure about the RECORDTONE
record = 1400/500,0/10000
info = 950/330,1400/330,1800/330,0/330
stutter = !400*33/100,!0/100,!400*33/100,!0/100,!400*33/100,!0/100,!400*33/100,!0/100,!400*33/100,!0/100,!400*33/100,!0/100,400*33

View file

@ -0,0 +1,4 @@
[general]
autoregister=yes
#include jabber_users.conf

View file

@ -0,0 +1,8 @@
[gtalk-|NAME|]
type=client
serverhost=talk.google.com
username=|USERNAME|/Talk
secret=|SECRET|
timeout=150
status=|STATUS|
statusmessage=|STATUSMESSAGE|

View file

@ -0,0 +1,7 @@
[general]
queue_log = no
event_log = no
[logfiles]
console => notice,warning,error
messages => error

View file

@ -0,0 +1,7 @@
[general]
enabled = no
port = 5038
bindaddr = 0.0.0.0

View file

@ -0,0 +1,34 @@
[modules]
autoload=no
load => res_jabber.so ; Used for Gtalk
load => res_clioriginate.so ; originate calls from commandline
load => res_rtp_asterisk.so ; rtp "engine" is now a loadable module in asterisk 1.8
load => pbx_config.so ; Text Extension Configuration Requires N/A
load => func_callerid.so ; Gets or sets Caller*ID data on the channel. - Requires ?
load => func_channel.so
load => func_logic.so ; Logic functions (if, etc.)
load => func_strings.so ; string manipulation functions
load => cdr_manager.so ; Asterisk Call Manager CDR Backend - Requires N/A
load => chan_local.so ; Show status of local channels- Requires N/A
load => chan_gtalk.so ; Use gtalk
load => chan_sip.so ; Session Initiation Protocol (SIP) - Requires res_features.so
load => codec_alaw.so ; A-law Coder/Decoder - Requires N/A
load => codec_a_mu.so ; A-law and Mulaw direct Coder/Decoder - Requires N/A
load => codec_gsm.so ; GSM/PCM16 (signed linear) Codec Translat - Requires N/A
load => codec_ulaw.so ; Mu-law Coder/Decoder - Requires N/A
load => format_gsm.so ; Raw GSM data - Requires N/A
load => format_pcm.so ; Raw uLaw 8khz Audio support (PCM) - Requires N/A
load => format_wav_gsm.so
load => app_dial.so ; Dialing Application - Requires res_features.so, res_musiconhold.so
load => app_parkandannounce.so ; Call Parking and Announce Application - Requires res_features.so
load => app_playback.so ; Sound File Playback Application - Requires N/A
load => app_record.so ; Sound File Record Application - Requires N/A
load => app_system.so ; Execute a system command - Requires N/A
load => app_disa.so ; Direct Inward System Access
load => app_authenticate.so ; Authenticate via pin
load => app_senddtmf.so ; Ability to send DTMF tones on the line.
load => func_cut.so ; To manipulate strings
load => func_timeout.so ; Used for DISA timeouts
[global]
chan_modem.so=no

View file

@ -0,0 +1,6 @@
[general]
rtpstart=|RTPSTART|
rtpend=|RTPEND|
rtpchecksums=no
dtmftimeout=3000
rtcpinterval = 2000

View file

@ -0,0 +1,37 @@
[general]
context=default-incoming-call-context
allowoverlap=yes
allowtransfer=yes
realm=asterisk
bindaddr=0.0.0.0
srvlookup=yes
maxexpiry=600
minexpiry=60
defaultexpiry=300
qualifyfreq=55
disallow=all
allow=ulaw
allow=alaw
dtmfmode = inband
alwaysauthreject = yes
t1min=100
timert1=500
timerb=16000
rtptimeout=600
rtpkeepalive=30
useragent=|USERAGENT|
localnet=192.168.0.0/16
localnet=10.0.0.0/8
localnet=172.16.0.0/12
nat=yes
directmedia=no
sipdebug=no
bindport=|BINDPORT|
externhost=|EXTERNHOST|
#include sip_registrations.conf
[authentication]
#include sip_peers.conf
#include sip_users.conf

View file

@ -0,0 +1,13 @@
[peer-|NAME|]
type = peer
defaultuser = |DEFAULTUSER|
fromuser = |FROMUSER|
secret = |SECRET|
host = |HOST|
fromdomain = |FROMDOMAIN|
context = context-incoming-|NAME|
insecure = port,invite
qualify = 2000
|PORT|
|OUTBOUNDPROXY|

View file

@ -0,0 +1,2 @@
register => |DEFAULTUSER|:|SECRET|@peer-|NAME|

View file

@ -0,0 +1,11 @@
[|DEFAULTUSER|]
fullname = |FULLNAME|
defaultuser = |DEFAULTUSER|
secret = |SECRET|
hassip = yes
hasvoicemail = no
host = dynamic
type = friend
context = context-user-|CONTEXTNAME|
qualify = no