Commit Graph

29927 Commits

Author SHA1 Message Date
Jenkins2 12e63bdefc Merge "Fix downloader not working with curl" 2017-08-18 10:36:46 -05:00
Sean Bright 667986d875 res_calendar_icalendar: Properly handle recurring events
When looking for recurring events, use the correct end time based on the
configured 'timeframe.'

ASTERISK-27174 #close
Reported by: Mark Thompson

Change-Id: Id90c3cfc79d561a5521d79be176683e225f2edef
2017-08-17 12:15:52 -05:00
George Joseph 0e777258be Fix downloader not working with curl
The codec/dpma downloader wasn't handling curl correctly.  The logic
that transforms makeopts into a bash-sourceable file wasn't
handling the make 'or' command in DOWNLOAD_TIMEOUT so bash was
looking for an 'or' command.

That logic has been eliminated.  Instead of trying to transform
and source makeopts, the downloader now calls a make scriptlet
to print the value of a specific variable.  This way, make handles
the ors (or any other make construct that happens to creep into
that file).

ASTERISK-27202
Reported by: Sean McCord

Change-Id: Iadfb6693528e4d4da7b8bb201fa66da2c71c7f99
2017-08-16 16:11:58 -05:00
Kevin Harwell e4e2e53c8a manager: hook event is not being raised
When the iostream code went in it introduced a conditional that made it so the
hook event was not being raised even if a hook is present. This patch adds a
check to see if a hook is present in astman_append. If so then call into the
send_string function, which in turn raises the even for specified hook.

Also updated the ami hooks unit test, so the test could be automated.

ASTERISK-27200 #close

Change-Id: Iff37f02f9708195d8f23e68f959d6eab720e1e36
2017-08-16 09:42:11 -05:00
Jenkins2 abed04aebc Merge "configure: Check cache for valid pjproject tarball before downloading." 2017-08-16 07:32:16 -05:00
Richard Mudgett c049d1c3b2 configure: Check cache for valid pjproject tarball before downloading.
On a fresh Asterisk source directory, the bundled pjproject tarball is
unconditionally downloaded even if the tarball is already in a specified
cache directory.

* Made check if the pjproject tarball is valid in the cache directory
before downloading the tarball on a fresh source directory.

Change-Id: Ic7ec842d3c97ecd8dafbad6f056b7fdbce41cae5
2017-08-15 15:23:56 -05:00
Richard Mudgett 9e2b2a9837 res_pjsip: Fix prune_on_boot to remove only contacts for the host.
* Check that the contact's reg_server matches the host's name before
deleting any prune_on_boot contacts.  We don't want to delete reliable
transport contacts made with other servers if the ps_contacts database
table is shared with other servers.

Thanks to Ross Beer for pointing out that the original prune logic would
delete reliable transport contacts from other servers.

ASTERISK-27147

Change-Id: I8e439d0d1c266ffdfd7b73d1e5e466180a689bd0
2017-08-15 11:22:54 -05:00
Andrey Egorov 15fbcc74d8 res_xmpp: Google OAuth 2.0 protocol support for XMPP / Motif
Add ability to use tokens instead of passwords according to Google OAuth 2.0
protocol.

ASTERISK-27169
Reported by: Andrey Egorov
Tested by: Andrey Egorov

Change-Id: I07f7052a502457ab55010a4d3686653b60f4c8db
2017-08-15 06:09:52 -05:00
Jenkins2 9c0bdf3b5d Merge "STUN/netsock2: Fix some valgrind uninitialized memory findings." 2017-08-14 13:45:25 -05:00
George Joseph 592f816290 Merge "res_pjsip_outbound_registration.c: Re-REGISTER on transport shutdown." 2017-08-14 12:20:21 -05:00
George Joseph 8a58f3c600 Merge "res_pjsip: Remove ephemeral registered contacts on transport shutdown." 2017-08-14 12:20:14 -05:00
George Joseph d21ab7663d Merge "res_pjsip: PJSIP Transport state monitor refactor." 2017-08-14 12:19:53 -05:00
Jenkins2 474fc166e8 Merge "res_pjsip_transport_management.c: Rename some variables." 2017-08-14 09:28:41 -05:00
Richard Mudgett bd28a9bbd8 STUN/netsock2: Fix some valgrind uninitialized memory findings.
* netsock2.c: Test the addr->len member first as it may be the only member
initialized in the struct.

* stun.c:ast_stun_handle_packet(): The combinded[] local array could get
used uninitialized by ast_stun_request().  The uninitialized string gets
copied to another location and could overflow the destination memory
buffer.

These valgrind findings were found for ASTERISK_27150 but are not
necessarily a fix for the issue.

Change-Id: I55f8687ba4ffc0f69578fd850af006a56cbc9a57
2017-08-10 14:38:12 -05:00
Richard Mudgett 1bec781cce res_pjsip_outbound_registration.c: Re-REGISTER on transport shutdown.
The fix for the issue is broken up into three parts.

This is part three which handles the client side of REGISTER requests.
The registered contact may no longer be valid on the server when the
transport used is reliable and the connection is broken.

* Re-REGISTER our contact if the reliable transport is broken after
registration completes.  We attempt to re-REGISTER immediately to minimize
the time we are unreachable.  Time may have already passed between the
connection being broken and the loss being detected.

* Reorder sip_outbound_registration_state_alloc() so the STATSD_GUAGE's
are still correct if an allocation failure happens.

ASTERISK-27147

Change-Id: I3668405b1ee75dfefb07c0d637826176f741ce83
2017-08-10 12:18:58 -05:00
Richard Mudgett 82f4ade959 res_pjsip: Remove ephemeral registered contacts on transport shutdown.
The fix for the issue is broken up into three parts.

This is part two which handles the server side of REGISTER requests when
rewrite_contact is enabled.  Any registered reliable transport contact
becomes invalid when the transport connection becomes disconnected.

* Monitor the rewrite_contact's reliable transport REGISTER contact for
shutdown.  If it is shutdown then the contact must be removed because it
is no longer valid.  Otherwise, when the client attempts to re-REGISTER it
may be blocked because the invalid contact is there.  Also if we try to
send a call to the endpoint using the invalid contact then the endpoint is
not likely to see the request.  The endpoint either won't be listening on
that port for new connections or a NAT/firewall will block it.

* Prune any rewrite_contact's registered reliable transport contacts on
boot.  The reliable transport no longer exists so the contact is invalid.

* Websockets always rewrite the REGISTER contact address and the transport
needs to be monitored for shutdown.

* Made the websocket transport set a unique name since that is what we use
as the ao2 container key.  Otherwise, we would not know which transport we
find when one of them shuts down.  The names are also used for PJPROJECT
debug logging.

* Made the websocket transport post the PJSIP_TP_STATE_CONNECTED state
event.  Now the global keep_alive_interval option, initially idle shutdown
timer, and the server REGISTER contact monitor can work on wetsocket
transports.

* Made the websocket transport set the PJSIP_TP_DIR_INCOMING direction.
Now initially idle websockets will automatically shutdown.

ASTERISK-27147

Change-Id: I397a5e7d18476830f7ffe1726adf9ee6c15964f4
2017-08-10 12:18:58 -05:00
Richard Mudgett 1dcb92bba8 res_pjsip: PJSIP Transport state monitor refactor.
The fix for the issue is broken up into three parts.

This is part one which refactors the transport state monitor code to allow
more modules to be able to monitor transports.

* Pull the management of PJPROJECT's transport state callback code from
res_pjsip_transport_management.c into res_pjsip.  Now other modules can
dynamically add and remove themselves from transport monitoring without
worrying about breaking PJPROJECT's callback chain.

* Add the ability for other modules to get a callback whenever a specific
transport is shutdown.

ASTERISK-27147

Change-Id: I7d9a31371eb1487c9b7050cf82a9af5180a57912
2017-08-10 12:18:58 -05:00
Richard Mudgett ee5edfb050 res_pjsip_transport_management.c: Rename some variables.
* Use monitored instead of the misleading keepalive name.

Change-Id: I9e5bcbb4ab2b82d49bcd0f06dfe85d15e0b552b6
2017-08-10 12:18:58 -05:00
Richard Mudgett ecd1f87edf UPGRADE notes: Prepare for the eventual 16 branch.
Change-Id: I4ca2f07ed62d77f1fdd10c3b216f6a28dd75720c
2017-08-10 11:46:42 -05:00
Scott Griepentrog 4ed2733dde res_pjsip_messaging: IPv6 receive address needs brackets
When handling an incoming SIP MESSAGE, PJSIP
attaches the IP address that the message was
received from to the message in the variable
PJSIP_RECVADDR.  When the IP address is IPv6
the :PORT appended results in an unparseable
mess. By using an additional bit flag on the
pj_sockaddr_print call, the conventional use
of brackets around the address is achieved.

ASTERISK-27193 #close

Change-Id: I12342521f2ce87a5b6e4883d480a3fd957aa9fd9
2017-08-10 09:23:38 -05:00
Jenkins2 f5f0b73e3f Merge "Make --with-pjproject-bundled the default for Asterisk 15" 2017-08-10 07:25:26 -05:00
Jenkins2 08d22bedcc Merge "res_rtp_asterisk: Make P2P bridge Asymmetric codec aware" 2017-08-09 15:39:34 -05:00
Torrey Searle d430f718f5 res_rtp_asterisk: enable rtcp & QOS stats on native bridge
Asterisk wasn't generating or forwarding RTCP packets when native
bridge was activated.  Also the stats weren't available via
CHANNEL(qos). Now the RTCP stats are always calculated.

ASTERISK-27158 #close

Change-Id: I46fb8f61c95e836b9d2dda6054b0cf205c16037b
2017-08-09 09:22:48 -05:00
Torrey Searle a2dde59154 res_rtp_asterisk: Make P2P bridge Asymmetric codec aware
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-09 08:57:50 -05:00
Jenkins2 df4bcdda2a Merge "res_pjsip_session/_sdp_rtp: Handling of 'msid' is incorrect" 2017-08-09 08:15:24 -05:00
George Joseph 305bd0d99f Make --with-pjproject-bundled the default for Asterisk 15
'--with-pjproject-bundled' is now the default when running
./configure. It can be disabled with '--without-pjproject-bundled'.

To make building without an internet connection easier, a new
./configure option '--with-download-cache' was added that sets
the cache for externals (like pjproject, the codecs and the DPMA),
AND the sounds files.  It can also be specified as an environment
variable named "AST_DOWNLOAD_CACHE".  The existing
'--with-sounds-cache' option / SOUNDS_CACHE_DIR env variable and
'--with-externals-cache' option / EXTERNALS_CACHE_DIR env variable
remain and if specified, will override '--with-downloads-cache'.

ASTERISK-27189

Change-Id: Ifa9783fddf44aafadb060c9feba713dfa81d38ce
2017-08-08 16:43:00 -05:00
Joshua Colp 62092bc114 res_pjsip_session: Release media resources on session end quicker.
A change was made long ago where the session was kept around
until the underlying INVITE session had been destroyed. This
had the side effect of also keeping the underlying media resources
around for this time as well.

This change ensures that when we are told to terminate the
session we immediately release any media sessions associated
with it.

ASTERISK-27110

Change-Id: I643e431d5c3bf05cda220c1d39e824a505a29b82
2017-08-07 19:54:01 -05:00
Jenkins2 2ea19e7140 Merge "bridge: Fix stream topology/participant locking and video misrouting." 2017-08-07 18:49:24 -05:00
Joshua Colp 04b300525a Merge "chan_sip: Access incoming REFER headers in dialplan" 2017-08-07 09:51:57 -05:00
Jenkins2 80ed3b39d5 Merge "channel: Fix leak on successful call to chan->tech->requester." 2017-08-07 09:30:21 -05:00
Joshua Colp dcd846c321 Merge "res_pjsip_nat.c: Remove unnecessary CMP_STOP." 2017-08-07 08:31:50 -05:00
Jenkins2 e0aed61e96 Merge "Support GMIME 3.0" 2017-08-07 07:33:03 -05:00
Jenkins2 1fde9dc7a5 Merge "app_privacy: remove unused header asterisk/image.h" 2017-08-07 07:04:13 -05:00
kkm 4b58609c33 chan_sip: Access incoming REFER headers in dialplan
This adds a way to access information passed along with SIP headers in
a REFER message that initiates a transfer. Headers matching a dialplan
variable GET_TRANSFERRER_DATA in the transferrer channel are added to
a HASH object TRANSFER_DATA to be accessed with functions HASHKEY and HASH.

The variable GET_TRANSFERRER_DATA is interpreted to be a prefix for
headers that should be put into the hash. If not set, no headers are
included. If set to a string (perhaps 'X-' in a typical case), all headers
starting this string are added. Empty string matches all headers.

If there are multiple of the same header, only the latest occurrence in
the REFER message is available in the hash.

Obviously, the variable GET_TRANSFERRER_DATA must be inherited by the
referrer channel, and should be set with the '_' or '__' prefix.

I avoided a specific reference to SIP or REFER, as in my mind the mechanism
can be generalized to other channel techs.

ASTERISK-27162

Change-Id: I73d7a1e95981693bc59aa0d5093c074b555f708e
2017-08-07 11:17:39 +00:00
Joshua Colp 88c65f7cb6 bridge: Fix stream topology/participant locking and video misrouting.
This change fixes a few locking issues and some video misrouting.

1. When accessing the stream topology of a channel the channel lock
must be held to guarantee the topology remains valid.

2. When a channel was joined to a bridge the bridge specific
implementation for stream mapping was not invoked, causing video
to be misrouted for a brief period of time.

ASTERISK-27182

Change-Id: I5d2f779248b84d41c5bb3896bf22ba324b336b03
2017-08-06 16:15:34 +00:00
Corey Farrell 16cfc3a954 channel: Fix leak on successful call to chan->tech->requester.
joint_cap needs to be released unconditionally as chan->tech->requester
does not steal the reference even on success.

ASTERISK-27180 #close

Change-Id: I647728992559bdb0a9c7357c20be1b36400d68b6
2017-08-05 16:15:31 -04:00
Kevin Harwell 104a8047a5 res_pjsip_session/_sdp_rtp: Handling of 'msid' is incorrect
Currently, the handling of the msid attribute is not quite right. According to
the spec the msid's between the offer/answer are not dependent upon one another.
Meaning the same msid's given in an offer do not have to be returned in the
answer for a given stream. And they probably shouldn't be (copied/reused) since
this can potentially cause some browser side confusion.

This patch generates new msids when both an offer and answer are sent from
Asterisk. However, Asterisk does reuse the original msid it sent out for a
reinvite. Also audio+video streams are paired together by sharing the same
stream id, but a different track id.

ASTERISK-27179 #close

Change-Id: Ifaec06dc7e65ad841633a24ebec8c8a9302d6643
2017-08-04 17:15:40 -05:00
Jenkins2 2ba29df200 Merge "alembic/res_pjsip: Add "webrtc" configuration option" 2017-08-04 13:11:34 -05:00
Joshua Colp 1f01106cfc Merge "chan_sip: Add dialplan function SIP_HEADERS" 2017-08-04 12:57:58 -05:00
Jenkins2 38c8080cdd Merge "Fix compile error for old versions of GCC." 2017-08-04 12:03:23 -05:00
Jenkins2 9850034f6a Merge "Correct some leaks in unit tests." 2017-08-04 11:50:45 -05:00
Jenkins2 7af10de1ba Merge "res_pjsip_transport_websocket.c: Fix serializer ref leak." 2017-08-04 10:51:42 -05:00
Jenkins2 50d842b79a Merge "res_pjsip_outbound_registration.c: Misc fixes." 2017-08-04 10:00:56 -05:00
Corey Farrell 7f8f3ca4dd Correct some leaks in unit tests.
* chan_sip: channel in test_sip_rtpqos_1.
* test_config: config hook, config info and global config holder.
* test_core_format: format in format_attribute_set_without_interface.
* test_stream: unneeded frame duplication.
* test_taskprocessor: task_data.

Change-Id: I94d364d195cf3b3b5de2bf3ad565343275c7ad31
2017-08-03 22:09:28 -04:00
Richard Mudgett 842e1414d0 res_pjsip_transport_websocket.c: Fix serializer ref leak.
Change-Id: Ib5a19bfd597f63d9021baeb645fc11153b3afa57
2017-08-03 16:35:49 -05:00
Richard Mudgett 615b6a200a res_pjsip_outbound_registration.c: Misc fixes.
* Remove unnecessary CMP_STOP.

* In handle_client_registration() use DEBUG_ATLEAST() to only do work
needed for the debug log message when the debug log message is needed.

* In sip_outbound_registration_state_destroy() check state->registration
for NULL.

Change-Id: I656d0fa11dda0b00048103efb1558e67a426fd80
2017-08-03 16:26:52 -05:00
Richard Mudgett 564927c5ed res_pjsip_nat.c: Remove unnecessary CMP_STOP.
Change-Id: I6279b0d723bc3b75b8d65e81e02da9ea9bc0c3da
2017-08-03 16:24:22 -05:00
Richard Mudgett 5655cded78 res_pjsip_registrar.c: Remove unnecessary CMP_STOP.
Most uses of CMP_STOP are superfluous and are only respected when
OBJ_MULTIPLE is used to search the container.

Change-Id: I20571a202ec0aa1098bb2749eeba18de7ca110b8
2017-08-03 16:22:15 -05:00
Tzafrir Cohen 123c93a77c Support GMIME 3.0
Support building the Asterisk httpd with version 3.0 of gmime as
well as earlier versions of that library.

ASTERISK-27173

Change-Id: I7e13dd05a3083ccb0df2dabf83110223f6a9fa8f
2017-08-03 14:15:26 -04:00
Kevin Harwell 521b6fed12 alembic/res_pjsip: Add "webrtc" configuration option
When the "webrtc" option was added in res_pjsip it was not added to the alembic
scripts. This patch adds the option for alembic.

Also, changed the sorcery configuration type to an OPT_YESNO_T value instead of
an OPT_BOOL_T so if this field is ever written to a database it will write out
the correct value.

ASTERISK-27119 #close

Change-Id: I3e199f060aea25e193c439fc5cf96be4d3ed1c7b
2017-08-03 11:44:28 -05:00