{ "info": { "author": "Walter Doekes, OSSO B.V.", "author_email": "wjdoekes+asterisklint@osso.nl", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", "Topic :: Communications :: Telephony", "Topic :: Software Development :: Pre-processors" ], "description": "Asterisk PBX configuration syntax checker\n=========================================\n\n.. image:: https://bettercodehub.com/edge/badge/ossobv/asterisklint\n\nAsterisklint is a suite of tools to check syntax of your Asterisk PBX\nconfiguration files.\n\nAlright, enough talking. Some examples please.\n\n\nInvocation\n----------\n\n.. code-block:: console\n\n $ asterisklint\n usage: asterisklint [-h] COMMAND\n asterisklint: error: the following arguments are required: COMMAND\n\n $ asterisklint ls\n builtin:\n ls List available commands.\n\n /usr/lib/python/dist-packages:\n dialplan-check Do sanity checks on dialplan. Takes 'extensions.conf'\n as argument. Suppress error classes using ALINT_IGNORE.\n dialplan-show Show dialplan like Asterisk does with CLI command\n \"dialplan show\". Takes 'extensions.conf' as argument.\n func_odbc-check Do sanity checks on func_odbc.conf. Takes\n 'func_odbc.conf' as argument. Suppress error classes\n using ALINT_IGNORE.\n ident-scan Report similarly named contexts, labels and variables.\n Takes 'extensions.conf' as argument. All parse errors\n are suppressed.\n modules-show Show which modules, apps and functions are used by the\n dialplan. Takes 'extensions.conf' as argument.\n\n Place custom commands in ~/.asterisklint/asterisklint/commands.\n\n\nTake this little dialplan snippet, that we'll call ``extensions.conf``::\n\n [default]\n exten => _8[2-9]x,1,NoOp\n same => n,GoSub(somewhere,s,1(argument1,argument2)\n same => n,Payback(audiofile)\n\nNow run the ``dialplan-check`` command on it:\n\n.. code-block:: console\n\n $ ALINT_IGNORE=H_DP_ asterisklint dialplan-check extensions.conf\n extensions.conf:2 H_PAT_NON_CANONICAL: pattern '_8[2-9]x' is not in the canonical form '_8NX'\n extensions.conf:3 W_APP_BAD_CASE: app 'GoSub' does not have the proper Case 'Gosub'\n extensions.conf:3 W_APP_BALANCE: app data '1(argument1,argument2' looks like unbalanced parentheses/quotes/curlies\n extensions.conf:4 E_APP_MISSING: app 'Payback' does not exist, dialplan will halt here!\n extensions.conf:3 E_DP_GOTO_NOCONTEXT: context not found for goto to somewhere, s, 1\n\nIt had a lot to complain about that little snippet. But it was right. We\neven suppressed two hints about a missing ``[general]`` and ``[global]``\ncontext using ``ALINT_IGNORE``.\n\nNot everything it checks is documented, and it does not check everything\nthat we like yet. But it's a start. Bug reports are welcome. Feature requests\nprefer to be accompanied by a patch :-)\n\nTry out ``modules-show`` if you use ``autoload=no`` in your ``modules.conf``.\n\nAll commands show help if asked:\n\n.. code-block:: console\n\n $ asterisklint modules-show --help\n usage: asterisklint modules-show [-h] [--func-odbc FUNC_ODBC_CONF]\n [EXTENSIONS_CONF]\n\n Show which modules, apps and functions are used by the dialplan. Useful when\n you use autoload=no in your modules.conf. Beware that you do need more modules\n than just these listed.\n\n positional arguments:\n EXTENSIONS_CONF path to extensions.conf\n\n optional arguments:\n -h, --help show this help message and exit\n --func-odbc FUNC_ODBC_CONF\n path to func_odbc.conf, will be read automatically if\n found in same the same dir as extensions.conf; set\n empty to disable\n\n\nInstallation\n------------\n\nInstallation is a matter of ``python3 setup.py install``. Or, for more convenience,\ninstall a PyPI uploaded version through ``pip3(1)``:\n\n.. code-block:: console\n\n $ sudo pip3 install asterisklint\n ...\n Successfully installed asterisklint\n\n\nThe ``dialplan-check`` comes in handy as a git commit hook, for example\n``.git/hooks/pre-commit``:\n\n.. code-block:: sh\n\n #!/bin/sh\n export ALINT_IGNORE= # adjust as needed\n\n asterisklint dialplan-check PATH/TO/extensions.conf\n ret=$?\n if test $ret -ne 0; then\n echo >&2\n echo 'One or more dialplan syntax errors. Please fix before committing.' >&2\n exit $ret\n fi\n\n exit 0\n\n\nTODO\n----\n\n* Expression parsing.\n* Web: state is kept between requests:\n - on 500-error, the next user may get older errors (because of the\n messagedef singleton)\n - the BackGround/Background hack is stored between requests\n* Log/store Set'd variables and compare against Read variables. Also log\n variables Set through the ARRAY() function. (And HASH?)\n* Fix various includes issues:\n - Recursive #includes probably make asterisklint run out of stack.\n - Add checks for recursive dialplan-includes.\n - Scan for missing dialplan-includes.\n* Trim CALLERID match (as used in FreePBX dialplan).\n* Func_odbc parsing improvements:\n - check for missing synopsis/syntax (compare syntax to ARGn count)\n - check for correct usage of VAL (write only) and ARG and missing SQL_ESC\n - yield the odbc functions instead of contexts like it does now\n (See more in func_odbc.py.)\n* Add ``app-check`` command to do dialplan checks of individual lines.\n* Add ``expr-check`` command to do expression (``$[...]``) checks.\n E.g. add:\n exten => X!,1,Set(boolean=$[\"\" <555> = 1234])\n ; Set(boolean=$[${CALLERID(all)} = 1234])\n ; incorrectly using 'all', should use 'num'\n ==> syntax error, unexpected '=', expecting '-' or '!' or '(' or ''\n* Allow multiline variables using += (key=val; key+=more-val).\n* Investigate whether exten=>s,n(label)... exten=>s,label+10... is valid.\n* For the Goto/Gosub-visiting:\n - Attempt to match contexts by regex if there are $VARs involved?\n - Allow a \"noqa\" style exceptions to be placed in a comment?\n* Improve documentation as needed.\n* Before 1.0, start adding versioning -- including semver -- so users can\n depend on a stable API from their custom scripts. Also version the scripts\n (commands) so they won't talk to older/newer libs if that poses a problem.\n\n\nBUGS\n----\n\n* The library is very much in flux. Don't expect it to stabilize any time\n soon. Pay attention to versions!\n* Multiline comments (``;-- ... --;``) are unsupported. Does anyone use those?\n* Limits aren't checked (dialplan lines are limited at 255 or 8191 bytes\n for LOW_MEMORY and normal mode respectively).\n* The library/suite is Python3 only. Right now the effort to make it Python2\n compatible is larger than the demand. In the future Python2 compatibility\n will become even less relevant.\n\n\nAuthor\n------\n\nWalter Doekes, OSSO B.V. 2015-2017\n\n\n\n0.4.1 (2018-10-10)\n~~~~~~~~~~~~~~~~~~\n\nBug fixes:\n\n* Cope with ${vars} in FUNC() arguments.\n* Fix typo's in func_odbc-check.\n* Speedup in dialplan goto-parsing.\n* Unbreak custom command support.\n\nImprovements:\n\n* Add missing app_milliwatt, app_mysql, app_originate,\n func_audiohookinherit, func_volume_register.\n* Add preliminary func_odbc-annotate command; not feature complete.\n* Add the (now obsolete) vg.py contrib command which alters certain file\n reading functions so a slightly different syntax is accepted.\n* Check applications called in ExecIf().\n\n0.4.0 (2017-04-05)\n~~~~~~~~~~~~~~~~~~\n\nBug fixes:\n\n* When doing dialplan-file mutations, operate on the symlink target\n instead of replacing the symlink.\n* Don't install README files into /usr, but in\n /usr/share/doc/asterisklint (or with a different prefix).\n* Also search in included contexts for priority labels.\n\nImprovements:\n\n* Add various apps:\n - Authenticate, ControlPlayback, PickupChan\n - PickupOld1v4 (a workaround, see ASTERISK-26464)\n - VoiceMailPlayMsg, VMSayName,\n - ContinueWhile, EndWhile, ExitWhile, While,\n - AGI, DeadAGI, EAGI,\n - StopMusicOnHold\n* Add various functions:\n - DB, DB_EXISTS, DB_KEYS, DB_DELETE,\n - MD5, TIMEOUT\n - LOCAL, LOCAL_PEEK, STACK_PEEK\n* Add initial checks of function parameters: nothing more than the\n parentheses check we already used on undefined apps.\n* Add application Set() support. Add function SET() support. This also\n enables checking calls to writable functions.\n* Allow both the \"BackGround\" and \"Background\" spelling, as long as\n you choose one consistently.\n* A bunch of refactoring to make BetterCodeHub happy. If you've made\n custom subcommands, look at the MainBase class.\n* Add test with Asterisk 13 sample dialplan as input.\n* Add web frontend into repository.\n\n0.3.0 (2016-06-08)\n~~~~~~~~~~~~~~~~~~\n\n* Add preliminary Goto/Gosub scanning: the dialplan-check now tries to\n find non-existent goto destinations. New error classes:\n E_DP_GOTO_CONTEXT_NOLABEL, E_DP_GOTO_NOCONTEXT, E_DP_GOTO_NOLABEL,\n W_DP_GOTO_CONTEXT_NOEXTEN.\n* Add preliminary app argument checking. New error classes:\n E_APP_ARG_IFCONST, E_APP_ARG_IFEMPTY, E_APP_ARG_SYNTAX.\n* Add new command: ident-scan. It lists used contexts, labels and\n variables and does a poor attempt at finding typo's by comparing\n them against each other.\n* Add Asterisk apps: NoCDR, Record.\n* The commands taking a path to extensions.conf now default to scanning\n for it in the current directory.\n* Python3.5 testcase compatibility fix.\n\n0.2.1 (2016-01-29)\n~~~~~~~~~~~~~~~~~~\n\n* Don't look in __init__ for custom commands.\n\n0.2.0 (2016-01-29)\n~~~~~~~~~~~~~~~~~~\n\n* Add partial func_odbc checking.\n* Add new command: func_odbc-check\n* Do func_odbc checks for modules-show and dialplan-show, so you don't\n get flooded with E_FUNC_MISSING errors if you use func_odbc.\n* Fix a few variable/dialplan parsing bugs, improve some.\n\n0.1.0 (2016-01-15)\n~~~~~~~~~~~~~~~~~~\n\n* Initial release.\n* The following commands are available:\n dialplan-check, dialplan-show, modules-show", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ossobv/asterisklint", "keywords": "", "license": "GPLv3+", "maintainer": "", "maintainer_email": "", "name": "asterisklint", "package_url": "https://pypi.org/project/asterisklint/", "platform": "", "project_url": "https://pypi.org/project/asterisklint/", "project_urls": { "Homepage": "https://github.com/ossobv/asterisklint" }, "release_url": "https://pypi.org/project/asterisklint/0.4.1/", "requires_dist": null, "requires_python": "", "summary": "Asterisk PBX configuration syntax checker", "version": "0.4.1" }, "last_serial": 4359036, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "8e9ea3f2418c96e881bc883827f3fd4b", "sha256": "52dc856ad73a0274dac4f70677f2a825bce05e3b96cce6a85c5b0104143f3832" }, "downloads": -1, "filename": "asterisklint-0.1.0.tar.gz", "has_sig": false, "md5_digest": "8e9ea3f2418c96e881bc883827f3fd4b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 52475, "upload_time": "2016-01-15T22:04:49", "url": "https://files.pythonhosted.org/packages/9d/19/db2997fe5177917430117a3423b58de79ad12e89b8c8445c9b32ce556437/asterisklint-0.1.0.tar.gz" } ], "0.1.0rc6": [ { "comment_text": "", "digests": { "md5": "73e90a67745a59db7a6649e79b5ec161", "sha256": "a0268df15ecd1c63f494f22f2f58be41cb5788cdee81c2f373121b84f764eaeb" }, "downloads": -1, "filename": "asterisklint-0.1.0rc6.tar.gz", "has_sig": false, "md5_digest": "73e90a67745a59db7a6649e79b5ec161", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 51947, "upload_time": "2015-12-18T10:17:26", "url": "https://files.pythonhosted.org/packages/76/a1/a75e71aba15163e81dec405d7cf7b74b0d835f99b6bd7ae086fd02925288/asterisklint-0.1.0rc6.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "2fdfe2ee6b9b7a3887b74148f94e7ad6", "sha256": "81d2902e1df1f3bc540cb8427138a720a4403c0d25b43455042bb754699739d9" }, "downloads": -1, "filename": "asterisklint-0.2.0.tar.gz", "has_sig": false, "md5_digest": "2fdfe2ee6b9b7a3887b74148f94e7ad6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 57142, "upload_time": "2016-01-29T12:34:01", "url": "https://files.pythonhosted.org/packages/8b/ff/7142cd88158c3ec741fd685396af37e2d119ff26472c2ffb7f9cfcb80348/asterisklint-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "0317d6495afc5d709bd32a4d81237348", "sha256": "be8989622fb68a580cf818516513d63019dcbc34a4234f9eccdd9e88664c96ea" }, "downloads": -1, "filename": "asterisklint-0.2.1.tar.gz", "has_sig": false, "md5_digest": "0317d6495afc5d709bd32a4d81237348", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 57232, "upload_time": "2016-01-29T12:48:22", "url": "https://files.pythonhosted.org/packages/38/38/63c557112af81a6ad600cd632dc2fe31c206d372a8bc7a13b0a7199f7d0f/asterisklint-0.2.1.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "35ebc12dad5bc3784cdef984d8036d52", "sha256": "476e3053ca14e304471cb20b17f81ef002eead237e6d5007cbf0563ea425762b" }, "downloads": -1, "filename": "asterisklint-0.3.0.tar.gz", "has_sig": false, "md5_digest": "35ebc12dad5bc3784cdef984d8036d52", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 65285, "upload_time": "2016-06-08T07:48:01", "url": "https://files.pythonhosted.org/packages/45/a6/eda4a94b23f69ff24ef278a7ab1606970a1ee56afcde50b7bc99b3936bf3/asterisklint-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "ffa3ac0f2ea21a729f5f773df3c54d28", "sha256": "cfa7f00dcec8f6c3b7e680043d860dda83e229dd3d653e2c5d890160e2fd6778" }, "downloads": -1, "filename": "asterisklint-0.4.0.tar.gz", "has_sig": false, "md5_digest": "ffa3ac0f2ea21a729f5f773df3c54d28", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 67651, "upload_time": "2017-04-07T09:18:59", "url": "https://files.pythonhosted.org/packages/ef/53/e43210f49eebf4b227c1ad45a9ea75101750e90c4abbec82d5b667d4a899/asterisklint-0.4.0.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "c7dfcd64c7295f8b9a14002811a2e5a4", "sha256": "f254a36bbfc3daf7ee8741b465c66c87a095d17c430e9baae25974345f23c66d" }, "downloads": -1, "filename": "asterisklint-0.4.1.tar.gz", "has_sig": false, "md5_digest": "c7dfcd64c7295f8b9a14002811a2e5a4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 74232, "upload_time": "2018-10-10T08:03:53", "url": "https://files.pythonhosted.org/packages/ab/17/6ae6bde3761de53dfb88a2e04327be5c4916b5005a54eb89c35d333b1e55/asterisklint-0.4.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c7dfcd64c7295f8b9a14002811a2e5a4", "sha256": "f254a36bbfc3daf7ee8741b465c66c87a095d17c430e9baae25974345f23c66d" }, "downloads": -1, "filename": "asterisklint-0.4.1.tar.gz", "has_sig": false, "md5_digest": "c7dfcd64c7295f8b9a14002811a2e5a4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 74232, "upload_time": "2018-10-10T08:03:53", "url": "https://files.pythonhosted.org/packages/ab/17/6ae6bde3761de53dfb88a2e04327be5c4916b5005a54eb89c35d333b1e55/asterisklint-0.4.1.tar.gz" } ] }