├── .dockerignore ├── tests ├── function │ └── __init__.py ├── alintregress │ ├── __init__.py │ └── test_asterisk_dp.py ├── extensions.conf ├── __init__.py ├── cls │ ├── __init__.py │ └── test_singleton.py ├── file │ ├── __init__.py │ ├── test_ctrl.py │ ├── test_normal.py │ └── test_encoding.py ├── alinttest │ ├── __init__.py │ └── test_message.py ├── config │ ├── __init__.py │ └── test_normal.py ├── dialplan │ ├── __init__.py │ ├── test_include.py │ └── test_normal.py ├── pattern │ └── __init__.py ├── variable │ ├── __init__.py │ └── test_split.py └── application │ ├── __init__.py │ ├── test_voicemail.py │ └── test_set.py ├── asterisklint ├── app │ ├── v11 │ │ ├── app_db.py │ │ ├── app_cdr.py │ │ ├── app_dial.py │ │ ├── app_echo.py │ │ ├── app_exec.py │ │ ├── app_macro.py │ │ ├── app_mysql.py │ │ ├── app_page.py │ │ ├── app_queue.py │ │ ├── app_read.py │ │ ├── app_stack.py │ │ ├── app_while.py │ │ ├── builtin.py │ │ ├── chan_sip.py │ │ ├── func_odbc.py │ │ ├── res_agi.py │ │ ├── res_fax.py │ │ ├── unknown.py │ │ ├── app_chanspy.py │ │ ├── app_forkcdr.py │ │ ├── app_meetme.py │ │ ├── app_record.py │ │ ├── app_system.py │ │ ├── app_verbose.py │ │ ├── app_confbridge.py │ │ ├── app_directory.py │ │ ├── app_dumpchan.py │ │ ├── app_followme.py │ │ ├── app_milliwatt.py │ │ ├── app_mixmonitor.py │ │ ├── app_originate.py │ │ ├── app_playback.py │ │ ├── app_playtones.py │ │ ├── app_senddtmf.py │ │ ├── app_softhangup.py │ │ ├── app_userevent.py │ │ ├── app_voicemail.py │ │ ├── app_waituntil.py │ │ ├── app_authenticate.py │ │ ├── app_chanisavail.py │ │ ├── app_sayunixtime.py │ │ ├── app_setcallerid.py │ │ ├── res_musiconhold.py │ │ ├── app_celgenuserevent.py │ │ ├── app_channelredirect.py │ │ ├── app_controlplayback.py │ │ ├── app_directed_pickup.py │ │ └── __init__.py │ ├── v13 │ │ ├── app_db.py │ │ ├── app_cdr.py │ │ ├── app_dial.py │ │ ├── app_echo.py │ │ ├── app_exec.py │ │ ├── app_macro.py │ │ ├── app_mysql.py │ │ ├── app_page.py │ │ ├── app_queue.py │ │ ├── app_read.py │ │ ├── app_stack.py │ │ ├── app_while.py │ │ ├── builtin.py │ │ ├── chan_sip.py │ │ ├── func_odbc.py │ │ ├── res_agi.py │ │ ├── res_fax.py │ │ ├── unknown.py │ │ ├── app_chanspy.py │ │ ├── app_forkcdr.py │ │ ├── app_meetme.py │ │ ├── app_record.py │ │ ├── app_stasis.py │ │ ├── app_system.py │ │ ├── app_verbose.py │ │ ├── app_agent_pool.py │ │ ├── app_bridgewait.py │ │ ├── app_confbridge.py │ │ ├── app_directory.py │ │ ├── app_dumpchan.py │ │ ├── app_followme.py │ │ ├── app_milliwatt.py │ │ ├── app_mixmonitor.py │ │ ├── app_originate.py │ │ ├── app_playback.py │ │ ├── app_playtones.py │ │ ├── app_senddtmf.py │ │ ├── app_softhangup.py │ │ ├── app_userevent.py │ │ ├── app_voicemail.py │ │ ├── app_waituntil.py │ │ ├── app_authenticate.py │ │ ├── app_chanisavail.py │ │ ├── app_sayunixtime.py │ │ ├── app_setcallerid.py │ │ ├── res_musiconhold.py │ │ ├── app_bridgeaddchan.py │ │ ├── app_celgenuserevent.py │ │ ├── app_channelredirect.py │ │ ├── app_controlplayback.py │ │ ├── app_directed_pickup.py │ │ └── __init__.py │ ├── vall │ │ ├── __init__.py │ │ ├── app_cdr.py │ │ ├── app_read.py │ │ ├── app_record.py │ │ ├── app_stasis.py │ │ ├── unknown.py │ │ ├── app_db.py │ │ ├── app_forkcdr.py │ │ ├── app_senddtmf.py │ │ ├── func_odbc.py │ │ ├── app_directory.py │ │ ├── app_dumpchan.py │ │ ├── app_playback.py │ │ ├── app_softhangup.py │ │ ├── app_userevent.py │ │ ├── app_waituntil.py │ │ ├── app_authenticate.py │ │ ├── app_bridgeaddchan.py │ │ ├── app_bridgewait.py │ │ ├── app_chanisavail.py │ │ ├── app_confbridge.py │ │ ├── app_controlplayback.py │ │ ├── app_celgenuserevent.py │ │ ├── app_echo.py │ │ ├── app_page.py │ │ ├── app_followme.py │ │ ├── app_mysql.py │ │ ├── app_milliwatt.py │ │ ├── app_verbose.py │ │ ├── app_channelredirect.py │ │ ├── app_dial.py │ │ ├── app_chanspy.py │ │ ├── res_fax.py │ │ ├── app_sayunixtime.py │ │ ├── app_playtones.py │ │ ├── app_system.py │ │ ├── app_agent_pool.py │ │ ├── app_mixmonitor.py │ │ ├── app_setcallerid.py │ │ ├── res_agi.py │ │ ├── chan_sip.py │ │ ├── app_macro.py │ │ ├── app_while.py │ │ ├── genstub.sh │ │ ├── res_musiconhold.py │ │ ├── app_directed_pickup.py │ │ ├── app_meetme.py │ │ ├── app_originate.py │ │ ├── app_queue.py │ │ ├── app_voicemail.py │ │ └── app_exec.py │ └── __init__.py ├── func │ ├── v11 │ │ ├── builtin.py │ │ ├── chan_sip.py │ │ ├── func_cdr.py │ │ ├── func_cut.py │ │ ├── func_db.py │ │ ├── func_env.py │ │ ├── func_md5.py │ │ ├── func_uri.py │ │ ├── res_fax.py │ │ ├── unknown.py │ │ ├── app_queue.py │ │ ├── app_stack.py │ │ ├── func_base64.py │ │ ├── func_curl.py │ │ ├── func_enum.py │ │ ├── func_global.py │ │ ├── func_logic.py │ │ ├── func_math.py │ │ ├── func_odbc.py │ │ ├── func_rand.py │ │ ├── func_shell.py │ │ ├── func_volume.py │ │ ├── func_callerid.py │ │ ├── func_channel.py │ │ ├── func_devstate.py │ │ ├── func_dialplan.py │ │ ├── func_strings.py │ │ ├── func_timeout.py │ │ ├── app_confbridge.py │ │ ├── func_dialgroup.py │ │ ├── func_groupcount.py │ │ ├── func_audiohookinherit.py │ │ └── __init__.py │ ├── v13 │ │ ├── builtin.py │ │ ├── chan_sip.py │ │ ├── func_cdr.py │ │ ├── func_cut.py │ │ ├── func_db.py │ │ ├── func_env.py │ │ ├── func_md5.py │ │ ├── func_uri.py │ │ ├── res_fax.py │ │ ├── unknown.py │ │ ├── app_queue.py │ │ ├── app_stack.py │ │ ├── chan_pjsip.py │ │ ├── func_base64.py │ │ ├── func_curl.py │ │ ├── func_enum.py │ │ ├── func_global.py │ │ ├── func_logic.py │ │ ├── func_math.py │ │ ├── func_odbc.py │ │ ├── func_pjsip.py │ │ ├── func_rand.py │ │ ├── func_shell.py │ │ ├── func_volume.py │ │ ├── res_pjsip.py │ │ ├── func_callerid.py │ │ ├── func_channel.py │ │ ├── func_devstate.py │ │ ├── func_dialplan.py │ │ ├── func_strings.py │ │ ├── func_timeout.py │ │ ├── app_confbridge.py │ │ ├── func_dialgroup.py │ │ ├── func_groupcount.py │ │ ├── func_talkdetect.py │ │ ├── func_audiohookinherit.py │ │ └── __init__.py │ ├── vall │ │ ├── __init__.py │ │ ├── func_md5.py │ │ ├── func_rand.py │ │ ├── func_shell.py │ │ ├── func_timeout.py │ │ ├── func_volume.py │ │ ├── res_fax.py │ │ ├── unknown.py │ │ ├── func_dialgroup.py │ │ ├── func_talkdetect.py │ │ ├── func_cdr.py │ │ ├── res_pjsip.py │ │ ├── func_curl.py │ │ ├── func_global.py │ │ ├── func_cut.py │ │ ├── func_odbc.py │ │ ├── func_uri.py │ │ ├── func_devstate.py │ │ ├── app_confbridge.py │ │ ├── func_base64.py │ │ ├── func_dialplan.py │ │ ├── app_stack.py │ │ ├── func_channel.py │ │ ├── func_enum.py │ │ ├── chan_sip.py │ │ ├── func_db.py │ │ ├── func_callerid.py │ │ ├── func_groupcount.py │ │ ├── func_pjsip.py │ │ ├── func_audiohookinherit.py │ │ ├── genstub.sh │ │ ├── func_env.py │ │ ├── app_queue.py │ │ ├── chan_pjsip.py │ │ ├── func_logic.py │ │ ├── builtin.py │ │ └── func_math.py │ ├── __init__.py │ └── base.py ├── commands │ ├── __init__.py │ ├── dialplan-show.py │ ├── func_odbc-check.py │ └── dialplan-check.py ├── helper │ └── __init__.py ├── where.py ├── __init__.py ├── expression.py ├── alintver.py ├── cls.py ├── function.py ├── mainutil.py └── version.py ├── .gitignore ├── artwork ├── LICENSE.CC.BY-NC-SA.4-0.source ├── asterisklint-logo │ ├── icon_black.png │ ├── icon_color.png │ ├── icon_white.png │ ├── vertical_black.png │ ├── vertical_color.png │ ├── vertical_white.png │ ├── horizontal_black.png │ ├── horizontal_color.png │ └── horizontal_white.png └── README.rst ├── assets └── asterisklint_head.png ├── web ├── static │ ├── asterisklint_head.png │ └── ie10-viewport-bug-workaround.js ├── example-api-call.sh ├── Dockerfile ├── README.rst └── asterisklint.ini ├── Dockerfile ├── NOTEPAD.rst ├── scripts └── asterisklint └── Makefile /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | -------------------------------------------------------------------------------- /tests/function/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/alintregress/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /asterisklint/app/v11/app_db.py: -------------------------------------------------------------------------------- 1 | ../vall/app_db.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_db.py: -------------------------------------------------------------------------------- 1 | ../vall/app_db.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_cdr.py: -------------------------------------------------------------------------------- 1 | ../vall/app_cdr.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_dial.py: -------------------------------------------------------------------------------- 1 | ../vall/app_dial.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_echo.py: -------------------------------------------------------------------------------- 1 | ../vall/app_echo.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_exec.py: -------------------------------------------------------------------------------- 1 | ../vall/app_exec.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_macro.py: -------------------------------------------------------------------------------- 1 | ../vall/app_macro.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_mysql.py: -------------------------------------------------------------------------------- 1 | ../vall/app_mysql.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_page.py: -------------------------------------------------------------------------------- 1 | ../vall/app_page.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_queue.py: -------------------------------------------------------------------------------- 1 | ../vall/app_queue.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_read.py: -------------------------------------------------------------------------------- 1 | ../vall/app_read.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_stack.py: -------------------------------------------------------------------------------- 1 | ../vall/app_stack.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_while.py: -------------------------------------------------------------------------------- 1 | ../vall/app_while.py -------------------------------------------------------------------------------- /asterisklint/app/v11/builtin.py: -------------------------------------------------------------------------------- 1 | ../vall/builtin.py -------------------------------------------------------------------------------- /asterisklint/app/v11/chan_sip.py: -------------------------------------------------------------------------------- 1 | ../vall/chan_sip.py -------------------------------------------------------------------------------- /asterisklint/app/v11/func_odbc.py: -------------------------------------------------------------------------------- 1 | ../vall/func_odbc.py -------------------------------------------------------------------------------- /asterisklint/app/v11/res_agi.py: -------------------------------------------------------------------------------- 1 | ../vall/res_agi.py -------------------------------------------------------------------------------- /asterisklint/app/v11/res_fax.py: -------------------------------------------------------------------------------- 1 | ../vall/res_fax.py -------------------------------------------------------------------------------- /asterisklint/app/v11/unknown.py: -------------------------------------------------------------------------------- 1 | ../vall/unknown.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_cdr.py: -------------------------------------------------------------------------------- 1 | ../vall/app_cdr.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_dial.py: -------------------------------------------------------------------------------- 1 | ../vall/app_dial.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_echo.py: -------------------------------------------------------------------------------- 1 | ../vall/app_echo.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_exec.py: -------------------------------------------------------------------------------- 1 | ../vall/app_exec.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_macro.py: -------------------------------------------------------------------------------- 1 | ../vall/app_macro.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_mysql.py: -------------------------------------------------------------------------------- 1 | ../vall/app_mysql.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_page.py: -------------------------------------------------------------------------------- 1 | ../vall/app_page.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_queue.py: -------------------------------------------------------------------------------- 1 | ../vall/app_queue.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_read.py: -------------------------------------------------------------------------------- 1 | ../vall/app_read.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_stack.py: -------------------------------------------------------------------------------- 1 | ../vall/app_stack.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_while.py: -------------------------------------------------------------------------------- 1 | ../vall/app_while.py -------------------------------------------------------------------------------- /asterisklint/app/v13/builtin.py: -------------------------------------------------------------------------------- 1 | ../vall/builtin.py -------------------------------------------------------------------------------- /asterisklint/app/v13/chan_sip.py: -------------------------------------------------------------------------------- 1 | ../vall/chan_sip.py -------------------------------------------------------------------------------- /asterisklint/app/v13/func_odbc.py: -------------------------------------------------------------------------------- 1 | ../vall/func_odbc.py -------------------------------------------------------------------------------- /asterisklint/app/v13/res_agi.py: -------------------------------------------------------------------------------- 1 | ../vall/res_agi.py -------------------------------------------------------------------------------- /asterisklint/app/v13/res_fax.py: -------------------------------------------------------------------------------- 1 | ../vall/res_fax.py -------------------------------------------------------------------------------- /asterisklint/app/v13/unknown.py: -------------------------------------------------------------------------------- 1 | ../vall/unknown.py -------------------------------------------------------------------------------- /asterisklint/func/v11/builtin.py: -------------------------------------------------------------------------------- 1 | ../vall/builtin.py -------------------------------------------------------------------------------- /asterisklint/func/v11/chan_sip.py: -------------------------------------------------------------------------------- 1 | ../vall/chan_sip.py -------------------------------------------------------------------------------- /asterisklint/func/v11/func_cdr.py: -------------------------------------------------------------------------------- 1 | ../vall/func_cdr.py -------------------------------------------------------------------------------- /asterisklint/func/v11/func_cut.py: -------------------------------------------------------------------------------- 1 | ../vall/func_cut.py -------------------------------------------------------------------------------- /asterisklint/func/v11/func_db.py: -------------------------------------------------------------------------------- 1 | ../vall/func_db.py -------------------------------------------------------------------------------- /asterisklint/func/v11/func_env.py: -------------------------------------------------------------------------------- 1 | ../vall/func_env.py -------------------------------------------------------------------------------- /asterisklint/func/v11/func_md5.py: -------------------------------------------------------------------------------- 1 | ../vall/func_md5.py -------------------------------------------------------------------------------- /asterisklint/func/v11/func_uri.py: -------------------------------------------------------------------------------- 1 | ../vall/func_uri.py -------------------------------------------------------------------------------- /asterisklint/func/v11/res_fax.py: -------------------------------------------------------------------------------- 1 | ../vall/res_fax.py -------------------------------------------------------------------------------- /asterisklint/func/v11/unknown.py: -------------------------------------------------------------------------------- 1 | ../vall/unknown.py -------------------------------------------------------------------------------- /asterisklint/func/v13/builtin.py: -------------------------------------------------------------------------------- 1 | ../vall/builtin.py -------------------------------------------------------------------------------- /asterisklint/func/v13/chan_sip.py: -------------------------------------------------------------------------------- 1 | ../vall/chan_sip.py -------------------------------------------------------------------------------- /asterisklint/func/v13/func_cdr.py: -------------------------------------------------------------------------------- 1 | ../vall/func_cdr.py -------------------------------------------------------------------------------- /asterisklint/func/v13/func_cut.py: -------------------------------------------------------------------------------- 1 | ../vall/func_cut.py -------------------------------------------------------------------------------- /asterisklint/func/v13/func_db.py: -------------------------------------------------------------------------------- 1 | ../vall/func_db.py -------------------------------------------------------------------------------- /asterisklint/func/v13/func_env.py: -------------------------------------------------------------------------------- 1 | ../vall/func_env.py -------------------------------------------------------------------------------- /asterisklint/func/v13/func_md5.py: -------------------------------------------------------------------------------- 1 | ../vall/func_md5.py -------------------------------------------------------------------------------- /asterisklint/func/v13/func_uri.py: -------------------------------------------------------------------------------- 1 | ../vall/func_uri.py -------------------------------------------------------------------------------- /asterisklint/func/v13/res_fax.py: -------------------------------------------------------------------------------- 1 | ../vall/res_fax.py -------------------------------------------------------------------------------- /asterisklint/func/v13/unknown.py: -------------------------------------------------------------------------------- 1 | ../vall/unknown.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_chanspy.py: -------------------------------------------------------------------------------- 1 | ../vall/app_chanspy.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_forkcdr.py: -------------------------------------------------------------------------------- 1 | ../vall/app_forkcdr.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_meetme.py: -------------------------------------------------------------------------------- 1 | ../vall/app_meetme.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_record.py: -------------------------------------------------------------------------------- 1 | ../vall/app_record.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_system.py: -------------------------------------------------------------------------------- 1 | ../vall/app_system.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_verbose.py: -------------------------------------------------------------------------------- 1 | ../vall/app_verbose.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_chanspy.py: -------------------------------------------------------------------------------- 1 | ../vall/app_chanspy.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_forkcdr.py: -------------------------------------------------------------------------------- 1 | ../vall/app_forkcdr.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_meetme.py: -------------------------------------------------------------------------------- 1 | ../vall/app_meetme.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_record.py: -------------------------------------------------------------------------------- 1 | ../vall/app_record.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_stasis.py: -------------------------------------------------------------------------------- 1 | ../vall/app_stasis.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_system.py: -------------------------------------------------------------------------------- 1 | ../vall/app_system.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_verbose.py: -------------------------------------------------------------------------------- 1 | ../vall/app_verbose.py -------------------------------------------------------------------------------- /asterisklint/func/v11/app_queue.py: -------------------------------------------------------------------------------- 1 | ../vall/app_queue.py -------------------------------------------------------------------------------- /asterisklint/func/v11/app_stack.py: -------------------------------------------------------------------------------- 1 | ../vall/app_stack.py -------------------------------------------------------------------------------- /asterisklint/func/v11/func_base64.py: -------------------------------------------------------------------------------- 1 | ../vall/func_base64.py -------------------------------------------------------------------------------- /asterisklint/func/v11/func_curl.py: -------------------------------------------------------------------------------- 1 | ../vall/func_curl.py -------------------------------------------------------------------------------- /asterisklint/func/v11/func_enum.py: -------------------------------------------------------------------------------- 1 | ../vall/func_enum.py -------------------------------------------------------------------------------- /asterisklint/func/v11/func_global.py: -------------------------------------------------------------------------------- 1 | ../vall/func_global.py -------------------------------------------------------------------------------- /asterisklint/func/v11/func_logic.py: -------------------------------------------------------------------------------- 1 | ../vall/func_logic.py -------------------------------------------------------------------------------- /asterisklint/func/v11/func_math.py: -------------------------------------------------------------------------------- 1 | ../vall/func_math.py -------------------------------------------------------------------------------- /asterisklint/func/v11/func_odbc.py: -------------------------------------------------------------------------------- 1 | ../vall/func_odbc.py -------------------------------------------------------------------------------- /asterisklint/func/v11/func_rand.py: -------------------------------------------------------------------------------- 1 | ../vall/func_rand.py -------------------------------------------------------------------------------- /asterisklint/func/v11/func_shell.py: -------------------------------------------------------------------------------- 1 | ../vall/func_shell.py -------------------------------------------------------------------------------- /asterisklint/func/v11/func_volume.py: -------------------------------------------------------------------------------- 1 | ../vall/func_volume.py -------------------------------------------------------------------------------- /asterisklint/func/v13/app_queue.py: -------------------------------------------------------------------------------- 1 | ../vall/app_queue.py -------------------------------------------------------------------------------- /asterisklint/func/v13/app_stack.py: -------------------------------------------------------------------------------- 1 | ../vall/app_stack.py -------------------------------------------------------------------------------- /asterisklint/func/v13/chan_pjsip.py: -------------------------------------------------------------------------------- 1 | ../vall/chan_pjsip.py -------------------------------------------------------------------------------- /asterisklint/func/v13/func_base64.py: -------------------------------------------------------------------------------- 1 | ../vall/func_base64.py -------------------------------------------------------------------------------- /asterisklint/func/v13/func_curl.py: -------------------------------------------------------------------------------- 1 | ../vall/func_curl.py -------------------------------------------------------------------------------- /asterisklint/func/v13/func_enum.py: -------------------------------------------------------------------------------- 1 | ../vall/func_enum.py -------------------------------------------------------------------------------- /asterisklint/func/v13/func_global.py: -------------------------------------------------------------------------------- 1 | ../vall/func_global.py -------------------------------------------------------------------------------- /asterisklint/func/v13/func_logic.py: -------------------------------------------------------------------------------- 1 | ../vall/func_logic.py -------------------------------------------------------------------------------- /asterisklint/func/v13/func_math.py: -------------------------------------------------------------------------------- 1 | ../vall/func_math.py -------------------------------------------------------------------------------- /asterisklint/func/v13/func_odbc.py: -------------------------------------------------------------------------------- 1 | ../vall/func_odbc.py -------------------------------------------------------------------------------- /asterisklint/func/v13/func_pjsip.py: -------------------------------------------------------------------------------- 1 | ../vall/func_pjsip.py -------------------------------------------------------------------------------- /asterisklint/func/v13/func_rand.py: -------------------------------------------------------------------------------- 1 | ../vall/func_rand.py -------------------------------------------------------------------------------- /asterisklint/func/v13/func_shell.py: -------------------------------------------------------------------------------- 1 | ../vall/func_shell.py -------------------------------------------------------------------------------- /asterisklint/func/v13/func_volume.py: -------------------------------------------------------------------------------- 1 | ../vall/func_volume.py -------------------------------------------------------------------------------- /asterisklint/func/v13/res_pjsip.py: -------------------------------------------------------------------------------- 1 | ../vall/res_pjsip.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_confbridge.py: -------------------------------------------------------------------------------- 1 | ../vall/app_confbridge.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_directory.py: -------------------------------------------------------------------------------- 1 | ../vall/app_directory.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_dumpchan.py: -------------------------------------------------------------------------------- 1 | ../vall/app_dumpchan.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_followme.py: -------------------------------------------------------------------------------- 1 | ../vall/app_followme.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_milliwatt.py: -------------------------------------------------------------------------------- 1 | ../vall/app_milliwatt.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_mixmonitor.py: -------------------------------------------------------------------------------- 1 | ../vall/app_mixmonitor.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_originate.py: -------------------------------------------------------------------------------- 1 | ../vall/app_originate.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_playback.py: -------------------------------------------------------------------------------- 1 | ../vall/app_playback.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_playtones.py: -------------------------------------------------------------------------------- 1 | ../vall/app_playtones.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_senddtmf.py: -------------------------------------------------------------------------------- 1 | ../vall/app_senddtmf.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_softhangup.py: -------------------------------------------------------------------------------- 1 | ../vall/app_softhangup.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_userevent.py: -------------------------------------------------------------------------------- 1 | ../vall/app_userevent.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_voicemail.py: -------------------------------------------------------------------------------- 1 | ../vall/app_voicemail.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_waituntil.py: -------------------------------------------------------------------------------- 1 | ../vall/app_waituntil.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_agent_pool.py: -------------------------------------------------------------------------------- 1 | ../vall/app_agent_pool.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_bridgewait.py: -------------------------------------------------------------------------------- 1 | ../vall/app_bridgewait.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_confbridge.py: -------------------------------------------------------------------------------- 1 | ../vall/app_confbridge.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_directory.py: -------------------------------------------------------------------------------- 1 | ../vall/app_directory.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_dumpchan.py: -------------------------------------------------------------------------------- 1 | ../vall/app_dumpchan.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_followme.py: -------------------------------------------------------------------------------- 1 | ../vall/app_followme.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_milliwatt.py: -------------------------------------------------------------------------------- 1 | ../vall/app_milliwatt.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_mixmonitor.py: -------------------------------------------------------------------------------- 1 | ../vall/app_mixmonitor.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_originate.py: -------------------------------------------------------------------------------- 1 | ../vall/app_originate.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_playback.py: -------------------------------------------------------------------------------- 1 | ../vall/app_playback.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_playtones.py: -------------------------------------------------------------------------------- 1 | ../vall/app_playtones.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_senddtmf.py: -------------------------------------------------------------------------------- 1 | ../vall/app_senddtmf.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_softhangup.py: -------------------------------------------------------------------------------- 1 | ../vall/app_softhangup.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_userevent.py: -------------------------------------------------------------------------------- 1 | ../vall/app_userevent.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_voicemail.py: -------------------------------------------------------------------------------- 1 | ../vall/app_voicemail.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_waituntil.py: -------------------------------------------------------------------------------- 1 | ../vall/app_waituntil.py -------------------------------------------------------------------------------- /asterisklint/func/v11/func_callerid.py: -------------------------------------------------------------------------------- 1 | ../vall/func_callerid.py -------------------------------------------------------------------------------- /asterisklint/func/v11/func_channel.py: -------------------------------------------------------------------------------- 1 | ../vall/func_channel.py -------------------------------------------------------------------------------- /asterisklint/func/v11/func_devstate.py: -------------------------------------------------------------------------------- 1 | ../vall/func_devstate.py -------------------------------------------------------------------------------- /asterisklint/func/v11/func_dialplan.py: -------------------------------------------------------------------------------- 1 | ../vall/func_dialplan.py -------------------------------------------------------------------------------- /asterisklint/func/v11/func_strings.py: -------------------------------------------------------------------------------- 1 | ../vall/func_strings.py -------------------------------------------------------------------------------- /asterisklint/func/v11/func_timeout.py: -------------------------------------------------------------------------------- 1 | ../vall/func_timeout.py -------------------------------------------------------------------------------- /asterisklint/func/v13/func_callerid.py: -------------------------------------------------------------------------------- 1 | ../vall/func_callerid.py -------------------------------------------------------------------------------- /asterisklint/func/v13/func_channel.py: -------------------------------------------------------------------------------- 1 | ../vall/func_channel.py -------------------------------------------------------------------------------- /asterisklint/func/v13/func_devstate.py: -------------------------------------------------------------------------------- 1 | ../vall/func_devstate.py -------------------------------------------------------------------------------- /asterisklint/func/v13/func_dialplan.py: -------------------------------------------------------------------------------- 1 | ../vall/func_dialplan.py -------------------------------------------------------------------------------- /asterisklint/func/v13/func_strings.py: -------------------------------------------------------------------------------- 1 | ../vall/func_strings.py -------------------------------------------------------------------------------- /asterisklint/func/v13/func_timeout.py: -------------------------------------------------------------------------------- 1 | ../vall/func_timeout.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_authenticate.py: -------------------------------------------------------------------------------- 1 | ../vall/app_authenticate.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_chanisavail.py: -------------------------------------------------------------------------------- 1 | ../vall/app_chanisavail.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_sayunixtime.py: -------------------------------------------------------------------------------- 1 | ../vall/app_sayunixtime.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_setcallerid.py: -------------------------------------------------------------------------------- 1 | ../vall/app_setcallerid.py -------------------------------------------------------------------------------- /asterisklint/app/v11/res_musiconhold.py: -------------------------------------------------------------------------------- 1 | ../vall/res_musiconhold.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_authenticate.py: -------------------------------------------------------------------------------- 1 | ../vall/app_authenticate.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_chanisavail.py: -------------------------------------------------------------------------------- 1 | ../vall/app_chanisavail.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_sayunixtime.py: -------------------------------------------------------------------------------- 1 | ../vall/app_sayunixtime.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_setcallerid.py: -------------------------------------------------------------------------------- 1 | ../vall/app_setcallerid.py -------------------------------------------------------------------------------- /asterisklint/app/v13/res_musiconhold.py: -------------------------------------------------------------------------------- 1 | ../vall/res_musiconhold.py -------------------------------------------------------------------------------- /asterisklint/func/v11/app_confbridge.py: -------------------------------------------------------------------------------- 1 | ../vall/app_confbridge.py -------------------------------------------------------------------------------- /asterisklint/func/v11/func_dialgroup.py: -------------------------------------------------------------------------------- 1 | ../vall/func_dialgroup.py -------------------------------------------------------------------------------- /asterisklint/func/v11/func_groupcount.py: -------------------------------------------------------------------------------- 1 | ../vall/func_groupcount.py -------------------------------------------------------------------------------- /asterisklint/func/v13/app_confbridge.py: -------------------------------------------------------------------------------- 1 | ../vall/app_confbridge.py -------------------------------------------------------------------------------- /asterisklint/func/v13/func_dialgroup.py: -------------------------------------------------------------------------------- 1 | ../vall/func_dialgroup.py -------------------------------------------------------------------------------- /asterisklint/func/v13/func_groupcount.py: -------------------------------------------------------------------------------- 1 | ../vall/func_groupcount.py -------------------------------------------------------------------------------- /asterisklint/func/v13/func_talkdetect.py: -------------------------------------------------------------------------------- 1 | ../vall/func_talkdetect.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_celgenuserevent.py: -------------------------------------------------------------------------------- 1 | ../vall/app_celgenuserevent.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_channelredirect.py: -------------------------------------------------------------------------------- 1 | ../vall/app_channelredirect.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_controlplayback.py: -------------------------------------------------------------------------------- 1 | ../vall/app_controlplayback.py -------------------------------------------------------------------------------- /asterisklint/app/v11/app_directed_pickup.py: -------------------------------------------------------------------------------- 1 | ../vall/app_directed_pickup.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_bridgeaddchan.py: -------------------------------------------------------------------------------- 1 | ../vall/app_bridgeaddchan.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_celgenuserevent.py: -------------------------------------------------------------------------------- 1 | ../vall/app_celgenuserevent.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_channelredirect.py: -------------------------------------------------------------------------------- 1 | ../vall/app_channelredirect.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_controlplayback.py: -------------------------------------------------------------------------------- 1 | ../vall/app_controlplayback.py -------------------------------------------------------------------------------- /asterisklint/app/v13/app_directed_pickup.py: -------------------------------------------------------------------------------- 1 | ../vall/app_directed_pickup.py -------------------------------------------------------------------------------- /asterisklint/func/v11/func_audiohookinherit.py: -------------------------------------------------------------------------------- 1 | ../vall/func_audiohookinherit.py -------------------------------------------------------------------------------- /asterisklint/func/v13/func_audiohookinherit.py: -------------------------------------------------------------------------------- 1 | ../vall/func_audiohookinherit.py -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.sw? 2 | *.pyc 3 | __pycache__ 4 | 5 | /Makefile.version 6 | /build 7 | -------------------------------------------------------------------------------- /artwork/LICENSE.CC.BY-NC-SA.4-0.source: -------------------------------------------------------------------------------- 1 | https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.txt 2 | -------------------------------------------------------------------------------- /assets/asterisklint_head.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossobv/asterisklint/HEAD/assets/asterisklint_head.png -------------------------------------------------------------------------------- /web/static/asterisklint_head.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossobv/asterisklint/HEAD/web/static/asterisklint_head.png -------------------------------------------------------------------------------- /artwork/asterisklint-logo/icon_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossobv/asterisklint/HEAD/artwork/asterisklint-logo/icon_black.png -------------------------------------------------------------------------------- /artwork/asterisklint-logo/icon_color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossobv/asterisklint/HEAD/artwork/asterisklint-logo/icon_color.png -------------------------------------------------------------------------------- /artwork/asterisklint-logo/icon_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossobv/asterisklint/HEAD/artwork/asterisklint-logo/icon_white.png -------------------------------------------------------------------------------- /artwork/asterisklint-logo/vertical_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossobv/asterisklint/HEAD/artwork/asterisklint-logo/vertical_black.png -------------------------------------------------------------------------------- /artwork/asterisklint-logo/vertical_color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossobv/asterisklint/HEAD/artwork/asterisklint-logo/vertical_color.png -------------------------------------------------------------------------------- /artwork/asterisklint-logo/vertical_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossobv/asterisklint/HEAD/artwork/asterisklint-logo/vertical_white.png -------------------------------------------------------------------------------- /artwork/asterisklint-logo/horizontal_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossobv/asterisklint/HEAD/artwork/asterisklint-logo/horizontal_black.png -------------------------------------------------------------------------------- /artwork/asterisklint-logo/horizontal_color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossobv/asterisklint/HEAD/artwork/asterisklint-logo/horizontal_color.png -------------------------------------------------------------------------------- /artwork/asterisklint-logo/horizontal_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossobv/asterisklint/HEAD/artwork/asterisklint-logo/horizontal_white.png -------------------------------------------------------------------------------- /web/example-api-call.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | url=${1:-http://localhost:8080/dialplan-check/} 3 | file=${2:-../extensions.conf} 4 | jsondialplan=$(jq -Rs . "$file") 5 | curl -XPOST "$url" --data-raw '{"files":{"extensions.conf":'"$jsondialplan"'}}' 6 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3-alpine AS builder 2 | COPY . /app 3 | RUN python -m venv /opt/venv 4 | ENV PATH="/opt/venv/bin:$PATH" 5 | WORKDIR /app 6 | RUN pip install . 7 | 8 | 9 | FROM python:3-alpine 10 | COPY --from=builder /opt/venv /opt/venv 11 | ENV PATH="/opt/venv/bin:$PATH" 12 | WORKDIR /etc/asterisk 13 | CMD ["asterisklint", "ls"] 14 | -------------------------------------------------------------------------------- /artwork/README.rst: -------------------------------------------------------------------------------- 1 | AsteriskLint artwork 2 | ==================== 3 | 4 | The artwork -- the AsteriskLint logo, created by Ura Design (@uracreative) -- 5 | is licensed according to the 6 | *Attribution-NonCommercial-ShareAlike 4.0 International* Creative Commons 7 | license (CC BY-NC-SA 4.0); 8 | see `LICENSE.CC.BY-NC-SA.4-0.txt 9 | `_. 10 | -------------------------------------------------------------------------------- /web/static/ie10-viewport-bug-workaround.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * IE10 viewport hack for Surface/desktop Windows 8 bug 3 | * Copyright 2014-2015 Twitter, Inc. 4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 5 | */ 6 | !function(){"use strict" 7 | if(navigator.userAgent.match(/IEMobile\/10\.0/)){var e=document.createElement("style") 8 | e.appendChild(document.createTextNode("@-ms-viewport{width:auto!important}")),document.querySelector("head").appendChild(e)}}() 9 | -------------------------------------------------------------------------------- /web/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ossobv/uwsgi-python:3 2 | 3 | ARG CACHEBUST 4 | ARG VERSION 5 | 6 | RUN \ 7 | # Falcon is a prerequisite for wsgi.py. 8 | pip3 install --no-cache-dir 'falcon>=2' && \ 9 | # Fetch asterisklint, the --pre-release if available. 10 | pip3 install --no-cache-dir --pre asterisklint${VERSION:+==}${VERSION} 11 | 12 | COPY asterisklint.ini index.html wsgi.py /app/ 13 | COPY static /app/static 14 | RUN python3 -m compileall /app/ 15 | 16 | # Drop write perms from all added files again, as umask is not 022: 17 | # https://gitlab.com/gitlab-org/gitlab-runner/issues/1736 18 | RUN chmod -R go-w /app 19 | 20 | USER www-data 21 | WORKDIR /app 22 | CMD ["uwsgi", "asterisklint.ini"] 23 | -------------------------------------------------------------------------------- /web/README.rst: -------------------------------------------------------------------------------- 1 | Web frontend 2 | ============ 3 | 4 | :: 5 | 6 | $ mkvirtualenv --python=$(which python3) asterisklint-web 7 | $ pip install falcon 8 | $ pip install asterisklint 9 | 10 | 11 | TODO 12 | ---- 13 | 14 | * Short explanation at the top. 15 | * Move notes to below Evaluate. 16 | * Checkboxes for eliminating certain warnings/errors. 17 | * Proper count of issues per issue. 18 | - Also in URI: W (bitmask of issue types shown) 19 | * Store dialplans for future viewing. (Optional.) 20 | Also fill the textbox at once? Otherwise others cannot edit it easily. 21 | - HS = store for 2**3 seconds 22 | - 13S = 2h 23 | - 16S = 18h 24 | - 18S = 3d 25 | - 21S = 24d 26 | - 24S = 6m 27 | -------------------------------------------------------------------------------- /web/asterisklint.ini: -------------------------------------------------------------------------------- 1 | [uwsgi] 2 | plugin = python3 3 | wsgi-file = wsgi.py 4 | 5 | # Default: 6 | #log-format = [pid: %(pid)|app: -|req: -/-] %(addr) (%(user)) {%(vars) vars in %(pktsize) bytes} [%(ctime)] %(method) %(uri) => generated %(rsize) bytes in %(msecs) msecs (%(proto) %(status)) %(headers) headers in %(hsize) bytes (%(switches) switches on core %(core)) 7 | log-format = [pid: %(pid)|app: -|req: -/-] %(var.HTTP_X_FORWARDED_FOR) (%(user)) {%(vars) vars in %(pktsize) bytes} [%(ctime)] %(method) %(uri) => generated %(rsize) bytes in %(msecs) msecs (%(proto) %(status)) %(headers) headers in %(hsize) bytes (%(switches) switches on core %(core)) proxy=%(addr) 8 | 9 | master = 1 10 | http-socket = :8080 11 | workers = 4 12 | 13 | static-map=/static=/app/static 14 | -------------------------------------------------------------------------------- /tests/extensions.conf: -------------------------------------------------------------------------------- 1 | [general] 2 | clearglobalvars=yes 3 | 4 | [globals] 5 | SOMEGLOBAL=X 6 | SOMEGLOBAL2=Y 7 | 8 | [test] 9 | exten => s(goed1),1,NoOp 10 | same => n,Set(a=) 11 | same => n,NoOp(NIET GOED) 12 | same => n,NoOp($[${a}=]) 13 | same => n,NoOp($[${a}=""]) 14 | same => n,NoOp($[="${a}"]) 15 | same => n,NoOp($[=${a}]) 16 | 17 | same => n,NoOp(WEL GOED) 18 | same => n,NoOp($["${a}"=""]) 19 | 20 | same => n,Set(a=x) 21 | same => n(goed),NoOp(OOK GOED) 22 | same => n,NoOp($[${a}=x]) 23 | same => n,NoOp($[${a}="x"]) 24 | same => n,NoOp($["${a}"=x]) 25 | same => n,NoOp($["${a}"="x"]) 26 | 27 | [test2] 28 | exten => _X!,1,NoOp(all) 29 | exten => _N!,2,NoOp(N only) 30 | exten => _[01]!,2,NoOp(01 only) 31 | exten => _X!,3,NoOp(all again) 32 | 33 | [globals] 34 | OTHER=Y 35 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | -------------------------------------------------------------------------------- /tests/cls/__init__.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | -------------------------------------------------------------------------------- /tests/file/__init__.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | -------------------------------------------------------------------------------- /asterisklint/app/v13/__init__.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2019 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | -------------------------------------------------------------------------------- /asterisklint/func/v13/__init__.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2019 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | -------------------------------------------------------------------------------- /tests/alinttest/__init__.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | -------------------------------------------------------------------------------- /tests/config/__init__.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | -------------------------------------------------------------------------------- /tests/dialplan/__init__.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | -------------------------------------------------------------------------------- /tests/pattern/__init__.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | -------------------------------------------------------------------------------- /tests/variable/__init__.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | -------------------------------------------------------------------------------- /asterisklint/app/v11/__init__.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | -------------------------------------------------------------------------------- /asterisklint/app/vall/__init__.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | -------------------------------------------------------------------------------- /asterisklint/commands/__init__.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | -------------------------------------------------------------------------------- /asterisklint/func/v11/__init__.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | -------------------------------------------------------------------------------- /asterisklint/helper/__init__.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | -------------------------------------------------------------------------------- /tests/application/__init__.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | -------------------------------------------------------------------------------- /asterisklint/func/vall/__init__.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_cdr.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class NoCDR(AppBase): 20 | pass 21 | 22 | 23 | def register(app_loader): 24 | app_loader.register(NoCDR()) 25 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_read.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class Read(AppBase): 20 | pass 21 | 22 | 23 | def register(app_loader): 24 | app_loader.register(Read()) 25 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_record.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class Record(AppBase): 20 | pass 21 | 22 | 23 | def register(app_loader): 24 | app_loader.register(Record()) 25 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_stasis.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2019 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class Stasis(AppBase): 20 | pass 21 | 22 | 23 | def register(app_loader): 24 | app_loader.register(Stasis()) 25 | -------------------------------------------------------------------------------- /asterisklint/func/vall/func_md5.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2017 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class MD5(FuncBase): 20 | pass 21 | 22 | 23 | def register(func_loader): 24 | func_loader.register(MD5()) 25 | -------------------------------------------------------------------------------- /asterisklint/app/vall/unknown.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class Unknown(AppBase): 20 | pass 21 | 22 | 23 | def register(app_loader): 24 | app_loader.register(Unknown()) 25 | -------------------------------------------------------------------------------- /asterisklint/func/vall/func_rand.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class RAND(FuncBase): 20 | pass 21 | 22 | 23 | def register(func_loader): 24 | func_loader.register(RAND()) 25 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_db.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class DBdeltree(AppBase): 20 | pass 21 | 22 | 23 | def register(app_loader): 24 | app_loader.register(DBdeltree()) 25 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_forkcdr.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class ForkCDR(AppBase): 20 | pass 21 | 22 | 23 | def register(app_loader): 24 | app_loader.register(ForkCDR()) 25 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_senddtmf.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2019 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class SendDTMF(AppBase): 20 | pass 21 | 22 | 23 | def register(app_loader): 24 | app_loader.register(SendDTMF()) 25 | -------------------------------------------------------------------------------- /asterisklint/app/vall/func_odbc.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2019 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class ODBCFinish(AppBase): 20 | pass 21 | 22 | 23 | def register(app_loader): 24 | app_loader.register(ODBCFinish()) 25 | -------------------------------------------------------------------------------- /asterisklint/func/vall/func_shell.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class SHELL(FuncBase): 20 | pass 21 | 22 | 23 | def register(func_loader): 24 | func_loader.register(SHELL()) 25 | -------------------------------------------------------------------------------- /asterisklint/func/vall/func_timeout.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2017 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class TIMEOUT(FuncBase): 20 | pass 21 | 22 | 23 | def register(func_loader): 24 | func_loader.register(TIMEOUT()) 25 | -------------------------------------------------------------------------------- /asterisklint/func/vall/func_volume.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2018 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class VOLUME(FuncBase): 20 | pass 21 | 22 | 23 | def register(func_loader): 24 | func_loader.register(VOLUME()) 25 | -------------------------------------------------------------------------------- /asterisklint/func/vall/res_fax.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class FAXOPT(FuncBase): 20 | pass 21 | 22 | 23 | def register(func_loader): 24 | func_loader.register(FAXOPT()) 25 | -------------------------------------------------------------------------------- /asterisklint/func/vall/unknown.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class UNKNOWN(FuncBase): 20 | pass 21 | 22 | 23 | def register(func_loader): 24 | func_loader.register(UNKNOWN()) 25 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_directory.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2019 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class Directory(AppBase): 20 | pass 21 | 22 | 23 | def register(app_loader): 24 | app_loader.register(Directory()) 25 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_dumpchan.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class DumpChan(AppBase): 20 | pass 21 | 22 | 23 | def register(app_loader): 24 | app_loader.register(DumpChan()) 25 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_playback.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class Playback(AppBase): 20 | pass 21 | 22 | 23 | def register(app_loader): 24 | app_loader.register(Playback()) 25 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_softhangup.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2019 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class SoftHangup(AppBase): 20 | pass 21 | 22 | 23 | def register(app_loader): 24 | app_loader.register(SoftHangup()) 25 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_userevent.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class UserEvent(AppBase): 20 | pass 21 | 22 | 23 | def register(app_loader): 24 | app_loader.register(UserEvent()) 25 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_waituntil.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class WaitUntil(AppBase): 20 | pass 21 | 22 | 23 | def register(app_loader): 24 | app_loader.register(WaitUntil()) 25 | -------------------------------------------------------------------------------- /asterisklint/func/vall/func_dialgroup.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2017 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class DIALGROUP(FuncBase): 20 | pass 21 | 22 | 23 | def register(func_loader): 24 | func_loader.register(DIALGROUP()) 25 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_authenticate.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2017 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class Authenticate(AppBase): 20 | pass 21 | 22 | 23 | def register(app_loader): 24 | app_loader.register(Authenticate()) 25 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_bridgeaddchan.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class BridgeAdd(AppBase): 20 | pass 21 | 22 | 23 | def register(app_loader): 24 | app_loader.register(BridgeAdd()) 25 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_bridgewait.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class BridgeWait(AppBase): 20 | pass 21 | 22 | 23 | def register(app_loader): 24 | app_loader.register(BridgeWait()) 25 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_chanisavail.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class ChanIsAvail(AppBase): 20 | pass 21 | 22 | 23 | def register(app_loader): 24 | app_loader.register(ChanIsAvail()) 25 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_confbridge.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class ConfBridge(AppBase): 20 | pass 21 | 22 | 23 | def register(app_loader): 24 | app_loader.register(ConfBridge()) 25 | -------------------------------------------------------------------------------- /asterisklint/func/vall/func_talkdetect.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2017 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class TALK_DETECT(FuncBase): 20 | pass 21 | 22 | 23 | def register(func_loader): 24 | func_loader.register(TALK_DETECT()) 25 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_controlplayback.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2017 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class ControlPlayback(AppBase): 20 | pass 21 | 22 | 23 | def register(app_loader): 24 | app_loader.register(ControlPlayback()) 25 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_celgenuserevent.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class CELGenUserEvent(AppBase): 20 | pass 21 | 22 | 23 | def register(app_loader): 24 | app_loader.register(CELGenUserEvent()) 25 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_echo.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class Echo(AppBase): 20 | pass 21 | 22 | 23 | def register(app_loader): 24 | for app in ( 25 | Echo, 26 | ): 27 | app_loader.register(app()) 28 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_page.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class Page(AppBase): 20 | pass 21 | 22 | 23 | def register(app_loader): 24 | for app in ( 25 | Page, 26 | ): 27 | app_loader.register(app()) 28 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_followme.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2019 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class FollowMe(AppBase): 20 | pass 21 | 22 | 23 | def register(app_loader): 24 | for app in ( 25 | FollowMe, 26 | ): 27 | app_loader.register(app()) 28 | -------------------------------------------------------------------------------- /asterisklint/func/vall/func_cdr.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class CDR(FuncBase): 20 | pass 21 | 22 | 23 | def register(func_loader): 24 | for func in ( 25 | CDR, 26 | ): 27 | func_loader.register(func()) 28 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_mysql.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2018 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class MYSQL(AppBase): 20 | # From addons/app_mysql.c. Has ugly alternative case (should be MySQL). 21 | pass 22 | 23 | 24 | def register(app_loader): 25 | app_loader.register(MYSQL()) 26 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_milliwatt.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2018 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import App, AppOptions 17 | 18 | 19 | class Milliwatt(App): 20 | def __init__(self): 21 | super().__init__(args=[AppOptions('o')]) 22 | 23 | 24 | def register(app_loader): 25 | app_loader.register(Milliwatt()) 26 | -------------------------------------------------------------------------------- /asterisklint/func/vall/res_pjsip.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2020 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class PJSIP_HEADER(FuncBase): 20 | pass 21 | 22 | 23 | def register(func_loader): 24 | for func in ( 25 | PJSIP_HEADER, 26 | ): 27 | func_loader.register(func()) 28 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_verbose.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class Log(AppBase): 20 | pass 21 | 22 | 23 | class Verbose(AppBase): 24 | pass 25 | 26 | 27 | def register(app_loader): 28 | app_loader.register(Log()) 29 | app_loader.register(Verbose()) 30 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_channelredirect.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class ChannelRedirect(AppBase): 20 | pass 21 | 22 | 23 | def register(app_loader): 24 | for app in ( 25 | ChannelRedirect, 26 | ): 27 | app_loader.register(app()) 28 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_dial.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class Dial(AppBase): 20 | pass 21 | 22 | 23 | class RetryDial(AppBase): 24 | pass 25 | 26 | 27 | def register(app_loader): 28 | app_loader.register(Dial()) 29 | app_loader.register(RetryDial()) 30 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_chanspy.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class ChanSpy(AppBase): 20 | pass 21 | 22 | 23 | class ExtenSpy(AppBase): 24 | pass 25 | 26 | 27 | def register(app_loader): 28 | app_loader.register(ChanSpy()) 29 | app_loader.register(ExtenSpy()) 30 | -------------------------------------------------------------------------------- /asterisklint/app/vall/res_fax.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class ReceiveFAX(AppBase): 20 | pass 21 | 22 | 23 | class SendFAX(AppBase): 24 | pass 25 | 26 | 27 | def register(app_loader): 28 | for app in ( 29 | ReceiveFAX, SendFAX): 30 | app_loader.register(app()) 31 | -------------------------------------------------------------------------------- /asterisklint/func/vall/func_curl.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class CURL(FuncBase): 20 | pass 21 | 22 | 23 | class CURLOPT(FuncBase): 24 | pass 25 | 26 | 27 | def register(func_loader): 28 | for func in ( 29 | CURL, CURLOPT): 30 | func_loader.register(func()) 31 | -------------------------------------------------------------------------------- /asterisklint/func/vall/func_global.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class GLOBAL(FuncBase): 20 | pass 21 | 22 | 23 | class SHARED(FuncBase): 24 | pass 25 | 26 | 27 | def register(func_loader): 28 | for func in ( 29 | GLOBAL, SHARED): 30 | func_loader.register(func()) 31 | -------------------------------------------------------------------------------- /NOTEPAD.rst: -------------------------------------------------------------------------------- 1 | DN: 2 | 3 | - plain-config lint(?) 4 | - func_odbc lint 5 | - example modules.conf parser where load/noload/preload/autoload 6 | are the only valid variables 7 | - eindelijk beginnen aan function args parsing... 8 | - app-check # dialplan-check zonder dp 9 | - expr-check # expression-check zonder app/func 10 | 11 | NDN: 12 | 13 | - voor zover ik weet gaan long lines prima goed (bug=8191), maaar de output toont max 1024 van een 14 | dialplan regel (of 256 voor ast 1.4) 15 | - asterisk-style inheritance? 16 | - dialplan match-by-cli 17 | - asterisk heeft geen multiline config (wel een maxlen van 8191 (buf[8192] in config_text_file_load) 18 | - multiline config kan wel mooi met var=x; var+=y (maar lastig voor linter :-/ ) 19 | - multiline comments tussen ;-- en --; -- gebruikt niemand afaik 20 | - delegate globals lintage to Config lint 21 | - create the possibility for Asterisk version differences 22 | - allow warnings to be suppressed? (always-emit, emit-once, silence) 23 | - wat voor soort warnings: error (skip/ignore/fail), warning (case 24 | fouten of schijnbaar/mogelijke inconsequentie) 25 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_sayunixtime.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class DateTime(AppBase): 20 | pass 21 | 22 | 23 | class SayUnixTime(AppBase): 24 | pass 25 | 26 | 27 | def register(app_loader): 28 | for app in ( 29 | DateTime, SayUnixTime): 30 | app_loader.register(app()) 31 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_playtones.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2020 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class PlayTones(AppBase): 20 | pass 21 | 22 | 23 | class StopPlayTones(AppBase): 24 | pass 25 | 26 | 27 | def register(app_loader): 28 | for app in ( 29 | PlayTones, StopPlayTones): 30 | app_loader.register(app()) 31 | -------------------------------------------------------------------------------- /asterisklint/func/vall/func_cut.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class CUT(FuncBase): 20 | pass 21 | 22 | 23 | class SORT(FuncBase): 24 | pass 25 | 26 | 27 | def register(func_loader): 28 | for func in ( 29 | CUT, 30 | SORT, 31 | ): 32 | func_loader.register(func()) 33 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_system.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class System(AppBase): 20 | pass 21 | 22 | 23 | class TrySystem(AppBase): 24 | pass 25 | 26 | 27 | def register(app_loader): 28 | for app in ( 29 | System, 30 | TrySystem, 31 | ): 32 | app_loader.register(app()) 33 | -------------------------------------------------------------------------------- /asterisklint/func/vall/func_odbc.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class ODBC_FETCH(FuncBase): 20 | pass 21 | 22 | 23 | class SQL_ESC(FuncBase): 24 | pass 25 | 26 | 27 | def register(func_loader): 28 | for func in ( 29 | ODBC_FETCH, 30 | SQL_ESC, 31 | ): 32 | func_loader.register(func()) 33 | -------------------------------------------------------------------------------- /asterisklint/func/vall/func_uri.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class URIDECODE(FuncBase): 20 | pass 21 | 22 | 23 | class URIENCODE(FuncBase): 24 | pass 25 | 26 | 27 | def register(func_loader): 28 | for func in ( 29 | URIDECODE, 30 | URIENCODE, 31 | ): 32 | func_loader.register(func()) 33 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_agent_pool.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2019 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class AgentLogin(AppBase): 20 | pass 21 | 22 | 23 | class AgentRequest(AppBase): 24 | pass 25 | 26 | 27 | def register(app_loader): 28 | for app in ( 29 | AgentLogin, 30 | AgentRequest, 31 | ): 32 | app_loader.register(app()) 33 | -------------------------------------------------------------------------------- /asterisklint/func/vall/func_devstate.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class DEVICE_STATE(FuncBase): 20 | pass 21 | 22 | 23 | class HINT(FuncBase): 24 | pass 25 | 26 | 27 | def register(func_loader): 28 | for func in ( 29 | DEVICE_STATE, 30 | HINT, 31 | ): 32 | func_loader.register(func()) 33 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_mixmonitor.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class MixMonitor(AppBase): 20 | pass 21 | 22 | 23 | class StopMixMonitor(AppBase): 24 | pass 25 | 26 | 27 | def register(app_loader): 28 | for app in ( 29 | MixMonitor, 30 | StopMixMonitor, 31 | ): 32 | app_loader.register(app()) 33 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_setcallerid.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class SetCallerID(AppBase): 20 | pass 21 | 22 | 23 | class SetCallerPres(AppBase): 24 | pass 25 | 26 | 27 | def register(app_loader): 28 | for app in ( 29 | SetCallerID, 30 | SetCallerPres, 31 | ): 32 | app_loader.register(app()) 33 | -------------------------------------------------------------------------------- /asterisklint/func/vall/app_confbridge.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class CONFBRIDGE(FuncBase): 20 | pass 21 | 22 | 23 | class CONFBRIDGE_INFO(FuncBase): 24 | pass 25 | 26 | 27 | def register(func_loader): 28 | for func in ( 29 | CONFBRIDGE, 30 | CONFBRIDGE_INFO, 31 | ): 32 | func_loader.register(func()) 33 | -------------------------------------------------------------------------------- /asterisklint/func/vall/func_base64.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class BASE64_ENCODE(FuncBase): 20 | pass 21 | 22 | 23 | class BASE64_DECODE(FuncBase): 24 | pass 25 | 26 | 27 | def register(func_loader): 28 | for func in ( 29 | BASE64_ENCODE, 30 | BASE64_DECODE, 31 | ): 32 | func_loader.register(func()) 33 | -------------------------------------------------------------------------------- /asterisklint/func/vall/func_dialplan.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class DIALPLAN_EXISTS(FuncBase): 20 | pass 21 | 22 | 23 | class VALID_EXTEN(FuncBase): 24 | pass 25 | 26 | 27 | def register(func_loader): 28 | for func in ( 29 | DIALPLAN_EXISTS, 30 | VALID_EXTEN, 31 | ): 32 | func_loader.register(func()) 33 | -------------------------------------------------------------------------------- /asterisklint/app/vall/res_agi.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2017 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class AGI(AppBase): 20 | pass 21 | 22 | 23 | class DeadAGI(AppBase): 24 | pass 25 | 26 | 27 | class EAGI(AppBase): 28 | pass 29 | 30 | 31 | def register(app_loader): 32 | for app in ( 33 | AGI, 34 | DeadAGI, 35 | EAGI, 36 | ): 37 | app_loader.register(app()) 38 | -------------------------------------------------------------------------------- /asterisklint/app/vall/chan_sip.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class SIPAddHeader(AppBase): 20 | pass 21 | 22 | 23 | class SIPRemoveHeader(AppBase): 24 | pass # not in v1.4 25 | 26 | 27 | class SIPDtmfMode(AppBase): 28 | pass 29 | 30 | 31 | def register(app_loader): 32 | for app in ( 33 | SIPAddHeader, SIPRemoveHeader, SIPDtmfMode): 34 | app_loader.register(app()) 35 | -------------------------------------------------------------------------------- /asterisklint/where.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | 17 | 18 | class Where(object): 19 | def __init__(self, filename, lineno, line): 20 | self.filename = filename # shared constant in CPython, so cheap 21 | self.lineno = lineno 22 | self.line = line 23 | 24 | def __str__(self): 25 | return '%s:%d' % (self.filename, self.lineno) 26 | 27 | 28 | DUMMY_WHERE = Where(filename='', lineno=-1, line='') 29 | -------------------------------------------------------------------------------- /asterisklint/func/vall/app_stack.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2017 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class LOCAL(FuncBase): 20 | pass 21 | 22 | 23 | class LOCAL_PEEK(FuncBase): 24 | pass 25 | 26 | 27 | class STACK_PEEK(FuncBase): 28 | pass 29 | 30 | 31 | def register(func_loader): 32 | for func in ( 33 | LOCAL, 34 | LOCAL_PEEK, 35 | STACK_PEEK, 36 | ): 37 | func_loader.register(func()) 38 | -------------------------------------------------------------------------------- /asterisklint/__init__.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from .config import ConfigAggregator 17 | from .dialplan import DialplanAggregator 18 | from .file import FileReader 19 | from .func_odbc import FuncOdbcAggregator 20 | 21 | 22 | class FileConfigParser(ConfigAggregator, FileReader): 23 | pass 24 | 25 | 26 | class FileDialplanParser(DialplanAggregator, FileReader): 27 | pass 28 | 29 | 30 | class FileFuncOdbcParser(FuncOdbcAggregator, FileReader): 31 | pass 32 | -------------------------------------------------------------------------------- /asterisklint/func/__init__.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2017 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..defines import ErrorDef, WarningDef 17 | 18 | 19 | if 'we_dont_want_two_linefeeds_between_classdefs': # for flake8 20 | class E_FUNC_BAD_ARGS(ErrorDef): 21 | message = "function {func!r} does not take these arguments '{data}'" 22 | 23 | class W_FUNC_BALANCE(WarningDef): 24 | message = ('function data {data!r} looks like unbalanced ' 25 | 'parentheses/quotes/curlies') 26 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_macro.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class Macro(AppBase): 20 | pass 21 | 22 | 23 | class MacroIf(AppBase): 24 | pass 25 | 26 | 27 | class MacroExclusive(AppBase): 28 | pass 29 | 30 | 31 | class MacroExit(AppBase): 32 | pass 33 | 34 | 35 | def register(app_loader): 36 | for app in ( 37 | Macro, MacroIf, MacroExclusive, MacroExit): 38 | app_loader.register(app()) 39 | -------------------------------------------------------------------------------- /asterisklint/func/vall/func_channel.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class CHANNEL(FuncBase): 20 | pass 21 | 22 | 23 | class CHANNELS(FuncBase): 24 | pass 25 | 26 | 27 | class MASTER_CHANNEL(FuncBase): 28 | pass 29 | 30 | 31 | def register(func_loader): 32 | for func in ( 33 | CHANNEL, 34 | CHANNELS, 35 | MASTER_CHANNEL, 36 | ): 37 | func_loader.register(func()) 38 | -------------------------------------------------------------------------------- /asterisklint/func/vall/func_enum.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class ENUMQUERY(FuncBase): 20 | pass 21 | 22 | 23 | class ENUMRESULT(FuncBase): 24 | pass 25 | 26 | 27 | class ENUMLOOKUP(FuncBase): 28 | pass 29 | 30 | 31 | class TXTCIDNAME(FuncBase): 32 | pass 33 | 34 | 35 | def register(func_loader): 36 | for func in ( 37 | ENUMQUERY, ENUMRESULT, ENUMLOOKUP, TXTCIDNAME): 38 | func_loader.register(func()) 39 | -------------------------------------------------------------------------------- /asterisklint/func/vall/chan_sip.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class CHECKSIPDOMAIN(FuncBase): 20 | pass 21 | 22 | 23 | class SIP_HEADER(FuncBase): 24 | pass 25 | 26 | 27 | class SIPCHANINFO(FuncBase): 28 | pass 29 | 30 | 31 | class SIPPEER(FuncBase): 32 | pass 33 | 34 | 35 | def register(func_loader): 36 | for func in ( 37 | CHECKSIPDOMAIN, SIP_HEADER, 38 | SIPCHANINFO, SIPPEER): 39 | func_loader.register(func()) 40 | -------------------------------------------------------------------------------- /asterisklint/func/vall/func_db.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2017 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class DB(FuncBase): 20 | pass 21 | 22 | 23 | class DB_DELETE(FuncBase): 24 | pass 25 | 26 | 27 | class DB_EXISTS(FuncBase): 28 | pass 29 | 30 | 31 | class DB_KEYS(FuncBase): 32 | pass 33 | 34 | 35 | def register(func_loader): 36 | for func in ( 37 | DB, 38 | DB_EXISTS, 39 | DB_KEYS, 40 | DB_DELETE, 41 | ): 42 | func_loader.register(func()) 43 | -------------------------------------------------------------------------------- /tests/file/test_ctrl.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from asterisklint.alinttest import ALintTestCase 17 | from asterisklint.file import FileReader 18 | 19 | 20 | class CtrlTest(ALintTestCase): 21 | def test_ctrl(self): 22 | reader = self.create_instance_and_load_single_file( 23 | FileReader, 'test.conf', b'''\ 24 | [context]\x00 25 | variable=value\v 26 | other=value 27 | ''') 28 | out = [i for i in reader] 29 | self.assertEqual(len(out), 3) 30 | self.assertLinted({'W_FILE_CTRL_CHAR': 2}) 31 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_while.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2017 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class ContinueWhile(AppBase): 20 | pass 21 | 22 | 23 | class EndWhile(AppBase): 24 | pass 25 | 26 | 27 | class ExitWhile(AppBase): 28 | pass 29 | 30 | 31 | class While(AppBase): 32 | pass 33 | 34 | 35 | def register(app_loader): 36 | for app in ( 37 | ContinueWhile, 38 | EndWhile, 39 | ExitWhile, 40 | While, 41 | ): 42 | app_loader.register(app()) 43 | -------------------------------------------------------------------------------- /asterisklint/func/vall/func_callerid.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class CALLERID(FuncBase): 20 | pass 21 | 22 | 23 | class CALLERPRES(FuncBase): 24 | pass 25 | 26 | 27 | class CONNECTEDLINE(FuncBase): 28 | pass 29 | 30 | 31 | class REDIRECTING(FuncBase): 32 | pass 33 | 34 | 35 | def register(func_loader): 36 | for func in ( 37 | CALLERID, 38 | CALLERPRES, 39 | CONNECTEDLINE, 40 | REDIRECTING, 41 | ): 42 | func_loader.register(func()) 43 | -------------------------------------------------------------------------------- /asterisklint/func/vall/func_groupcount.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class GROUP(FuncBase): 20 | pass 21 | 22 | 23 | class GROUP_COUNT(FuncBase): 24 | pass 25 | 26 | 27 | class GROUP_LIST(FuncBase): 28 | pass 29 | 30 | 31 | class GROUP_MATCH_COUNT(FuncBase): 32 | pass 33 | 34 | 35 | def register(func_loader): 36 | for func in ( 37 | GROUP, 38 | GROUP_COUNT, 39 | GROUP_LIST, 40 | GROUP_MATCH_COUNT, 41 | ): 42 | func_loader.register(func()) 43 | -------------------------------------------------------------------------------- /asterisklint/func/vall/func_pjsip.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2020 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class PJSIP_AOR(FuncBase): 20 | # func_pjsip_aor.so 21 | pass 22 | 23 | 24 | class PJSIP_CONTACT(FuncBase): 25 | # func_pjsip_contact.so 26 | pass 27 | 28 | 29 | class PJSIP_ENDPOINT(FuncBase): 30 | # func_pjsip_endpoint.so 31 | pass 32 | 33 | 34 | def register(func_loader): 35 | for func in ( 36 | PJSIP_AOR, 37 | PJSIP_CONTACT, 38 | PJSIP_ENDPOINT, 39 | ): 40 | func_loader.register(func()) 41 | -------------------------------------------------------------------------------- /asterisklint/app/vall/genstub.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | filename="$1"; shift 3 | year=`date +%Y` 4 | cat > $filename << EOF 5 | # AsteriskLint -- an Asterisk PBX config syntax checker 6 | # Copyright (C) $year Walter Doekes, OSSO B.V. 7 | # 8 | # This program is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program. If not, see . 20 | from ..base import AppBase 21 | 22 | 23 | EOF 24 | for cmd in "$@"; do 25 | cat >> $filename << EOF 26 | class $cmd(AppBase): 27 | pass 28 | 29 | 30 | EOF 31 | done 32 | 33 | cat >> $filename << EOF 34 | def register(app_loader): 35 | for app in ( 36 | EOF 37 | for cmd in "$@"; do 38 | cat >> $filename << EOF 39 | $cmd, 40 | EOF 41 | done 42 | cat >> $filename << EOF 43 | ): 44 | app_loader.register(app()) 45 | EOF 46 | -------------------------------------------------------------------------------- /asterisklint/func/vall/func_audiohookinherit.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2017 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from .. import E_FUNC_BAD_ARGS 17 | from ..base import FuncBase 18 | 19 | 20 | class AUDIOHOOK_INHERIT(FuncBase): 21 | def __call__(self, data, where): 22 | if isinstance(data, str) and data not in ( 23 | 'MixMonitor', 'Chanspy', 'Volume', 'Speex', 24 | 'pitch_shift', 'JACK_HOOK', 'Mute'): 25 | E_FUNC_BAD_ARGS(where, func=self.name, data=data) 26 | 27 | super().__call__(data, where) 28 | 29 | 30 | def register(func_loader): 31 | func_loader.register(AUDIOHOOK_INHERIT()) 32 | -------------------------------------------------------------------------------- /asterisklint/func/vall/genstub.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | filename="$1"; shift 3 | year=`date +%Y` 4 | cat > $filename << EOF 5 | # AsteriskLint -- an Asterisk PBX config syntax checker 6 | # Copyright (C) $year Walter Doekes, OSSO B.V. 7 | # 8 | # This program is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program. If not, see . 20 | from ..base import FuncBase 21 | 22 | 23 | EOF 24 | for cmd in "$@"; do 25 | cat >> $filename << EOF 26 | class $cmd(FuncBase): 27 | pass 28 | 29 | 30 | EOF 31 | done 32 | 33 | cat >> $filename << EOF 34 | def register(func_loader): 35 | for func in ( 36 | EOF 37 | for cmd in "$@"; do 38 | cat >> $filename << EOF 39 | $cmd, 40 | EOF 41 | done 42 | cat >> $filename << EOF 43 | ): 44 | func_loader.register(func()) 45 | EOF 46 | -------------------------------------------------------------------------------- /asterisklint/app/vall/res_musiconhold.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2017 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class MusicOnHold(AppBase): 20 | pass 21 | 22 | 23 | class WaitMusicOnHold(AppBase): 24 | pass 25 | 26 | 27 | class SetMusicOnHold(AppBase): 28 | pass 29 | 30 | 31 | class StartMusicOnHold(AppBase): 32 | pass 33 | 34 | 35 | class StopMusicOnHold(AppBase): 36 | pass 37 | 38 | 39 | def register(app_loader): 40 | for app in ( 41 | MusicOnHold, WaitMusicOnHold, SetMusicOnHold, 42 | StartMusicOnHold, StopMusicOnHold): 43 | app_loader.register(app()) 44 | -------------------------------------------------------------------------------- /asterisklint/func/vall/func_env.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class ENV(FuncBase): 20 | pass 21 | 22 | 23 | class FILE(FuncBase): 24 | pass 25 | 26 | 27 | class FILE_COUNT_LINE(FuncBase): 28 | pass 29 | 30 | 31 | class FILE_FORMAT(FuncBase): 32 | pass 33 | 34 | 35 | class STAT(FuncBase): 36 | pass 37 | 38 | 39 | def register(func_loader): 40 | for func in ( 41 | ENV, 42 | FILE, 43 | FILE_COUNT_LINE, 44 | FILE_FORMAT, 45 | STAT, 46 | ): 47 | func_loader.register(func()) 48 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_directed_pickup.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class Pickup(AppBase): 20 | pass 21 | 22 | 23 | class PickupChan(AppBase): 24 | pass 25 | 26 | 27 | class PickupOld1v4(AppBase): 28 | """ 29 | This is not in any main Asterisk branch. Quickest fix was to add 30 | here for now. 31 | 32 | NOTE: https://issues.asterisk.org/jira/browse/ASTERISK-26464 33 | """ 34 | pass 35 | 36 | 37 | def register(app_loader): 38 | for app in ( 39 | Pickup, 40 | PickupChan, 41 | PickupOld1v4): 42 | app_loader.register(app()) 43 | -------------------------------------------------------------------------------- /asterisklint/func/base.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2017 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from . import W_FUNC_BALANCE 17 | from ..variable import variable_check_balance 18 | 19 | 20 | class FuncBase(object): 21 | @property 22 | def name(self): 23 | return self.__class__.__name__ 24 | 25 | @property 26 | def module(self): 27 | return self.__module__.rsplit('.', 1)[-1] 28 | 29 | def __call__(self, data, where): 30 | try: 31 | self.check_balance(data) 32 | except ValueError: 33 | W_FUNC_BALANCE(where, data=str(data)) 34 | 35 | @staticmethod 36 | def check_balance(data): 37 | variable_check_balance(data) 38 | -------------------------------------------------------------------------------- /scripts/asterisklint: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # AsteriskLint -- an Asterisk PBX config syntax checker 3 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 4 | # 5 | # This program is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | import os 18 | import sys 19 | 20 | # Add ../ to the path, useful when running from development dir. 21 | if os.path.basename(os.path.dirname(os.path.abspath(__file__))) == 'scripts': 22 | sys.path.insert( 23 | 0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) 24 | 25 | # Remove bindir from path, lest we try to import from self. 26 | try: 27 | sys.path.remove(os.path.dirname(os.path.abspath(__file__))) 28 | except ValueError: 29 | pass 30 | 31 | from asterisklint.main import main 32 | 33 | if __name__ == '__main__': 34 | sys.exit(main(sys.argv[1:], os.environ)) 35 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_meetme.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class MeetMe(AppBase): 20 | pass 21 | 22 | 23 | class MeetMeCount(AppBase): 24 | pass 25 | 26 | 27 | class MeetMeAdmin(AppBase): 28 | pass 29 | 30 | 31 | class MeetMeChannelAdmin(AppBase): 32 | pass 33 | 34 | 35 | class SLAStation(AppBase): 36 | pass 37 | 38 | 39 | class SLATrunk(AppBase): 40 | pass 41 | 42 | 43 | def register(app_loader): 44 | for app in ( 45 | MeetMe, 46 | MeetMeCount, 47 | MeetMeAdmin, 48 | MeetMeChannelAdmin, 49 | SLAStation, 50 | SLATrunk, 51 | ): 52 | app_loader.register(app()) 53 | -------------------------------------------------------------------------------- /asterisklint/expression.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from .variable import Var 17 | 18 | 19 | class Expr(Var): 20 | """ 21 | A special case of Var where an expression is evaluated. 22 | 23 | TODO: complain about (expr); 24 | - excess whitespace 25 | - no agreement on quotes on either side of expression 26 | - bad/unknown operators 27 | - joined expressions (expr in expr, which is not needed, because you 28 | can use parens) 29 | """ 30 | def __init__(self, expression=None): # drop start and length args 31 | super().__init__(name=expression) 32 | 33 | def __str__(self): 34 | if self.name: 35 | return '$[{}]'.format(self.name) 36 | return super().__str__() 37 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_originate.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2018 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import E_APP_ARG_BADOPT, App, AppArg 17 | 18 | 19 | class AppOrExten(AppArg): 20 | def validate(self, arg, where): 21 | if arg not in ('app', 'exten'): 22 | E_APP_ARG_BADOPT( 23 | where, argno=self.argno, app=self.app, opts=arg) 24 | 25 | 26 | class Originate(App): 27 | def __init__(self): 28 | super().__init__( 29 | # arg1 means Application-name or Context 30 | args=[AppArg('tech_data'), AppOrExten('type'), AppArg('arg1'), 31 | AppArg('arg2'), AppArg('arg3'), AppArg('timeout')], 32 | min_args=3) 33 | 34 | 35 | def register(app_loader): 36 | app_loader.register(Originate()) 37 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_queue.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase 17 | 18 | 19 | class Queue(AppBase): 20 | pass 21 | 22 | 23 | class AddQueueMember(AppBase): 24 | pass 25 | 26 | 27 | class RemoveQueueMember(AppBase): 28 | pass 29 | 30 | 31 | class PauseQueueMember(AppBase): 32 | pass 33 | 34 | 35 | class UnpauseQueueMember(AppBase): 36 | pass 37 | 38 | 39 | class QueueLog(AppBase): 40 | pass 41 | 42 | 43 | def register(app_loader): 44 | for app in ( 45 | Queue, 46 | AddQueueMember, 47 | RemoveQueueMember, 48 | PauseQueueMember, 49 | UnpauseQueueMember, 50 | QueueLog, 51 | ): 52 | app_loader.register(app()) 53 | -------------------------------------------------------------------------------- /asterisklint/func/vall/app_queue.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class QUEUE_EXISTS(FuncBase): 20 | pass 21 | 22 | 23 | class QUEUE_MEMBER(FuncBase): 24 | pass 25 | 26 | 27 | class QUEUE_MEMBER_COUNT(FuncBase): 28 | pass 29 | 30 | 31 | class QUEUE_MEMBER_LIST(FuncBase): 32 | pass 33 | 34 | 35 | class QUEUE_MEMBER_PENALTY(FuncBase): 36 | pass 37 | 38 | 39 | class QUEUE_VARIABLES(FuncBase): 40 | pass 41 | 42 | 43 | class QUEUE_WAITING_COUNT(FuncBase): 44 | pass 45 | 46 | 47 | def register(func_loader): 48 | for func in ( 49 | QUEUE_EXISTS, QUEUE_MEMBER, QUEUE_MEMBER_COUNT, 50 | QUEUE_MEMBER_LIST, QUEUE_MEMBER_PENALTY, 51 | QUEUE_VARIABLES, QUEUE_WAITING_COUNT): 52 | func_loader.register(func()) 53 | -------------------------------------------------------------------------------- /asterisklint/alintver.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2022 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | license_str = """ 17 | Copyright (C) 2015-2022 Walter Doekes, OSSO B.V. 18 | 19 | This program is free software: you can redistribute it and/or modify 20 | it under the terms of the GNU General Public License as published by 21 | the Free Software Foundation, either version 3 of the License, or 22 | (at your option) any later version. 23 | 24 | This program is distributed in the hope that it will be useful, 25 | but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | GNU General Public License for more details. 28 | 29 | You should have received a copy of the GNU General Public License 30 | along with this program. If not, see . 31 | """ 32 | version_str = '0.4.3' 33 | -------------------------------------------------------------------------------- /asterisklint/func/vall/chan_pjsip.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2020 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class PJSIP_DIAL_CONTACTS(FuncBase): 20 | pass 21 | 22 | 23 | class PJSIP_DTMF_MODE(FuncBase): 24 | pass 25 | 26 | 27 | class PJSIP_MEDIA_OFFER(FuncBase): 28 | pass 29 | 30 | 31 | class PJSIP_MOH_PASSTHROUGH(FuncBase): 32 | pass 33 | 34 | 35 | class PJSIP_PARSE_URI(FuncBase): 36 | pass 37 | 38 | 39 | class PJSIP_SEND_SESSION_REFRESH(FuncBase): 40 | pass 41 | 42 | 43 | def register(func_loader): 44 | for func in ( 45 | PJSIP_DIAL_CONTACTS, 46 | PJSIP_DTMF_MODE, 47 | PJSIP_MEDIA_OFFER, 48 | PJSIP_MOH_PASSTHROUGH, 49 | PJSIP_PARSE_URI, 50 | PJSIP_SEND_SESSION_REFRESH, 51 | ): 52 | func_loader.register(func()) 53 | -------------------------------------------------------------------------------- /asterisklint/func/vall/func_logic.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | from asterisklint.varfun import VarLoader 19 | 20 | 21 | class EXISTS(FuncBase): 22 | pass 23 | 24 | 25 | class IF(FuncBase): 26 | pass 27 | 28 | 29 | class IFTIME(FuncBase): 30 | pass 31 | 32 | 33 | class IMPORT(FuncBase): 34 | pass 35 | 36 | 37 | class ISNULL(FuncBase): 38 | pass 39 | 40 | 41 | class SET(FuncBase): 42 | def __call__(self, data, where): 43 | VarLoader().parse_assignment(data, where) 44 | super().__call__(data, where) 45 | 46 | 47 | def register(func_loader): 48 | for func in ( 49 | EXISTS, 50 | IF, 51 | IFTIME, 52 | IMPORT, 53 | ISNULL, 54 | SET, 55 | ): 56 | func_loader.register(func()) 57 | -------------------------------------------------------------------------------- /tests/alinttest/test_message.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from asterisklint.alinttest import ALintTestCase 17 | from asterisklint.defines import WarningDef 18 | from asterisklint.where import DUMMY_WHERE 19 | 20 | 21 | class MessageTestCase(ALintTestCase): 22 | def test_normal(self): 23 | class W_WARNING1(WarningDef): 24 | message = 'irrelevant' 25 | 26 | W_WARNING1(DUMMY_WHERE) 27 | self.assertLinted({'W_WARNING1': 1}) 28 | 29 | def test_format_required(self): 30 | class W_WARNING2(WarningDef): 31 | message = '{message} with {format}' 32 | 33 | # Properly formatted. 34 | W_WARNING2(DUMMY_WHERE, format='cheese', message='sandwitch') 35 | 36 | # Missing formats. 37 | self.assertRaises( 38 | KeyError, 39 | W_WARNING2, DUMMY_WHERE, message='sandwitch') 40 | 41 | self.assertLinted({'W_WARNING2': 2}) 42 | -------------------------------------------------------------------------------- /asterisklint/func/vall/builtin.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | 18 | 19 | class _Builtin(object): 20 | @property 21 | def module(self): 22 | return '' 23 | 24 | 25 | class BuiltinFuncBase(_Builtin, FuncBase): 26 | pass 27 | 28 | 29 | class AMI_CLIENT(BuiltinFuncBase): 30 | pass 31 | 32 | 33 | class EXCEPTION(BuiltinFuncBase): 34 | pass 35 | 36 | 37 | class FEATURE(BuiltinFuncBase): 38 | pass 39 | 40 | 41 | class FEATUREMAP(BuiltinFuncBase): 42 | pass 43 | 44 | 45 | class MESSAGE(BuiltinFuncBase): 46 | pass 47 | 48 | 49 | class MESSAGE_DATA(BuiltinFuncBase): 50 | pass 51 | 52 | 53 | class TESTTIME(BuiltinFuncBase): 54 | pass 55 | 56 | 57 | def register(func_loader): 58 | for func in ( 59 | AMI_CLIENT, EXCEPTION, FEATURE, FEATUREMAP, 60 | MESSAGE, MESSAGE_DATA, TESTTIME): 61 | func_loader.register(func()) 62 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_voicemail.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2017 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import App, AppArg, AppOptions, AppBase 17 | 18 | 19 | class VoiceMail(App): 20 | def __init__(self): 21 | super().__init__( 22 | # BUG: g takes an argument NUM. 23 | args=[AppArg('mailboxes'), AppOptions('bdgsuUP')], min_args=1) 24 | 25 | 26 | class VoiceMailMain(AppBase): 27 | pass 28 | 29 | 30 | class VoiceMailPlayMsg(AppBase): 31 | pass 32 | 33 | 34 | class MailboxExists(AppBase): 35 | pass 36 | 37 | 38 | class VMAuthenticate(AppBase): 39 | pass 40 | 41 | 42 | class VMSayName(AppBase): 43 | pass 44 | 45 | 46 | def register(app_loader): 47 | for app in ( 48 | VoiceMail, 49 | VoiceMailMain, 50 | VoiceMailPlayMsg, 51 | MailboxExists, 52 | VMAuthenticate, 53 | VMSayName, 54 | ): 55 | app_loader.register(app()) 56 | -------------------------------------------------------------------------------- /asterisklint/func/vall/func_math.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import FuncBase 17 | from ...varfun import VarLoader 18 | 19 | 20 | class MATH(FuncBase): 21 | pass 22 | 23 | 24 | class INC(FuncBase): 25 | """ 26 | INC takes a single varname as argument. That means we can count the 27 | variable as used. 28 | """ 29 | def __call__(self, data, where): 30 | ret = super().__call__(data, where) 31 | VarLoader().count_var(data, where) 32 | return ret 33 | 34 | 35 | class DEC(FuncBase): 36 | """ 37 | DEC takes a single varname as argument. That means we can count the 38 | variable as used. 39 | """ 40 | def __call__(self, data, where): 41 | ret = super().__call__(data, where) 42 | VarLoader().count_var(data, where) 43 | return ret 44 | 45 | 46 | def register(func_loader): 47 | for func in ( 48 | MATH, INC, DEC): 49 | func_loader.register(func()) 50 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | FLAKE8 = $(shell which flake8.3 flake8 true 2>/dev/null | head -n1) 2 | PYTHON = python3 3 | 4 | default: update_version test 5 | 6 | Makefile.version: FORCE 7 | # DEB/FILE version: 0.3.0~rc2 <-- canonical 8 | # GIT tag version: v0.3.0_rc2 9 | # PyPI/PEP440 version: 0.3.0rc2 10 | @echo "FILE_VERSION = $$(sed -e 's/ .*//;1q' CHANGES.rst)" \ 11 | > Makefile.version.tmp 12 | @echo "GIT_VERSION = $$(git describe --tags --match \ 13 | 'v[0-9]*' --abbrev=4 HEAD 2>/dev/null | \ 14 | sed -e 's/^v//;s/_/~/;s/-/+/')" \ 15 | >> Makefile.version.tmp 16 | @cmp Makefile.version Makefile.version.tmp >/dev/null || \ 17 | mv Makefile.version.tmp Makefile.version 18 | @$(RM) -f Makefile.version.tmp 19 | @cat Makefile.version 20 | -include Makefile.version 21 | 22 | install: Makefile.version 23 | $(PYTHON) setup.py install 24 | 25 | test: 26 | find . -name '*.py' | xargs -d\\n $(FLAKE8) || true; echo 27 | $(PYTHON) -m asterisklint.alinttest discover -v --pattern='test_*.py' 28 | 29 | license_turds: 30 | find . -name '*.py' -print0 | xargs -0 grep -L '^# Copyright (C)' | \ 31 | while read f; do t=`mktemp`; \ 32 | ( head -n15 setup.py; cat "$$f" ) > "$$t"; mv "$$t" "$$f"; done 33 | 34 | pypi_upload: update_version 35 | # Call `make pypi_upload` to ensure that the version is correctly set. 36 | echo -n 'Continue uploading to PyPI? ' && read x && test "$$x" = y 37 | $(PYTHON) setup.py sdist 38 | twine upload dist/$(shell ./scripts/asterisklint --version | \ 39 | head -n1 | sed -e 's/ /-/;s/$$/.tar.gz/') 40 | 41 | update_version: 42 | echo '$(GIT_VERSION)' | grep -Fq '$(FILE_VERSION)' # startswith.. 43 | sed -i -e "s/^version_str = .*/version_str = '$(FILE_VERSION)'/" \ 44 | asterisklint/alintver.py 45 | 46 | .PHONY: FORCE default install test pypi_upload update_version license_turds 47 | -------------------------------------------------------------------------------- /asterisklint/cls.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | 17 | 18 | class Singleton(type): 19 | """ 20 | Create singleton classes. Usage:: 21 | 22 | class MyClass(metaclass=Singleton): 23 | ... 24 | 25 | MyClass().do_stuff() 26 | 27 | If your class implements the reinit() method, it will be called with 28 | the same arguments as to __init__ in case it was already created. 29 | There you may evaluate if the args/kwargs are allowed and/or need 30 | updating:: 31 | 32 | def reinit(self, optional_config=None): 33 | if optional_config and self.config != optional_config: 34 | raise ProgrammingError("You cannot switch config!") 35 | """ 36 | _instances = {} 37 | 38 | def __call__(cls, *args, **kwargs): 39 | if cls not in cls._instances: 40 | ret = cls._instances[cls] = super().__call__(*args, **kwargs) 41 | else: 42 | ret = cls._instances[cls] 43 | if hasattr(ret, 'reinit'): 44 | ret.reinit(*args, **kwargs) 45 | 46 | return ret 47 | -------------------------------------------------------------------------------- /tests/file/test_normal.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from asterisklint.alinttest import ALintTestCase 17 | from asterisklint.file import FileReader 18 | 19 | 20 | class NormalTest(ALintTestCase): 21 | def test_normal(self): 22 | reader = self.create_instance_and_load_single_file( 23 | FileReader, 'test.conf', b'''\ 24 | [context] 25 | variable=value 26 | other=value 27 | 28 | [context2] 29 | and_that_is=it 30 | ''') 31 | out = [i for i in reader] 32 | self.assertEqual(len(out), 6) 33 | 34 | self.assertEqual(out[0][0].filename, 'test.conf') 35 | self.assertEqual(out[0][0].lineno, 1) 36 | self.assertEqual(out[0][0].line, b'[context]\n') 37 | self.assertEqual(out[0][1], '[context]') 38 | 39 | self.assertEqual(out[1][0].filename, 'test.conf') 40 | self.assertEqual(out[1][0].lineno, 2) 41 | self.assertEqual(out[1][0].line, b'variable=value\n') 42 | self.assertEqual(out[1][1], 'variable=value') 43 | 44 | self.assertEqual(out[5][0].lineno, 6) 45 | self.assertEqual(out[5][1], 'and_that_is=it') 46 | -------------------------------------------------------------------------------- /tests/alintregress/test_asterisk_dp.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2017 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from importlib import import_module 17 | 18 | from asterisklint.alinttest import ALintTestCase 19 | from asterisklint.application import AppLoader 20 | 21 | 22 | class AsteriskDpTest(ALintTestCase): 23 | """ 24 | Test extensions.conf as supplied by Asterisk 13; after a few edits. 25 | """ 26 | def test_extensions_conf(self): 27 | filename = __file__.rsplit('.', 1)[0] + '.conf' # drop '.py[c]' 28 | 29 | # Hack to preserve chosen Background-case. This dialplan would 30 | # "unfix" the defaults for the other tests. 31 | background = AppLoader().get('background') 32 | chosen_spelling = background.chosen_spelling 33 | 34 | try: 35 | mainmod = import_module('asterisklint.commands.dialplan-check') 36 | mainmod.main([filename], {}) 37 | 38 | finally: 39 | # Reset original Background-case. 40 | background.chosen_spelling = chosen_spelling 41 | 42 | self.assertLinted( 43 | {'I_NOTIMPL_IGNOREPAT': 3, 44 | 'I_NOTIMPL_SWITCH': 1, 45 | 'W_DP_PRIO_BADORDER': 4}) 46 | -------------------------------------------------------------------------------- /tests/application/test_voicemail.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from functools import partial 17 | 18 | from asterisklint.alinttest import ALintTestCase 19 | from asterisklint.app.vall.app_voicemail import VoiceMail 20 | from asterisklint.where import DUMMY_WHERE 21 | 22 | 23 | class VoiceMailArgsTest(ALintTestCase): 24 | def setUp(self): 25 | super().setUp() 26 | ignored = [] 27 | self.v = partial( 28 | VoiceMail(), jump_destinations=ignored, where=DUMMY_WHERE) 29 | 30 | def test_one_arg(self): 31 | self.v('mailbox@context') 32 | 33 | def test_two_args(self): 34 | self.v('mailbox@context,bd') 35 | 36 | def test_min_args(self): 37 | self.v('') # 0 args, no good 38 | self.assertLinted({'E_APP_ARG_FEW': 1}) 39 | 40 | def test_max_args(self): 41 | self.v('a,,c') # 3 args, no good 42 | self.assertLinted({'E_APP_ARG_MANY': 1}) 43 | 44 | def test_bad_option(self): 45 | self.v('a,X') # 2nd arg has bad option 46 | self.assertLinted({'E_APP_ARG_BADOPT': 1}) 47 | 48 | def test_dupe_option(self): 49 | self.v('a,bdb') # 2nd arg has duplicate option 50 | self.assertLinted({'E_APP_ARG_DUPEOPT': 1}) 51 | -------------------------------------------------------------------------------- /asterisklint/function.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from .variable import SliceMixin, Var 17 | 18 | 19 | class ReadFunc(Var): 20 | """ 21 | A special case of VarSlice where a function call is evaluated. 22 | 23 | The ReadFunc is different from the WriteFunc in that the ReadFunc 24 | has surrounding ${} tokens and allows slicing. 25 | """ 26 | def __init__(self, func=None, args=None): 27 | assert func is not None and args is not None 28 | 29 | # The "convenience" strjoin in Var getslice creates trouble for 30 | # us here: args can be a list or a simple iterable. 31 | if isinstance(args, list): 32 | func_and_args = [func, '('] + args + [')'] 33 | else: 34 | func_and_args = [func, '(', args, ')'] 35 | 36 | super().__init__(name=Var.join(func_and_args)) 37 | 38 | self.func = func 39 | self.args = args 40 | 41 | 42 | class ReadFuncSlice(SliceMixin, ReadFunc): 43 | pass 44 | 45 | 46 | class WriteFunc(object): 47 | """ 48 | A really simple object with function name and arguments. 49 | 50 | This does nothing at the moment. 51 | """ 52 | def __init__(self, func=None, args=None): 53 | assert func is not None and args is not None 54 | 55 | self.func = func 56 | self.args = args 57 | -------------------------------------------------------------------------------- /tests/file/test_encoding.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from asterisklint.alinttest import ALintTestCase 17 | from asterisklint.file import FileReader 18 | 19 | 20 | class EncodingTest(ALintTestCase): 21 | def test_utf8(self): 22 | reader = self.create_instance_and_load_single_file( 23 | FileReader, 'utf8.conf', b'''\ 24 | [c\xc3\xb6ntext] 25 | variable=value 26 | ''') 27 | out = [i for i in reader] 28 | self.assertEqual(len(out), 2) 29 | self.assertEqual(out[0][1], '[c\u00f6ntext]') 30 | 31 | def test_cp1252(self): 32 | reader = self.create_instance_and_load_single_file( 33 | FileReader, 'cp1252.conf', b'''\ 34 | [cont\x80xt] 35 | variable=value 36 | ''') 37 | out = [i for i in reader] 38 | self.assertEqual(len(out), 2) 39 | self.assertEqual(out[0][1], '[cont\u20acxt]') 40 | self.assertLinted({'E_FILE_UTF8_BAD': 1}) 41 | 42 | def test_utf8_and_cp1252(self): 43 | reader = self.create_instance_and_load_single_file( 44 | FileReader, 'encodingmess.conf', b'''\ 45 | [c\xc3\xb6nt\x80xt] 46 | variable=value 47 | ''') 48 | out = [i for i in reader] 49 | self.assertEqual(len(out), 2) 50 | self.assertEqual(out[0][1], '[c\u00c3\u00b6nt\u20acxt]') 51 | self.assertLinted({'E_FILE_UTF8_BAD': 1}) 52 | -------------------------------------------------------------------------------- /tests/variable/test_split.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2017 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from asterisklint.alinttest import ALintTestCase 17 | from asterisklint.variable import Var 18 | from asterisklint.varfun import VarLoader 19 | from asterisklint.where import DUMMY_WHERE 20 | 21 | 22 | class SplitTest(ALintTestCase): 23 | def test_slice(self): 24 | var = VarLoader().parse_variables( 25 | '${${foo}:${start}:${len}}', DUMMY_WHERE) 26 | self.assertEqual(str(var), '${${foo}:${start}:${len}}') 27 | 28 | def test_equals(self): 29 | var = VarLoader().parse_variables('foo=${bar}=baz', DUMMY_WHERE) 30 | data = var.split('=', 1) 31 | self.assertEqual(len(data), 2) 32 | variable, value = data 33 | self.assertTrue(isinstance(variable, str)) 34 | self.assertTrue(isinstance(value, Var)) 35 | self.assertEqual(value.format(bar='BAR'), 'BAR=baz') 36 | 37 | def test_writefunc(self): 38 | # TODO: overly complicated internals here; please fix 39 | var = VarLoader().parse_variables('FUNC(${bar},baz)', DUMMY_WHERE) 40 | data = var.split('(', 1) 41 | self.assertEqual(len(data), 2) 42 | variable, value = data 43 | self.assertTrue(isinstance(variable, str)) 44 | self.assertTrue(isinstance(value, Var)) 45 | self.assertEqual(value[-1], ')') 46 | value = Var.join(value[0:-1]) 47 | self.assertEqual(value.format(bar='BAR'), 'BAR,baz') 48 | -------------------------------------------------------------------------------- /asterisklint/commands/dialplan-show.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2017 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | """ 17 | Show dialplan like Asterisk does with CLI command "dialplan show". Takes 18 | 'extensions.conf' as argument. 19 | """ 20 | from asterisklint import FileDialplanParser 21 | from asterisklint.defines import MessageDefManager 22 | from asterisklint.mainutil import MainBase 23 | 24 | 25 | class Main(MainBase): 26 | def create_argparser(self, argparser_class): 27 | parser = argparser_class( 28 | description=( 29 | 'Shows the dialplan like Asterisk does with the CLI command ' 30 | '"dialplan show". Useful for testing whether asterisklint ' 31 | 'parser the input properly.')) 32 | parser.add_argument( 33 | 'dialplan', metavar='EXTENSIONS_CONF', nargs='?', 34 | default='./extensions.conf', 35 | help='path to extensions.conf') 36 | parser.add_argument( 37 | '--reverse', action='store_true', 38 | help="some versions of Asterisk output the dialplan file " 39 | "in reverse") 40 | return parser 41 | 42 | def handle_args(self, args): 43 | MessageDefManager.muted = True # no messages to stderr 44 | parser = FileDialplanParser() 45 | parser.include(args.dialplan) 46 | dialplan = next(iter(parser)) 47 | print(dialplan.format_as_dialplan_show( 48 | reverse=args.reverse)) 49 | 50 | 51 | main = Main() 52 | -------------------------------------------------------------------------------- /asterisklint/commands/func_odbc-check.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2017 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | """ 17 | Do sanity checks on func_odbc.conf. Takes 'func_odbc.conf' as argument. 18 | Suppress errors using ALINT_IGNORE env. 19 | """ 20 | from asterisklint import FileFuncOdbcParser 21 | from asterisklint.defines import MessageDefManager 22 | from asterisklint.mainutil import MainBase 23 | 24 | 25 | class Main(MainBase): 26 | def create_argparser(self, argparser_class): 27 | parser = argparser_class( 28 | description=( 29 | 'Do sanity checks on func_odbc.conf. Suppress comma separated ' 30 | 'error classes through the ALINT_IGNORE environment variable. ' 31 | 'Returns 1 if any issue was reported.')) 32 | parser.add_argument( 33 | 'func_odbc', metavar='FUNC_ODBC_CONF', nargs='?', 34 | default='./func_odbc.conf', 35 | help="path to func_odbc.conf") 36 | return parser 37 | 38 | def handle_args(self, args): 39 | parser = FileFuncOdbcParser() 40 | parser.include(args.func_odbc) 41 | for func_odbc_context in parser: 42 | pass 43 | 44 | # MessageDefManager.raised is a dict of messages ordered by 45 | # message type. All message types share the same muted flag, 46 | # so we need only examine the first. 47 | if any(not i[0].muted for i in MessageDefManager.raised.values()): 48 | return 1 49 | 50 | 51 | main = Main() 52 | -------------------------------------------------------------------------------- /tests/application/test_set.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from asterisklint import FileDialplanParser 17 | from asterisklint.alinttest import ALintTestCase, ignoreLinted 18 | 19 | 20 | @ignoreLinted('H_DP_GENERAL_MISPLACED', 'H_DP_GLOBALS_MISPLACED') 21 | class SetTest(ALintTestCase): 22 | def get_extension(self, reader): 23 | out = [i for i in reader] 24 | self.assertEqual(len(out), 1) 25 | dialplan = out[0] 26 | 27 | contexts = dialplan.contexts 28 | self.assertEqual(len(contexts), 1) 29 | self.assertEqual(len(contexts[0]), 1) 30 | return contexts[0][0] 31 | 32 | def test_normal(self): 33 | reader = self.create_instance_and_load_single_file( 34 | FileDialplanParser, 'test.conf', b'''\ 35 | [context] 36 | exten => s,1,Set(variable=value) 37 | ''') 38 | exten = self.get_extension(reader) 39 | self.assertEqual(exten.app.name, 'Set') 40 | # FIXME: test variable == value stuff? 41 | 42 | def test_canonical_case(self): 43 | reader = self.create_instance_and_load_single_file( 44 | FileDialplanParser, 'test.conf', b'''\ 45 | [context] 46 | ; proper case for "set" app is "Set" 47 | exten => s,1,set(variable=value) 48 | ''') 49 | exten = self.get_extension(reader) 50 | del exten 51 | self.assertLinted({'W_APP_BAD_CASE': 1}) 52 | # FIXME: test that variable is placed onto a global list of variables 53 | # FIXME: test that the app_set.so is placed onto a global list of 54 | # used modules 55 | -------------------------------------------------------------------------------- /tests/config/test_normal.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from asterisklint import FileConfigParser 17 | from asterisklint.alinttest import ALintTestCase 18 | from asterisklint.config import Context, Varset 19 | 20 | 21 | class NormalTest(ALintTestCase): 22 | def test_normal(self): 23 | reader = self.create_instance_and_load_single_file( 24 | FileConfigParser, 'test.conf', b'''\ 25 | [context] 26 | variable => value 27 | other=value2 28 | 29 | [context2] 30 | and_that_is=it 31 | ''') 32 | out = [i for i in reader] 33 | self.assertEqual(len(out), 2) 34 | self.assertEqual(out[0].__class__, Context) 35 | self.assertEqual(out[0].name, 'context') 36 | self.assertEqual(len(out[0]), 2) 37 | self.assertEqual(out[1].__class__, Context) 38 | self.assertEqual(out[1].name, 'context2') 39 | self.assertEqual(len(out[1]), 1) 40 | 41 | variables = [i for i in out[0]] 42 | self.assertEqual(variables[0].__class__, Varset) 43 | self.assertEqual(variables[0].variable, 'variable') 44 | self.assertEqual(variables[0].value, 'value') 45 | self.assertTrue(variables[0].arrow) 46 | 47 | self.assertEqual(variables[1].__class__, Varset) 48 | self.assertEqual(variables[1].variable, 'other') 49 | self.assertEqual(variables[1].value, 'value2') 50 | self.assertFalse(variables[1].arrow) 51 | 52 | variables = [i for i in out[1]] 53 | self.assertEqual([(i.variable, i.value) for i in variables], 54 | [('and_that_is', 'it')]) 55 | -------------------------------------------------------------------------------- /asterisklint/mainutil.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | import argparse 17 | import os 18 | 19 | from . import FileFuncOdbcParser 20 | 21 | 22 | class MainBase(object): 23 | def create_argparser(self, argparser_class): 24 | raise NotImplementedError() 25 | 26 | def handle_args(self, args): 27 | raise NotImplementedError() 28 | 29 | def parse_args(self, args): 30 | parser = self.create_argparser(argparse.ArgumentParser) 31 | return parser.parse_args(args) 32 | 33 | def __call__(self, args, envs): 34 | args = self.parse_args(args) 35 | return self.handle_args(args) 36 | 37 | 38 | class UniqueStore(argparse.Action): 39 | "Make sure an --argument is only used at most once." 40 | def __call__(self, parser, namespace, values, option_string): 41 | if getattr(namespace, self.dest, self.default) is not None: 42 | parser.error("{} appears several times".format(option_string)) 43 | setattr(namespace, self.dest, values) 44 | 45 | 46 | def load_func_odbc_functions(func_odbc_arg, dialplan_arg): 47 | if func_odbc_arg == '': 48 | # Explicit disable. 49 | return 50 | 51 | if func_odbc_arg is None: 52 | # Auto-detect? 53 | func_odbc_arg = os.path.join( 54 | os.path.dirname(dialplan_arg), 'func_odbc.conf') 55 | if not os.path.exists(func_odbc_arg): 56 | # If there is no such file, don't worry about it. 57 | return 58 | 59 | # Load it up. 60 | # TODO: do we want to silence func_odbc errors/warnings here? 61 | parser = FileFuncOdbcParser() 62 | parser.include(func_odbc_arg) 63 | for func_odbc_context in parser: 64 | pass 65 | -------------------------------------------------------------------------------- /asterisklint/version.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2019 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | import os 17 | 18 | from .cls import Singleton 19 | 20 | 21 | class AsteriskVersion(metaclass=Singleton): 22 | """ 23 | Store the used Asterisk version globally. If you don't initialize 24 | this before anyone requests anything, you get the default. 25 | 26 | Example:: 27 | 28 | from asterisklint.version import AsteriskVersion 29 | 30 | AsteriskVersion('v13') # set version 13 throughout the run 31 | """ 32 | DEFAULT = 'v13' 33 | 34 | def __init__(self, version=None): 35 | self.version = version or self.DEFAULT 36 | 37 | def reinit(self, version=None): 38 | if version and self.version != version: 39 | raise RuntimeError( 40 | 'Attempt to re-set Asterisk version from {} to {}'.format( 41 | self.version, version)) 42 | 43 | def list_app_mods(self): 44 | """ 45 | Return a list app names in absolute import format. Takes 46 | internal version into account. 47 | """ 48 | return self._list_mods('app') 49 | 50 | def list_func_mods(self): 51 | """ 52 | Return a list function names in absolute import format. Takes 53 | internal version into account. 54 | """ 55 | return self._list_mods('func') 56 | 57 | def _get_path(self, submod): 58 | return os.path.join(os.path.dirname(__file__), submod, self.version) 59 | 60 | def _list_mods(self, submod): 61 | appsdir = self._get_path(submod) 62 | appmods = [i[0:-3] for i in os.listdir(appsdir) if i.endswith('.py')] 63 | 64 | modfmt = 'asterisklint.{}.{}.{{}}'.format(submod, self.version) 65 | return [modfmt.format(appmod) for appmod in appmods] 66 | -------------------------------------------------------------------------------- /tests/dialplan/test_include.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from asterisklint import FileDialplanParser 17 | from asterisklint.alinttest import ALintTestCase, ignoreLinted 18 | 19 | 20 | class IncludeTest(ALintTestCase): 21 | maxDiff = 2048 22 | 23 | @ignoreLinted('*') # don't care about formatting errors 24 | def test_random_include_order(self): 25 | reader = self.create_instance_and_load_single_file( 26 | FileDialplanParser, 'test.conf', b'''\ 27 | [context1] 28 | include => context2 29 | exten => _Z!,1,NoOp 30 | same => n,Goto(2${EXTEN:1}) 31 | 32 | [context2] 33 | exten => _Z!,1,NoOp 34 | same => n,Set(CALLERID(num)=1234) 35 | include => context1 36 | same => n,Dial(SIP/300) 37 | ''') 38 | out = [i for i in reader] 39 | self.assertEqual(len(out), 1) 40 | dialplan = out[0] 41 | 42 | # Dialplan show defaults in reversed context order.. oddly 43 | # enough. But odbc-loaded data isn't? Because of the 44 | # cat_metrics? 45 | fmt = dialplan.format_as_dialplan_show() 46 | self.assertEqual(fmt, '''\ 47 | [ Context 'context2' created by 'pbx_config' ] 48 | '_Z!' => 1. NoOp() [pbx_config] 49 | 2. Set(CALLERID(num)=1234) [pbx_config] 50 | 3. Dial(SIP/300) [pbx_config] 51 | Include => 'context1' [pbx_config] 52 | 53 | [ Context 'context1' created by 'pbx_config' ] 54 | '_Z!' => 1. NoOp() [pbx_config] 55 | 2. Goto(2${EXTEN:1}) [pbx_config] 56 | Include => 'context2' [pbx_config] 57 | ''') 58 | -------------------------------------------------------------------------------- /asterisklint/app/vall/app_exec.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2018 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..base import AppBase, VarCondIfStyleApp 17 | 18 | # In the following commit -- between Asterisk 1.4 and Asterisk 1.6.x -- 19 | # not only did the default App argument delimiter change from pipe (|) 20 | # to comma (,), but also the ExecIf change to GotoIf-style syntax, using 21 | # a question mark (?). 22 | # 23 | # > commit 55b1ee298e926c594f45456e5afbc25c79e3889b 24 | # > Author: Tilghman Lesher 25 | # > Date: Mon Jul 23 19:51:41 2007 +0000 26 | # 27 | # > Merge the dialplan_aesthetics branch. Most of this patch simply 28 | # > converts applications using old methods of parsing arguments to 29 | # > using the standard macros. However, the big change is that the 30 | # > really old way of specifying application and arguments separated by 31 | # > a comma will no longer work (e.g. NoOp,foo|bar). Instead, the way 32 | # > that has been recommended since long before 1.0 will become the only 33 | # > method available (e.g. NoOp(foo,bar). 34 | # > 35 | # > git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@76703 36 | # > 65c4cc65-6c06-0410-ace0-fbb531ad65f3 37 | 38 | 39 | class Exec(AppBase): 40 | pass 41 | 42 | 43 | class ExecIf(VarCondIfStyleApp): 44 | def __call__(self, data, where, jump_destinations): 45 | from asterisklint.application import App 46 | 47 | cond, iftrue, iffalse = super().__call__( 48 | data, where, jump_destinations) 49 | if iftrue: 50 | App(iftrue, where=where) 51 | if iffalse: 52 | App(iffalse, where=where) 53 | 54 | return cond, iftrue, iffalse 55 | 56 | 57 | class TryExec(AppBase): 58 | pass 59 | 60 | 61 | def register(app_loader): 62 | for app in ( 63 | Exec, ExecIf, TryExec): 64 | app_loader.register(app()) 65 | -------------------------------------------------------------------------------- /tests/cls/test_singleton.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from asterisklint.cls import Singleton 17 | from asterisklint.alinttest import ALintTestCase 18 | 19 | 20 | class TestSingleton(metaclass=Singleton): 21 | def __init__(self, foo=None): 22 | self.foo = foo or 'bar' 23 | 24 | 25 | class TestSingletonWithReinit(metaclass=Singleton): 26 | def __init__(self, foo=None): 27 | self.foo = foo or 'bar' 28 | 29 | def reinit(self, foo=None): 30 | if foo and self.foo != foo: 31 | raise ValueError( 32 | 'Reinitializing {} with arg {!r} conflicts with ' 33 | 'previous arg {!r}'.format( 34 | self.__class__.__name__, foo, self.foo)) 35 | 36 | 37 | class SingletonTest(ALintTestCase): 38 | def test_singleton(self): 39 | s = TestSingleton() # no args, gets 'bar' 40 | self.assertEqual(s.foo, 'bar') 41 | 42 | s2 = TestSingleton('def') # different args 43 | self.assertEqual(s2.foo, 'bar') # unchanged 44 | self.assertEqual(s, s2) 45 | 46 | s3 = TestSingleton('bar') # same args 47 | self.assertEqual(s, s3) # also unchanged, obviously 48 | 49 | def test_singleton_with_reinit(self): 50 | s = TestSingletonWithReinit('abc') # 'abc' args 51 | self.assertEqual(s.foo, 'abc') 52 | 53 | s2 = TestSingletonWithReinit('abc') # same args 54 | self.assertEqual(s2.foo, 'abc') # unchanged 55 | self.assertEqual(s, s2) 56 | 57 | s3 = TestSingletonWithReinit() # no args 58 | self.assertEqual(s3.foo, 'abc') # unchanged 59 | self.assertEqual(s, s3) 60 | 61 | # Trying to change the args this time, will fail. 62 | self.assertRaises(ValueError, TestSingletonWithReinit, 'bar') 63 | -------------------------------------------------------------------------------- /tests/dialplan/test_normal.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2016 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from asterisklint import FileDialplanParser 17 | from asterisklint.alinttest import ALintTestCase, ignoreLinted 18 | 19 | 20 | class NormalTest(ALintTestCase): 21 | def test_normal(self): 22 | reader = self.create_instance_and_load_single_file( 23 | FileDialplanParser, 'test.conf', b'''\ 24 | [general] 25 | writeprotect=yes 26 | 27 | [globals] 28 | GLOBAL1=X 29 | GLOBAL2=Y 30 | 31 | [non_empty_context] 32 | exten => s,1,NoOp 33 | same => n(label2),Verbose(foo) 34 | same => n,Hangup() 35 | 36 | [empty_context] 37 | ''') 38 | out = [i for i in reader] 39 | self.assertEqual(len(out), 1) 40 | dialplan = out[0] 41 | 42 | contexts = dialplan.contexts 43 | self.assertEqual(len(contexts), 2) 44 | self.assertEqual(len(contexts[0]), 3) 45 | self.assertEqual(len(contexts[1]), 0) 46 | 47 | @ignoreLinted('H_*') 48 | def test_dupe_label(self): 49 | reader = self.create_instance_and_load_single_file( 50 | FileDialplanParser, 'test.conf', b'''\ 51 | [non_empty_context] 52 | exten => s,1(label1),Verbose(foo1) 53 | same => n(label2),Verbose(foo2) 54 | same => n(label1),Verbose(foo3) 55 | same => n(label2),Verbose(foo4) 56 | same => n,Hangup() 57 | ''') 58 | out = [i for i in reader] 59 | self.assertEqual(len(out), 1) 60 | dialplan = out[0] 61 | 62 | contexts = dialplan.contexts 63 | self.assertEqual(len(contexts), 1) 64 | self.assertEqual(len(contexts[0]), 5) 65 | self.assertEqual(contexts[0][0].label, 'label1') 66 | self.assertEqual(contexts[0][1].label, 'label2') 67 | self.assertEqual(contexts[0][2].label, '') # E_DP_LABEL_DUPE #1 68 | self.assertEqual(contexts[0][3].label, '') # E_DP_LABEL_DUPE #2 69 | self.assertLinted({'E_DP_LABEL_DUPE': 2}) 70 | -------------------------------------------------------------------------------- /asterisklint/app/__init__.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2017 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | from ..defines import ErrorDef, WarningDef 17 | 18 | 19 | if 'we_dont_want_two_linefeeds_between_classdefs': # for flake8 20 | class E_APP_ARG_FEW(ErrorDef): 21 | message = 'too few arguments for app {app!r}, minimum is {min_args}' 22 | 23 | class E_APP_ARG_MANY(ErrorDef): 24 | message = 'too many arguments for app {app!r}, maximum is {max_args}' 25 | 26 | class E_APP_ARG_BADOPT(ErrorDef): 27 | message = ('unrecognised options {opts!r} in arg {argno} ' 28 | 'for app {app!r}') 29 | 30 | class E_APP_ARG_DUPEOPT(ErrorDef): 31 | message = 'duplicate options {opts!r} in arg {argno} for app {app!r}' 32 | 33 | class E_APP_ARG_IFCONST(ErrorDef): 34 | message = ("apparent constant in If-condition; app {app!r}, " 35 | "data '{data}' and cond '{cond}'") 36 | 37 | class E_APP_ARG_IFEMPTY(ErrorDef): 38 | message = "empty If-condition; app {app!r}, data '{data}'" 39 | 40 | class E_APP_ARG_IFSTYLE(ErrorDef): 41 | message = ("{app!r} takes the form ?[:] " 42 | "but data is '{data}', cond '{cond}', args '''{args}'''") 43 | 44 | class E_APP_ARG_PIPEDELIM(ErrorDef): 45 | message = ('the application delimiter is now the comma, not ' 46 | 'the pipe; see app {app!r} and data {data!r}') 47 | 48 | class E_APP_ARG_SYNTAX(ErrorDef): 49 | message = ('generic application syntax error; app {app!r} and ' 50 | 'data {data!r}') 51 | 52 | class E_APP_MISSING(ErrorDef): 53 | message = 'app {app!r} does not exist, dialplan will halt here!' 54 | 55 | class W_APP_BAD_CASE(WarningDef): 56 | message = 'app {app!r} does not have the proper Case {proper!r}' 57 | 58 | class W_APP_BALANCE(WarningDef): 59 | message = ('app data {data!r} looks like unbalanced ' 60 | 'parentheses/quotes/curlies') 61 | -------------------------------------------------------------------------------- /asterisklint/commands/dialplan-check.py: -------------------------------------------------------------------------------- 1 | # AsteriskLint -- an Asterisk PBX config syntax checker 2 | # Copyright (C) 2015-2017 Walter Doekes, OSSO B.V. 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | """ 17 | Do sanity checks on dialplan. Takes 'extensions.conf' as argument. 18 | Suppress errors using ALINT_IGNORE env. 19 | """ 20 | from asterisklint import FileDialplanParser 21 | from asterisklint.defines import MessageDefManager 22 | from asterisklint.mainutil import ( 23 | MainBase, UniqueStore, load_func_odbc_functions) 24 | 25 | 26 | class Main(MainBase): 27 | def create_argparser(self, argparser_class): 28 | parser = argparser_class( 29 | description=( 30 | 'Do sanity checks on dialplan. Suppress comma separated ' 31 | 'error classes through the ALINT_IGNORE environment variable. ' 32 | 'Returns 1 if any issue was reported.')) 33 | parser.add_argument( 34 | 'dialplan', metavar='EXTENSIONS_CONF', nargs='?', 35 | default='./extensions.conf', 36 | help='path to extensions.conf') 37 | parser.add_argument( 38 | '--func-odbc', metavar='FUNC_ODBC_CONF', action=UniqueStore, 39 | help="path to func_odbc.conf, will be read automatically if found " 40 | "in same the same dir as extensions.conf; " 41 | "set empty to disable") 42 | return parser 43 | 44 | def handle_args(self, args): 45 | # Load func_odbc functions if requested. 46 | load_func_odbc_functions(args.func_odbc, args.dialplan) 47 | 48 | parser = FileDialplanParser() 49 | parser.include(args.dialplan) 50 | dialplan = next(iter(parser)) 51 | dialplan.walk_jump_destinations() 52 | del dialplan 53 | 54 | # MessageDefManager.raised is a dict of messages ordered by message 55 | # type. All message types share the same muted flag, so we need only 56 | # examine the first. 57 | if any(not i[0].muted for i in MessageDefManager.raised.values()): 58 | return 1 59 | 60 | 61 | main = Main() 62 | --------------------------------------------------------------------------------