Commit Graph

29958 Commits

Author SHA1 Message Date
George Joseph
fe805c75fc Update for 15.1.3 15.1.3 2017-12-01 14:42:25 -05:00
George Joseph
f79ec1ccc8 AST-2017-013: chan_skinny: Call pthread_detach when sess threads end
chan_skinny creates a new thread for each new session.  In trying
to be a good cleanup citizen, the threads are joinable and the
unload_module function does a pthread_cancel() and a pthread_join()
on any sessions that are active at that time.  This has an
unintended side effect though. Since you can call pthread_join on a
thread that's already terminated, pthreads keeps the thread's
storage around until you explicitly call pthread_join (or
pthread_detach()).   Since only the module_unload function was
calling pthread_join, and even then only on the ones active at the
tme, the storage for every thread/session ever created sticks
around until asterisk exits.

* A thread can detach itself so the session_destroy() function
  now calls pthread_detach() just before it frees the session
  memory allocation.  The module_unload function still takes care
  of the ones that are still active should the module be unloaded.

ASTERISK-27452
Reported by: Juan Sacco

Change-Id: I9af7268eba14bf76960566f891320f97b974e6dd
2017-12-01 13:04:06 -06:00
Ben Ford
fecd5b4d91 Update for 15.1.2 15.1.2 2017-11-10 11:59:51 -05:00
Kevin Harwell
0f998b6613 Merge "res_pjsip: Add to list of valid characters for from_user." into 15.1 2017-11-09 14:39:11 -06:00
Ben Ford
f0cebe2321 res_pjsip: Add to list of valid characters for from_user.
Fixes a regression where some characters were unable to be used in
the from_user field of an endpoint. Additionally, the backtick was
removed from the list of valid characters, since it is not valid,
and it was replaced with a single quote, which is a valid character.

ASTERISK-27387

Change-Id: Id80c10a644508365c87b3182e99ea49da11b0281
(cherry picked from commit 5b13290522)
2017-11-09 12:48:29 -05:00
Richard Mudgett
7ebf5a9386 res_pjsip_registrar.c: Fix AOR and pjproject group deadlock.
One of the patches for ASTERISK_27147 introduced a deadlock regression.
When the connection oriented transport shut down, the code attempted to
remove the associated contact.  However, that same transport had just
requested a registration that we hadn't responded to yet.  Depending
upon timing we could deadlock.

* Made send the REGISTER response after we completed processing the
request contacts and released the AOR lock to avoid the deadlock.

ASTERISK-27391

Change-Id: I89a90f87cb7a02facbafb44c75d8845f93417364
2017-11-09 12:26:47 -05:00
George Joseph
3f3172ac93 Update for 15.1.1 15.1.1 2017-11-08 11:28:11 -05:00
George Joseph
1f625292d2 Merge "AST-2017-009: pjproject: Add validation of numeric header values" into 15.1 2017-11-08 09:53:11 -06:00
George Joseph
dc6b375d53 Merge "AST-2017-011 - res_pjsip_session: session leak when a call is rejected" into 15.1 2017-11-08 09:45:11 -06:00
George Joseph
fd22ce2ed4 AST-2017-009: pjproject: Add validation of numeric header values
Parsing the numeric header fields like cseq, ttl, port, etc. all
had the potential to overflow, either causing unintended values to
be captured or, if the values were subsequently converted back to
strings, a buffer overrun.  To address this, new "strto" functions
have been created that do range checking and those functions are
used wherever possible in the parser.

 * Created pjlib/include/limits.h and pjlib/include/compat/limits.h
   to either include the system limits.h or define common numeric
   limits if there is no system limits.h.

 * Created strto*_validate functions in sip_parser that take bounds
   and on failure call the on_str_parse_error function which prints
   an error message and calls PJ_THROW.

 * Updated sip_parser to validate the numeric fields.

 * Fixed an issue in sip_transport that prevented error messages
   from being properly displayed.

 * Added "volatile" to some variables referenced in PJ_CATCH blocks
   as the optimizer was sometimes optimizing them away.

 * Fixed length calculation in sip_transaction/create_tsx_key_2543
   to account for signed ints being 11 characters, not 9.

ASTERISK-27319
Reported by: Youngsung Kim at LINE Corporation

Change-Id: I48de2e4ccf196990906304e8d7061f4ffdd772ff
2017-11-08 07:00:02 -07:00
Kevin Harwell
93e6dd60bb AST-2017-011 - res_pjsip_session: session leak when a call is rejected
A previous commit made it so when an invite session transitioned into a
disconnected state destruction of the Asterisk pjsip session object was
postponed until either a transport error occurred or the event timer
expired. However, if a call was rejected (for instance a 488) before the
session was fully established the event timer may not have been initiated,
or it was canceled without triggering either of the session finalizing states
mentioned above.

Really the only time destruction of the session should be delayed is when a
BYE is being transacted. This is because it's possible in some cases for the
session to be disconnected, but the BYE is still transacting.

This patch makes it so the session object always gets released (no more
memory leak) when the pjsip session is in a disconnected state. Except when
the method is a BYE. Then it waits until a transport error occurs or an event
timeout.

ASTERISK-27345 #close

Reported by: Corey Farrell

Change-Id: I1e724737b758c20ac76d19d3611e3d2876ae10ed
2017-11-08 05:49:40 -07:00
Richard Mudgett
6fce3fdedd AST-2017-010: Fix cdr_object_update_party_b_userfield_cb() buf overrun
cdr_object_update_party_b_userfield_cb() could overrun the fixed buffer if
the supplied string is too long.  The long string could be supplied by
external means using the CDR(userfield) function.

This may seem reminiscent to AST-2017-001 (ASTERISK_26897) and it is.  The
earlier patch fixed the buffer overrun for Party A's userfield while this
patch fixes the same thing for Party B's userfield.

ASTERISK-27337

Change-Id: I0fa767f65ecec7e676ca465306ff9e0edbf3b652
2017-11-08 05:40:54 -07:00
Kevin Harwell
fbaca8d545 Update for 15.1.0 15.1.0 2017-10-30 10:49:35 -05:00
Kevin Harwell
75a97ab9cd Update for 15.1.0-rc2 15.1.0-rc2 2017-10-25 15:11:26 -05:00
George Joseph
52cd94eea6 Merge "http.c: Fix http header send content." into 15.1 2017-10-25 14:58:27 -05:00
Joshua Colp
4a9525a52b res_xmpp: Ensure the connection filter is available.
Users of the API that res_xmpp provides expect that a
filter be available on the client at all times. When
OAuth authentication support was added this requirement
was not maintained.

This change merely moves the OAuth authentication to
after the filter is created, ensuring users of res_xmpp
can add things to the filter as needed.

ASTERISK-27346

Change-Id: I4ac474afe220e833288ff574e32e2b9a23394886
(cherry picked from commit 0efeb7885a)
2017-10-25 11:23:14 -05:00
Ben Ford
f534b40813 http.c: Fix http header send content.
Currently ast_http_send barricades a portion of the content that
needs to be sent in order to establish a connection for things
like the ARI client. The conditional and contents have been changed
to ensure that everything that needs to be sent, will be sent.

ASTERISK-27372

Change-Id: I8816d2d8f80f4fefc6dcae4b5fdfc97f1e46496d
2017-10-25 10:40:00 -05:00
Kevin Harwell
620d45dbf2 Update for 15.1.0-rc1 15.1.0-rc1 2017-10-13 13:19:25 -05:00
Kevin Harwell
f1b646805e AMI: Increase version number
Bump the AMI patch number since the following new addition was made:

* Added a new CancelAtxfer action that cancels an attended transfer.

Change-Id: I9bac528791bd62ef0e99243903b6bc7a6c7ab182
2017-10-13 12:12:34 -05:00
Joshua Colp
9f9371952c Merge "features, manager : Add CancelAtxfer AMI action" into 15 2017-10-13 07:53:29 -05:00
Thomas Sevestre
eadea6f55b features, manager : Add CancelAtxfer AMI action
Add action to cancel feature attended transfer with AMI interface

ASTERISK-27215 #close

Change-Id: Iab8a81362b5a1757e2608f70b014ef863200cb42
2017-10-12 13:31:16 -05:00
Daniel Tryba
a7d977d986 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:06:03 -05:00
Jenkins2
59f732b675 Merge "sorcery: Use ao2_weakproxy to hold list of instances." into 15 2017-10-12 10:44:11 -05:00
Jenkins2
ae5ecbd739 Merge "named_locks: Use ao2_weakproxy_find." into 15 2017-10-12 10:19:44 -05:00
Joshua Colp
13c4c50252 Merge "astobj2: Add ao2_weakproxy_find function." into 15 2017-10-12 09:37:40 -05:00
Jenkins2
8e50cc9034 Merge "astobj2: Run weakproxy callbacks outside of lock." into 15 2017-10-12 09:04:39 -05:00
Jenkins2
5d899db84d Merge "cdr.c: Defer misc checks." into 15 2017-10-12 08:02:29 -05:00
Jenkins2
929bdbfa19 Merge "res_pjsip: Prevent "user=phone" being added multiple times to header" into 15 2017-10-12 07:04:00 -05:00
Jenkins2
be4090d496 Merge "cdr_mysql: avoid releasing a config string" into 15 2017-10-11 19:45:43 -05:00
Joshua Colp
6c67c25bf4 Merge "chan_vpb: Fix a gcc 7 out-of-bounds complaint" into 15 2017-10-11 16:38:51 -05:00
Jenkins2
6022fe5821 Merge "app_originate: Set ORIGINATE_STATUS correctly on failure" into 15 2017-10-11 15:42:16 -05:00
Daniel Tryba
3a692949b7 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 15:36:20 -05:00
Tzafrir Cohen
21e981982f 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:50 -05:00
Jenkins2
2bbb871b10 Merge "app_queue.c: clear moh field in init_queue" into 15 2017-10-11 14:43:55 -05:00
Richard Mudgett
f8da683a16 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:40 -05:00
Jenkins2
8f0ce6483e Merge "cdr.c: Eliminated simple RAII_VAR usages." into 15 2017-10-11 12:09:59 -05:00
George Joseph
4d518dd748 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 07:10:29 -05:00
Corey Farrell
cd521f166f sorcery: Use ao2_weakproxy to hold list of instances.
Store weak proxy objects in instances container.

Change-Id: I5a150a4e13cee319d46b5a4654f95a4623a978f8
2017-10-11 07:53:20 -04:00
Jenkins2
defa7084c7 Merge "res_pjsip_registrar.c: Update remove_existing AOR contact handling." into 15 2017-10-11 06:42:29 -05:00
Corey Farrell
d0a49d84ac named_locks: Use ao2_weakproxy_find.
Change-Id: I0ce8a1b7101b6caac6a19f83a89f00eaba1e9d9c
2017-10-10 20:17:13 -04:00
Corey Farrell
e54238388d astobj2: Add ao2_weakproxy_find function.
This function finds a weak proxy in an ao2_container and returns the
real object associated with it.

Change-Id: I9da822049747275f5961b5c0a7f14e87157d65d8
2017-10-10 20:17:09 -04:00
Corey Farrell
0727a8e524 astobj2: Run weakproxy callbacks outside of lock.
Copy the list of weakproxy callbacks to temporary memory so they can be
run without holding the weakproxy lock.

Change-Id: Ib167622a8a0f873fd73938f7611b2a5914308047
2017-10-10 20:16:59 -04:00
Sean Bright
9acfcefbd3 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:25:21 -04:00
Torrey Searle
7155055b9f contrib/thirdparty/sip_to_pjsip: add additional flag mappings
add mappings for udptl redundancy, rtptimeout, and debug flags

Change-Id: Ie73cf5c83c05dee01eb9624ede76c1a30225d73a
2017-10-10 10:50:10 -05:00
Richard Mudgett
a22ac5eee1 cdr.c: Eliminated simple RAII_VAR usages.
Change-Id: I150505db307249a962987e7b941bdd369bb91f35
2017-10-10 09:59:20 -05:00
Jenkins2
bc76eb294f Merge "res_pjproject: Fix cleanup of buildopts vector." into 15 2017-10-10 08:30:37 -05:00
Jenkins2
caad08d4ec Merge "tcptls: Do not re-bind to wildcard on client creation." into 15 2017-10-10 07:50:28 -05:00
Corey Farrell
d106e63258 res_pjproject: Fix cleanup of buildopts vector.
ASTERISK-27306

Change-Id: I3bed0edf3f55b1d4adcbabb25ec14f11dc766c72
2017-10-09 23:17:19 -05:00
Jenkins2
75525ab378 Merge "res_pjsip: Fix issues that prevented shutdown of modules." into 15 2017-10-09 20:19:20 -05:00
Jenkins2
9304e90657 Merge "cdr.c: Replace redundant check with an ast_assert()" into 15 2017-10-09 19:48:32 -05:00