Commit Graph

29254 Commits

Author SHA1 Message Date
Richard Mudgett
a8c6c3bd7d cdr.c: Eliminated many calls to ao2_global_obj_ref().
The CDR performance gets worse the further it gets behind in processing
stasis messages.  One of the reasons is we were getting the global config
to determine if we needed to log a debugging message.

* Many calls to ao2_global_obj_ref() were just so we could determine if
debug mode is enabled.  Made a global flag to check instead.

* Eliminated many RAII_VAR() usages associated with the remaining
ao2_global_obj_ref() calls.

* Added missing NULL checks for the returned ao2_global_obj_ref() value.

ASTERISK-27335

Change-Id: Iceaad93172862f610cad0188956634187bfcc7cd
2017-10-12 19:11:02 -05:00
Richard Mudgett
b56fa63db8 cdr.c: Defer getting ao2_global_obj_ref() until needed.
The CDR performance gets worse the further it gets behind in processing
stasis messages.  One of the reasons is we were getting the global config
even if we didn't need it.

* Most uses of the global config were only needed on off nominal code
paths so it makes sense to not get it until absolutely needed.

ASTERISK-27335

Change-Id: I00c63b7ec233e5bfffd5d976f05568613d3c2365
2017-10-12 19:11:02 -05:00
Richard Mudgett
92c5cf3920 cdr.c: Set stringfields only if they are different.
The CDR performance gets worse the further it gets behind in processing
stasis messages.  One of the reasons is we were repeatedly setting string
fields to potentially the same string in base_process_party_a().  Setting
a string field involves allocating room for the new string out of a memory
pool which may have to allocate even more memory.

* Check to see if the string field is already set to the desired string.

ASTERISK-27335

Change-Id: I3ccb7e23f1488417e08cafe477755033eed65a7c
2017-10-12 19:11:02 -05:00
Richard Mudgett
6393c106ca cdr.c: Fix setting dnid, callingsubaddr, and calledsubaddr
The string comparisons for setting these CDR variables was inverted.  We
were repeatedly setting these CDR variables only if the channel snapshots
had the same value.

ASTERISK-27335

Change-Id: I9482073524411e7ea6c03805b16de200cb1669ea
2017-10-12 19:11:02 -05:00
Jenkins2
28a3ff75d5 Merge "res_pjsip_session: Prevent user=phone being added to anonimized URIs." into 13 2017-10-12 12:22:10 -05:00
Daniel Tryba
21d502818f res_pjsip_session: Prevent user=phone being added to anonimized URIs.
Move ast_sip_add_usereqphone to be called after anonymization of URIs,
to prevent the user_eq_phone adding "user=phone" to URIs containing a
username that is not a phonenumber (RFC3261 19.1.1). An extra call to
ast_sip_add_usereqphone on the saved version before anonymization is
added to add user=phone" to the PAI.

ASTERISK-27047 #close

Change-Id: Ie5644bc66341b86dc08b1f7442210de2e6acdec6
2017-10-12 11:05:28 -05:00
Jenkins2
603418aac7 Merge "cdr.c: Defer misc checks." into 13 2017-10-12 07:12:59 -05:00
Joshua Colp
5bed433e71 Merge "res_pjsip: Prevent "user=phone" being added multiple times to header" into 13 2017-10-12 07:01:18 -05:00
Jenkins2
b4113450e6 Merge "cdr_mysql: avoid releasing a config string" into 13 2017-10-11 19:09:52 -05:00
Jenkins2
b498942ba3 Merge "chan_vpb: Fix a gcc 7 out-of-bounds complaint" into 13 2017-10-11 16:28:29 -05:00
Daniel Tryba
af09996178 res_pjsip: Prevent "user=phone" being added multiple times to header
ast_sip_add_usereqphone adds "user=phone" to the header every time is is
called without checking whether the param already exists. Preventing
this by searching to string representation of header for "user=phone".

ASTERISK-26988 #close

Change-Id: Ib84383b07254de357dc6a98d91fc1d2c2c3719e6
2017-10-11 16:34:52 -04:00
Tzafrir Cohen
8e05796e81 cdr_mysql: avoid releasing a config string
Fixes a memory corruption issue after a reload of cdr_mysql.

Issue was accidentally included in 747beb1ed1 .

ASTERISK-27270 #close

Change-Id: I90b6a9d18710c0f9009466370bd5f4bac5d5d12e
2017-10-11 15:14:32 -05:00
Jenkins2
4a2caab4f6 Merge "app_originate: Set ORIGINATE_STATUS correctly on failure" into 13 2017-10-11 15:03:46 -05:00
Richard Mudgett
5f6bad6733 cdr.c: Defer misc checks.
Try to defer some checks until needed in case there is an early exit.

Change-Id: Ibc6b34c38a4f60ad4f9b67984b7d070a07257064
2017-10-11 13:28:26 -05:00
Jenkins2
4a0fa1ba59 Merge "cdr.c: Eliminated simple RAII_VAR usages." into 13 2017-10-11 12:18:55 -05:00
Joshua Colp
0430ae5d51 Merge "app_queue.c: clear moh field in init_queue" into 13 2017-10-11 11:05:27 -05:00
George Joseph
f3f141781c chan_vpb: Fix a gcc 7 out-of-bounds complaint
chan_vpb was trying to use sizeof(*p->play_dtmf), where
p->play_dtmf is defined as char[16], to get the length of the array
but since p->play_dtmf is an actual array, sizeof(*p->play_dtmf)
returns the size of the first array element, which is 1.  gcc7
validly complains because the context in which it's used could
cause an out-of-bounds condition.

Change-Id: If9c4bfdb6b02fa72d39e0c09bf88900663c000ba
2017-10-11 06:03:41 -06:00
Jenkins2
5a8c148dcf Merge "res_pjsip_registrar.c: Update remove_existing AOR contact handling." into 13 2017-10-11 06:34:00 -05:00
Nathan Bruning
416e35589e app_queue.c: clear moh field in init_queue
ASTERISK-27301 #close

Change-Id: Ic31361f34e2de3b6470e68fc37205a7711082eba
2017-10-11 05:34:36 -05:00
Jenkins2
821d7428ab Merge "contrib/thirdparty/sip_to_pjsip: add additional flag mappings" into 13 2017-10-10 12:24:37 -05:00
Sean Bright
e71a65a358 app_originate: Set ORIGINATE_STATUS correctly on failure
We were ignoring the return value from ast_pbx_outgoing_exten() and
ast_pbx_outgoing_app() which could fail before setting the reason code.
This resulted in failures being reported as success.

ASTERISK-25266 #close
Reported by: Allen Ford

Change-Id: Idf16237b7e41b527d2c69c865829128686beeb3b
2017-10-10 13:06:11 -04:00
Richard Mudgett
42fdfffefc cdr.c: Eliminated simple RAII_VAR usages.
Change-Id: I150505db307249a962987e7b941bdd369bb91f35
2017-10-10 09:59:09 -05:00
Jenkins2
da07a3bb62 Merge "res_pjproject: Fix cleanup of buildopts vector." into 13 2017-10-10 08:12:38 -05:00
Jenkins2
2f3d3881d4 Merge "tcptls: Do not re-bind to wildcard on client creation." into 13 2017-10-10 07:41:42 -05:00
Corey Farrell
48971e4d43 res_pjproject: Fix cleanup of buildopts vector.
ASTERISK-27306

Change-Id: I3bed0edf3f55b1d4adcbabb25ec14f11dc766c72
2017-10-09 23:17:43 -05:00
Joshua Colp
ce26554b51 Merge "cdr.h: Fix doxygen comments." into 13 2017-10-09 19:52:22 -05:00
Jenkins2
dedd5abfe2 Merge "cdr.c: Replace redundant check with an ast_assert()" into 13 2017-10-09 19:30:50 -05:00
Jenkins2
dc524825a9 Merge "cdr.c: Use current ao2 flag names" into 13 2017-10-09 18:33:29 -05:00
Jenkins2
d536802de2 Merge "res_pjsip: Fix issues that prevented shutdown of modules." into 13 2017-10-09 17:46:11 -05:00
Jenkins2
b3c49f271e Merge "cdr.c: Replace inlined code with ao2_t_replace()" into 13 2017-10-09 16:37:28 -05:00
Jenkins2
103737f7b1 Merge "res_config_sqlite: Don't enable SQLite CDRs when running 'make samples'" into 13 2017-10-09 15:40:53 -05:00
Jenkins2
4aba59b036 Merge "res_pjsip: Fix leak of persistent endpoint references." into 13 2017-10-09 15:16:51 -05:00
Richard Mudgett
128f7ffaa2 cdr.c: Replace redundant check with an ast_assert()
The only caller of cdr_object_fn_table.process_party_b() explicitly does
the check before calling.

Change-Id: Ib0c53cdf5048227842846e0df9d2c19117c45618
2017-10-09 13:33:52 -05:00
Richard Mudgett
3525081a7c cdr.c: Replace inlined code with ao2_t_replace()
Change-Id: I9f424f5282ca7d833592f958d95f1b2bafb549b0
2017-10-09 13:29:52 -05:00
Richard Mudgett
7366657a9a cdr.c: Use current ao2 flag names
Change-Id: Ib59d7d2f2a4a822754628f2c48a308d6791a6e6e
2017-10-09 13:27:27 -05:00
Richard Mudgett
34d55352a5 cdr.h: Fix doxygen comments.
* Also some misc formatting in cdr.c.

Change-Id: Ied89a28802a662c37c43326a1aafdce596e0df4a
2017-10-09 13:25:13 -05:00
Richard Mudgett
d388c18abf res_pjsip_registrar.c: Update remove_existing AOR contact handling.
When "rewrite_contact" is enabled, the "max_contacts" count option can
block re-registrations because the source port from the endpoint can be
random.  When the re-registration is blocked, the endpoint may give up
re-registering and require manual intervention.

* The "remove_existing" option now allows a registration to succeed by
displacing any existing contacts that now exceed the "max_contacts" count.
Any removed contacts are the next to expire.  The behaviour change is
beneficial when "rewrite_contact" is enabled and "max_contacts" is greater
than one.  The removed contact is likely the old contact created by
"rewrite_contact" that the device is refreshing.

ASTERISK-27192

Change-Id: I64c107a10b70db1697d17136051ae6bf22b5314b
2017-10-09 12:53:13 -05:00
Corey Farrell
82592c3673 res_pjsip: Fix issues that prevented shutdown of modules.
res_pjsip and res_pjsip_session had circular references, preventing both
modules from shutting down.
* Move session supplement registration to res_pjsip.
* Use create internal functions for use by pjsip_message_filter.c.

ASTERISK-27306

Change-Id: Ifbd5c19ec848010111afeab2436f9699da06ba6b
2017-10-09 12:49:39 -04:00
Sean Bright
6b16fa12c8 res_config_sqlite: Don't enable SQLite CDRs when running 'make samples'
Change-Id: I65a5190b2732b2246d67472db70dd37db64ddad4
2017-10-09 09:15:54 -04:00
hajekd
39b68a41f7 res/res_ari.c Fix: Memory leaks in ARI when using Content-Type: application/json
ASTERISK-27305
Reported by: David Hajek
Tested by: David Hajek

Change-Id: Ife3e289062e6cf7d0e7d342dbf79ed96feff441e
2017-10-08 21:05:56 +02:00
Alexander Traud
209916981a tcptls: Do not re-bind to wildcard on client creation.
Since ASTERISK-26922, this issue affected only those chan_sip which were
* enabled for dual-stack (bindaddr=::), and
* enabled for TCP (tcpenable=yes) and/or TLS (tlsenable=yes), and
* tried to register and/or invite a IPv4-only service,
* via TCP and/or TLS.
Now, ast_tcptls_client_create does not re-bind to [::] anymore.

ASTERISK-27324 #close

Change-Id: I4b242837bdeb1ec7130dc82505c6180a946fd9b5
2017-10-08 09:22:57 -05:00
Corey Farrell
f1163c0f6f res_pjsip: Fix leak of persistent endpoint references.
Do not manually call sip_endpoint_apply_handler from load_all_endpoints.
This is not necessary and causes memory leaks.

Additionally reinitialize persistent->aors when we reuse a persistent
object with a new endpoint.

ASTERISK-27306

Change-Id: I59bbfc8da8a14d5f4af8c5bb1e71f8592ae823eb
2017-10-06 15:54:11 -05:00
Jenkins2
d2a39f896d Merge "vector: multiple evaluation of elem in AST_VECTOR_ADD_SORTED." into 13 2017-10-06 15:09:23 -05:00
Jenkins2
3844179335 Merge "res_pjsip: Fix leak of fake_auth references." into 13 2017-10-06 14:46:11 -05:00
Corey Farrell
8bf4be1048 vector: multiple evaluation of elem in AST_VECTOR_ADD_SORTED.
Use temporary variable to prevent multiple evaluations of elem argument.
This resolves a memory leak in res_pjproject startup.

ASTERISK-27317 #close

Change-Id: Ib960d7f5576f9e1a3c478ecb48995582a574e06d
2017-10-06 13:39:04 -05:00
Jenkins2
7703ab0443 Merge "main/strings: Fix uninitialized value." into 13 2017-10-06 13:21:33 -05:00
Jenkins2
a6ead833ee Merge "res_pjsip_caller_id chan_sip: Comply to RFC 3323 values for privacy" into 13 2017-10-06 09:51:07 -05:00
Corey Farrell
5110600f1e res_pjsip: Fix leak of fake_auth references.
pjsip_distributor leaks references to fake_auth when the default realm
has not changed.

ASTERISK-27306

Change-Id: I3fcf103b3680ad2d1d4610dcd6738eeaebf4d202
2017-10-06 09:24:52 -05:00
Corey Farrell
462dd7c2de main/strings: Fix uninitialized value.
ast_strings_match uses sscanf and checks for non-zero return to verify a
token was parsed. This is incorrect as sscanf returns EOF (-1) for errors.

ASTERISK-27318 #close

Change-Id: Ifcece92605f58116eff24c5a0a3b0ee08b3c87b1
2017-10-05 20:28:28 -05:00
Jenkins2
646d97f626 Merge "app_queue.c: Fix announcements when announce-to-first-user not enabled." into 13 2017-10-04 14:32:26 -05:00