Commit Graph

19 Commits

Author SHA1 Message Date
Sean Bright 51cba591e3 pbx.c: On error, ast_add_extension2_lockopt should always free 'data'
In the event that the desired extension already exists,
ast_add_extension2_lockopt() will free the 'data' it is passed before
returning an error, so we should not be freeing it ourselves.

Additionally, there were two places where ast_add_extension2_lockopt()
could return an error without also freeing the 'data' pointer, so we
add that.

ASTERISK-29097 #close

Change-Id: I904707aae55169feda050a5ed7c6793b53fe6eae
2020-10-02 10:11:38 -05:00
Sean Bright b40dd11afe res_pjsip_config_wizard: Fix change detection for wizard settings
ast_sorcery_changeset_create() is not commutative and will fail to detect
differences between two variable lists depending on what changed, so switch to
ast_variable_lists_match().

ASTERISK-28492 #close
Reported by: Jean-Denis Girard

Change-Id: I7b3256983ddfaa2138d3de92a444a53b5193a4e1
2020-01-05 10:13:05 -06:00
Sean Bright 82a43394ed res_pjsip_config_wizard: Don't crash if misconfigured
If both send_registrations and send_auth are both set to yes,
outbound_auth/username must be set or we crash.

ASTERISK-27992 #close

Change-Id: I6418d56de1ae53f80393b314c2584048fbf7f11d
2019-02-27 19:54:32 -06:00
Corey Farrell f899368cd6 res_pjsip_config_wizard: Fix leaks and add check for malloc failure.
wizard_apply_handler():
- Free host if we fail to add it to the vector.

wizard_mapped_observer():
- Check for otw allocation failure.
- Free otw if we fail to add it to the vector.

Change-Id: Ib5d3bcabbd9c24dd8a3c9cc692a794a5f60243ad
2017-11-06 18:44:01 -05:00
George Joseph 2fe52174de res_pjsip_config_wizard: Add 2 new parameters to help with proxy config
Two new parameters have been added to the pjsip config wizard.

 * Setting 'sends_line_with_registrations' to true will cause the wizard
   to skip the creation of an identify object to match incoming request
   to the endpoint and instead add the line and endpoint parameters to
   the outbound registration object.

 * Setting 'outbound_proxy' is a shortcut for adding individual
   endpoint/outbound_proxy, aor/outbound_proxy and
   registration/outbound_proxy parameters.

Change-Id: I678e5f80765734c056620528a6d40d82736ceeb0
(cherry picked from commit a827892ff7)
(cherry picked from commit 27344675be)
2017-03-28 15:51:21 -06:00
Jonathan R. Rose d96e350256 core/pbx: dialplan show - display filename/line#
Adds the ability for extensions to be registered to include filename and
line number so that dialplan show output can show the filename and line
number of a config file responsible for generating a given extension.

This only affects config modules that are written to use the new extension
registering functions. In this patch, that only includes pbx_config, so
extensions registered in extensions.conf and any included extension will
be shown in this manner. Extensions registered in this manner will show
the filename and line number *instead* of the registrar.

ASTERISK-26658 #close
Reported by: Jonathan R. Rose

Change-Id: Ieccc6abccdff34ed5c7da3511fd24972b8f2dd30
2017-01-04 14:06:20 -06:00
Corey Farrell a6e5bae3ef Remove ASTERISK_REGISTER_FILE.
ASTERISK_REGISTER_FILE no longer has any purpose so this commit removes
all traces of it.

Previously exported symbols removed:
* __ast_register_file
* __ast_unregister_file
* ast_complete_source_filename

This also removes the mtx_prof static variable that was declared when
MTX_PROFILE was enabled.  This variable was only used in lock.c so it
is now initialized in that file only.

ASTERISK-26480 #close

Change-Id: I1074af07d71f9e159c48ef36631aa432c86f9966
2016-10-27 09:53:55 -04:00
Badalyan Vyacheslav 3ab7fae96b res_pjsip_config_wizard: Memory leak in module_unload
Fixed a memory leak. It removes only the first element.
Added a useful feature in vector.h to remove all items
under the CMP through a callback function / macro.

ASTERISK-26453 #close

Change-Id: I84508353463456d2495678f125738e20052da950
2016-10-10 12:01:20 -04:00
George Joseph 4f08e9fb64 res_pjsip_config_wizard: Add command to export primitive objects
A new command (pjsip export config_wizard primitives) has been added that
will export all the pjsip objects it created to the console or a file
suitable for reuse in a pjsip.conf file.

ASTERISK-24919 #close
Reported-by: Ray Crumrine

Change-Id: Ica2a5f494244b4f8345b0437b16d06aa0484452b
2016-02-15 21:37:04 -06:00
George Joseph 5d93928175 res_pjsip_config_wizard/config: Fix template processing
The config wizard was always pulling the first occurrence of
a variable from an ast_variable list but this gets the template
value from the list instead of any overridden value.  This patch
creates ast_variable_find_last_in_list() in config.c and updates
res_pjsip_config_wizard to use it instead of
ast_variable_find_in_list.  Now the overridden values, where they
exist, are used instead of template variables.

Updated test_config to test the new API.

ASTERISK-25089 #close

Reported-by: George Joseph <george.joseph@fairview5.com>
Tested-by: George Joseph <george.joseph@fairview5.com>
Change-Id: Ifa7ddefc956a463923ee6839dd1ebe021c299de4
2015-05-15 17:19:49 -05:00
Rodrigo Ramírez Norambuena eec010829a AST_MODULE_INFO: Format corrections to the usages of AST_MODULE_INFO macro.
Change-Id: Icf88f9f861c6b2a16e5f626ff25795218a6f2723
2015-05-13 16:34:23 -05:00
Matt Jordan 4a58261694 git migration: Refactor the ASTERISK_FILE_VERSION macro
Git does not support the ability to replace a token with a version
string during check-in. While it does have support for replacing a
token on clone, this is somewhat sub-optimal: the token is replaced
with the object hash, which is not particularly easy for human
consumption. What's more, in practice, the source file version was often
not terribly useful. Generally, when triaging bugs, the overall version
of Asterisk is far more useful than an individual SVN version of a file. As a
result, this patch removes Asterisk's support for showing source file
versions.

Specifically, it does the following:

* Rename ASTERISK_FILE_VERSION macro to ASTERISK_REGISTER_FILE, and
  remove passing the version in with the macro. Other facilities
  than 'core show file version' make use of the file names, such as
  setting a debug level only on a specific file. As such, the act of
  registering source files with the Asterisk core still has use. The
  macro rename now reflects the new macro purpose.

* main/asterisk:
  - Refactor the file_version structure to reflect that it no longer
    tracks a version field.
  - Remove the "core show file version" CLI command. Without the file
    version, it is no longer useful.
  - Remove the ast_file_version_find function. The file version is no
    longer tracked.
  - Rename ast_register_file_version/ast_unregister_file_version to
    ast_register_file/ast_unregister_file, respectively.

* main/manager: Remove value from the Version key of the ModuleCheck
  Action. The actual key itself has not been removed, as doing so would
  absolutely constitute a backwards incompatible change. However, since
  the file version is no longer tracked, there is no need to attempt to
  include it in the Version key.

* UPGRADE: Add notes for:
  - Modification to the ModuleCheck AMI Action
  - Removal of the "core show file version" CLI command

Change-Id: I6cf0ff280e1668bf4957dc21f32a5ff43444a40e
2015-04-13 03:48:57 -04:00
George Joseph f69e46de25 res_pjsip_config_wizard: Cleanup load unload
While investigating other unload issues I realized that the load/unload process 
for the config wizard was pretty ugly so I've refactored it as follows...

When the res_pjsip sorcery instance is created the config_wizard bumps it's own 
module reference to prevent it from unloading while the sorcery instance is 
still active.  When res_pjsip unloads and it's sorcery instance is destroyed, 
the config wizard unrefs itself which then allows itself to unload cleanly.  
Since the config wizard now can't load after res_pjsip or unload before it 
(which should have been the correct behavior all along), I was able to remove 
the chunks of code in both load_module and unload_module that handled that case.

Ran the testsuite tests to insure there were no functional changes and REF_DEBUG 
to insure that Asterisk was shutting down cleanly with no FRACKs or leaks.

Tested-by: George Joseph
Review: https://reviewboard.asterisk.org/r/4610/
........

Merged revisions 434619 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434620 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-04-10 17:00:38 +00:00
George Joseph 49161d8df8 res_pjsip_config_wizard: Add ability to auto-create hints.
Looking at the Super Awesome Company sample reminded me that creating hints is 
just plain gruntwork.  So you can now have the pjsip conifg wizard auto-create 
them for you.

Specifying 'hint_exten' in the wizard will create 
'exten => <hint_exten>,hint/PJSIP/<wizard_id>'
in whatever is specified for 'hint_context'.

Specifying 'hint_application' in the wizard will create
'exten => <hint_exten>,1,<hint_application>'
in whatever is specified for 'hint_context'.

The default for 'hint_context' is the endpoint's context.
There's no default for 'hint_application'.  If not specified, no app is added.
There's no default for 'hint_exten'.  If not specified, neither the hint itself 
nor the application will be created.

Some may think this is the slippery slope to users.conf but hints are a basic 
necessity for phones unlike voicemail, manager, etc that users.conf creates.

Tested-by: George Joseph
Review: https://reviewboard.asterisk.org/r/4383/
........

Merged revisions 431643 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431644 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-10 23:17:17 +00:00
David M. Lee 89610adda5 Add depend on pjproject to res_pjsip_config_wizard.c
........

Merged revisions 431030 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431034 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-23 18:46:09 +00:00
George Joseph 18b5a336ef res_pjsip_config_wizard: fix unload SEGV
If certain pjsip modules aren't loaded, the wizard causes a SEGV
when it unloads.  Added a check for the presense of the object
type wizard before trying to clean it up.

Tested-by: George Joseph
........

Merged revisions 429719 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@429720 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-12-18 00:11:24 +00:00
George Joseph c4360796f7 res_pjsip_config_wizard: Change FILEUNCHANGED config_load2 flag determination
The module now applies the FILEUNCHANGED flag when both reloaded is
specified AND there's no last_config for the object type.

Tested-by: George Joseph

Review: https://reviewboard.asterisk.org/r/4276/
........

Merged revisions 429699 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@429700 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-12-17 23:06:01 +00:00
George Joseph c4cc668ba9 res_pjsip_config_wizard: fix test breakage
Fix test breakage caused by not checking for res_pjsip before
calling ast_sip_get_sorcery.

Tested-by: George Joseph

Review: https://reviewboard.asterisk.org/r/4269/
........

Merged revisions 429653 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@429654 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-12-16 17:53:59 +00:00
George Joseph 39b54a21dc res_pjsip_config_wizard: Allow streamlined config of common pjsip scenarios
res_pjsip_config_wizard
------------------
 * This is a new module that adds streamlined configuration capability for
   chan_pjsip.  It's targetted at users who have lots of basic configuration
   scenarios like 'phone' or 'agent' or 'trunk'.  Additional information
   can be found in the sample configuration file at
   config/samples/pjsip_wizard.conf.sample.

Tested-by: George Joseph

Review: https://reviewboard.asterisk.org/r/4190/
........

Merged revisions 429592 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@429593 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-12-15 17:08:24 +00:00