Commit Graph

52 Commits

Author SHA1 Message Date
Joshua C. Colp 304f8ddfb2 sorcery: Add support for more intelligent reloading.
Some sorcery objects actually contain dynamic content
that can change despite the underlying configuration
itself not changing. A good example of this is the
res_pjsip_endpoint_identifier_ip module which allows
specifying hostnames. While the configuration may not
change between reloads the DNS information of the
hostnames can.

This change adds the ability for a sorcery object to be
marked as having dynamic contents which is then taken
into account when reloading by the sorcery file based
config module. If there is an object with dynamic content
then a reload will be forced while if there are none
then the existing behavior of not reloading occurs.

ASTERISK-29321

Change-Id: I9342dc55be46cc00204533c266a68d972760a0b1
2021-03-05 10:32:28 -06:00
Sean Bright 29d867ed67 res_pjsip_endpoint_identifier_ip: Document support for hostnames
ASTERISK-25429 #close
Reported by: Joshua C. Colp

Change-Id: I7cdfc6026821636acc2465094b7fcde8471a3824
2020-01-10 15:15:59 -06:00
Sean Bright 312abaa1fe res_pjsip_endpoint_identifier_ip.c: Add port matching support
Adds source port matching support when IP matching is used:

  [example]
  type = identify
  match = 1.2.3.4:5060/32, 1.2.3.4:6000/32, asterisk.org:4444

If the IP matches but the source port does not, we reject and search for
alternatives. SRV lookups are still performed if enabled (srv_lookups = yes),
unless the configured FQDN includes a port number in which case just a host
lookup is performed.

ASTERISK-28639 #close
Reported by: Mitch Claborn

Change-Id: I256d5bd5d478b95f526e2f80ace31b690eebba92
2020-01-08 08:37:53 -06:00
Kevin Harwell bdd785d31c various files - fix some alerts raised by lgtm code analysis
This patch fixes several issues reported by the lgtm code analysis tool:

https://lgtm.com/projects/g/asterisk/asterisk

Not all reported issues were addressed in this patch. This patch mostly fixes
confirmed reported errors, potential problematic code points, and a few other
"low hanging" warnings or recommendations found in core supported modules.
These include, but are not limited to the following:

* innapropriate stack allocation in loops
* buffer overflows
* variable declaration "hiding" another variable declaration
* comparisons results that are always the same
* ambiguously signed bit-field members
* missing header guards

Change-Id: Id4a881686605d26c94ab5409bc70fcc21efacc25
2019-11-18 08:30:45 -06:00
Richard Mudgett e5ae04b48b res_pjsip_endpoint_identifier_ip.c: Added regex support to match_header
This patch adds regular expression support to make the identify section's
match_header option more useful when attempting to match complex headers
like the 'To' or 'From' headers.  The 'From' header has variable
components such as the tag parameter that you cannot predict.  To specify
a regular expression put slashes around the regular expression in place of
the header value.

[identify-alice]
type=identify
endpoint=alice
match_header=From: /<sip:alice@127\\.0\\.0\\.1>/

* Added regex support to match_header so you could match a 'To' header
among other complex headers.

Fixed reported crashes when trying to match special headers like 'Contact'.
The identify section's match_header method used code that assumed you were
matching a generic header.  Any other type of header could cause a crash
if the header structure variant did not match the generic header enough.

* Made use code that will work for any header type instead of code
specific to generic headers.

Other fixes while in the area:

* Made check all headers of the requested name.
* Added some more sanity checks to the configured identify matching
options when applying the configuration.

ASTERISK-27548

Change-Id: I27dfd4ff5e2259b906640e3c330681b76b4ed1f1
2018-07-27 10:58:38 -05:00
Alexander Traud f10fc135d4 res_pjsip_endpoint_identifier_ip: Unregister the module for headers.
Asterisk uses Reference Counting to track whether a module can be unloaded.
Every consumer who requires a module, increases the reference count. When the
consumer goes, is unloaded itself, it has to decrease the reference count on
all its used/required modules. That way
 core stop gracefully
works on the command-line interface (CLI): One module after the other is
unloaded. A recent change broke this for the module res_pjsip.

ASTERISK-27861

Change-Id: I261abcb411d026bbb0691cc78f28300bfd3103a3
2018-05-17 08:58:43 +02:00
Corey Farrell 527cf5a570 Remove redundant module checks and references.
This removes references that are no longer needed due to automatic
references created by module dependencies.

In addition this removes most calls to ast_module_check as they were
checking modules which are listed as dependencies.

Change-Id: I332a6e8383d4c72c8e89d988a184ab8320c4872e
2018-01-24 13:37:29 -05:00
Richard Mudgett 8494e78010 res_pjsip: Split type=identify to IP address and SIP header matching priorities
The type=identify endpoint identification method can match by IP address
and by SIP header.  However, the SIP header matching has limited
usefulness because you cannot specify the SIP header matching priority
relative to the IP address matching.  All the matching happens at the same
priority and the order of evaluating the identify sections is
indeterminate.  e.g., If you had two type=identify sections where one
matches by IP address for endpoint alice and the other matches by SIP
header for endpoint bob then you couldn't predict which endpoint is
matched when a request comes in that matches both.

* Extract the SIP header matching criteria into its own "header" endpoint
identification method so the user can specify the relative priority of the
SIP header and the IP address matching criteria in the global
endpoint_identifier_order option.  The "ip" endpoint identification method
now only matches by IP address.

ASTERISK-27491

Change-Id: I9df142a575b7e1e3471b7cda5d3ea156cef08095
2018-01-16 12:50:34 -06:00
Corey Farrell 9cfdb81e91 loader: Add dependency fields to module structures.
* Declare 'requires' and 'enhances' text fields on module info structure.
* Rename 'nonoptreq' to 'optional_modules'.
* Update doxygen comments.

Still need to investigate dependencies among modules I cannot compile.

Change-Id: I3ad9547a0a6442409ff4e352a6d897bef2cc04bf
2018-01-15 13:25:51 -05:00
Jenkins2 e4ee41da4d Merge "res_pjsip_endpoint_identifier_ip.c: Remove unnecessary requirement." 2018-01-11 13:36:02 -06:00
Jenkins2 97a0e8591f Merge "res_pjsip.c: Update the endpoint identification documentation." 2018-01-11 08:42:52 -06:00
Richard Mudgett 8f3167c5f1 res_pjsip.c: Update the endpoint identification documentation.
* Endpoint identify_by documentation.
* IP/Header endpoint identifier documentation.

Change-Id: Id92f00b495acca7be945daf749d2abd7f76a0b5a
2018-01-09 13:38:59 -06:00
Richard Mudgett 42a61d9db6 res_pjsip_endpoint_identifier_ip.c: Remove unnecessary requirement.
The requirement that "ip" must be in the endpoint identify_by list to
allow the type=identify method to identify the endpoint is not necessary.
The "ip" identifier method can match one and only one endpoint.  To even
work, the "ip" identifier method configuration must explicitly specify the
identified endpoint.  Therefore, why bother configuring the type=identify
identifier in the first place?  The requirement only adds the potential
for configuration errors for no benefit.  Even worse, those configuration
errors cannot be detected when the configuration loads.  The requirement
was introduced with the ASTERISK_27206 patch.

* Remove the code change that enforces the requiremnt.  Listing the "ip"
method in the identify_by value is simply documentation.

Change-Id: Ia057f92a33fb5d9f51dc5d5692e3d5ee1a6f2c11
2018-01-09 12:34:41 -06:00
Richard Mudgett be488eb14a res_pjsip_endpoint_identifier_ip.c: Allow multiple IdentifyDetail AMI events.
The AMI PJSIPShowEndpoint action could only list one IdentifyDetail AMI
event per endpoint.  However, there is no reason that multiple
type=identify sections cannot identify the same endpoint.

* Reworked format_ami_endpoint_identify() to generate as many
IdentifyDetail AMI events as there are matching identifiers.

Change-Id: Ie146792aef72d78e05416ab5b27bc552a30399db
2018-01-09 12:08:13 -06:00
Richard Mudgett b20b5758d9 res_pjsip_endpoint_identifier_ip.c: Fix apply identify validation.
The ip_identify_apply() did not validate the configuration for simple
static configuration errors or deal well with address resolution errors.

* Added missing configuration validation checks.
* Fixed address resolution error handling.
* Demoted an error message to a warning since it does not fail applying
the identify object configuration.

Change-Id: I8b519607263fe88e8ce964f526a45359fd362b6e
2018-01-05 18:49:28 -06:00
Joshua Colp 9e1fbab382 res_pjsip: Add 'ip' as a valid option to 'identify_by' on endpoint.
When the identify_by option on an endpoint is set to ip it will
only be identified using the res_pjsip_endpoint_identifier_ip module.
This ensures that it is not mistakenly matched using the username of
the From header. To ensure behavior has not changed the default has
been changed to "username,ip" for the identify_by option.

ASTERISK-27206

Change-Id: I2170b86a7f7e221b4f00bf14aa1ef1ac5b050bbd
2017-10-25 18:14:03 +00:00
Joshua Colp 0b8a57af6d res_pjsip_endpoint_identifier_ip: Don't output error if no header_match.
This change ensures that if no header_match option is set on an
identify an error message is not output stating the option is set
to an invalid value.

ASTERISK-26863

Change-Id: I239bc6d2319dd3da24ba96a38d4d6e9b5526d62a
2017-03-15 13:52:15 +00:00
Matt Jordan 1475604eff res_pjsip_endpoint_identifier_ip: Add an option to match requests by header
This patch adds a new features to the endpoint identifier module,
'match_header'. When set, inbound requests are matched by a provided SIP
header: value pair. This option works in conjunction with the existing
'match' configuration option, such that if any 'match*' attribute
matches an inbound request, the request is associated with the specified
endpoint.

Since this module now identifies by more than just IP address,
appropriate renaming of the module and/or variables can be done in a
non-release branch.

ASTERISK-26863 #close

Change-Id: Icfc14835c962f92e35e67bbdb235cf0589de5453
(cherry picked from commit 30f52d79d7)
2017-03-15 07:51:35 -06:00
Matt Jordan 2d7e68c075 res_pjsip_endpoint_identifier_ip: Clean up a spaces/tabs issue
Tabs > spaces. Always.

Change-Id: I899ff662361c7ab0327173bd7851a67b53dd65f1
2017-03-14 07:00:02 -06:00
Joshua Colp 7fa3de7ae9 res_pjsip_endpoint_identifier_ip: Fix memory leak of hosts when resolving.
This change adds a missing unreference of the hostname when resolving and
also cleans up the iterator.

ASTERISK-26735

Change-Id: Ic012ebaf3d89e714eec340b7b0c5e63c66af857a
2017-01-26 10:59:10 -06:00
Joshua Colp ee2b0f2eef res_pjsip_endpoint_identifier_ip: Ensure error defaults to 0.
When configuring a match using a netmask the error variable was
not defaulting to 0. For some people this would cause the code
to think an error occurred when adding the match when in reality
it added perfectly fine.

ASTERISK-26693

Change-Id: I850c250813742bddde65c84e739093c9e01dfe56
2017-01-24 15:41:34 -06:00
Joshua Colp 23690c1b35 res_pjsip_endpoint_identifier_ip: Read settings before resolving.
An option has been added, srv_lookups, which controls whether
SRV lookups are performed on the provided match hosts or not.
It was possible for this option to be applied after resolution
had already happened.

This change makes it so hosts are stored away, settings are read
and applied, and then resolution is done. This ensures that no
matter the ordering the srv_lookups option is in effect.

ASTERISK-26735

Change-Id: I750378cb277be0140f8c5539450270afbfc43388
2017-01-23 10:10:27 -06:00
Joshua Colp a7d856cd96 res_pjsip_endpoint_identifier_ip: Add support for SRV lookups.
This change implements SRV support for the IP based endpoint
identifier module. All possible addresses through SRV are looked
up and added as matches. If no SRV records are available a
fallback to normal host resolution is done. If an IP address
is provided then no SRV lookup occurs.

This is configured using the "srv_lookups" option on the
identify section and defaults to "yes".

ASTERISK-26693

Change-Id: I6b641e275bf96629320efa8b479737062aed82ac
2017-01-06 09:00:22 -06:00
Alexei Gradinari 322c3b4262 res_pjsip: module load priority
The res_pjsip_authenticator_digest, res_pjsip_endpoint_identifier_*
and res_pjsip_registrar modules should load ASAP
to avoid "No matching endpoint found" for legitimate endpoint.

ASTERISK-25994

Change-Id: Iac95d95ad031e0be104189d29e923a2ad7c24a1b
2016-05-06 12:56:07 -04:00
George Joseph d2eb65f71e res_pjsip: Strip spaces from items parsed from comma-separated lists
Configurations like "aors = a, b, c" were either ignoring everything after "a"
or trying to look up " b".  Same for mailboxes,  ciphers, contacts and a few
others.

To fix, all the strsep(&copy, ",") calls have been wrapped in ast_strip.  To
facilitate this, ast_strip, ast_skip_blanks and ast_skip_nonblanks were
updated to handle null pointers.

In some cases, an ast_strlen_zero() test was added to skip consecutive commas.

There was also an attempt to ast_free an ast_strdupa'd string in
ast_sip_for_each_aor which was causing a SEGV.  I removed it.

Although this issue was reported for realtime, the issue was in the res_pjsip
modules so all config mechanisms were affected.

ASTERISK-25829 #close
Reported-by: Mateusz Kowalski

Change-Id: I0b22a2cf22a7c1c50d4ecacbfa540155bec0e7a2
2016-03-07 13:16:41 -06:00
Joshua Colp 902309fd04 res_sorcery_memory_cache: Add support for a full backend cache.
This change introduces the configuration option 'full_backend_cache'
which changes the cache to be a full mirror of the backend instead
of a per-object cache. This allows all sorcery retrieval operations
to be carried out against it and is useful for object types which
are used in a "retrieve all" or "retrieve some" pattern.

ASTERISK-25625 #close

Change-Id: Ie2993487e9c19de563413ad5561c7403b48caab5
2015-12-17 13:20:55 -06:00
George Joseph a8aee0bbdb res_pjsip: Add "like" processing to pjsip list and show commands
Add the ability to filter output from pjsip list and show commands
using the "like" predicate like chan_sip.

For endpoints, aors, auths, registrations, identifyies and transports,
the modification was a simple change of an ast_sorcery_retrieve_by_fields
call to ast_sorcery_retrieve_by_regex.  For channels and contacts a
little more work had to be done because neither of those objects are
true sorcery objects.  That was just removing the non-matching object
from the final container.  Of course, a little extra plumbing in the
common pjsip_cli code was needed to parse the "like" and pass the regex
to the get_container callbacks.

Some of the get_container code in res_pjsip_endpoint_identifier was also
refactored for simplicity.

ASTERISK-25477 #close
Reported by: Bryant Zimmerman
Tested by: George Joseph

Change-Id: I646d9326b778aac26bb3e2bcd7fa1346d24434f1
2015-10-24 11:02:43 -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
Kevin Harwell 803a916334 res_pjsip: Allow configuration of endpoint identifier query order
Updated some documentation stating that endpoint identifiers registered without
a name are place at the front of the lookup list. Also renamed register method
'ast_sip_register_endpoint_identifier_by_name' to
'ast_sip_register_endpoint_identifier_with_name'

ASTERISK-24840
Reported by: Mark Michelson
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433032 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-17 18:35:07 +00:00
Kevin Harwell aef7278af6 res_pjsip: Allow configuration of endpoint identifier query order
This patch fixes previously reverted code that caused binary incompatibility
problems with some modules. And like the original patch it makes sure that
no matter what order the endpoint identifier modules were loaded, priority is
given based on the ones specified in the new global 'endpoint_identifier_order'
option.

ASTERISK-24840
Reported by: Mark Michelson
Review: https://reviewboard.asterisk.org/r/4489/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433029 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-17 18:22:20 +00:00
Kevin Harwell d42c6adb1a Revert - res_pjsip: Allow configuration of endpoint identifier query order
Due to a break in binary compatibility with some other modules these changes
are being reverted until the issue can be resolved.

ASTERISK-24840
Reported by: Mark Michelson
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432869 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-13 14:55:44 +00:00
Kevin Harwell 1ce529d30e res_pjsip: allow configuration of endpoint identifier query order
It's possible to have a scenario that will create a conflict between endpoint
identifiers. For instance an incoming call could be identified by two different
endpoint identifiers and the one chosen depended upon which identifier module
loaded first. This of course causes problems when, for example, the incoming
call is expected to be identified by username, but instead is identified by ip.
This patch adds a new 'global' option to res_pjsip called
'endpoint_identifier_order'. It is a comma separated list of endpoint
identifier names that specifies the order by which identifiers are processed
and checked.

ASTERISK-24840 #close
Reported by: Mark Michelson
Review: https://reviewboard.asterisk.org/r/4455/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432639 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-09 16:13:40 +00:00
George Joseph f418f25c44 res_pjsip_endpoint_identifier_ip: Add 'show identify(ies)' cli commands
While troubleshooting other things I realized there were no pjsip cli
commands for identify.  This patch adds them.  It also also fixes a
reference leak when a 'show endpoint' displayed identifies and properly
sets the return code if load_module can't allocate a cli formatter structure.

Tested-by: George Joseph

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

Merged revisions 428725 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@428732 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-12-02 00:31:49 +00:00
Kinsey Moore 86a4ce4957 PJSIP: Enforce module load dependencies
This enforces that res_pjsip, res_pjsip_session, and res_pjsip_pubsub
have loaded properly before attempting to load any modules that depend
on them since the module loader system is not currently capable of
resolving module dependencies on its own.

ASTERISK-24312 #close
Reported by: Dafi Ni
Review: https://reviewboard.asterisk.org/r/4062/
........

Merged revisions 425690 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@425700 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-16 16:32:25 +00:00
Kinsey Moore 4d2c7c23f8 PJSIP: Handle defaults properly
This updates the code behind PJSIP configuration options with custom
handlers to deal with the assigned default values properly where it
makes sense and adjusting the default value where it doesn't. Before
applying this patch, there were several cases where the default value
for an option would prevent that config section from loading properly.

Reported by: Thomas Thompson
Review: https://reviewboard.asterisk.org/r/4019/
........

Merged revisions 424263 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@424267 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-01 12:28:05 +00:00
Jonathan Rose ac46240b62 res_pjsip_endpoint_identifier_ip: Fix parsing of match value with CIDR
Also fixes comma separates match lists

ASTERISK-24290 #close
Reported by: Ray Crumrine
Review: https://reviewboard.asterisk.org/r/3995/
........

Merged revisions 423417 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@423442 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-18 17:22:03 +00:00
George Joseph 126334a7aa res_pjsip: ami: Fix error in AMI output when an endpoint has no transport
When no transport is associated to an endpoint, the AMI output for
PJSIPShowEndpoint indicates an error instead of silently ignoring the
missing transport.

This patch causes the error to appear only if a transport was specified
on the endpoint and the transport doesn't exist.  It also fixes an issue
with counting the objects that were actually found.

ASTERISK-24161 #close
ASTERISK-24331 #close
Tested by: George Joseph
Review: https://reviewboard.asterisk.org/r/3998/
........

Merged revisions 423282 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@423285 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-18 15:14:38 +00:00
Mark Michelson dcf1ad14da Add module support level to ast_module_info structure. Print it in CLI "module show" .
ASTERISK-23919 #close
Reported by Malcolm Davenport

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419592 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-25 16:47:17 +00:00
George Joseph d87f8c429e pjsip cli: Change Identify to show CIDR notation instead of netmasks.
* Added ast_sockaddr_cidr_bits() to count the 1 bits in an ast_sockaddr.
* Added ast_ha_join_cidr() which uses ast_sockaddr_cidr_bits() for the netmask
  instead of ast_sockaddr_stringify_addr.
* Changed res_pjsip_endpoint_identifier_ip to call ast_ha_join_cidr() instead
  of ast_ha_join() for the CLI output.

This is a CLI change only.  AMI was not affected.

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

Merged revisions 416737 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416738 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-19 20:13:20 +00:00
Mark Michelson 57239bfe37 PJSIP: Allow for identify sections to be specified in sorcery.conf.
"identify" is a special type of configuration object in PJSIP because
unlike the other objects, it is not provided by the base res_pjsip module.
Instead, it is provided by the res_pjsip_endpoint_identifier_ip module. If
using the default sorcery wizard (config,criteria=type=identify) then things
work because the module that applies the default wizard is the correct module.

However, if attempting to use sorcery.conf to apply an alternate wizard, it
was not possible. If you attempted to specify the identify object type in the
res_pjsip section, then the object could not be registered since the object
was undocumented for the res_pjsip module. There was no alternate configuration
section defined for it, so you were out of luck if you wanted to override the
default wizard.

With this change, the identify section will properly have a sorcery.conf-based
wizard applied when the identify definition is within the res_pjsip_endpoint_identifier_ip
section.
........

Merged revisions 410933 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410934 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-19 17:27:57 +00:00
George Joseph 3ff60b75b1 pjsip_cli: Create pjsip show channel and contact, and general cli code cleanup.
Created the 'pjsip show channel' and 'pjsip show contact' commands.
Refactored out the hated ast_hashtab.  Replaced with ao2_container.
Cleaned up function naming.  Internal only, no public name changes.
Cleaned up whitespace and brace formatting in cli code.
Changed some NULL checking from "if"s to ast_asserts.
Fixed some register/unregister ordering to reduce deadlock potential.
Fixed ast_sip_location_add_contact where the 'name' buffer was too short.
Fixed some self-assignment issues in res_pjsip_outbound_registration.

(closes issue ASTERISK-23276)
Review: http://reviewboard.asterisk.org/r/3283/
........

Merged revisions 410287 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410288 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-08 16:50:36 +00:00
George Joseph a4906e9f86 sorcery: Create AST_SORCERY dialplan function.
This patch creates the AST_SORCERY dialplan function which allows someone to
retrieve any value from a sorcery-based config file.  It's similar to 
AST_CONFIG.

The creation of the function itself was fairly straightforward but it required
changes to the underlying sorcery infrastructure that rippled into individual
sorcery objects.  The changes stemmed from inconsistencies in how sorcery
created ast_variable objectsets from sorcery objects and the inconsistency
in how individual objects used that feature especially when it came to
parameters that can be specified multiple times like contact in aor and match
in identify.  You can read more here...
http://lists.digium.com/pipermail/asterisk-dev/2014-February/065202.html

So, what this patch does, besides actually creating the AST_SORCERY function,
is the following...

* Creates ast_variable_list_append which is a helper to append one ast_variable
  list to another.
* Modifies the ast_sorcery_object_field_register functions to accept the
  already-defined sorcery_fields_handler callback.
* Modifies ast_sorcery_objectset_create to accept a parameter indicating return
  type preference...a single ast_variable with all values concatenated or an
  ast_variable list with multiple entries.  Also fixed a few bugs.
* Modifies individual sorcery object implementations to use the new function
  definition of the ast_sorcery_object_field_register functions.
* Modifies location.c and res_pjsip_endpoint_identifier_ip.c to implement
  sorcery_fields_handler handlers so they return multiple occurrences as an
  ast_variable_list.
* Added a whole bunch of tests to test_sorcery.

(closes issue ASTERISK-22537)
Review: http://reviewboard.asterisk.org/r/3254/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410042 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-06 22:39:54 +00:00
Richard Mudgett b5ca213e34 res_pjsip: Updates and adds more PJSIP CLI commands.
* Adds identify, transport, and registration support to the PJSIP CLI.

* Creates three additional callbacks, one for an iterator, one for a
comparator, and one for a container.  This eliminates the link dependency
from higher level modules to lower level ones.

* Eliminates duplicate sorting in PJSIP CLI commands.

* Cleans up PJSIP CLI output formatting.

* Pushes CLI command registration down to the implementing source file.

* Adds several ast_sip_destroy_sorcery functions to complement existing
ast_sip_sorcery_initialize functions.  The destroy functions unregister
PJSIP CLI commands and PJSIP CLI formatters.

Reported by: George Joseph

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

Merged revisions 407568 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407573 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-06 17:55:45 +00:00
Joshua Colp e583dca9dd res_pjsip_endpoint_identifier_ip: Accept hostnames in the 'match' field.
Hostnames specified in the 'match' field will be resolved and all addresses
returned. Each address will be added to the endpoint identifier for the
matching process.

Reported by: Rob Thomas
........

Merged revisions 404613 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404620 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-31 22:21:07 +00:00
Matthew Jordan b172d369c4 res_pjsip: Add PJSIP CLI commands
Implements the following cli commands:
pjsip list aors
pjsip list auths
pjsip list channels
pjsip list contacts
pjsip list endpoints
pjsip show aor(s)
pjsip show auth(s)
pjsip show channels
pjsip show endpoint(s)

Also...
Minor modifications made to the AMI command implementations to facilitate
reuse.

New function ast_variable_list_sort added to config.c and config.h to implement
variable list sorting.

(issue ASTERISK-22610)
patches:
  pjsip_cli_v2.patch uploaded by george.joseph (License 6322)
........

Merged revisions 404480 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404507 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-20 21:32:13 +00:00
Kevin Harwell 05cbf8df9b res_pjsip: AMI commands and events.
Created the following AMI commands and corresponding events for res_pjsip:

PJSIPShowEndpoints - Provides a listing of all pjsip endpoints and a few
                     select attributes on each.
  Events:
    EndpointList - for each endpoint a few attributes.
    EndpointlistComplete - after all endpoints have been listed.

PJSIPShowEndpoint - Provides a detail list of attributes for a specified
                    endpoint.
  Events:
    EndpointDetail - attributes on an endpoint.
    AorDetail - raised for each AOR on an endpoint.
    AuthDetail - raised for each associated inbound and outbound auth
    TransportDetail - transport attributes.
    IdentifyDetail - attributes for the identify object associated with
                     the endpoint.
    EndpointDetailComplete - last event raised after all detail events.

PJSIPShowRegistrationsInbound - Provides a detail listing of all inbound
                                registrations.
  Events:
    InboundRegistrationDetail - inbound registration attributes for each
                                registration.
    InboundRegistrationDetailComplete - raised after all detail records have
                                been listed.

PJSIPShowRegistrationsOutbound  - Provides a detail listing of all outbound
                                  registrations.
  Events:
    OutboundRegistrationDetail - outbound registration attributes for each
                                 registration.
    OutboundRegistrationDetailComplete - raised after all detail records
                                 have been listed.

PJSIPShowSubscriptionsInbound - A detail listing of all inbound subscriptions
                                and their attributes.
  Events:
    SubscriptionDetail - on each subscription detailed attributes
    SubscriptionDetailComplete - raised after all detail records have
                                 been listed.

PJSIPShowSubscriptionsOutbound - A detail listing of all outboundbound
                                subscriptions and their attributes.
  Events:
    SubscriptionDetail - on each subscription detailed attributes
    SubscriptionDetailComplete - raised after all detail records have
                                 been listed.

(issue ASTERISK-22609)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/2959/
........

Merged revisions 403131 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403133 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-11-23 17:26:57 +00:00
Rusty Newton 873969d6c5 Broke the build! Forgot para tags within my description.
https://bamboo.asterisk.org/bamboo/browse/AST-ATRUNKBUILD-304
........

Merged revisions 399064 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@399071 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-13 14:27:54 +00:00
Rusty Newton fc09e5eb66 'identify' configObject doesn't have a synopsis
Add a straightforward synopsis and description to the identify config object
in XML documentation.

(issue ASTERISK-22311)
(closes issue ASTERISK-22311)
Reported By: Rusty Newton
........

Merged revisions 399031 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@399032 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-13 13:28:26 +00:00
Mark Michelson 9fb34542d1 Add extra debugging to res_pjsip_endpoint_identifier_ip
........

Merged revisions 398694 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@398695 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-09 22:00:44 +00:00
Mark Michelson ed19b8ee76 Add debug message to res_pjsip_endpoint_identifier_ip to indicate when an endpoint is successfully retrieved.
(closes issue ASTERISK-22101)
reported by Rusty Newton



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397109 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-20 15:32:20 +00:00