[asterisk-commits] dlee: branch dlee/record r395138 - in /team/dlee/record: ./ apps/ apps/confbr...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jul 23 10:00:15 CDT 2013
Author: dlee
Date: Tue Jul 23 10:00:12 2013
New Revision: 395138
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395138
Log:
Merged revisions 394776-395136 from http://svn.asterisk.org/svn/asterisk/trunk
Added:
team/dlee/record/channels/chan_bridge_media.c
- copied unchanged from r395136, trunk/channels/chan_bridge_media.c
team/dlee/record/configs/safe_asterisk.conf.sample
- copied unchanged from r395136, trunk/configs/safe_asterisk.conf.sample
Modified:
team/dlee/record/ (props changed)
team/dlee/record/CHANGES
team/dlee/record/Makefile
team/dlee/record/apps/app_celgenuserevent.c
team/dlee/record/apps/app_dial.c
team/dlee/record/apps/app_directed_pickup.c
team/dlee/record/apps/app_queue.c
team/dlee/record/apps/confbridge/conf_chan_announce.c
team/dlee/record/apps/confbridge/conf_chan_record.c
team/dlee/record/apps/confbridge/confbridge_manager.c
team/dlee/record/bridges/bridge_native_rtp.c
team/dlee/record/channels/chan_dahdi.c
team/dlee/record/channels/chan_gulp.c
team/dlee/record/channels/chan_sip.c
team/dlee/record/channels/iax2/parser.c
team/dlee/record/channels/sig_analog.c
team/dlee/record/configs/iax.conf.sample
team/dlee/record/configs/indications.conf.sample
team/dlee/record/contrib/realtime/postgresql/realtime.sql
team/dlee/record/contrib/scripts/safe_asterisk
team/dlee/record/funcs/func_channel.c
team/dlee/record/include/asterisk/astobj2.h
team/dlee/record/include/asterisk/audiohook.h
team/dlee/record/include/asterisk/cel.h
team/dlee/record/include/asterisk/channel.h
team/dlee/record/include/asterisk/core_unreal.h
team/dlee/record/include/asterisk/logger.h
team/dlee/record/include/asterisk/res_sip.h
team/dlee/record/include/asterisk/res_sip_session.h
team/dlee/record/include/asterisk/stasis_app.h
team/dlee/record/include/asterisk/stasis_app_playback.h
team/dlee/record/include/asterisk/stasis_channels.h
team/dlee/record/include/asterisk/stasis_message_router.h
team/dlee/record/include/asterisk/stasis_system.h
team/dlee/record/main/asterisk.c
team/dlee/record/main/audiohook.c
team/dlee/record/main/bridging.c
team/dlee/record/main/ccss.c
team/dlee/record/main/cdr.c
team/dlee/record/main/cel.c
team/dlee/record/main/channel.c
team/dlee/record/main/core_unreal.c
team/dlee/record/main/features.c
team/dlee/record/main/http.c
team/dlee/record/main/manager.c
team/dlee/record/main/manager_bridging.c
team/dlee/record/main/manager_channels.c
team/dlee/record/main/pbx.c
team/dlee/record/main/stasis_channels.c
team/dlee/record/main/stasis_message_router.c
team/dlee/record/main/stasis_system.c
team/dlee/record/res/parking/parking_manager.c
team/dlee/record/res/res_sip.c
team/dlee/record/res/res_sip/sip_configuration.c
team/dlee/record/res/res_sip/sip_options.c
team/dlee/record/res/res_sip_sdp_rtp.c
team/dlee/record/res/res_sip_session.c
team/dlee/record/res/res_sip_session.exports.in
team/dlee/record/res/res_stasis.c
team/dlee/record/res/res_stasis_http_bridges.c
team/dlee/record/res/res_stasis_http_channels.c
team/dlee/record/res/res_stasis_http_playback.c
team/dlee/record/res/res_stasis_playback.c
team/dlee/record/res/stasis/app.c
team/dlee/record/res/stasis/app.h
team/dlee/record/res/stasis/control.c
team/dlee/record/res/stasis_http/ari_model_validators.c
team/dlee/record/res/stasis_http/ari_model_validators.h
team/dlee/record/res/stasis_http/resource_bridges.c
team/dlee/record/res/stasis_http/resource_bridges.h
team/dlee/record/res/stasis_http/resource_channels.c
team/dlee/record/res/stasis_http/resource_channels.h
team/dlee/record/rest-api/api-docs/bridges.json
team/dlee/record/rest-api/api-docs/channels.json
team/dlee/record/rest-api/api-docs/playback.json
team/dlee/record/rest-api/api-docs/recordings.json
team/dlee/record/tests/test_cel.c
team/dlee/record/tests/test_stasis.c
Propchange: team/dlee/record/
------------------------------------------------------------------------------
--- branch-11-blocked (original)
+++ branch-11-blocked Tue Jul 23 10:00:12 2013
@@ -1,1 +1,1 @@
-/branches/11:373240,375247,375702,385356
+/branches/11:373240,375247,375702,385356,395020
Propchange: team/dlee/record/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.
Propchange: team/dlee/record/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Jul 23 10:00:12 2013
@@ -1,1 +1,1 @@
-/trunk:1-394772
+/trunk:1-395137
Modified: team/dlee/record/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/CHANGES?view=diff&rev=395138&r1=395137&r2=395138
==============================================================================
--- team/dlee/record/CHANGES (original)
+++ team/dlee/record/CHANGES Tue Jul 23 10:00:12 2013
@@ -294,6 +294,10 @@
the Local channel. This affects the LocalBridge, LocalOptimizationBegin,
and LocalOptimizationEnd events.
+ * The option 'allowmultiplelogin' can now be set or overriden in a particular
+ account. When set in the general context, it will act as the default
+ setting for defined accounts.
+
AGI (Asterisk Gateway Interface)
------------------
* The manager event AGIExec has been split into AGIExecStart and AGIExecEnd.
@@ -319,6 +323,27 @@
* When a CDR is dispatched, user defined CDR variables from both parties are
included in the resulting CDR. If both parties have the same variable, only
the Party A value is provided.
+
+CEL (Channel Event Logging)
+------------------
+ * The 'extra' field of all CEL events that use it now consists of a JSON blob
+ with key/value pairs which are defined in the Asterisk 12 CEL documentation.
+
+ * AST_CEL_BLINDTRANSFER events now report the transferee bridge unique
+ identifier, extension, and context in a JSON blob as the extra string
+ instead of the transferee channel name as the peer.
+
+ * AST_CEL_ATTENDEDTRANSFER events now report the peer as NULL and additional
+ information in the 'extra' string as a JSON blob. For transfers that occur
+ between two bridged channels, the 'extra' JSON blob contains the primary
+ bridge unique identifier, the secondary channel name, and the secondary
+ bridge unique identifier. For transfers that occur between a bridged channel
+ and a channel running an app, the 'extra' JSON blob contains the primary
+ bridge unique identifier, the secondary channel name, and the app name.
+
+ * AST_CEL_LOCAL_OPTIMIZE events have been added to convey local channel
+ optimizations with the record occurring for the semi-one channel and
+ the semi-two channel name in the peer field.
Features
-------------------
@@ -555,6 +580,18 @@
If no resources exist or all are unavailable the device state is considered
to be unavailable.
+
+Scripts
+------------------
+
+safe_asterisk
+------------------
+ * The safe_asterisk script will now install over previously installations.
+ In previous versions of Asterisk, once installed a 'make install' would
+ skip over safe_asterisk if it was already installed.
+ * Certain options in safe_asterisk can now be configured from the
+ safe_asterisk.conf file. A sample version of this is located in the
+ configs/ folder.
------------------------------------------------------------------------------
--- Functionality changes from Asterisk 10 to Asterisk 11 --------------------
Modified: team/dlee/record/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/Makefile?view=diff&rev=395138&r1=395137&r2=395138
==============================================================================
--- team/dlee/record/Makefile (original)
+++ team/dlee/record/Makefile Tue Jul 23 10:00:12 2013
@@ -558,8 +558,8 @@
bininstall: _all installdirs $(SUBDIRS_INSTALL) main-bininstall
$(INSTALL) -m 755 contrib/scripts/astgenkey "$(DESTDIR)$(ASTSBINDIR)/"
$(INSTALL) -m 755 contrib/scripts/autosupport "$(DESTDIR)$(ASTSBINDIR)/"
- if [ ! -f "$(DESTDIR)$(ASTSBINDIR)/safe_asterisk" -a ! -f /sbin/launchd ]; then \
- cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;s|__ASTERISK_LOG_DIR__|$(ASTLOGDIR)|;' > contrib/scripts/safe.tmp ; \
+ if [ ! -f /sbin/launchd ]; then \
+ cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;s|__ASTERISK_LOG_DIR__|$(ASTLOGDIR)|;s|__ASTERISK_ETC_DIR__|$(ASTETCDIR)|;' > contrib/scripts/safe.tmp ; \
$(INSTALL) -m 755 contrib/scripts/safe.tmp "$(DESTDIR)$(ASTSBINDIR)/safe_asterisk" ; \
rm -f contrib/scripts/safe.tmp ; \
fi
Modified: team/dlee/record/apps/app_celgenuserevent.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/apps/app_celgenuserevent.c?view=diff&rev=395138&r1=395137&r2=395138
==============================================================================
--- team/dlee/record/apps/app_celgenuserevent.c (original)
+++ team/dlee/record/apps/app_celgenuserevent.c Tue Jul 23 10:00:12 2013
@@ -75,9 +75,9 @@
parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
- blob = ast_json_pack("{s: s, s: s}",
+ blob = ast_json_pack("{s: s, s: {s: s}}",
"event", args.event,
- "extra", args.extra);
+ "extra", "extra", args.extra);
if (!blob) {
return res;
}
Modified: team/dlee/record/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/apps/app_dial.c?view=diff&rev=395138&r1=395137&r2=395138
==============================================================================
--- team/dlee/record/apps/app_dial.c (original)
+++ team/dlee/record/apps/app_dial.c Tue Jul 23 10:00:12 2013
@@ -60,7 +60,6 @@
#include "asterisk/stringfields.h"
#include "asterisk/global_datastores.h"
#include "asterisk/dsp.h"
-#include "asterisk/cel.h"
#include "asterisk/aoc.h"
#include "asterisk/ccss.h"
#include "asterisk/indications.h"
Modified: team/dlee/record/apps/app_directed_pickup.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/apps/app_directed_pickup.c?view=diff&rev=395138&r1=395137&r2=395138
==============================================================================
--- team/dlee/record/apps/app_directed_pickup.c (original)
+++ team/dlee/record/apps/app_directed_pickup.c Tue Jul 23 10:00:12 2013
@@ -46,7 +46,6 @@
#include "asterisk/features.h"
#include "asterisk/manager.h"
#include "asterisk/callerid.h"
-#include "asterisk/cel.h"
#define PICKUPMARK "PICKUPMARK"
Modified: team/dlee/record/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/apps/app_queue.c?view=diff&rev=395138&r1=395137&r2=395138
==============================================================================
--- team/dlee/record/apps/app_queue.c (original)
+++ team/dlee/record/apps/app_queue.c Tue Jul 23 10:00:12 2013
@@ -103,7 +103,6 @@
#include "asterisk/taskprocessor.h"
#include "asterisk/aoc.h"
#include "asterisk/callerid.h"
-#include "asterisk/cel.h"
#include "asterisk/data.h"
#include "asterisk/term.h"
#include "asterisk/dial.h"
Modified: team/dlee/record/apps/confbridge/conf_chan_announce.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/apps/confbridge/conf_chan_announce.c?view=diff&rev=395138&r1=395137&r2=395138
==============================================================================
--- team/dlee/record/apps/confbridge/conf_chan_announce.c (original)
+++ team/dlee/record/apps/confbridge/conf_chan_announce.c Tue Jul 23 10:00:12 2013
@@ -134,6 +134,7 @@
.send_text = ast_unreal_sendtext,
.queryoption = ast_unreal_queryoption,
.setoption = ast_unreal_setoption,
+ .properties = AST_CHAN_TP_ANNOUNCER,
};
struct ast_channel_tech *conf_announce_get_tech(void)
Modified: team/dlee/record/apps/confbridge/conf_chan_record.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/apps/confbridge/conf_chan_record.c?view=diff&rev=395138&r1=395137&r2=395138
==============================================================================
--- team/dlee/record/apps/confbridge/conf_chan_record.c (original)
+++ team/dlee/record/apps/confbridge/conf_chan_record.c Tue Jul 23 10:00:12 2013
@@ -86,6 +86,7 @@
.call = rec_call,
.read = rec_read,
.write = rec_write,
+ .properties = AST_CHAN_TP_RECORDER,
};
struct ast_channel_tech *conf_record_get_tech(void)
Modified: team/dlee/record/apps/confbridge/confbridge_manager.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/apps/confbridge/confbridge_manager.c?view=diff&rev=395138&r1=395137&r2=395138
==============================================================================
--- team/dlee/record/apps/confbridge/confbridge_manager.c (original)
+++ team/dlee/record/apps/confbridge/confbridge_manager.c Tue Jul 23 10:00:12 2013
@@ -195,13 +195,16 @@
{
struct ast_bridge_blob *blob = stasis_message_data(message);
const char *conference_name;
- RAII_VAR(struct ast_str *, bridge_text,
- ast_manager_build_bridge_state_string(blob->bridge, ""),
- ast_free);
+ RAII_VAR(struct ast_str *, bridge_text, NULL, ast_free);
RAII_VAR(struct ast_str *, channel_text, NULL, ast_free);
ast_assert(blob != NULL);
ast_assert(event != NULL);
+
+ bridge_text = ast_manager_build_bridge_state_string(blob->bridge, "");
+ if (!bridge_text) {
+ return;
+ }
conference_name = ast_json_string_get(ast_json_object_get(blob->blob, "conference"));
ast_assert(conference_name != NULL);
Modified: team/dlee/record/bridges/bridge_native_rtp.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/bridges/bridge_native_rtp.c?view=diff&rev=395138&r1=395137&r2=395138
==============================================================================
--- team/dlee/record/bridges/bridge_native_rtp.c (original)
+++ team/dlee/record/bridges/bridge_native_rtp.c Tue Jul 23 10:00:12 2013
@@ -45,7 +45,6 @@
#include "asterisk/bridging_technology.h"
#include "asterisk/frame.h"
#include "asterisk/rtp_engine.h"
-#include "asterisk/audiohook.h"
/*! \brief Forward declarations for frame hook usage */
static int native_rtp_bridge_join(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
@@ -85,13 +84,7 @@
/*! \brief Internal helper function which checks whether the channels are compatible with our native bridging */
static int native_rtp_bridge_capable(struct ast_channel *chan)
{
- if (ast_channel_monitor(chan) || (ast_channel_audiohooks(chan) &&
- !ast_audiohook_write_list_empty(ast_channel_audiohooks(chan))) ||
- !ast_framehook_list_contains_no_active(ast_channel_framehooks(chan))) {
- return 0;
- } else {
- return 1;
- }
+ return ast_channel_has_audio_frame_or_monitor(chan);
}
/*! \brief Internal helper function which gets all RTP information (glue and instances) relating to the given channels */
Modified: team/dlee/record/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/channels/chan_dahdi.c?view=diff&rev=395138&r1=395137&r2=395138
==============================================================================
--- team/dlee/record/channels/chan_dahdi.c (original)
+++ team/dlee/record/channels/chan_dahdi.c Tue Jul 23 10:00:12 2013
@@ -107,7 +107,6 @@
#include "asterisk/callerid.h"
#include "asterisk/adsi.h"
#include "asterisk/cli.h"
-#include "asterisk/cel.h"
#include "asterisk/features.h"
#include "asterisk/musiconhold.h"
#include "asterisk/say.h"
Modified: team/dlee/record/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/channels/chan_gulp.c?view=diff&rev=395138&r1=395137&r2=395138
==============================================================================
--- team/dlee/record/channels/chan_gulp.c (original)
+++ team/dlee/record/channels/chan_gulp.c Tue Jul 23 10:00:12 2013
@@ -114,7 +114,6 @@
};
struct gulp_pvt {
- struct ast_sip_session *session;
struct ast_sip_session_media *media[SIP_MEDIA_SIZE];
};
@@ -122,9 +121,6 @@
{
struct gulp_pvt *pvt = obj;
int i;
-
- ao2_cleanup(pvt->session);
- pvt->session = NULL;
for (i = 0; i < SIP_MEDIA_SIZE; ++i) {
ao2_cleanup(pvt->media[i]);
@@ -336,12 +332,12 @@
static int media_offer_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
- struct gulp_pvt *pvt = ast_channel_tech_pvt(chan);
+ struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(chan);
if (!strcmp(data, "audio")) {
- return media_offer_read_av(pvt->session, buf, len, AST_FORMAT_TYPE_AUDIO);
+ return media_offer_read_av(channel->session, buf, len, AST_FORMAT_TYPE_AUDIO);
} else if (!strcmp(data, "video")) {
- return media_offer_read_av(pvt->session, buf, len, AST_FORMAT_TYPE_VIDEO);
+ return media_offer_read_av(channel->session, buf, len, AST_FORMAT_TYPE_VIDEO);
}
return 0;
@@ -349,10 +345,10 @@
static int media_offer_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
{
- struct gulp_pvt *pvt = ast_channel_tech_pvt(chan);
+ struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(chan);
struct media_offer_data mdata = {
- .session = pvt->session,
+ .session = channel->session,
.value = value
};
@@ -362,7 +358,7 @@
mdata.media_type = AST_FORMAT_TYPE_VIDEO;
}
- return ast_sip_push_task_synchronous(pvt->session->serializer, media_offer_write_av, &mdata);
+ return ast_sip_push_task_synchronous(channel->session->serializer, media_offer_write_av, &mdata);
}
static struct ast_custom_function media_offer_function = {
@@ -374,19 +370,24 @@
/*! \brief Function called by RTP engine to get local audio RTP peer */
static enum ast_rtp_glue_result gulp_get_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance **instance)
{
- struct gulp_pvt *pvt = ast_channel_tech_pvt(chan);
+ struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(chan);
+ struct gulp_pvt *pvt = channel->pvt;
struct ast_sip_endpoint *endpoint;
- if (!pvt || !pvt->session || !pvt->media[SIP_MEDIA_AUDIO]->rtp) {
+ if (!pvt || !channel->session || !pvt->media[SIP_MEDIA_AUDIO]->rtp) {
return AST_RTP_GLUE_RESULT_FORBID;
}
- endpoint = pvt->session->endpoint;
+ endpoint = channel->session->endpoint;
*instance = pvt->media[SIP_MEDIA_AUDIO]->rtp;
ao2_ref(*instance, +1);
ast_assert(endpoint != NULL);
+ if (endpoint->media_encryption != AST_SIP_MEDIA_ENCRYPT_NONE) {
+ return AST_RTP_GLUE_RESULT_FORBID;
+ }
+
if (endpoint->direct_media) {
return AST_RTP_GLUE_RESULT_REMOTE;
}
@@ -397,24 +398,33 @@
/*! \brief Function called by RTP engine to get local video RTP peer */
static enum ast_rtp_glue_result gulp_get_vrtp_peer(struct ast_channel *chan, struct ast_rtp_instance **instance)
{
- struct gulp_pvt *pvt = ast_channel_tech_pvt(chan);
-
- if (!pvt || !pvt->session || !pvt->media[SIP_MEDIA_VIDEO]->rtp) {
+ struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(chan);
+ struct gulp_pvt *pvt = channel->pvt;
+ struct ast_sip_endpoint *endpoint;
+
+ if (!pvt || !channel->session || !pvt->media[SIP_MEDIA_VIDEO]->rtp) {
return AST_RTP_GLUE_RESULT_FORBID;
}
+
+ endpoint = channel->session->endpoint;
*instance = pvt->media[SIP_MEDIA_VIDEO]->rtp;
ao2_ref(*instance, +1);
+ ast_assert(endpoint != NULL);
+ if (endpoint->media_encryption != AST_SIP_MEDIA_ENCRYPT_NONE) {
+ return AST_RTP_GLUE_RESULT_FORBID;
+ }
+
return AST_RTP_GLUE_RESULT_LOCAL;
}
/*! \brief Function called by RTP engine to get peer capabilities */
static void gulp_get_codec(struct ast_channel *chan, struct ast_format_cap *result)
{
- struct gulp_pvt *pvt = ast_channel_tech_pvt(chan);
-
- ast_format_cap_copy(result, pvt->session->endpoint->codecs);
+ struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(chan);
+
+ ast_format_cap_copy(result, channel->session->endpoint->codecs);
}
static int send_direct_media_request(void *data)
@@ -486,8 +496,9 @@
const struct ast_format_cap *cap,
int nat_active)
{
- struct gulp_pvt *pvt = ast_channel_tech_pvt(chan);
- struct ast_sip_session *session = pvt->session;
+ struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(chan);
+ struct gulp_pvt *pvt = channel->pvt;
+ struct ast_sip_session *session = channel->session;
int changed = 0;
struct ast_channel *bridge_peer;
@@ -544,7 +555,8 @@
{
struct ast_channel *chan;
struct ast_format fmt;
- struct gulp_pvt *pvt;
+ RAII_VAR(struct gulp_pvt *, pvt, NULL, ao2_cleanup);
+ struct ast_sip_channel_pvt *channel;
if (!(pvt = ao2_alloc(sizeof(*pvt), gulp_pvt_dtor))) {
return NULL;
@@ -552,27 +564,28 @@
if (!(chan = ast_channel_alloc(1, state, S_OR(session->id.number.str, ""), S_OR(session->id.name.str, ""), "", "", "", linkedid, 0, "Gulp/%s-%08x", ast_sorcery_object_get_id(session->endpoint),
ast_atomic_fetchadd_int((int *)&chan_idx, +1)))) {
- ao2_cleanup(pvt);
return NULL;
}
ast_channel_tech_set(chan, &gulp_tech);
- ao2_ref(session, +1);
- pvt->session = session;
+ if (!(channel = ast_sip_channel_pvt_alloc(pvt, session))) {
+ ast_hangup(chan);
+ return NULL;
+ }
+
/* If res_sip_session is ever updated to create/destroy ast_sip_session_media
* during a call such as if multiple same-type stream support is introduced,
* these will need to be recaptured as well */
pvt->media[SIP_MEDIA_AUDIO] = ao2_find(session->media, "audio", OBJ_KEY);
pvt->media[SIP_MEDIA_VIDEO] = ao2_find(session->media, "video", OBJ_KEY);
- ast_channel_tech_pvt_set(chan, pvt);
+ ast_channel_tech_pvt_set(chan, channel);
if (pvt->media[SIP_MEDIA_AUDIO] && pvt->media[SIP_MEDIA_AUDIO]->rtp) {
ast_rtp_instance_set_channel_id(pvt->media[SIP_MEDIA_AUDIO]->rtp, ast_channel_uniqueid(chan));
}
if (pvt->media[SIP_MEDIA_VIDEO] && pvt->media[SIP_MEDIA_VIDEO]->rtp) {
ast_rtp_instance_set_channel_id(pvt->media[SIP_MEDIA_VIDEO]->rtp, ast_channel_uniqueid(chan));
}
-
if (ast_format_cap_is_empty(session->req_caps) || !ast_format_cap_has_joint(session->req_caps, session->endpoint->codecs)) {
ast_format_cap_copy(ast_channel_nativeformats(chan), session->endpoint->codecs);
@@ -637,8 +650,7 @@
/*! \brief Function called by core when we should answer a Gulp session */
static int gulp_answer(struct ast_channel *ast)
{
- struct gulp_pvt *pvt = ast_channel_tech_pvt(ast);
- struct ast_sip_session *session = pvt->session;
+ struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(ast);
if (ast_channel_state(ast) == AST_STATE_UP) {
return 0;
@@ -646,10 +658,10 @@
ast_setstate(ast, AST_STATE_UP);
- ao2_ref(session, +1);
- if (ast_sip_push_task(session->serializer, answer, session)) {
+ ao2_ref(channel->session, +1);
+ if (ast_sip_push_task(channel->session->serializer, answer, channel->session)) {
ast_log(LOG_WARNING, "Unable to push answer task to the threadpool. Cannot answer call\n");
- ao2_cleanup(session);
+ ao2_cleanup(channel->session);
return -1;
}
@@ -659,8 +671,8 @@
/*! \brief Function called by core to read any waiting frames */
static struct ast_frame *gulp_read(struct ast_channel *ast)
{
- struct gulp_pvt *pvt = ast_channel_tech_pvt(ast);
- struct ast_sip_session *session = pvt->session;
+ struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(ast);
+ struct gulp_pvt *pvt = channel->pvt;
struct ast_frame *f;
struct ast_sip_session_media *media = NULL;
int rtcp = 0;
@@ -702,8 +714,8 @@
ast_set_write_format(ast, ast_channel_writeformat(ast));
}
- if (session->dsp) {
- f = ast_dsp_process(ast, session->dsp, f);
+ if (channel->session->dsp) {
+ f = ast_dsp_process(ast, channel->session->dsp, f);
if (f && (f->frametype == AST_FRAME_DTMF)) {
ast_debug(3, "* Detected inband DTMF '%c' on '%s'\n", f->subclass.integer,
@@ -717,7 +729,8 @@
/*! \brief Function called by core to write frames */
static int gulp_write(struct ast_channel *ast, struct ast_frame *frame)
{
- struct gulp_pvt *pvt = ast_channel_tech_pvt(ast);
+ struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(ast);
+ struct gulp_pvt *pvt = channel->pvt;
struct ast_sip_session_media *media;
int res = 0;
@@ -764,9 +777,10 @@
static int fixup(void *data)
{
struct fixup_data *fix_data = data;
- struct gulp_pvt *pvt = ast_channel_tech_pvt(fix_data->chan);
-
- fix_data->session->channel = fix_data->chan;
+ struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(fix_data->chan);
+ struct gulp_pvt *pvt = channel->pvt;
+
+ channel->session->channel = fix_data->chan;
if (pvt->media[SIP_MEDIA_AUDIO] && pvt->media[SIP_MEDIA_AUDIO]->rtp) {
ast_rtp_instance_set_channel_id(pvt->media[SIP_MEDIA_AUDIO]->rtp, ast_channel_uniqueid(fix_data->chan));
}
@@ -780,18 +794,17 @@
/*! \brief Function called by core to change the underlying owner channel */
static int gulp_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
{
- struct gulp_pvt *pvt = ast_channel_tech_pvt(newchan);
- struct ast_sip_session *session = pvt->session;
+ struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(newchan);
struct fixup_data fix_data;
- fix_data.session = session;
+ fix_data.session = channel->session;
fix_data.chan = newchan;
- if (session->channel != oldchan) {
- return -1;
- }
-
- if (ast_sip_push_task_synchronous(session->serializer, fixup, &fix_data)) {
+ if (channel->session->channel != oldchan) {
+ return -1;
+ }
+
+ if (ast_sip_push_task_synchronous(channel->session->serializer, fixup, &fix_data)) {
ast_log(LOG_WARNING, "Unable to perform channel fixup\n");
return -1;
}
@@ -990,8 +1003,8 @@
/*! \brief Function called by core to ask the channel to indicate some sort of condition */
static int gulp_indicate(struct ast_channel *ast, int condition, const void *data, size_t datalen)
{
- struct gulp_pvt *pvt = ast_channel_tech_pvt(ast);
- struct ast_sip_session *session = pvt->session;
+ struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(ast);
+ struct gulp_pvt *pvt = channel->pvt;
struct ast_sip_session_media *media;
int response_code = 0;
int res = 0;
@@ -999,7 +1012,7 @@
switch (condition) {
case AST_CONTROL_RINGING:
if (ast_channel_state(ast) == AST_STATE_RING) {
- if (session->endpoint->inband_progress) {
+ if (channel->session->endpoint->inband_progress) {
response_code = 183;
res = -1;
} else {
@@ -1008,7 +1021,7 @@
} else {
res = -1;
}
- ast_devstate_changed(AST_DEVICE_UNKNOWN, AST_DEVSTATE_CACHABLE, "Gulp/%s", ast_sorcery_object_get_id(session->endpoint));
+ ast_devstate_changed(AST_DEVICE_UNKNOWN, AST_DEVSTATE_CACHABLE, "Gulp/%s", ast_sorcery_object_get_id(channel->session->endpoint));
break;
case AST_CONTROL_BUSY:
if (ast_channel_state(ast) != AST_STATE_UP) {
@@ -1048,19 +1061,19 @@
case AST_CONTROL_VIDUPDATE:
media = pvt->media[SIP_MEDIA_VIDEO];
if (media && media->rtp) {
- ao2_ref(session, +1);
-
- if (ast_sip_push_task(session->serializer, transmit_info_with_vidupdate, session)) {
- ao2_cleanup(session);
+ ao2_ref(channel->session, +1);
+
+ if (ast_sip_push_task(channel->session->serializer, transmit_info_with_vidupdate, channel->session)) {
+ ao2_cleanup(channel->session);
}
} else {
res = -1;
}
break;
case AST_CONTROL_CONNECTED_LINE:
- ao2_ref(session, +1);
- if (ast_sip_push_task(session->serializer, update_connected_line_information, session)) {
- ao2_cleanup(session);
+ ao2_ref(channel->session, +1);
+ if (ast_sip_push_task(channel->session->serializer, update_connected_line_information, channel->session)) {
+ ao2_cleanup(channel->session);
}
break;
case AST_CONTROL_UPDATE_RTP_PEER:
@@ -1095,10 +1108,10 @@
}
if (response_code) {
- struct indicate_data *ind_data = indicate_data_alloc(session, condition, response_code, data, datalen);
- if (!ind_data || ast_sip_push_task(session->serializer, indicate, ind_data)) {
+ struct indicate_data *ind_data = indicate_data_alloc(channel->session, condition, response_code, data, datalen);
+ if (!ind_data || ast_sip_push_task(channel->session->serializer, indicate, ind_data)) {
ast_log(LOG_NOTICE, "Cannot send response code %d to endpoint %s. Could not queue task properly\n",
- response_code, ast_sorcery_object_get_id(session->endpoint));
+ response_code, ast_sorcery_object_get_id(channel->session->endpoint));
ao2_cleanup(ind_data);
res = -1;
}
@@ -1214,15 +1227,14 @@
/*! \brief Function called by core for Asterisk initiated transfer */
static int gulp_transfer(struct ast_channel *chan, const char *target)
{
- struct gulp_pvt *pvt = ast_channel_tech_pvt(chan);
- struct ast_sip_session *session = pvt->session;
- struct transfer_data *trnf_data = transfer_data_alloc(session, target);
+ struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(chan);
+ struct transfer_data *trnf_data = transfer_data_alloc(channel->session, target);
if (!trnf_data) {
return -1;
}
- if (ast_sip_push_task(session->serializer, transfer, trnf_data)) {
+ if (ast_sip_push_task(channel->session->serializer, transfer, trnf_data)) {
ast_log(LOG_WARNING, "Error requesting transfer\n");
ao2_cleanup(trnf_data);
return -1;
@@ -1234,12 +1246,12 @@
/*! \brief Function called by core to start a DTMF digit */
static int gulp_digit_begin(struct ast_channel *chan, char digit)
{
- struct gulp_pvt *pvt = ast_channel_tech_pvt(chan);
- struct ast_sip_session *session = pvt->session;
+ struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(chan);
+ struct gulp_pvt *pvt = channel->pvt;
struct ast_sip_session_media *media = pvt->media[SIP_MEDIA_AUDIO];
int res = 0;
- switch (session->endpoint->dtmf) {
+ switch (channel->session->endpoint->dtmf) {
case AST_SIP_DTMF_RFC_4733:
if (!media || !media->rtp) {
return -1;
@@ -1322,21 +1334,21 @@
/*! \brief Function called by core to stop a DTMF digit */
static int gulp_digit_end(struct ast_channel *ast, char digit, unsigned int duration)
{
- struct gulp_pvt *pvt = ast_channel_tech_pvt(ast);
- struct ast_sip_session *session = pvt->session;
+ struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(ast);
+ struct gulp_pvt *pvt = channel->pvt;
struct ast_sip_session_media *media = pvt->media[SIP_MEDIA_AUDIO];
int res = 0;
- switch (session->endpoint->dtmf) {
+ switch (channel->session->endpoint->dtmf) {
case AST_SIP_DTMF_INFO:
{
- struct info_dtmf_data *dtmf_data = info_dtmf_data_alloc(session, digit, duration);
+ struct info_dtmf_data *dtmf_data = info_dtmf_data_alloc(channel->session, digit, duration);
if (!dtmf_data) {
return -1;
}
- if (ast_sip_push_task(session->serializer, transmit_info_dtmf, dtmf_data)) {
+ if (ast_sip_push_task(channel->session->serializer, transmit_info_dtmf, dtmf_data)) {
ast_log(LOG_WARNING, "Error sending DTMF via INFO.\n");
ao2_cleanup(dtmf_data);
return -1;
@@ -1378,13 +1390,12 @@
/*! \brief Function called by core to actually start calling a remote party */
static int gulp_call(struct ast_channel *ast, const char *dest, int timeout)
{
- struct gulp_pvt *pvt = ast_channel_tech_pvt(ast);
- struct ast_sip_session *session = pvt->session;
-
- ao2_ref(session, +1);
- if (ast_sip_push_task(session->serializer, call, session)) {
+ struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(ast);
+
+ ao2_ref(channel->session, +1);
+ if (ast_sip_push_task(channel->session->serializer, call, channel->session)) {
ast_log(LOG_WARNING, "Error attempting to place outbound call to call '%s'\n", dest);
- ao2_cleanup(session);
+ ao2_cleanup(channel->session);
return -1;
}
@@ -1484,8 +1495,9 @@
pjsip_tx_data *packet = NULL;
struct hangup_data *h_data = data;
struct ast_channel *ast = h_data->chan;
- struct gulp_pvt *pvt = ast_channel_tech_pvt(ast);
- struct ast_sip_session *session = pvt->session;
+ struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(ast);
+ struct gulp_pvt *pvt = channel->pvt;
+ struct ast_sip_session *session = channel->session;
int cause = h_data->cause;
if (!session->defer_terminate &&
@@ -1507,16 +1519,16 @@
/*! \brief Function called by core to hang up a Gulp session */
static int gulp_hangup(struct ast_channel *ast)
{
- struct gulp_pvt *pvt = ast_channel_tech_pvt(ast);
- struct ast_sip_session *session = pvt->session;
- int cause = hangup_cause2sip(ast_channel_hangupcause(session->channel));
+ struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(ast);
+ struct gulp_pvt *pvt = channel->pvt;
+ int cause = hangup_cause2sip(ast_channel_hangupcause(channel->session->channel));
struct hangup_data *h_data = hangup_data_alloc(cause, ast);
if (!h_data) {
goto failure;
}
- if (ast_sip_push_task(session->serializer, hangup, h_data)) {
+ if (ast_sip_push_task(channel->session->serializer, hangup, h_data)) {
ast_log(LOG_WARNING, "Unable to push hangup task to the threadpool. Expect bad things\n");
goto failure;
}
@@ -1527,7 +1539,7 @@
/* Go ahead and do our cleanup of the session and channel even if we're not going
* to be able to send our SIP request/response
*/
- clear_session_and_channel(session, ast, pvt);
+ clear_session_and_channel(channel->session, ast, pvt);
ao2_cleanup(pvt);
ao2_cleanup(h_data);
@@ -1665,10 +1677,10 @@
/*! \brief Function called by core to send text on Gulp session */
static int gulp_sendtext(struct ast_channel *ast, const char *text)
{
- struct gulp_pvt *pvt = ast_channel_tech_pvt(ast);
- struct sendtext_data *data = sendtext_data_create(pvt->session, text);
-
- if (!data || ast_sip_push_task(pvt->session->serializer, sendtext, data)) {
+ struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(ast);
+ struct sendtext_data *data = sendtext_data_create(channel->session, text);
+
+ if (!data || ast_sip_push_task(channel->session->serializer, sendtext, data)) {
ao2_ref(data, -1);
return -1;
}
Modified: team/dlee/record/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/channels/chan_sip.c?view=diff&rev=395138&r1=395137&r2=395138
==============================================================================
--- team/dlee/record/channels/chan_sip.c (original)
+++ team/dlee/record/channels/chan_sip.c Tue Jul 23 10:00:12 2013
@@ -276,7 +276,6 @@
#include "asterisk/translate.h"
#include "asterisk/ast_version.h"
#include "asterisk/event.h"
-#include "asterisk/cel.h"
#include "asterisk/data.h"
#include "asterisk/aoc.h"
#include "asterisk/message.h"
@@ -8044,7 +8043,7 @@
return NULL;
}
- if (i->relatedpeer) {
+ if (i->relatedpeer && i->relatedpeer->endpoint) {
if (ast_endpoint_add_channel(i->relatedpeer->endpoint, tmp)) {
ast_channel_unref(tmp);
sip_pvt_lock(i);
@@ -10194,6 +10193,7 @@
} else if (!strcmp(protocol, "UDP/TLS/RTP/SAVP") || !strcmp(protocol, "UDP/TLS/RTP/SAVPF")) {
secure_audio = 1;
+ processed_crypto = 1;
if (p->srtp) {
ast_set_flag(p->srtp, AST_SRTP_CRYPTO_OFFER_OK);
}
@@ -10276,6 +10276,7 @@
} else if (!strcmp(protocol, "UDP/TLS/RTP/SAVP") || !strcmp(protocol, "UDP/TLS/RTP/SAVPF")) {
secure_video = 1;
+ processed_crypto = 1;
if (p->vsrtp || (p->vsrtp = ast_sdp_srtp_alloc())) {
ast_set_flag(p->vsrtp, AST_SRTP_CRYPTO_OFFER_OK);
}
@@ -13037,13 +13038,17 @@
static char *crypto_get_attrib(struct ast_sdp_srtp *srtp, int dtls_enabled, int default_taglen_32)
{
char *a_crypto;
- char *orig_crypto;
-
- if (!srtp) {
+ const char *orig_crypto;
+
+ if (!srtp || dtls_enabled) {
return NULL;
}
- orig_crypto = ast_strdupa(ast_sdp_srtp_get_attrib(srtp, dtls_enabled, default_taglen_32));
+ orig_crypto = ast_sdp_srtp_get_attrib(srtp, dtls_enabled, default_taglen_32);
+ if (ast_strlen_zero(orig_crypto)) {
+ return NULL;
+ }
+
if (ast_asprintf(&a_crypto, "a=crypto:%s\r\n", orig_crypto) == -1) {
return NULL;
}
@@ -15744,7 +15749,6 @@
static int expire_register(const void *data)
{
struct sip_peer *peer = (struct sip_peer *)data;
- RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
if (!peer) { /* Hmmm. We have no peer. Weird. */
return 0;
@@ -15764,11 +15768,14 @@
peer->socket.ws_session = NULL;
}
- ast_endpoint_set_state(peer->endpoint, AST_ENDPOINT_OFFLINE);
- blob = ast_json_pack("{s: s, s: s}",
- "peer_status", "Unregistered",
- "cause", "Expired");
- ast_endpoint_blob_publish(peer->endpoint, ast_endpoint_state_type(), blob);
+ if (peer->endpoint) {
+ RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
+ ast_endpoint_set_state(peer->endpoint, AST_ENDPOINT_OFFLINE);
+ blob = ast_json_pack("{s: s, s: s}",
+ "peer_status", "Unregistered",
+ "cause", "Expired");
+ ast_endpoint_blob_publish(peer->endpoint, ast_endpoint_state_type(), blob);
+ }
register_peer_exten(peer, FALSE); /* Remove regexten */
ast_devstate_changed(AST_DEVICE_UNKNOWN, AST_DEVSTATE_CACHABLE, "SIP/%s", peer->name);
@@ -16013,7 +16020,6 @@
int start = 0;
int wildcard_found = 0;
int single_binding_found = 0;
- RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
ast_copy_string(contact, __get_header(req, "Contact", &start), sizeof(contact));
@@ -16201,11 +16207,14 @@
ast_db_put("SIP/Registry", peer->name, data);
}
- ast_endpoint_set_state(peer->endpoint, AST_ENDPOINT_ONLINE);
- blob = ast_json_pack("{s: s, s: s}",
- "peer_status", "Registered",
- "address", ast_sockaddr_stringify(&peer->addr));
- ast_endpoint_blob_publish(peer->endpoint, ast_endpoint_state_type(), blob);
+ if (peer->endpoint) {
+ RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
+ ast_endpoint_set_state(peer->endpoint, AST_ENDPOINT_ONLINE);
+ blob = ast_json_pack("{s: s, s: s}",
+ "peer_status", "Registered",
+ "address", ast_sockaddr_stringify(&peer->addr));
+ ast_endpoint_blob_publish(peer->endpoint, ast_endpoint_state_type(), blob);
+ }
/* Is this a new IP address for us? */
if (ast_sockaddr_cmp(&peer->addr, &oldsin)) {
@@ -17209,7 +17218,6 @@
/* Create peer if we have autocreate mode enabled */
peer = temp_peer(name);
if (peer) {
- RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
ao2_t_link(peers, peer, "link peer into peer table");
if (!ast_sockaddr_isnull(&peer->addr)) {
ao2_t_link(peers_by_ip, peer, "link peer into peers-by-ip table");
@@ -17238,11 +17246,14 @@
ast_string_field_set(p, fullcontact, peer->fullcontact);
/* Say OK and ask subsystem to retransmit msg counter */
transmit_response_with_date(p, "200 OK", req);
- ast_endpoint_set_state(peer->endpoint, AST_ENDPOINT_ONLINE);
- blob = ast_json_pack("{s: s, s: s}",
- "peer_status", "Registered",
- "address", ast_sockaddr_stringify(addr));
- ast_endpoint_blob_publish(peer->endpoint, ast_endpoint_state_type(), blob);
+ if (peer->endpoint) {
+ RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
+ ast_endpoint_set_state(peer->endpoint, AST_ENDPOINT_ONLINE);
+ blob = ast_json_pack("{s: s, s: s}",
+ "peer_status", "Registered",
+ "address", ast_sockaddr_stringify(addr));
+ ast_endpoint_blob_publish(peer->endpoint, ast_endpoint_state_type(), blob);
+ }
send_mwi = 1;
res = 0;
break;
@@ -17332,7 +17343,9 @@
break;
}
- ast_endpoint_blob_publish(peer->endpoint, ast_endpoint_state_type(), blob);
+ if (peer->endpoint) {
+ ast_endpoint_blob_publish(peer->endpoint, ast_endpoint_state_type(), blob);
+ }
}
if (peer) {
sip_unref_peer(peer, "register_verify: sip_unref_peer: tossing stack peer pointer at end of func");
@@ -23815,7 +23828,6 @@
if (statechanged) {
const char *s = is_reachable ? "Reachable" : "Lagged";
char str_lastms[20];
- RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
snprintf(str_lastms, sizeof(str_lastms), "%d", pingtime);
@@ -23825,13 +23837,18 @@
if (sip_cfg.peer_rtupdate) {
[... 7036 lines stripped ...]
More information about the asterisk-commits
mailing list