Commit Graph

26 Commits

Author SHA1 Message Date
Scott Griepentrog 5a46d69543 pjsip: avoid edge case potential crash in answer()
When accidentally compiling against a wrong version of
pjsip headers with a different pjsip_inv_session size,
the invite_tsx structure could be null in the answer()
function.  This led to a crash because it attempted to
send the session response with an uninitialized packet
pointer.  This patch presets packet to null and adds a
diagnostic log message to explain why the call fails.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@408971 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-26 19:00:56 +00:00
Jonathan Rose 85fbbed45d chan_pjsip: Provide a means for tracking device state when holding/unholding
Previously PJSIP did not track hold/unhold and it would always simply be
'inuse'. This patch fixes that.

review: https://reviewboard.asterisk.org/r/3129/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@405910 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-20 18:18:25 +00:00
Kevin Harwell 3373a5332b chan_pjsip: initial device state on endpoints is INVALID
When endpoints get loaded their device state gets set to 'INVALID' because the
channel driver has not been loaded yet.  Fixed by updating the device state for
every endpoint upon load of the channel driver.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@405644 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-16 16:46:00 +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
Kevin Harwell 821ab51381 res_pjsip: add 'set_var' support on endpoints
Added a new 'set_var' option for ast_sip_endpoint(s).  For each variable
specified that variable gets set upon creation of a pjsip channel involving
the endpoint.

(closes issue ASTERISK-22868)
Reported by: Joshua Colp
Review: https://reviewboard.asterisk.org/r/3095/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404664 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-02 19:08:19 +00:00
Joshua Colp f720a9ac89 chan_pjsip: Handle hanging up before calling.
Channel creation in Asterisk is broken up into two steps: requesting and calling.
In some cases a channel may be requested but never called. This happens in the
ChanIsAvail dialplan application for determining if something is reachable or
not. The PJSIP channel driver did not take this situation into account and
attempted to end a session that was never called out on.

The code now checks the session state to determine if the session has been
called out on and if not terminates it instead of ending it.

(closes issue ASTERISK-23074)
Reported by: Kilburn
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404653 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-31 22:51:04 +00:00
Kevin Harwell 28c0cb28d0 channel locking: Add locking for channel snapshot creation
Original commit message by mmichelson (asterisk 12 r403311):

"This adds channel locks around calls to create channel snapshots as well
as other functions which operate on a channel and then end up
creating a channel snapshot. Functions that expect the channel to be
locked prior to being called have had their documentation updated to
indicate such."

The above was initially committed and then reverted at r403398.  The problem
was found to be in core_local.c in the publish_local_bridge_message function.
The ast_unreal_lock_all function locks and adds a reference to the returned
channels and while they were being unlocked they were not being unreffed when
no longer needed.  Fixed by unreffing the channels.

Also in bridge.c a lock was obtained on "other->chan", but then an attempt was
made to unlock "other" and not the previously locked channel.  Fixed by
unlocking "other->chan"

(closes issue ASTERISK-22709)
Reported by: John Bigelow
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404260 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-18 20:33:37 +00:00
Joshua Colp e2630fcd51 channels: Return allocated channels locked.
This change makes ast_channel_alloc return allocated channels
locked. By doing so no other thread can acquire, lock, and manipulate
the channel before it is completely set up.

(closes issue AST-1256)

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404210 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-18 19:28:05 +00:00
Kevin Harwell 84e1790beb bridge_native_rtp: Deadlock during 4-way conference creation
The change contains a slightly adjusted patch that was on the issue
(submitted by kmoore).  A fix was made by adding in a bridge lock
while calling bridge_start/stop from the framehook callback.  Since
the framehook callback is not called from the bridging core the bridge
is not locked, but needs to be before calling bridge_start.

(closes issue ASTERISK-22749)
Reported by: Kinsey Moore
Review: https://reviewboard.asterisk.org/r/3066/
Patches:
     lock_inversion.diff uploaded by kmoore (license 6273)
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403768 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-13 18:33:25 +00:00
Jonathan Rose 5583d2c629 chan_pjsip: Revert r403587
This patch was intended to eliminate a deadlock that occurs when
masquerades occur in pjsip channels, but has some potential side
effects. Mark Michelson is currently working on addressing this
problem from another angle.

(issue ASTERISK-22936)
Reported by: Jonathan Rose
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403707 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-12 19:18:06 +00:00
Matthew Jordan ce423d2ea4 func_channel, chan_pjsip: Add CHANNEL read function support for chan_pjsip
This patch adds CHANNEL read support for chan_pjsip. This allows the dialplan
to use the CHANNEL function on a chan_pjsip channel to obtain run-time
information about the channel from the PJSIP channel driver and the PJSIP
stack. This includes:
 * RTP information, including source/destination media addresses, whether or
   not the media is secure, held, and other properties.
 * RTCP information. This includes sets of parseable information, as well as
   individual statistic attriutes.
 * PJSIP information. This includes URIs, local/remote signalling addresses,
   whether or not the signalling is secure, and other properties.
 * The endpoint name. This can be used in conjunction with the PJSIP_ENDPOINT
   function to obtain more detailed endpoint information.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403619 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-11 13:06:30 +00:00
Jonathan Rose 905a7de52b chan_pjsip: Fix a sticking channel lock caused by channel masquerades
(closes issue ASTERISK-22936)
Reported by: Jonathan Rose
Review: https://reviewboard.asterisk.org/r/3042/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403588 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-09 22:59:14 +00:00
David M. Lee 1212906351 Reverting r403311. It's causing ARI tests to hang.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403404 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-05 22:10:20 +00:00
Mark Michelson 8e8b329e14 Add channel locking for channel snapshot creation.
This adds channel locks around calls to create channel snapshots as well
as other functions which operate on a channel and then end up
creating a channel snapshot. Functions that expect the channel to be
locked prior to being called have had their documentation updated to
indicate such.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403314 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-03 17:07:29 +00:00
Kevin Harwell 4746c068dc pjsip_messaging: Added debug for in dialog messaging
(issue ASTERISK-22777)
Reported by: Matt Jordan
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402266 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-30 17:54:26 +00:00
Joshua Colp 26914adc00 chan_pjsip: Fix a crash when direct media is enabled and an ACK is received after the channel is hung up.
(closes issue ASTERISK-22731)
Reported by: Kinsey Moore
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402065 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-26 12:56:08 +00:00
Mark Michelson ee21eee7e0 Cache string values of formats on ast_format_cap() to save processing.
Channel snapshots have string representations of the channel's native formats.
Prior to this change, the format strings were re-created on ever channel snapshot
creation. Since channel native formats rarely change, this was very wasteful.
Now, string representations of formats may optionally be stored on the ast_format_cap
for cases where string representations may be requested frequently. When formats
are altered, the string cache is marked as invalid. When strings are requested, the
cache validity is checked. If the cache is valid, then the cached strings are copied.
If the cache is invalid, then the string cache is rebuilt and copied, and the cache
is marked as being valid again.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400363 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-03 14:58:16 +00:00
Mark Michelson addbf276f5 Multiple revisions 400318-400319
........
  r400318 | mmichelson | 2013-10-02 17:08:49 -0500 (Wed, 02 Oct 2013) | 12 lines
  
  Remove unnecessary waits from stasis.
  
  Since caches are updated on publisher threads, there is no need
  to wait for the cache updates to occur after a stasis message
  is published.
  
  In the case of chan_pjsip device state changes, this set of
  changes caused an improvement to performance.
  
  Review: https://reviewboard.asterisk.org/r/2890
........
  r400319 | mmichelson | 2013-10-02 17:10:54 -0500 (Wed, 02 Oct 2013) | 3 lines
  
  Remove svn:mergeinfo property.
........

Merged revisions 400318-400319 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400335 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-02 22:22:17 +00:00
Joshua Colp c1235f2639 Reduce channel snapshot creation and publishing by up to 50%.
This change introduces the ability to stage channel snapshot
creation and publishing by suppressing the implicit creation
and publishing that some functions have. Once all operations
are executed the staging is marked as done and a single snapshot
is created and published.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400266 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-02 16:23:34 +00:00
Joshua Colp d4a026a0ee Add a missing session supplement unregistration in chan_pjsip for ACKs.
(closes issue ASTERISK-22453)
Reported by: Corey Farrell
Patches:
	chan_pjsip_session_unregister_supplement.patch uploaded by Corey Farrell (license 5909)
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@399533 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-20 16:18:42 +00:00
Kevin Harwell 4d35941891 pjsip: reinvite for connected line updates occurs when it should not
Connected line updates are now only sent out if an actual update needs to occur.
This happens under the following conditions:

1. The endpoint we are sending to is trusted.
2. Either a P-Asserted-Identity or Remote Party-ID header needs to be added/sent.
3. The connected id's number and name are valid.

Also added an SDP when an update is sent out.

(closes issue AST-1212)
Reported by: John Bigelow
Review: https://reviewboard.asterisk.org/r/2831/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@398808 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-11 14:23:28 +00:00
Matthew Jordan 4d348e853c Add pass through support for Opus and VP8; Opus format attribute negotiation
This patch adds pass through support for Opus and VP8. That includes:

* Format attribute negotiation for Opus. Note that unlike some other codecs,
  the draft RFC specifies having spaces delimiting the attributes in addition
  to ';', so you have "attra=X; attrb=Y". This broke the attribute parsing in
  chan_sip, so a small tweak was also included in this patch for that.

* A format attribute negotiation module for Opus, res_format_attr_opus

* Fast picture update for VP8. Since VP8 uses a different RTCP packet number
  than FIR, this really is specific to VP8 at this time.

Note that the format attribute negotiation in res_pjsip_sdp_rtp was written
by mjordan. The rest of this patch was written completely by Lorenzo Miniero.

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

(closes issue ASTERISK-21981)
Reported by: Tzafrir Cohen
patches:
  asterisk_opus+vp8_passthrough_20130718.patch uploaded by lminiero (License 6518)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397526 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-23 15:42:27 +00:00
Joshua Colp b2a13e83dc Fix crash when answering after a transport error occurs.
If a response to an initial incoming INVITE results in a transport error
the INVITE transaction is removed from the INVITE session. Any attempts
to answer the INVITE session after this results in a crash as it requires
the INVITE transaction to exist. This change explicitly locks the dialog
and checks to ensure that the INVITE transaction exists before answering.

(closes issue AST-1203)
Reported by: John Bigelow


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397515 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-23 13:58:08 +00:00
David M. Lee 88d6c366d1 Fixed compile errors introduced in r395954.
Just a merge error due to a file rename. Grrr...


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@395971 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-01 15:31:03 +00:00
Kinsey Moore f6c7e6355e Fix remnants of the pjsip renaming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@395851 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-31 13:31:55 +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