Commit Graph

44 Commits

Author SHA1 Message Date
Joshua Colp 80aa9aee5d res_pjsip_outbound_registration: Fix double unref on error return.
When the PJSIP pjsip_regc_send function is invoked and an error
status returned the caller currently decrements the reference count
of the client state that it just incremented, assuming the
registration callback would not have been invoked. In practice
this is not correct. If the failure happens after the transaction
has been set up the callback will still be invoked. This will
cause the reference count to be incorrectly decremented twice, once
by the registration callback and second by the caller of
pjsip_regc_send.

This change makes it so that whether the callback is invoked or
not is known by the caller of pjsip_regc_send. Depending on
this it can know whether it is responsible for decrementing the
reference count of the client state or not.

ASTERISK-25037 #close
Reported by: Joshua Colp

Change-Id: I749dc12f3a22115c49c5d7d95ff42a5fa45319de
2015-04-30 07:25:26 -05:00
Mark Michelson 4f1db2070d res_pjsip_outbound_registration: Don't fail on delayed processing.
Odd behaviors have been observed during outbound registrations. The most
common problem witnessed has been one where a request with
authentication credentials cannot be created after receiving a 401
response. Other behaviors include apparently processing an incorrect SIP
response.

Inspecting the code led to an apparent issue with regards to how we
handle transactions in outbound registration code. When a response to a
REGISTER arrives, we save a pointer to the transaction and then push a
task onto the registration serializer. Between the time that we save the
pointer and push the task, it's possible for the transaction to be
destroyed due to a timeout. It's also possible for the address to be
reused by the transaction layer for a new transaction.

To allow for authentication of a REGISTER request to be authenticated
after the transaction has timed out, we now hold a reference to the
original REGISTER request instead of the transaction. The function for
creating a request with authentication has been altered to take the
original request instead of the transaction where the original request
was sent.

ASTERISK-25020
Reported by Mark Michelson

Change-Id: I756c19ab05ada5d0503175db9676acf87c686d0a
2015-04-29 12:04:06 -05:00
Mark Michelson f47fed2e12 res_pjsip_outbound_registration: Add debugging messages.
When problems occur regarding outbound registrations, it currently
is difficult to debug. Most off-nominal paths had warning messages,
but sometimes we want to know what's going on before hitting the
off-nominal path. This patch adds lots of debugging output that
should give a clearer picture of what is happening with regards
to outbound registrations.

ASTERISK-25020
Reported by Mark Michelson

Change-Id: I577bde7860be0a6c872b5bcb4d5047340bf45d45
2015-04-28 10:43:38 -05:00
Richard Mudgett 69e107b24e res_pjsip_outbound_registration: Fix reload race condition.
Performing a CLI "module reload" command when there are new pjsip.conf
registration objects defined frequently failed to load them correctly.

What happens is a race condition between res_pjsip pushing its reload into
an asynchronous task processor task and the thread that does the rest of
the reloads when it gets to reloading the res_pjsip_outbound_registration
module.  A similar race condition happens between a reload and the CLI/AMI
show registrations commands.  The reload updates the current_states
container and the CLI/AMI commands call get_registrations() which builds a
new current_states container.

* Made res_pjsip.c reload_module() use ast_sip_push_task_synchronous()
instead of ast_sip_push_task() to eliminate two threads processing config
reloads at the same time.

* Made get_registrations() not replace the global current_states container
so the CLI/AMI show registrations command cannot interfere with reloading.
You could never add/remove objects in the container without the
possibility of the container being replaced out from under you by
get_registrations().

* Added a registration loaded sorcery instance observer to purge any dead
registration objects since get_registrations() cannot do this job anymore.
The struct ast_sorcery_instance_observer callbacks must be used because
the callback happens inline with the load process.  The struct
ast_sorcery_observer callbacks are pushed to a different thread.

* Added some global current_states NULL pointer checks in case the
container disappears because of unload_module().

* Made sorcery's struct ast_sorcery_instance_observer.object_type_loaded
callbacks guaranteed to be called before any struct
ast_sorcery_observer.loaded callbacks will be called.

* Moved the check for non-reloadable objects to before the sorcery
instance loading callbacks happen to short circuit unnecessary work.
Previously with non-reloadable objects, the sorcery instance
loading/loaded callbacks would always happen, the individual wizard
loading/loaded would be prevented, and the non-reloadable type logging
message would be logged for each associated wizard.

ASTERISK-24729 #close
Review: https://reviewboard.asterisk.org/r/4381/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431251 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-28 04:29:23 +00:00
Walter Doekes 49cbfa7de6 Fix typo's (retrieve, specified, address).
........

Merged revisions 430996 from http://svn.asterisk.org/svn/asterisk/branches/11
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431000 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-23 15:13:08 +00:00
Richard Mudgett e67ca431ee res_pjsip_outbound_registration.c: Minor code cleanup.
* Add an allocation failure check and assert in
sip_outbound_registration_response_cb().

* Made sip_outbound_registration_state_destroy() handle partially created
state objects from sip_outbound_registration_state_alloc().

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430958 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-22 19:14:35 +00:00
Richard Mudgett 38738a7316 res_pjsip_outbound_registration.c: Move unref to a better place.
Move an unconditional unref of client_state so it doesn't look like it
could be used after the last ref has destroyed it.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430903 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-21 21:57:45 +00:00
Joshua Colp 1e605d950b res_pjsip_outbound_registration: Fix race condition when reloading and listing registrations.
Due to the split of outbound registration state from configuration it is possible during
a reload for a "pjsip show registrations" CLI command to be executed which gets an older
snapshot of the configuration. This configuration may include outbound registrations which
have been removed due to a reload operation occurring at the same time. The code for
printing the outbound registration did not take this into account but now it does.

AST-1506 #close

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430665 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-15 12:10:22 +00:00
Richard Mudgett c7ea108e02 Revert -r430452 It needs to be redone for the next major AMI version change instead.
ASTERISK-24049


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430509 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-12 18:09:27 +00:00
Richard Mudgett ef34a05f21 AMI: Remove no longer used parameter from astman_send_listack().
Follow-up issue to -r430435 from reviewboard review.

ASTERISK-24049
Review: https://reviewboard.asterisk.org/r/4315/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430452 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-09 18:53:49 +00:00
Richard Mudgett 52a7cdb101 AMI: Make AMI actions that generate event lists consistent.
* Made the following AMI actions use list API calls for consistency:
Agents
BridgeInfo
BridgeList
BridgeTechnologyList
ConfbridgeLIst
ConfbridgeLIstRooms
CoreShowChannels
DAHDIShowChannels
DBGet
DeviceStateList
ExtensionStateList
FAXSessions
Hangup
IAXpeerlist
IAXpeers
IAXregistry
MeetmeList
MeetmeListRooms
MWIGet
ParkedCalls
Parkinglots
PJSIPShowEndpoint
PJSIPShowEndpoints
PJSIPShowRegistrationsInbound
PJSIPShowRegistrationsOutbound
PJSIPShowResourceLists
PJSIPShowSubscriptionsInbound
PJSIPShowSubscriptionsOutbound
PresenceStateList
PRIShowSpans
QueueStatus
QueueSummary
ShowDialPlan
SIPpeers
SIPpeerstatus
SIPshowregistry
SKINNYdevices
SKINNYlines
Status
VoicemailUsersList

* Incremented the AMI version to 2.7.0.

* Changed astman_send_listack() to not use the listflag parameter and
always set the value to "Start" so the start capitalization is consistent.
i.e., The FAXSessions used "Start" while the rest of the system used
"start".  The corresponding complete event always used "Complete".

* Fixed ami_show_resource_lists() "PJSIPShowResourceLists" to output the
AMI ActionID for all of its list events.

* Fixed off-nominal AMI protocol error in manager_bridge_info(),
manager_parking_status_single_lot(), and
manager_parking_status_all_lots().  Use of astman_send_error() after
responding to the original AMI action request violates the action response
pattern by sending two responses.

* Fixed minor protocol error in action_getconfig() when no requested
categories are found.  Each line needs to be formatted as "Header: text".

* Fixed off-nominal memory leak in manager_build_parked_call_string().

* Eliminated unnecessary use of RAII_VAR() in ami_subscription_detail().

ASTERISK-24049 #close
Reported by: Jonathan Rose

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430435 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-09 18:16:54 +00:00
George Joseph c55f86c69d res_pjsip_outbound_registration: Fix reference leak.
Every time a registration started, sip_outbound_registration_response_cb bumps 
the ref count on client_state then pushes a handle_registration_response task.  
handle_registration_response never unreffed it though.  So every time a 
registration goes out, the ref count goes up by one.

This patch adds the unreffs to handle_registration_response.

Tested-by: George Joseph

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430396 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-08 21:38:26 +00:00
George Joseph 030facce94 res_pjsip_outbound_registration: Fix several reload issues
There are 2 issues with reloading registrations...

1.  The 'can_reuse_registration' test wasn't considering the intervals or 
expiration in its determination of whether a registration changed or not so if 
you changed any of the intervals or the expiration and reloaded, the object 
would get reloaded but the actual timers wouldn't change.  
can_reuse_registration now does a sorcery diff on the old and new objects 
instead of discretely testing certain fields.  Now if you change expiration for 
instance, and reload, the timer is updated and re-registration will occur on the 
new value.

2.  If you mung up your password on an outbound registration you get a permanent 
failure.  If you fix the password (on the outbound_auth object) and reload, 
nothing tells outbound_registration to try again because the registration itself 
didn't change.  This patch adds an observer on the "auth" object type and if any 
auth changes, existing registration states are searched and those in a 
REJECTED_PERMANENT state are retried.

Tested-by: George Joseph

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430374 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-08 17:51:36 +00:00
George Joseph fb3c8e3424 outbound_registration: Add 'pjsip send register' and update 'send unregister'
The current behavior of 'pjsip send unregister' is to send the unregister
(REGISTER with 0 exp) but let the next scheduled register proceed normally.
I don't think that's a good idea.  If you unregister, it should stay
unregistered until you decide to start registrations again.  So this patch
just adds a cancel_registration call to the current unregister_task to
cancel the timer.

Of course, now you need  a way to start registration again so I've added
a 'pjsip send register' command that unregisters and cancels any existing
registration (the same as send unregister), then sends an immediate
registration and starts the timer back up again.

Both changes also ripple to AMI.  There's a new PJSIPRegister command.

There's no harm in calling either command repeatedly.  They don't care
about the actual state.

Tested-by: George Joseph

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430224 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-06 17:43:16 +00:00
Mark Michelson 2f3e5b494a Prevent potential infinite outbound authentication loops in registration.
Prior to this patch, Asterisk would always respond to 401 responses to
registration attempts by trying to provide a registration with authentication
credentials. Even if subsequent attempts were rejected with 401 responses,
Asterisk would continue this behavior. If authentication credentials were
incorrect, this could continue forever.

With this patch, we keep track of whether we have attempted authentication
on an outbound registration attempt. If we already have, we don not try
again until the next attempt. This prevents the infinite loop scenario.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@429762 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-12-18 15:40:13 +00:00
Kevin Harwell 49b7a1cbaf res_pjsip_exten_state: PJSIPShowSubscriptionsInbound causes crash
When using a non-default sorcery wizard (in this instance realtime) for
outbound registrations and after adding in an appropriate call to
ast_sorcery_apply_config() (since it is missing) Asterisk will crash after
a stack overflow occurs due to the code infinitely recursing.  The fix entails
removing the outbound registration state dependency from the outbound
registration sorcery object and instead keeping an in memory container that
can be used to lookup the state when needed.

ASTERISK-24514
Reported by: Mark Michelson
Review: https://reviewboard.asterisk.org/r/4164/
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@427823 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-11-13 22:26:56 +00:00
Joshua Colp d159885e50 res_pjsip_outbound_registration: Add virtual line support.
Virtual line support establishes a relationship between messages
related to an outbound registration and a local endpoint. This is
accomplished by attaching a parameter to the Contact of the outbound
registration and looking for it on any received requests. If the
parameter exists and can be matched to an outbound registration
the configured endpoint is associated with the request.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@427165 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-11-04 12:03:35 +00:00
Scott Griepentrog f59db388a7 pjsip: Handle outbound unregister correctly
This updates the status of the outbound registration
to reflect when it has been unregistered.  Since the
registration is unregistered but is not stopped, the
registration schedule remains active as before.  The
patch also updates the documentation of both the AMI
and CLI commands.

ASTERISK-24411 #close
Review: https://reviewboard.asterisk.org/r/4119/
Reported by: John Bigelow
patches:
  unregister-patch1.txt uploaded by John Bigelow (License 5091)
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@426925 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-31 16:24:00 +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
Matthew Jordan a9011106b6 res/res_pjsip_outbound_registration: Initialize auth_reject_permanent parameter
Prior to this patch, the auth_reject_permanent parameter was not initialized on
the registration client state, leading to the parameter being disabled
regardless of the value specified in pjsip.conf.

This patch initialized the setting on the registration client state to the
provided configuration value.

ASTERISK-24398 #close
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@424732 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-07 17:44:36 +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
Matthew Jordan 15dcaeef82 res_pjsip: Add ActionID to events created as a result of PJSIP AMI actions
A number of various PJSIP AMI actions were failing to parse out and place the
ActionID into their responses. This patch updates the various PJSIP actions
such that the passed in ActionID is emitted on any event list complete events,
as well as any intermediate events created as a result of the action.

#ASTERISK-23947 #close
Reported by: Mark Michelson

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417461 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-27 13:50:02 +00:00
Kinsey Moore abd3e4040b Allow Asterisk to compile under GCC 4.10
This resolves a large number of compiler warnings from GCC 4.10 which
cause the build to fail under dev mode. The vast majority are
signed/unsigned mismatches in printf-style format strings.
........

Merged revisions 413586 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 413587 from http://svn.asterisk.org/svn/asterisk/branches/11
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413589 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-09 22:49:26 +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
George Joseph 39a450d924 pjsip_cli: Add pjsip commands 'show registrations' and 'show contacts'.
Added 'show registrations' and 'show contacts' to pjsip cli to make things
a little more consistent.  The output is exactly the same as the list command.

Just needed to add entries to their respective ast_cli_entry structures.

(closes issue ASTERISK-23275)
Review: http://reviewboard.asterisk.org/r/3210/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@408523 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-20 21:12:02 +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
Kinsey Moore e0da867dbe PJSIP: Handle headers in a list appropriately
The PJSIP header parsing function (pjsip_parse_hdr) can generate more
than one header instance from a single header field. These header
instances exist as a list attached to the returned header and must be
handled appropriately when they are added to a message or else only the
first header instance will be used. This changes the linked list
functions used in outbound proxy code to merge the lists properly.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406022 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-21 17:15:34 +00:00
Kinsey Moore 7cbb6eab15 PJSIP: Add Path header support
This adds Path support to chan_pjsip in res_pjsip_path.c with minimal
additions in res_pjsip_registrar.c to store the path and additions in
res_pjsip_outbound_registration.c to enable advertisement of path
support to registrars and intervening proxies.

Path information is stored on contacts and is enabled via Address of
Record (AoRs) and Registration configuration sections.

While adding path support, it became necessary to be able to add SIP
supplements that handled messages outside of sessions, so a framework
for handling these types of hooks was added in parallel to the
already-existing session supplements and several senders of
out-of-dialog requests were refactored as a result.

(closes issue ASTERISK-21084)
Review: https://reviewboard.asterisk.org/r/3050/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@405566 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-15 13:16:10 +00:00
Joshua Colp 986c9e897d res_pjsip_outbound_registration: Don't assume that a registration client will always exist.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404936 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-05 16:01:53 +00:00
Joshua Colp 11f18e4724 res_pjsip_outbound_registration: Create registration client in pj thread.
Depending on which threading was loading the outbound registration it was
possible for the registration client to be allocated outside of a pj thread.
This change moves the creation inside the synchronous task where it is
guaranteed it will occur in a pj thread.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404924 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-05 01:31:19 +00:00
Joshua Colp f0f23655c9 res_pjsip_outbound_registration: Ensure URI validation happens in a pjlib thread.
This change moves outbound registration URI validation into the task executed
within a pjlib thread.

Reported by: Andrew Nagy
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404726 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-03 17:10:23 +00:00
Joshua Colp 135b9d3562 res_pjsip_outbound_registration: Add validation for 'server_uri' and 'client_uri'.
When applying configuration for outbound registrations the 'server_uri' and
'client_uri' fields were not validated. The code will now confirm that they
exist and that they contain parseable SIP URIs.

Reported by: Andrew Nagy
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404593 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-31 20:27:03 +00:00
Mark Michelson b18ed67d16 Switch PJSIP auth to use a vector.
Since Asterisk has a vector API now, places where arrays are manually
resized don't really make sense any more. Since the auth work in PJSIP
was freshly-written, it was easy to reform it to use a vector.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403499 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-09 16:10:05 +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
Kevin Harwell 61b60fab2d pjsip outbound registration: Log message says received a 408 when we didn't
If the server didn't exist that we are trying to register to the log message
would say that a 408 was received from that server when in reality one wasn't.
Added log messages stating no response was received if the response does not
exist.

(closes issue ASTERISK-22554)
Reported by: Rusty Newton
Review: https://reviewboard.asterisk.org/r/2893/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400891 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-14 15:54:06 +00:00
Kinsey Moore b44ce141e5 chan_sip: Allow Asterisk to retry after 403 on register
This adds a global option in chan_sip to allow it to continue
attempting registration if a 403 is received, clearing the cached nonce
and treating it as a non-fatal response. Normally, this would cause
registration attempts to that endpoint to stop.

This also adds a similar per-outbound-registration option to chan_pjsip
which allows the retry interval to be altered for 403 responses to
REGISTER requests.

(closes issue ASTERISK-17138)
Review: https://reviewboard.asterisk.org/r/2874/
Reported by: Rudi
........

Merged revisions 400137 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 400140 from http://svn.asterisk.org/svn/asterisk/branches/11
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400142 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-30 15:57:11 +00:00
Mark Michelson 23ed2ca57f Clarify server_uri and client_uri registration settings.
Used some of Rusty's suggested language plus also included
more SIPesque descriptions of where the URIs are actually
used in an outgoing REGISTER.

(closes issue ASTERISK-22390)
reported by Rusty Newton
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@398369 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-05 14:10:45 +00:00
Kevin Harwell 1be7514a59 Debug messages for pjsip outbound registration
Added debug messages indicating that an outbound registration attempt was made
and it was successful in pjsip.

(closes issue ASTERISK-22388)
Reported by: Rusty Newton
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@398227 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-04 14:32:25 +00:00
Kevin Harwell 9bad1dabcf Add a reloadable option for sorcery type objects
Some configuration objects currently won't place nice if reloaded.
Specifically, in this case the pjsip transport objects.  Now when
registering an object in sorcery one may specify that the object is
allowed to be reloaded or not.  If the object is set to not reload
then upon reloading of the configuration the objects of that type
will not be reloaded.  The initially loaded objects of that type
however will remain.

While the transport objects will not longer be reloaded it is still
possible for a user to configure an endpoint to an invalid transport.
A couple of log messages were added to help diagnose this problem if
it occurs.

(closes issue ASTERISK-22382)
Reported by: Rusty Newton
(closes issue ASTERISK-22384)
Reported by: Rusty Newton
Review: https://reviewboard.asterisk.org/r/2807/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@398140 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-30 19:55:56 +00:00
Joshua Colp 5b3441ae55 Fix crash in res_pjsip_outbound_registration when the remote server can not be resolved.
This crash was caused by decrementing the reference count of a newly created message when
it should not be. This change fixes that but also fixes all other cases where this was
incorrectly done.

(closes issue ASTERISK-22188)
Reported by: Kinsey Moore


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396319 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-06 12:39:27 +00:00
Matthew Jordan 80c9ad102e Add AMI registration events for PJSIP outbound registration attempts
This patch adds AMI events whenever an outbound registration attempt succeeds
or fails from res_pjsip_outbound_registration. This brings it inline with
the existing SIP channel driver and IAX channel driver.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396201 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-05 19:01:45 +00:00
Kinsey Moore 41cd06e03f Add CLI/AMI commands to force chan_pjsip actions
For chan_pjsip, this introduces CLI/AMI remote unregistration commands,
reworks CLI syntax for sending NOTIFYs, adds AMI qualification support,
and adds documentation for PJSIPNotify.

This also fixes two refcounting bugs in the outbound registration code.

Review: https://reviewboard.asterisk.org/r/2695/
(closes issue ASTERISK-21939)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396087 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-02 12:40:03 +00:00
Mark Michelson 735b30ad71 The large GULP->PJSIP renaming effort.
The general gist is to have a clear boundary between old SIP stuff
and new SIP stuff by having the word "SIP" for old stuff and "PJSIP"
for new stuff. Here's a brief rundown of the changes:

* The word "Gulp" in dialstrings, functions, and CLI commands is now
  "PJSIP"
* chan_gulp.c is now chan_pjsip.c
* Function names in chan_gulp.c that were "gulp_*" are now "chan_pjsip_*"
* All files that were "res_sip*" are now "res_pjsip*"
* The "res_sip" directory is now "res_pjsip"
* Files in the "res_pjsip" directory that began with "sip_*" are now "pjsip_*"
* The configuration file is now "pjsip.conf" instead of "res_sip.conf"
* The module info for all PJSIP-related files now uses "PJSIP" instead of "SIP"
* CLI and AMI commands created by Asterisk's PJSIP modules now have "pjsip" as
the starting word instead of "sip"



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@395764 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-30 18:14:50 +00:00