Commit Graph

27283 Commits

Author SHA1 Message Date
Jonathan Rose ceebdfce40 chan_sip: Add TCP/TLS keepalive to TCP/TLS server
Adds the TCP Keep Alive option to TCP and TLS server sockets. Previously
this option was only being set on session sockets.
http://www.tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/
According to the link above, the SO_KEEPALIVE option is useful for knowing
when a TCP connected endpoint has severed communication without indicating
it or has become unreachable for some reason. Without this patch, keep
alive is not set on the socket listening for incoming TCP sessions and
in Komatsu's report this resulted in the thread listening for TCP becoming
stuck in a waiting state.

ASTERISK-25364 #close
Reported by: Hiroaki Komatsu

Change-Id: I7ed7bcfa982b367dc64b4b73fbd962da49b9af36
2015-12-10 14:13:19 -06:00
Joshua Colp 71c5f33d32 Merge "res_pjsip: Add existence and readablity checks for tls related files" 2015-12-10 07:13:40 -06:00
Joshua Colp 45a40d14d9 Merge "app_meetme: Set default value for audio_buffers." 2015-12-10 06:03:25 -06:00
Joshua Colp cb99d15eae Merge "res_chan_stats: Fix bug to send correct statistics to StatsD" 2015-12-10 06:02:55 -06:00
Corey Farrell fcaebb0e43 app_meetme: Set default value for audio_buffers.
The default value was never set for audio_buffers, causing bad
audio quality.  This ensures the default is always set.

ASTERISK-25569 #close

Change-Id: I2d2ee3e644120b0f9f6ea6ab9286d7d590942a44
2015-12-09 15:57:48 -06:00
tcambron 5790700497 res_chan_stats: Fix bug to send correct statistics to StatsD
Fixed a bug that originally would show a negative number of
active calls occuring in Asterisk. A gauge is persistent so
incrementing and decrementing it results in a more consistent
performance. Also changed to the call to StatsD to use
ast_statsd_log_string() so that a "+" could be sent to StatsD.

ASTERISK-25619 #close

Change-Id: Iaaeff5c4c6a46535366b4d16ea0ed0ee75ab2ee7
2015-12-09 12:48:51 -06:00
Matt Jordan 259fa9c901 Merge "chan_sip: Check sip_pvt pointer in ast_channel_get_t38_state(c)" 2015-12-09 12:40:58 -06:00
George Joseph a987434564 res_pjsip: Add existence and readablity checks for tls related files
Both transport and endpoint now check for the existence and readability
of tls certificate and key files before passing them on to pjproject.
This will cause the object to not load rather than waiting for pjproject
to discover that there's a problem when a session is attempted.

NOTE: chan_sip also uses ast_rtp_dtls_cfg_parse but it's located
in build_peer which is gigantic and I didn't want to disturb it.
Error messages will emit but it won't interrupt chan_sip loading.

ASTERISK-25618 #close

Change-Id: Ie43f2c1d653ac1fda6a6f6faecb7c2ebadaf47c9
Reported-by: George Joseph
Tested-by: George Joseph
2015-12-08 18:04:33 -06:00
Eugene Voityuk be693539c3 chan_sip.c: Start ICE negotiation when response is sent or received.
The current logic for ICE negotiation starts it
when receiving an SDP with ICE candidates. This is
incorrect as ICE negotiation can only start when each 
call party have at least one pair of local and remote 
candidate. Starting ICE negotiation early would result 
in negotiation failure and ultimately no audio.

This change makes it so ICE negotiation is only started
when a response with SDP is received or when a response
with SDP is sent.

ASTERISK-24146

Change-Id: I55a632bde9e9827871b09141d82747e08379a8ca
2015-12-08 17:19:18 -06:00
Joshua Colp 4cf470c70a Merge "res_pjsip/config_transport: Prevent async_operations > 1 when protocol = tls" 2015-12-08 13:18:08 -06:00
Joshua Colp 67aae71d94 Merge "translate: Avoid a warning message when doing FEC within Opus Codec." 2015-12-08 13:14:22 -06:00
Filip Jenicek 59a91c350a chan_sip: Check sip_pvt pointer in ast_channel_get_t38_state(c)
Asterisk may crash when calling ast_channel_get_t38_state(c)
on a locked channel which is being hung up.

ASTERISK-25609 #close

Change-Id: Ifaa707c04b865a290ffab719bd2e5c48ff667c7b
2015-12-08 12:23:30 -06:00
George Joseph 28ab03fbf7 res_pjsip/config_transport: Prevent async_operations > 1 when protocol = tls
See ASTERISK-25615.
If the transport protocol is tls and async_operations > 1, pjproject
will segfault if more than one operation is attempted on the same socket.
Until this is fixed upstream, a check has been added to throw an error
if a tls transport config has async_operations set to > 1.

ASTERISK-25615

Change-Id: I76b9a5b2a5a0054fe71ca5851e635f2dca7685a6
Reported-by: George Joseph
Tested-by: George Joseph
2015-12-08 12:15:30 -06:00
Alexander Traud 55dd7125b3 codec_resample: Increase buffer for Opus Codec with FEC.
ASTERISK-25599 #close

Change-Id: Idbd187f711b2ec63dda949ca0f79aa0c1a0a0b6e
2015-12-08 15:40:38 +01:00
Alexander Traud 64f899e5f3 translate: Avoid a warning message when doing FEC within Opus Codec.
ASTERISK-25616 #close

Change-Id: Ibe729aaf2e6e25506cff247cec5149ec1e589319
2015-12-08 10:48:02 +01:00
Richard Mudgett 65c8147952 chan_sip: Fix crash involving the bogus peer during sip reload.
A crash happens sometimes when performing a CLI "sip reload".  The bogus
peer gets refreshed while it is in use by a new call which can cause the
crash.

* Protected the global bogus peer object with an ao2 global object
container.

ASTERISK-25610 #close

Change-Id: I5b528c742195681abcf713c6e1011ea65354eeed
2015-12-07 10:59:14 -06:00
Christof Lauber 48c065e46d chan_sip: Support parsing of Q.850 reason header in SIP BYE and CANCEL requests.
Current support for reason header did work only in SIP responses.
According to RFC3336 the reason header might appear in any SIP request.
But it seems to make most sence in BYE and CANCEL so parasing is done
there too (if use_q850_reason=yes).

Change-Id: Ib6be7b34c23a76d0e98dfd0816c89931000ac790
2015-12-07 10:04:42 -04:00
Joshua Colp 1759506082 Merge "res_pjsip/contacts/statsd: Make contact lifecycle events more consistent" 2015-12-07 07:51:20 -06:00
Matt Jordan 75c800eb28 Revert "bridges/bridge_t38: Add a bridging module for managing T.38 state"
This reverts commit f42d22d3a1.

Unfortunately, using a bridge to manage T.38 state will cause severe deadlocks
in core_unreal/chan_local. Local channels attempt to reach across both their
peer and the peer's bridge to inspect T.38 state. Given the propensity of
Local channel chains, managing the locking situation in such a scenario is
practically infeasible.

Change-Id: I932107387c13aad2c75a7a4c1e94197a9d6d8a51
2015-12-06 16:35:24 -06:00
George Joseph 4be231e82f res_pjsip/contacts/statsd: Make contact lifecycle events more consistent
It will never be perfect or even pretty, mostly because of the differences
between static and dynamic contacts.

Created:

Can't use the contact or contact_status alloc functions
because the objects come and go regardless of the actual state.

Can't use the contact_apply_handler, ast_sip_location_add_contact or
a sorcery created handler because they only get called for dynamic
contacts.  Similarly, permanent_uri_handler only gets called for
static contacts.

So, Matt had it right. :)  ast_res_pjsip_find_or_create_contact_status is
the only place it can go and not have duplicated code.  Both
permanent_uri_handler and contact_apply_handler call find_or_create.

Removed:

Can't use the destructors for the same reason as above.  The only
place to put this is in persistent_endpoint_contact_deleted_observer
which I believe is the "correct" place but even that will handle only
dynamic contacts.  This doesn't called on shutdown however.  There is
no hook to use for static contacts that may be removed because of a
config change while asterisk is in operation.

I moved the cleanup of contact_status from ast_sip_location_delete_contact
to the handler as well.

Status Change and RTT:

Although they worked fine where they were (in update_contact_status) I
moved them to persistent_endpoint_contact_status_observer to make it
more consistent with removed.  There was logic there already to detect
a state change.

Finally, fixed a nit in permanent_uri_handler rmudgett reported
eralier.

ASTERISK-25608 #close

Change-Id: I4b56e7dfc3be3baaaf6f1eac5b2068a0b79e357d
Reported-by: George Joseph
Tested-by: George Joseph
2015-12-04 16:53:20 -07:00
Matt Jordan e26647cbac Merge "res_format_attr_vp8: In SDP, forward max-fr and max-fs for video-codec VP8." 2015-12-04 11:34:16 -06:00
Matt Jordan 7008ccab79 Merge "res_format_attr_opus: Update to latest RFC 7587." 2015-12-04 11:34:04 -06:00
Alexander Traud 63c6d39a3e res_format_attr_vp8: In SDP, forward max-fr and max-fs for video-codec VP8.
ASTERISK-25584 #close

Change-Id: Iae00071b4ff1ae76f24995aeac4d00284fd14f91
2015-12-04 09:01:16 -06:00
Matt Jordan c0e6b3602d Merge "bridges/bridge_t38: Add a bridging module for managing T.38 state" 2015-12-04 08:58:06 -06:00
Matt Jordan f42d22d3a1 bridges/bridge_t38: Add a bridging module for managing T.38 state
When 4875e5ac32 was merged, it fixed several issues with a direct media bridge
transitioning to handling a T.38 fax. However, it uncovered a race condition
caused by the bridging core. When a channel involved in a T.38 fax leaves a
bridge, the frame queued by the channel driver that should inform the far side
that it is no longer in a T.38 fax may not make it across the bridge. The
bridging framework is *extremely* aggressive in tearing down the bridge, and
control frames that are currently in flight *may* get dropped.

This patch adds a new module to the bridging framework, bridge_t38. This module
maintains some notion of the T.38 state for the two channels in a bridge. When
the bridge detects that it is being torn down or when one of the two channels
leaves, it informs the respective channel(s) that they should stop faxing. This
ensures that channels switch back to audio if they survive and are ejected out
of a bridge while faxing.

ASTERISK-25582

Change-Id: If5b0bb478eb01c4607c9f4a7fc17c7957d260ea0
2015-12-04 10:23:48 -04:00
Matt Jordan 8d79446a11 Merge "Fix crash in audiohook translate to slin" 2015-12-04 07:31:11 -06:00
Alexander Traud dcc01bc0a7 res_format_attr_opus: Update to latest RFC 7587.
Beside that, the format-attribute module sends only non-default values in the
line fmtp, now. This avoids unnecessary overhead in SDP messages. Furthermore,
previously the parameter stereo was not parsed when being the first parameter.

ASTERISK-25583 #close

Change-Id: Iae85ba3e5960bfd5d51cf65bcffad00dd4875a73
2015-12-04 07:20:41 -06:00
Joshua Colp fc1186bf2d Merge "res_pjsip: Use a MD5 hash for static Contact IDs" 2015-12-03 15:51:56 -06:00
Jonathan Rose 69457b8d61 Fix crash in audiohook translate to slin
This patch fixes a crash which would occur when an audiohook was
applied to a channel using an audio codec that could not be translated
to signed linear (such as when using pass-through codecs like OPUS or
when the codec translator module for the format in use is not loaded).

ASTERISK-25498 #close
Reported by: Ben Langfeld

Change-Id: Ib6ea7373fcc22e537cad373996136636201f4384
2015-12-03 15:31:28 -06:00
Joshua Colp 268d21dee5 Merge "res_pjsip: Update logging to show contact->uri in messages" 2015-12-03 12:39:01 -06:00
Joshua Colp f474f92d6a Merge "app_queue: Show reason of pause on CLI" 2015-12-03 12:38:28 -06:00
Joshua Colp 75a0062d72 Merge "codec_resample: Increase buffer for Opus Codec." 2015-12-03 12:38:02 -06:00
George Joseph 5959186017 res_pjsip: Use a MD5 hash for static Contact IDs
When 90d9a70789 was merged, it mostly tested dynamic contacts created as
a result of registering a PJSIP endpoint. Contacts generated in this
fashion typically have a long alphanumeric string as their object identifier,
which maps reasonably well for StatsD. Unfortunately, this doesn't work in the
general case. StatsD treats both '.' and ':' characters as special characters.
In particular, having a ':' appear in the middle of a StatsD metric will
result in the metric being rejected.

This causes some obvious issues with SIP URIs.

The StatsD API should not be responsible for escaping the metric name passed
to it. The metric is treated as a single long string, and it would be
challenging to know what to escape in the string passed to the function.
Likewise, we don't want to escape the metric in PJSIP, as that involves
overhead that is wasted when either res_statsd isn't loaded or enabled.

This patch takes an alternative approach. The Contact ID has been changed
to be "aor@@uri_hash" instead of "aor@@uri". This (a) won't contain any of the
aforementioned special characters, (b) can be done on Contact creation,
which has minimal impact on run-time performance, and (c) also conforms to an
earlier commit that changed the ID for dynamic contacts.

The downside of this is that StatsD users will have to map SHA1 hashes back to
the Contacts that are emitting the statistics. To that end, the CLI commands
have been updated to include the first 10 characters of the MD5 hash, which
should be enough to match what is shown in Graphite (or some other StatsD
backend).

ASTERISK-25595 #close

Change-Id: Ic674a3307280365b4a45864a3571c295b48a01e2
Reported-by: Matt Jordan
Tested-by: George Joseph
2015-12-03 11:24:03 -07:00
Joshua Colp 385ac08d23 Merge "Build System: Support include-what-you-use." 2015-12-03 05:52:19 -06:00
Joshua Colp 2ec2f2f741 Merge "res_sorcery_memory_cache.c: Fix off nominal ref leak." 2015-12-03 05:51:23 -06:00
Joshua Colp b841b2fa11 Merge "sched.c: Make not return a sched id of 0." 2015-12-03 05:50:50 -06:00
Joshua Colp 356e0180a5 Merge "Audit improper usage of scheduler exposed by 5c713fdf18. (v13 additions)" 2015-12-03 05:49:38 -06:00
Joshua Colp a4138550f1 Merge "Audit improper usage of scheduler exposed by 5c713fdf18f." 2015-12-03 05:49:27 -06:00
George Joseph bd265a90be res_pjsip: Update logging to show contact->uri in messages
An earlier commit changed the id of dynamic contacts to contain
a hash instead of the uri.  This patch updates status change
logging to show the aor/uri instead of the id.  This required
adding the aor id to contact and contact_status and adding
uri to contact_status.  The aor id gets added to contact and
contact_status in their allocators and the uri gets added to
contact_status in pjsip_options when the contact_status is
created or updated.

ASTERISK-25598 #close

Reported-by: George Joseph
Tested-by: George Joseph

Change-Id: I56cbec1d2ddbe8461367dd8b6da8a6f47f6fe511
2015-12-02 19:37:09 -07:00
Jonathan Rose b5281b74e0 Unset BRIDGEPEER when leaving a bridge
Currently if a channel is transferred out of a bridge, the BRIDGEPEER
variable (also BRIDGEPVTCALLID) remain set even once the channel is
out of the bridge. This patch removes these variables when leaving
the bridge.

ASTERISK-25600 #close
Reported by: Mark Michelson

Change-Id: I753ead2fffbfc65427ed4e9244c7066610e546da
2015-12-01 17:34:04 -06:00
Richard Mudgett 59ba84e5cd res_sorcery_memory_cache.c: Fix off nominal ref leak.
Change-Id: If83d63cf11cbc6df9b15251848b01feb570ade49
2015-12-01 13:54:04 -06:00
Richard Mudgett ef77439e39 sched.c: Make not return a sched id of 0.
According to the API doxygen a sched ID of 0 is valid.  Unfortunately, 0
was never returned historically and several users incorrectly coded usage
of the returned sched ID assuming that 0 was invalid.

ASTERISK-25476

Change-Id: Ib19c7ebb44ec9fd393ef6646dea806d4f34e3a20
2015-12-01 13:54:04 -06:00
Richard Mudgett 145d10a5d0 Audit improper usage of scheduler exposed by 5c713fdf18. (v13 additions)
chan_sip.c:
* Initialize mwi subscription scheduler ids earlier because of ASTOBJ to
ao2 conversion.

* Initialize register scheduler ids earlier because of ASTOBJ to ao2
conversion.

chan_skinny.c:
* Fix more scheduler usage for the valid 0 id value.

ASTERISK-25476

Change-Id: If9f0e5d99638b2f9d102d1ebc9c5a14b2d706e95
2015-12-01 13:54:04 -06:00
Richard Mudgett fa20729032 Audit improper usage of scheduler exposed by 5c713fdf18.
channels/chan_iax2.c:
* Initialize struct chan_iax2_pvt scheduler ids earlier because of
iax2_destroy_helper().

channels/chan_sip.c:
channels/sip/config_parser.c:
* Fix initialization of scheduler id struct members.  Some off nominal
paths had 0 as a scheduler id to be destroyed when it was never started.

chan_skinny.c:
* Fix some scheduler id comparisons that excluded the valid 0 id.

channel.c:
* Fix channel initialization of the video stream scheduler id.

pbx_dundi.c:
* Fix channel initialization of the packet retransmission scheduler id.

ASTERISK-25476

Change-Id: I07a3449f728f671d326a22fcbd071f150ba2e8c8
2015-12-01 13:54:04 -06:00
Alexander Traud b24f2f4c2e codec_resample: Increase buffer for Opus Codec.
ASTERISK-25599 #close

Change-Id: I1f88a88c59fb4e1e62bbdbb100c7152d48e73f10
2015-12-01 14:56:43 +01:00
George Joseph e5723d2776 dns: Change lookup failures from LOG_ERROR to debug 1.
dns.c and dns_system_resolver.c were spitting out errors for lookup
failures for things like not finding a SRV record even though
there was an A record.  Those have been changed to debug messages.
Logging not finding ANY record is left to the higher level caller.

Also, dns_system_resolver was using Windows line endings so I
converted them to Unix style.  The actual log changes are on lines
156 and 159.

Change-Id: I65be16ea15304b96f9dcb4d289dbd3e2286fc094
2015-11-30 10:13:35 -07:00
Alexander Traud 270f7be54f Build System: Support include-what-you-use.
ASTERISK-25591 #close

Change-Id: I8d3efa0826142ece9cbed2fd0d46f3b607fee6ae
2015-11-30 13:31:21 +01:00
Rodrigo Ramírez Norambuena f2a84b500d app_queue: Show reason of pause on CLI
Add value of pause reason when is paused on CLI command "queue show"

ASTERISK-25581 #close

Report by: Rodrigo Ramírez Norambuena

Change-Id: I887028a40cd97b350da9a3bb2719616b7fec9864
2015-11-28 15:33:41 -03:00
Niklas Larsson 7cb8f2f33e CHANGES: Fix a typo
Change-Id: Iceb3d9bb78140c376174a7bee197dfcf8ef9cda7
2015-11-27 10:25:04 -06:00
Matt Jordan 088aecd780 Merge "fastagi: record file closed after sending result" 2015-11-25 22:19:19 -06:00