summaryrefslogtreecommitdiff
path: root/channels/chan_pjsip.c
AgeCommit message (Collapse)Author
2017-12-22Remove as much trailing whitespace as possible.Sean Bright
Change-Id: I873c1c6d00f447269bd841494459efccdd2c19c0
2017-12-15chan_pjsip.c: Improve ast_request() diagnostic msgs.Richard Mudgett
Attempting to dial PJSIP/endpoint when the endpoint doesn't exist and disable_multi_domain=no results in a misleading empty endpoint name message. The message should say the endpoint was not found. * Added missing endpoint not found message. * Added more information to the empty endpoint name msgs if available. * Eliminated RAII_VAR in request(). Change-Id: I21da85ebd62dcc32115b2ffcb5157416ebae51e4
2017-12-12chan_pjsip/res_pjsip: Add CHANNEL(pjsip,request_uri)Richard Mudgett
This patch does three things associated with the initial incoming INVITE request URI. 1) Add access to the full initial incoming INVITE request URI. 2) We were not setting DNID on incoming PJSIP channels. The DNID is the user portion of the initial incoming INVITE Request-URI. The value is accessed by reading CALLERID(dnid). 3) Fix CHANNEL(pjsip,target_uri) documentation. * The initial incoming INVITE request URI is now available using CHANNEL(pjsip,request_uri). * Set the DNID on PJSIP channel creation so CALLERID(dnid) can return the initial incoming INVITE request URI user portion. * CHANNEL(pjsip,target_uri) now correctly documents that the target URI is the contact URI. * Refactored print_escaped_uri() out of channel_read_pjsip() to handle pjsip_uri_print() error condition when the buffer is too small. ASTERISK-27478 Change-Id: I512e60d1f162395c946451becb37af3333337b33
2017-11-15chan_pjsip.c: Improve answer failure log messages.Richard Mudgett
* Balanced the session->inv_session refs on answer failure. Change-Id: I33542d639d37e692cb46550b972a5fcfc3b804b8
2017-11-09chan_pjsip.c: Fix uninitialized cause value on failure.Richard Mudgett
Change-Id: I3f9dd3c31bd582e54a30381500077de2319d8cc3
2017-09-05chan_pjsip: Suppress frame warnings.Ben Ford
When rtp_keepalive is on for a PJSIP endpoint dialing to another Asterisk instance also using PJSIP, Asterisk will continue to print warning messages about not being able to send frames of a certain type. This suppresses that warning message. Change-Id: I0332a05519d7bda9cacfa26d433909ff1909be67
2017-08-04res_rtp_asterisk: Make P2P bridge Asymmetric codec awareTorrey Searle
Introduce a new property to rtp-engine to make it aware of the desire for assymetric codecs or not. If asymmetric codecs is not allowed, the bridge will compare read/write formats and shut down the p2p bridge if needed ASTERISK-26745 #close Change-Id: I0d9c83e5356df81661e58d40a8db565833501a6f
2017-08-01chan_pjsip: add a new function PJSIP_DTMF_MODETorrey Searle
This function is a replica of SIPDtmfMode, allowing the DTMF mode of a PJSIP call to be modified on a per-call basis ASTERISK-27085 #close Change-Id: I20eef5da3e5d1d3e58b304416bc79683f87e7612
2017-07-24core: Add VP9 passthrough support.Joshua Colp
This change adds VP9 as a known codec and creates a cached "vp9" media format for use. Change-Id: I025a93ed05cf96153d66f36db1839109cc24c5cc
2017-06-29chan_pjsip: Fix ability to send UPDATE on COLPGeorge Joseph
When connected_line_method is "invite", we're supposed to determine if the client can support UPDATE and if it can, send UPDATE instead of INVITE to avoid the SDP renegotiation. Not only was pjproject not setting the PJSIP_INV_SUPPORT_UPDATE flag, we were testing that invite_tsx wasn't NULL which isn't always the case. * Updated chan_pjsip/update_connected_line_information to drop the requirement that invite_tsx isn't NULL. * Submitted patch to pjproject sip_inv.c that sets the PJSIP_INV_SUPPORT_UPDATE flag correctly. * Updated pjsip.conf.sample to clarify what happens when "invite" is specified. ASTERISK-27095 Change-Id: Ic2381b3567b8052c616d96fbe79564c530e81560
2017-06-23res_pjsip: Add DTMF INFO Failback modeTorrey Searle
The existing auto dtmf mode reverts to inband if 4733 fails to be negotiated. This patch adds a new mode auto_info which will switch to INFO instead of inband if 4733 is not available. ASTERISK-27066 #close Change-Id: Id185b11e84afd9191a2f269e8443019047765e91
2017-06-13Merge "pjsip: Extend 'asymmetric_rtp_codec' option to include us changing." ↵Joshua Colp
into 13
2017-06-07chan_pjsip: Update device state when in early media.Joshua Colp
The chan_pjsip module uses a calculation approach for determining device state. This means that in situations where we would expect device state to change we need to tell the core to query. A scenario that was missed is when early media was signaled. This change adds the notification for the core to query device state when we are told that early media is being provided. ASTERISK-27039 Change-Id: Iafebfd152894966344ff2e950a3cee9f59a3eb6f
2017-06-07pjsip: Extend 'asymmetric_rtp_codec' option to include us changing.Joshua Colp
PJSIP support in Asterisk differs from chan_sip in that it allows media to be sent as-is without transcoding provided the codecs were negotiated in the SDP. This is allowed according to the RFC. Support for this differs quite a lot though and some endpoints do not handle it well. This change extends the 'asymmetric_rtp_codec' option to also cover this case. When set to no (the default) the code behaves as chan_sip does - the best codec is selected and we will only ever send that, unless we change what we are sending if the remote side changes. When set to yes we will send media as-is without transcoding if the codec has been negotiated in the SDP. ASTERISK-26996 Change-Id: Ib1647f6902a0843e8c435946f831c2159e8d1d51
2017-04-27res_pjsip_session: Add cleanup to ast_sip_session_terminateGeorge Joseph
If you use ast_request to create a PJSIP channel but then hang it up without causing a transaction to be sent, the session will never be destroyed. This is due ot the fact that it's pjproject that triggers the session cleanup when the transaction ends. app_chanisavail was doing this to get more granular channel state and it's also possible for this to happen via ARI. * ast_sip_session_terminate was modified to explicitly call the cleanup tasks and unreference session if the invite state is NULL AND invite_tsx is NULL (meaning we never sent a transaction). * chan_pjsip/hangup was modified to bump session before it calls ast_sip_session_terminate to insure that session stays valid while it does its own cleanup. * Added test events to session_destructor for a future testsuite test. ASTERISK-26908 #close Reported-by: Richard Mudgett Change-Id: I52daf6f757184e5544c261f64f6fe9602c4680a9
2017-04-12modules: change module LOAD_FAILUREs to LOAD_DECLINESGeorge Joseph
In all non-pbx modules, AST_MODULE_LOAD_FAILURE has been changed to AST_MODULE_LOAD_DECLINE. This prevents asterisk from exiting if a module can't be loaded. If the user wishes to retain the FAILURE behavior for a specific module, they can use the "require" or "preload-require" keyword in modules.conf. A new API was added to logger: ast_is_logger_initialized(). This allows asterisk.c/check_init() to print to the error log once the logger subsystem is ready instead of just to stdout. If something does fail before the logger is initialized, we now print to stderr instead of stdout. Change-Id: I5f4b50623d9b5a6cb7c5624a8c5c1274c13b2b25
2017-02-13chan_pjsip: Multidomain endpoint finding on callNorbert Varga
When PJSIP tries to call an endpoint with a domain (e.g. 1000@test.com), the user part is stripped down as it would be a trunk with a specified user, and only the host part is called as a PJSIP endpoint and can't be found. This is not correct in the case of a multidomain SIP account, so the stripping after the @ sign is done only if the whole endpoint (in multidomain case 1000@test.com) can't be found. ASTERISK-26248 Change-Id: I3a2dd6f57f3bd042df46b961eccd81d31ab202e6
2016-11-16chan_pjsip: fix switching sending codec when asymmetric_rtp_codec=noAlexei Gradinari
The sending codec is switched to the receiving codec and then is switched back to the best native codec on EVERY receiving RTP packets. This is because after call of ast_channel_set_rawwriteformat there is call of ast_set_write_format which calls set_format which sets rawwriteformat to the best native format. This patch adds a new function ast_set_write_format_path which set specific write path on channel and uses this function to switch the sending codec. ASTERISK-26603 #close Change-Id: I5b7d098f8b254ce8f45546e6c36e5d324737f71d
2016-10-27Merge "pjsip: Fix a few media bugs with reinvites and asymmetric payloads." ↵Joshua Colp
into 13
2016-10-26pjsip: Fix a few media bugs with reinvites and asymmetric payloads.Joshua Colp
When channel format changes occurred as a result of an RTP re-negotiation the bridge was not informed this had happened. As a result the bridge technology was not re-evaluated and the channel may have been in a bridge technology that was incompatible with its formats. The bridge is now unbridged and the technology re-evaluated when this occurs. The chan_pjsip module also allowed asymmetric codecs for sending and receiving. This did not work with all devices and caused one way audio problems. The default has been changed to NOT do this but to match the sending codec to the receiving codec. For users who want asymmetric codecs an option has been added, asymmetric_rtp_codec, which will return chan_pjsip to the previous behavior. The codecs returned by the chan_pjsip module when queried by the bridge_native_rtp module were also not reflective of the actual negotiated codecs. The nativeformats are now returned as they reflect the actual negotiated codecs. ASTERISK-26423 #close Change-Id: I6ec88c6e3912f52c334f1a26983ccb8f267020dc
2016-10-18chan_pjsip: segfault on already disconnected sessionAlexei Gradinari
On heavy loaded system the TCP/TLS incoming calls could be disconnected by pjproject while these calls are being processed by asterisk. This patch uses functions pjsip_inv_add_ref/pjsip_inv_dec_ref to inform pjproject that an INVITE session is in use. ASTERISK-26482 #close Change-Id: Ia2e3e2f75358cdb530252a9ce158af3d5d9fdf33
2016-09-23channels/chan_pjsip: fix HANGUPCAUSE function bug.Aaron An
HANGUPCAUSE not return 'SIP 200 Ok' when dialed channel answered. This patch change the call order of ast_queue_control_data and ast_queue_control in chan_pjsip_incoming_response. ASTERISK-26396 #close Reported by: AaronAn Tested by: AaronAn Change-Id: Ide2d31723d8d425961e985de7de625694580be61
2016-08-10channels/chan_pjsip: Add PJSIP_SEND_SESSION_REFRESHMatt Jordan
This patch adds a new PJSIP specific dialplan function, PJSIP_SEND_SESSION_REFRESH. When invoked on a PJSIP channel, the media session will be refreshed via either an UPDATE or re-INVITE request. When used in conjunction with the PJSIP_MEDIA_OFFER dialplan function, the formats in use on a PJSIP channel can be re-negotiated and changed dynamically after call setup. ASTERISK-26277 #close Change-Id: Ib98fe09ba889aafe26d58d32f0fd1323f8fd9b1b
2016-07-21Merge "chan_pjsip.c: Fix deadlock potential in fax redirection." into 13zuul
2016-07-19chan_pjsip.c: Fix deadlock potential in fax redirection.Richard Mudgett
The chan_pjsip_cng_tone_detected() has the potential to deadlock if an incoming fax happens during the Playback or similar application. * Fixed the potential deadlock by not calling ast_async_goto() with the channel lock held. * Made always eat the fax detection frame whether there is a fax extension or not. ASTERISK-26216 Reported by: Richard Mudgett Change-Id: I32aecbb4818af646dc5a619f0dc040e9b1f222e5
2016-07-19res_pjsip: Add fax_detect_timeout endpoint option.Richard Mudgett
The new endpoint option allows the PJSIP channel driver's fax_detect endpoint option to timeout on a call after the specified number of seconds into a call. The new feature is disabled if the timeout is set to zero. The option is disabled by default. ASTERISK-26214 Reported by: Richard Mudgett Change-Id: Id5a87375fb2c4f9dc1d4b44c78ec8735ba65453d
2016-06-30res_pjsip: Add missing NULL checks when using pjsip_inv_end_session().Richard Mudgett
pjsip_inv_end_session() is documented as being able to return the passed in tdata parameter set to NULL on success. Change-Id: I09d53725c49b7183c41bfa1be3ff225f3a8d3047
2016-06-09chan_pjsip: Lock channel when checking for RTP changes.Mark Michelson
bridge_native_rtp can call into an RTP-capable channel driver in order for the driver to update information about who the channel is communicating with. For SIP channel drivers, this means deactivating RTCP and sending a reinvite so that the endpoints can communicate directly. bridge_native_rtp does the right thing and has the channel locked when calling into the channel driver. chan_pjsip can't alter session properties in this thread, though. chan_pjsip queues a task on the session serializer in order to update properties there. The problem is that this queued task was not locking the channel. This meant that the queued task could attempt to deactivate RTCP at the same time that the channel thread was attempting to process an incoming RTCP packet. This could lead to a crash. This patch fixes the issue by locking the channel in the queued task when altering RTP properties. ASTERISK-26092 #close Reported by Niklas Larsson Change-Id: I3464e226a3c41f6b915f97891e07fa1599e2a159
2016-03-29chan_pjsip: Add 'pjsip show channelstats'George Joseph
Added the ability to show channel statistics to chan_pjsip (cli_functions.c) Moved the existing 'pjsip show channel(s)' functionality from pjsip_configuration to cli_functions.c. The stats needed chan_pjsip's private header so it made sense to move the existing channel commands as well. Now using stasis_cache_dump to get the channel snapshots rather than retrieving all endpoints, then getting each one's channel snapshots. Much more efficient. Change-Id: I03b114522126d27434030b285bf6d531ddd79869
2016-03-18chan_pjsip: ref leak when checking direct_media_glareKevin Harwell
Fix the reference leak introduced in the following commit: 9444ddadf8525d1ce66a1faf1db97f9f6c265ca4 ASTERISK-25849 Change-Id: I5cfefd5ee6c1c3a1715c050330aaa10e4d2a5e85
2016-03-18chan_pjsip: transfers with direct media reinvite has wrong address/portKevin Harwell
During a transfer involving direct media a race occurs between when the transferer channel is swapped out, initiating rtp changes/updates, and the subsequent reinvites. When Alice, after speaking with Charlie (Bob is on hold), connects Bob and Charlie invites are sent to each in order to establish the call between them. Bob is taken off hold and Charlie is told to have his media flow through Asterisk. However, if before those invites go out the bridge updates Bob's and/or Charlie's rtp information with direct media data (i.e. address, port) then the invite(s) will contain the remote data in the SDP instead of the Asterisk data. The race occurs in the native bridge glue code when updating the peer. The direct_media_address can get set twice before sending out the first invite during call connection. This can happen because the checking/setting of the direct_media_address happened in one thread while the sending of the invite(s) happened in another thread. This fix removes the race condition by moving the checking/setting of the direct_media_address to be in the same thread as the sending of the invites(s). This serializes the checking/setting and sending so they can no longer happen out of order. ASTERISK-25849 #close Change-Id: Idfea590175e74f401929a601dba0c91ca1a7f873
2015-11-22chan_pjsip: Handle T.38 faxes with direct media bridgesMatt Jordan
When a channel is in a direct media bridge, a re-INVITE may arrive that forces Asterisk to re-negotiate the media to a T.38 fax. When this occurs, the bridge must change its technology to a simple bridge, and re-INVITE the media back to Asterisk. Generally, this logic mostly already exists in Asterisk. However, prior to this patch, there were a few bugs: (1) The T.38 framehook currently prevents a channel capable of T.38 faxes from ever entering into a direct media bridge. This applies even when the only media being passed over the channel is audio. This patch fixes this bug by having the framehook specify that it defers caring about any frame type. This allows the channels to enter into a direct media bridge, which will be broken when a re-INVITE is received. (2) When a re-INVITE is received, nothing instructed the bridging layer to re-inspect the allowed bridging technology. This now occurs when either a re-INVITE is received from a peer, or when a response is received from the far end (that is, when the T.38 state changes to either T38_PEER_REINVITE or T38_LOCAL_REINVITE). (3) chan_pjsip needs to do a small amount of work to prevent a direct media bridge from being chosen when a T.38 session is in progress. When a T.38 session supplement has a t38 datastore - which is added when we detect we should start thinking about T.38 on a channel - we now refuse a native RTP bridge. (4) When a BYE request is received, we don't terminate the T.38 session. If the other side of a T.38 fax survives the hangup (due to the 'g' flag in Dial, for example), we don't currently re-INVITE the media on the other channel back to audio. This patch now has res_pjsip_t38 intercept BYE requests and inform the far side that the T.38 session is terminated. This naturally causes the correct re-INVITEs to be sent. ASTERISK-25582 Change-Id: Iabd6aa578e633d16e6b9f342091264e4324a79eb
2015-11-09ast_format_cap_get_names: To display all formats, the buffer was increased.Alexander Traud
ASTERISK-25533 #close Change-Id: Ie1a9d1a6511b3f1a56b93d04475fbf8a4e40010a
2015-10-06chan_pjsip: Fix crash on reINVITE before initial INVITE completes.Richard Mudgett
Apparently some endpoints attempt to send a reINVITE before completing the initial INVITE transaction. In this case PJSIP responds appropriately to the reINVITE with a 491 INVITE request pending. Unfortunately chan_pjsip is using the initial INVITE transaction state to determine if an INVITE is the initial INVITE or a reINVITE. Since the initial INVITE transaction has not been confirmed yet chan_pjsip thinks the reINVITE is an initial INVITE and starts another PBX thread on the channel. The extra PBX thread ensures that hilarity ensues. * Fix checks for a reINVITE on incoming requests to look for the presence of a to-tag instead of the initial INVITE transaction state. * Made caller_id_incoming_request() determine what to do if there is a channel on the session or not. After a channel is created it is too late to just store the new party id on the session because the session's party id has already been copied to the channel's caller id. ASTERISK-25404 #close Reported by: Chet Stevens Change-Id: Ie78201c304a2b13226f3a4ce59908beecc2c68be
2015-10-05chan_pjsip: Add Referred-By header to the PJSIP REFER packet.Debian Amtelco
Some systems require the REFER packet to include a Referred-By header. If the channel variable SIPREFERREDBYHDR is set, it passes that value as the Referred-By header value. Otherwise, it adds the current dialog’s local info. Reported by: Dan Cropp Tested by: Dan Cropp Change-Id: I3d17912ce548667edf53cb549e88a25475eda245
2015-09-17PJSIP: avoid crash when getting rtp peerScott Griepentrog
Although unlikely, if the tech private is returned as a NULL, chan_pjsip_get_rtp_peer() would crash. ASTERISK-25323 Change-Id: Ie231369bfa7da926fb2b9fdaac228261a3152e6a
2015-08-26Chaos: make hangup NULL tolerantScott Griepentrog
In chan_pjsip_new, if allocation of the pvt structure fails, ast_hangup is called. But it was written to assume pvt was valid, and this change corrects that. ASTERISK-25323 Reported by: Scott Griepentrog Change-Id: I5f47860fe9cee4cd56abd3f79b108678ab72cc87
2015-07-24pjsip: Add rtp_timeout and rtp_timeout_hold endpoint options.Joshua Colp
This change adds support for the 'rtp_timeout' and 'rtp_timeout_hold' endpoint options. These allow the channel to be hung up if RTP is not received from the remote endpoint for a specified number of seconds. ASTERISK-25259 #close Change-Id: I3f39daaa7da2596b5022737b77799d16204175b9
2015-07-17chan_pjsip: Don't change formats when frame of unsupported format is received.Joshua Colp
Receipt of an RTP packet currently causes the formats on an PJSIP channel to change to the format of the RTP packet. In some off-nominal cases it's possible for this to be a format that has not been configured or negotiated. This change makes it so only formats explicitly configured on the endpoint are allowed. ASTERISK-25258 #close Change-Id: If93d641fb6418a285928839300d7854cab8c1020
2015-06-11chan_pjsip: Set the context and extension on the channel when createdMatt Jordan
Prior to this patch, chan_pjsip was failing to pass the endpoint's context and the desired extension to the ast_channel_alloc_* routine. This caused a new channel snapshot to be issued without a context and extension, which can cause some reporting issues for users of AMI, CEL, and other APIs. The channel driver would later set the context and extension on the channel such that the channel would start in the correct location in the dialplan, but the information reported in the initial event would be incorrect. This patch modifies the channel driver such that it now passes the context and extension directly into the allocation routine. This provides the information in the new channel snapshot published over Stasis. ASTERISK-25156 #close Reported by: cloos Change-Id: Ic6f8542836e596db8f662071d118e8f934fdf25e
2015-05-17chan_pjsip: Fix crash during off-nominal when no endpoint specified.snuffy
Add missing return -1 when no endpoint name is specified. ASTERISK-25086 #close Reported by: snuffy Change-Id: I9de76c2935a1f4e3f0cffe97a670106f5605e89e
2015-04-10chan_pjsip/res_pjsip/bridge_softmix/core: Improve translation path choices.Richard Mudgett
With this patch, chan_pjsip/res_pjsip now sets the native formats to the codecs negotiated by a call. * The changes in chan_pjsip.c and res_pjsip_sdp_rtp.c set the native formats to include all the negotiated audio codecs instead of only the initial preferred audio codec and later the currently received audio codec. * The audio frame handling in channel.c:ast_read() is more streamlined and will automatically adjust to changes in received frame formats. The new policy is to remove translation and pass the new frame format to the receiver except if the translation was to a signed linear format. A more long winded version is commented in ast_read() along with some caveats. * The audio frame handling in channel.c:ast_write() is more streamlined and will automatically adjust any needed translation to changes in the frame formats sent. Frame formats sent can change for many reasons such as a recording is being played back or the bridged peer changed the format it sends. Since it is a normal expectation that sent formats can change, the codec mismatch warning message is demoted to a debug message. * Removed the short circuit check in channel.c:ast_channel_make_compatible_helper(). Two party bridges need to make channels compatible with each other. However, transfers and moving channels among bridges can result in otherwise compatible channels having sub-optimal translation paths if the make compatible check is short circuited. A result of forcing the reevaluation of channel compatibility is that the asterisk.conf:transcode_via_slin and codecs.conf:genericplc options take effect consistently now. It is unfortunate that these two options are enabled by default and negate some of the benefits to the changes in channel.c:ast_read() by forcing translation through signed linear on a two party bridge. * Improved the softmix bridge technology to better control the translation of frames to the bridge. All of the incoming translation is now normally handled by ast_read() instead of splitting any translation steps between ast_read() and the slin factory. If any frame comes in with an unexpected format then the translation path in ast_read() is updated for the next frame and the slin factory handles the current frame translation. This is the final patch in a series of patches aimed at improving translation path choices. The other patches are on the following reviews: https://reviewboard.asterisk.org/r/4600/ https://reviewboard.asterisk.org/r/4605/ ASTERISK-24841 #close Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/4609/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@434671 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-04-10res_pjsip: Add an 'auto' option for DTMF ModeMatthew Jordan
This patch adds support for automatically detecting the type of DTMF that a PJSIP endpoint supports. When the 'dtmf_mode' endpoint option is set to 'auto', the channel created for an endpoint will attempt to determine if RFC 4733 DTMF is supported. If so, it will use that DTMF type. If not, the DTMF type for the channel will be set to inband. Review: https://reviewboard.asterisk.org/r/4438 ASTERISK-24706 #close Reported by: yaron nahum patches: yaron_patch_3_Feb.diff submitted by yaron nahum (License 6676) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@434637 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-04-08clang compiler warnings: Fix pointer-bool-converesion warningsMatthew Jordan
This patch fixes several warnings pointed out by the clang compiler. * chan_pjsip: Removed check for data->text, as it will always be non-NULL. * app_minivm: Fixed evaluation of etemplate->locale, which will always evaluate to 'true'. This patch changes the evaluation to use ast_strlen_zero. * app_queue: - Fixed evaluation of qe->parent->monfmt, which always evaluates to true. Instead, we just check to see if the dereferenced pointer evaluates to true. - Fixed evaluation of mem->state_interface, wrapping it with a call to ast_strlen_zero. * res_smdi: Wrapped search_msg->mesg_desk_term with calls to ast_strlen_zero. Review: https://reviewboard.asterisk.org/r/4541 ASTERISK-24917 Reported by: dkdegroot patches: rb4541.patch submitted by dkdegroot (License 6600) ........ Merged revisions 434285 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@434286 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-30clang compiler warnings: Fix invalid enum conversionMatthew Jordan
This patch fixes some invalid enum conversion warnings caught by clang. In particular: * chan_sip: Several functions mixed usage of the st_refresher_param enum and st_refresher enum. This patch corrects the functions to use the right enum. * chan_pjsip: Fixed mixed usage of ast_sip_session_t38state and ast_t38_state. * strings: Fixed incorrect usage of AO2 flags with strings container. * res_stasis: Change a return enumeration to stasis_app_user_event_res. Review: https://reviewboard.asterisk.org/r/4535 ASTERISK-24917 Reported by: dkdegroot patches: rb4535.patch submitted by dkdegroot (License 6600) ........ Merged revisions 433746 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433747 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-28clang compiler warnings: Fix a variety of "unused" warningsMatthew Jordan
This patch fixes the -Wunused-value -Wunused-variable -Wunused-const-variable errors caught by clang. Specifically: * apps/app_queue.c: removed unused qpm_cmd_usage[], qum_cmd_usage[], qsmp_cmd_usage[] * cel/cel_sqlite3_custom.c: removed unused name[] = "cel_sqlite3_custom" * channels/chan_pjsip.c: removed unused desc[] = "PJSIP Channel" * codecs/gsm/src/gsm_create.c: removed unused ident[] = "$Header$" * funcs/func_env.c:729: Fixed ast_str_append_substr. * main/editline/np/strlcat.c: removed unused rcsid variable * main/editline/np/strlcpy.c: removed unused rcsid variable * main/security_events.c: removed unused TIMESTAMP_STR_LEN * utils/conf2ael.c: removed unused cfextension_states * utils/extconf.c: removed unused cfextension_states Review: https://reviewboard.asterisk.org/r/4526 ASTERISK-24917 Reported by: dkdegroot patches: rb4526.patch submitted by dkdegroot (License 6600) ........ Merged revisions 433693 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433694 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-24chan_pjsip: Add "rpid_immediate" option to prevent unnecessary "180 Ringing" ↵Richard Mudgett
messages. Incoming PJSIP call legs that have not been answered yet send unnecessary "180 Ringing" or "183 Progress" messages every time a connected line update happens. If the outgoing channel is also PJSIP then the incoming channel will always send a "180 Ringing" or "183 Progress" message when the outgoing channel sends the INVITE. Consequences of these unnecessary messages: * The caller can start hearing ringback before the far end even gets the call. * Many phones tend to grab the first connected line information and refuse to update the display if it changes. The first information is not likely to be correct if the call goes to an endpoint not under the control of the first Asterisk box. When connected line first went into Asterisk in v1.8, chan_sip received an undocumented option "rpid_immediate" that defaults to disabled. When enabled, the option immediately passes connected line update information to the caller in "180 Ringing" or "183 Progress" messages as described above. * Added "rpid_immediate" option to prevent unnecessary "180 Ringing" or "183 Progress" messages. The default is "no" to disable sending the unnecessary messages. ASTERISK-24781 #close Reported by: Richard Mudgett Review: https://reviewboard.asterisk.org/r/4473/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433338 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-13chan_pjsip/res_pjsip_callerid: Make Party ID handling simpler and consistent.Richard Mudgett
The res_pjsip modules were manually checking both name and number presentation values when there is a function that determines the combined presentation for a party ID struct. The function takes into account if the name or number components are valid while the manual code rarely checked if the data was even valid. * Made use ast_party_id_presentation() rather than manually checking party ID presentation values. * Ensure that set_id_from_pai() and set_id_from_rpid() will not return presentation values other than what is pulled out of the SIP headers. It is best if the code doesn't assume that AST_PRES_ALLOWED and AST_PRES_USER_NUMBER_UNSCREENED are zero. * Fixed copy paste error in add_privacy_params() dealing with RPID privacy. * Pulled the id->number.valid test from add_privacy_header() and add_privacy_params() up into the parent function add_id_headers() to skip adding PAI/RPID headers earlier. * Made update_connected_line_information() not send out connected line updates if the connected line number is invalid. Lower level code would not add the party ID information and thus the sent message would be unnecessary. * Eliminated RAII_VAR usage in send_direct_media_request(). Review: https://reviewboard.asterisk.org/r/4472/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@432892 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-24ARI/PJSIP: Apply requesting channel's format cap to created channelsMatthew Jordan
This patch addresses the following problems: * ari/resource_channels: In ARI, we currently create a format capability structure of SLIN and apply it to the new channel being created. This was originally done when the PBX core was used to create the channel, as there was a condition where a newly created channel could be created without any formats. Unfortunately, now that the Dial API is being used, this has two drawbacks: (a) SLIN, while it will ensure audio will flows, can cause a lot of needless transcodings to occur, particularly when a Local channel is created to the dialplan. When no format capabilities are available, the Dial API handles this better by handing all audio formats to the requsted channels. As such, we defer to that API to provide the format capabilities. (b) If a channel (requester) is causing this channel to be created, we currently don't use its format capabilities as we are passing in our own. However, the Dial API will use the requester channel's formats if none are passed into it, and the requester channel exists and has format capabilities. This is the "best" scenario, as it is the most likely to create a media path that minimizes transcoding. Fixing this simply entails removing the providing of the format capabilities structure to the Dial API. * chan_pjsip: Rather than blindly picking the first format in the format capability structure - which actually *can* be a video or text format - we select an audio format, and only pick the first format if that fails. That minimizes the weird scenario where we attempt to transcode between video/audio. * res_pjsip_sdp_rtp: Applied the joint capapbilites to the format structure. Since ast_request already limits us down to one format capability once the format capabilities are passed along, there's no reason to squelch it here. * channel: Fixed a comment. The reason we have to minimize our requested format capabilities down to a single format is due to Asterisk's inability to convey the format to be used back "up" a channel chain. Consider the following: PJSIP/A => L;1 <=> L;2 => PJSIP/B g,u,a g,u,a g,u,a u That is, we have PJSIP/A dialing a Local channel, where the Local;2 dials PJSIP/B. PJSIP/A has native format capabilities g722,ulaw,alaw; the Local channel has inherited those format capabilities down the line; PJSIP/B supports only ulaw. According to these format capabilities, ulaw is acceptable and should be selected across all the channels, and no transcoding should occur. However, there is no way to convey this: when L;2 and PJSIP/B are put into a bridge, we will select ulaw, but that is not conveyed to PJSIP/A and L;1. Thus, we end up with: PJSIP/A <=> L;1 <=> L;2 <=> PJSIP/B g g X u u Which causes g722 to be written to PJSIP/B. Even if we can convey the 'ulaw' choice back up the chain (which through some severe hacking in Local channels was accomplished), such that the chain looks like: PJSIP/A <=> L;1 <=> L;2 <=> PJSIP/B u u u u We have no way to tell PJSIP/A's *channel driver* to Answer in the SDP back with only 'ulaw'. This results in all the channel structures being set up correctly, but PJSIP/A *still* sending g722 and causing the chain to fall apart. There's a lot of difficulty just in setting this up, as there are numerous race conditions in the act of bridging, and no clean mechanism to pass the selected format backwards down an established channel chain. As such, the best that can be done at this point in time is clarifying the comment. Review: https://reviewboard.asterisk.org/r/4434/ ASTERISK-24812 #close Reported by: Matt Jordan git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@432195 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-12ARI/PJSIP: Add the ability to redirect (transfer) a channel in a Stasis appMatthew Jordan
This patch adds a new feature to ARI to redirect a channel to another server, and fixes a few bugs in PJSIP's handling of the Transfer dialplan application/ARI redirect capability. *New Feature* A new operation has been added to the ARI channels resource, redirect. With this, a channel in a Stasis application can be redirected to another endpoint of the same underlying channel technology. *Bug fixes* In the process of writing this new feature, two bugs were fixed in the PJSIP stack: (1) The existing .transfer channel callback had the limitation that it could only transfer channels to a SIP URI, i.e., you had to pass 'PJSIP/sip:foo@my_provider.com' to the dialplan application. While this is still supported, it is somewhat unintuitive - particularly in a world full of endpoints. As such, we now also support specifying the PJSIP endpoint to transfer to. (2) res_pjsip_multihomed was, unfortunately, trying to 'help' a 302 redirect by updating its Contact header. Alas, that resulted in the forwarding destination set by the dialplan application/ARI resource/whatever being rewritten with very incorrect information. Hence, we now don't bother updating an outgoing response if it is a 302. Since this took a looong time to find, some additional debug statements have been added to those modules that update the Contact headers. Review: https://reviewboard.asterisk.org/r/4316/ ASTERISK-24015 #close Reported by: Private Name ASTERISK-24703 #close Reported by: Matt Jordan git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@431717 65c4cc65-6c06-0410-ace0-fbb531ad65f3