debugging: Add enough to choke a mule
Added to: * bridges/bridge_softmix.c * channels/chan_pjsip.c * include/asterisk/res_pjsip_session.h * main/channel.c * res/res_pjsip_session.c There NO functional changes in this commit. Change-Id: I06af034d1ff3ea1feb56596fd7bd6d7939dfdcc3
This commit is contained in:
parent
65088494cb
commit
6abf6f345d
|
@ -629,6 +629,7 @@ static void sfu_topologies_on_join(struct ast_bridge *bridge,
|
|||
|
||||
joiner_video = ast_stream_topology_alloc();
|
||||
if (!joiner_video) {
|
||||
ast_log(LOG_ERROR, "%s: Couldn't alloc topology\n", ast_channel_name(joiner->chan));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -642,6 +643,7 @@ static void sfu_topologies_on_join(struct ast_bridge *bridge,
|
|||
ast_channel_unlock(joiner->chan);
|
||||
|
||||
if (res || !sc->topology) {
|
||||
ast_log(LOG_ERROR, "%s: Couldn't append source streams\n", ast_channel_name(joiner->chan));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -655,11 +657,17 @@ static void sfu_topologies_on_join(struct ast_bridge *bridge,
|
|||
ast_channel_get_stream_topology(participant->chan));
|
||||
ast_channel_unlock(participant->chan);
|
||||
if (res) {
|
||||
ast_log(LOG_ERROR, "%s/%s: Couldn't append source streams\n",
|
||||
ast_channel_name(participant->chan), ast_channel_name(joiner->chan));
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
ast_channel_request_stream_topology_change(joiner->chan, sc->topology, NULL);
|
||||
res = ast_channel_request_stream_topology_change(joiner->chan, sc->topology, NULL);
|
||||
if (res) {
|
||||
ast_debug(3, "%s: Couldn't request topology change\n", ast_channel_name(joiner->chan));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
AST_LIST_TRAVERSE(participants, participant, entry) {
|
||||
if (participant == joiner) {
|
||||
|
@ -668,9 +676,16 @@ static void sfu_topologies_on_join(struct ast_bridge *bridge,
|
|||
|
||||
sc = participant->tech_pvt;
|
||||
if (append_all_streams(sc->topology, joiner_video)) {
|
||||
ast_log(LOG_ERROR, "%s/%s: Couldn't apopend streams\n",
|
||||
ast_channel_name(participant->chan), ast_channel_name(joiner->chan));
|
||||
goto cleanup;
|
||||
}
|
||||
res = ast_channel_request_stream_topology_change(participant->chan, sc->topology, NULL);
|
||||
if (res) {
|
||||
ast_debug(3, "%s/%s: Couldn't request topology change\n",
|
||||
ast_channel_name(participant->chan), ast_channel_name(joiner->chan));
|
||||
goto cleanup;
|
||||
}
|
||||
ast_channel_request_stream_topology_change(participant->chan, sc->topology, NULL);
|
||||
}
|
||||
|
||||
cleanup:
|
||||
|
@ -2250,10 +2265,13 @@ static void softmix_bridge_stream_sources_update(struct ast_bridge *bridge, stru
|
|||
struct ast_stream_topology *added_streams;
|
||||
struct ast_bridge_channels_list *participants = &bridge->channels;
|
||||
struct ast_bridge_channel *participant;
|
||||
SCOPE_ENTER(3, "%s: OT: %s NT: %s\n", ast_channel_name(bridge_channel->chan),
|
||||
ast_str_tmp(256, ast_stream_topology_to_str(old_topology, &STR_TMP)),
|
||||
ast_str_tmp(256, ast_stream_topology_to_str(new_topology, &STR_TMP)));
|
||||
|
||||
added_streams = ast_stream_topology_alloc();
|
||||
if (!added_streams) {
|
||||
return;
|
||||
SCOPE_EXIT_LOG(LOG_ERROR, "%s: Couldn't alloc topology\n", ast_channel_name(bridge_channel->chan));
|
||||
}
|
||||
|
||||
/* We go through the old topology comparing it to the new topology to determine what streams
|
||||
|
@ -2262,19 +2280,24 @@ static void softmix_bridge_stream_sources_update(struct ast_bridge *bridge, stru
|
|||
* Added streams are copied into a topology and added to each other participant while for
|
||||
* removed streams we merely store their position and mark them as removed later.
|
||||
*/
|
||||
ast_trace(-1, "%s: Checking for state changes\n", ast_channel_name(bridge_channel->chan));
|
||||
for (index = 0; index < ast_stream_topology_get_count(sc->topology) && index < ast_stream_topology_get_count(new_topology); ++index) {
|
||||
struct ast_stream *old_stream = ast_stream_topology_get_stream(sc->topology, index);
|
||||
struct ast_stream *new_stream = ast_stream_topology_get_stream(new_topology, index);
|
||||
SCOPE_ENTER(4, "%s: Slot: %d Old stream: %s New stream: %s\n", ast_channel_name(bridge_channel->chan),
|
||||
index, ast_str_tmp(256, ast_stream_to_str(old_stream, &STR_TMP)),
|
||||
ast_str_tmp(256, ast_stream_to_str(new_stream, &STR_TMP)));
|
||||
|
||||
/* Ignore all streams that don't carry video and streams that are strictly outgoing destination streams */
|
||||
if ((ast_stream_get_type(old_stream) != AST_MEDIA_TYPE_VIDEO && ast_stream_get_type(new_stream) != AST_MEDIA_TYPE_VIDEO) ||
|
||||
!strncmp(ast_stream_get_name(new_stream), SOFTBRIDGE_VIDEO_DEST_PREFIX,
|
||||
SOFTBRIDGE_VIDEO_DEST_LEN)) {
|
||||
continue;
|
||||
SCOPE_EXIT_EXPR(continue, "%s: Stream %d ignored\n", ast_channel_name(bridge_channel->chan), index);
|
||||
}
|
||||
|
||||
if (ast_stream_get_type(old_stream) == AST_MEDIA_TYPE_VIDEO && ast_stream_get_type(new_stream) != AST_MEDIA_TYPE_VIDEO) {
|
||||
/* If a stream renegotiates from video to non-video then we need to remove it as a source */
|
||||
ast_trace(-1, "%s: Stream %d added to remove list\n", ast_channel_name(bridge_channel->chan), index);
|
||||
removed_streams[removed_streams_count++] = index;
|
||||
} else if (ast_stream_get_type(old_stream) != AST_MEDIA_TYPE_VIDEO && ast_stream_get_type(new_stream) == AST_MEDIA_TYPE_VIDEO) {
|
||||
if (ast_stream_get_state(new_stream) != AST_STREAM_STATE_REMOVED) {
|
||||
|
@ -2282,11 +2305,14 @@ static void softmix_bridge_stream_sources_update(struct ast_bridge *bridge, stru
|
|||
if (append_source_stream(added_streams, ast_channel_name(bridge_channel->chan),
|
||||
bridge->softmix.send_sdp_label ? ast_channel_uniqueid(bridge_channel->chan) : NULL,
|
||||
new_stream, index)) {
|
||||
goto cleanup;
|
||||
SCOPE_EXIT_EXPR(goto cleanup, "%s: Couldn't append source stream %d:%s\n", ast_channel_name(bridge_channel->chan),
|
||||
index, ast_stream_get_name(new_stream));
|
||||
}
|
||||
ast_trace(-1, "%s: Stream %d changed from non-video to video\n", ast_channel_name(bridge_channel->chan), index);
|
||||
}
|
||||
} else if (ast_stream_get_state(old_stream) != AST_STREAM_STATE_REMOVED &&
|
||||
ast_stream_get_state(new_stream) != AST_STREAM_STATE_SENDRECV && ast_stream_get_state(new_stream) != AST_STREAM_STATE_RECVONLY) {
|
||||
ast_trace(-1, "%s: Stream %d added to remove list\n", ast_channel_name(bridge_channel->chan), index);
|
||||
/* If a stream renegotiates and is removed then we remove it */
|
||||
removed_streams[removed_streams_count++] = index;
|
||||
} else if ((ast_stream_get_state(old_stream) == AST_STREAM_STATE_REMOVED || ast_stream_get_state(old_stream) == AST_STREAM_STATE_INACTIVE ||
|
||||
|
@ -2297,9 +2323,14 @@ static void softmix_bridge_stream_sources_update(struct ast_bridge *bridge, stru
|
|||
if (append_source_stream(added_streams, ast_channel_name(bridge_channel->chan),
|
||||
bridge->softmix.send_sdp_label ? ast_channel_uniqueid(bridge_channel->chan) : NULL,
|
||||
new_stream, index)) {
|
||||
goto cleanup;
|
||||
SCOPE_EXIT_EXPR(goto cleanup, "%s: Couldn't append source stream %d:%s\n", ast_channel_name(bridge_channel->chan),
|
||||
index, ast_stream_get_name(new_stream));
|
||||
}
|
||||
ast_trace(-1, "%s: Stream %d:%s changed state from %s to %s\n", ast_channel_name(bridge_channel->chan),
|
||||
index, ast_stream_get_name(old_stream), ast_stream_state2str(ast_stream_get_state(old_stream)),
|
||||
ast_stream_state2str(ast_stream_get_state(new_stream)));
|
||||
}
|
||||
SCOPE_EXIT();
|
||||
}
|
||||
|
||||
/* Any newly added streams that did not take the position of a removed stream
|
||||
|
@ -2307,18 +2338,26 @@ static void softmix_bridge_stream_sources_update(struct ast_bridge *bridge, stru
|
|||
* removed from the topology but merely marked as removed we can pick up where we
|
||||
* left off when comparing the old and new topologies.
|
||||
*/
|
||||
ast_trace(-1, "%s: Checking for newly added streams\n", ast_channel_name(bridge_channel->chan));
|
||||
|
||||
for (; index < ast_stream_topology_get_count(new_topology); ++index) {
|
||||
struct ast_stream *stream = ast_stream_topology_get_stream(new_topology, index);
|
||||
SCOPE_ENTER(4, "%s: Checking stream %d:%s\n", ast_channel_name(bridge_channel->chan), index,
|
||||
ast_stream_get_name(stream));
|
||||
|
||||
if (!is_video_source(stream)) {
|
||||
continue;
|
||||
SCOPE_EXIT_EXPR(continue, "%s: Stream %d:%s is not video source\n", ast_channel_name(bridge_channel->chan),
|
||||
index, ast_stream_get_name(stream));
|
||||
}
|
||||
|
||||
if (append_source_stream(added_streams, ast_channel_name(bridge_channel->chan),
|
||||
bridge->softmix.send_sdp_label ? ast_channel_uniqueid(bridge_channel->chan) : NULL,
|
||||
stream, index)) {
|
||||
goto cleanup;
|
||||
SCOPE_EXIT_EXPR(goto cleanup, "%s: Couldn't append stream %d:%s\n", ast_channel_name(bridge_channel->chan),
|
||||
index, ast_stream_get_name(stream));
|
||||
}
|
||||
SCOPE_EXIT("%s: Added new stream %s\n", ast_channel_name(bridge_channel->chan),
|
||||
ast_str_tmp(256, ast_stream_to_str(stream, &STR_TMP)));
|
||||
}
|
||||
|
||||
/* We always update the stored topology if we can to reflect what is currently negotiated */
|
||||
|
@ -2333,42 +2372,67 @@ static void softmix_bridge_stream_sources_update(struct ast_bridge *bridge, stru
|
|||
* other participants.
|
||||
*/
|
||||
if (!removed_streams_count && !ast_stream_topology_get_count(added_streams)) {
|
||||
ast_trace(-1, "%s: Nothing added or removed\n", ast_channel_name(bridge_channel->chan));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ast_trace(-1, "%s: Processing adds and removes\n", ast_channel_name(bridge_channel->chan));
|
||||
/* Go through each participant adding in the new streams and removing the old ones */
|
||||
AST_LIST_TRAVERSE(participants, participant, entry) {
|
||||
if (participant == bridge_channel) {
|
||||
continue;
|
||||
}
|
||||
AST_LIST_TRAVERSE(participants, participant, entry)
|
||||
{
|
||||
struct softmix_channel *participant_sc = participant->tech_pvt;
|
||||
SCOPE_ENTER(4, "%s/%s: Old participant topology %s\n",
|
||||
ast_channel_name(bridge_channel->chan),
|
||||
ast_channel_name(participant->chan),
|
||||
ast_str_tmp(256, ast_stream_topology_to_str(participant_sc->topology, &STR_TMP)));
|
||||
|
||||
sc = participant->tech_pvt;
|
||||
if (participant == bridge_channel) {
|
||||
SCOPE_EXIT_EXPR(continue, "%s/%s: Same channel. Skipping\n",
|
||||
ast_channel_name(bridge_channel->chan),
|
||||
ast_channel_name(participant->chan));
|
||||
}
|
||||
|
||||
/* We add in all the new streams first so that they do not take the place
|
||||
* of any of our removed streams, allowing the remote side to reset the state
|
||||
* for each removed stream. */
|
||||
if (append_all_streams(sc->topology, added_streams)) {
|
||||
goto cleanup;
|
||||
}
|
||||
if (append_all_streams(participant_sc->topology, added_streams)) {
|
||||
SCOPE_EXIT_EXPR(goto cleanup, "%s/%s: Couldn't append streams\n", ast_channel_name(bridge_channel->chan),
|
||||
ast_channel_name(participant->chan));
|
||||
}
|
||||
ast_trace(-1, "%s/%s: Adding streams %s\n", ast_channel_name(bridge_channel->chan),
|
||||
ast_channel_name(participant->chan),
|
||||
ast_str_tmp(256, ast_stream_topology_to_str(added_streams, &STR_TMP)));
|
||||
|
||||
/* Then we go through and remove any ones that were removed */
|
||||
for (index = 0; removed_streams_count && index < ast_stream_topology_get_count(sc->topology); ++index) {
|
||||
for (index = 0;
|
||||
removed_streams_count && index < ast_stream_topology_get_count(sc->topology); ++index) {
|
||||
struct ast_stream *stream = ast_stream_topology_get_stream(sc->topology, index);
|
||||
int removed_stream;
|
||||
|
||||
for (removed_stream = 0; removed_stream < removed_streams_count; ++removed_stream) {
|
||||
if (is_video_dest(stream, ast_channel_name(bridge_channel->chan), removed_streams[removed_stream])) {
|
||||
if (is_video_dest(stream, ast_channel_name(bridge_channel->chan),
|
||||
removed_streams[removed_stream])) {
|
||||
ast_trace(-1, "%s/%s: Removing stream %s\n",
|
||||
ast_channel_name(bridge_channel->chan),
|
||||
ast_channel_name(participant->chan),
|
||||
ast_str_tmp(256, ast_stream_to_str(stream, &STR_TMP)));
|
||||
ast_stream_set_state(stream, AST_STREAM_STATE_REMOVED);
|
||||
}
|
||||
}
|
||||
}
|
||||
ast_channel_request_stream_topology_change(participant->chan, participant_sc->topology, NULL);
|
||||
SCOPE_EXIT("%s/%s: New participant topology %s\n",
|
||||
ast_channel_name(bridge_channel->chan),
|
||||
ast_channel_name(participant->chan),
|
||||
ast_str_tmp(256, ast_stream_topology_to_str(participant_sc->topology, &STR_TMP)));
|
||||
}
|
||||
|
||||
ast_channel_request_stream_topology_change(participant->chan, sc->topology, NULL);
|
||||
}
|
||||
|
||||
ast_trace(-1, "%s: New topology %s\n", ast_channel_name(bridge_channel->chan),
|
||||
ast_str_tmp(256, ast_stream_topology_to_str(sc->topology, &STR_TMP)));
|
||||
|
||||
cleanup:
|
||||
ast_stream_topology_free(added_streams);
|
||||
SCOPE_EXIT();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -2389,6 +2453,7 @@ static void softmix_bridge_stream_topology_changed(struct ast_bridge *bridge, st
|
|||
struct ast_vector_int media_types;
|
||||
int nths[AST_MEDIA_TYPE_END] = {0};
|
||||
int idx;
|
||||
SCOPE_ENTER(3, "%s: \n", ast_channel_name(bridge_channel->chan));
|
||||
|
||||
switch (bridge->softmix.video_mode.mode) {
|
||||
case AST_BRIDGE_VIDEO_MODE_NONE:
|
||||
|
@ -2396,7 +2461,7 @@ static void softmix_bridge_stream_topology_changed(struct ast_bridge *bridge, st
|
|||
case AST_BRIDGE_VIDEO_MODE_TALKER_SRC:
|
||||
default:
|
||||
ast_bridge_channel_stream_map(bridge_channel);
|
||||
return;
|
||||
SCOPE_EXIT_RTN("%s: Not in SFU mode\n", ast_channel_name(bridge_channel->chan));
|
||||
case AST_BRIDGE_VIDEO_MODE_SFU:
|
||||
break;
|
||||
}
|
||||
|
@ -2506,6 +2571,7 @@ static void softmix_bridge_stream_topology_changed(struct ast_bridge *bridge, st
|
|||
}
|
||||
|
||||
AST_VECTOR_FREE(&media_types);
|
||||
SCOPE_EXIT_RTN("%s\n", ast_channel_name(bridge_channel->chan));
|
||||
}
|
||||
|
||||
static struct ast_bridge_technology softmix_bridge = {
|
||||
|
|
|
@ -1570,32 +1570,45 @@ static struct topology_change_refresh_data *topology_change_refresh_data_alloc(
|
|||
|
||||
static int on_topology_change_response(struct ast_sip_session *session, pjsip_rx_data *rdata)
|
||||
{
|
||||
SCOPE_ENTER(3, "%s: Received response code %d. PT: %s AT: %s\n", ast_sip_session_get_name(session),
|
||||
rdata->msg_info.msg->line.status.code,
|
||||
ast_str_tmp(256, ast_stream_topology_to_str(session->pending_media_state->topology, &STR_TMP)),
|
||||
ast_str_tmp(256, ast_stream_topology_to_str(session->active_media_state->topology, &STR_TMP)));
|
||||
|
||||
|
||||
if (PJSIP_IS_STATUS_IN_CLASS(rdata->msg_info.msg->line.status.code, 200)) {
|
||||
/* The topology was changed to something new so give notice to what requested
|
||||
* it so it queries the channel and updates accordingly.
|
||||
*/
|
||||
if (session->channel) {
|
||||
ast_queue_control(session->channel, AST_CONTROL_STREAM_TOPOLOGY_CHANGED);
|
||||
SCOPE_EXIT_RTN_VALUE(0, "%s: Queued topology change frame\n", ast_sip_session_get_name(session));
|
||||
}
|
||||
SCOPE_EXIT_RTN_VALUE(0, "%s: No channel? Can't queue topology change frame\n", ast_sip_session_get_name(session));
|
||||
} else if (300 <= rdata->msg_info.msg->line.status.code) {
|
||||
/* The topology change failed, so drop the current pending media state */
|
||||
ast_sip_session_media_state_reset(session->pending_media_state);
|
||||
SCOPE_EXIT_RTN_VALUE(0, "%s: response code > 300. Resetting pending media state\n", ast_sip_session_get_name(session));
|
||||
}
|
||||
|
||||
return 0;
|
||||
SCOPE_EXIT_RTN_VALUE(0, "%s: Nothing to do\n", ast_sip_session_get_name(session));
|
||||
}
|
||||
|
||||
static int send_topology_change_refresh(void *data)
|
||||
{
|
||||
struct topology_change_refresh_data *refresh_data = data;
|
||||
struct ast_sip_session *session = refresh_data->session;
|
||||
int ret;
|
||||
SCOPE_ENTER(3, "%s: %s\n", ast_sip_session_get_name(session),
|
||||
ast_str_tmp(256, ast_stream_topology_to_str(refresh_data->media_state->topology, &STR_TMP)));
|
||||
|
||||
ret = ast_sip_session_refresh(refresh_data->session, NULL, NULL, on_topology_change_response,
|
||||
|
||||
ret = ast_sip_session_refresh(session, NULL, NULL, on_topology_change_response,
|
||||
AST_SIP_SESSION_REFRESH_METHOD_INVITE, 1, refresh_data->media_state);
|
||||
refresh_data->media_state = NULL;
|
||||
topology_change_refresh_data_free(refresh_data);
|
||||
|
||||
return ret;
|
||||
SCOPE_EXIT_RTN_VALUE(ret, "%s\n", ast_sip_session_get_name(session));
|
||||
}
|
||||
|
||||
static int handle_topology_request_change(struct ast_sip_session *session,
|
||||
|
@ -1627,6 +1640,15 @@ static int chan_pjsip_indicate(struct ast_channel *ast, int condition, const voi
|
|||
size_t device_buf_size;
|
||||
int i;
|
||||
const struct ast_stream_topology *topology;
|
||||
struct ast_frame f = {
|
||||
.frametype = AST_FRAME_CONTROL,
|
||||
.subclass = {
|
||||
.integer = condition
|
||||
}
|
||||
};
|
||||
char condition_name[256];
|
||||
SCOPE_ENTER(3, "%s: Indicated %s\n", ast_channel_name(ast),
|
||||
ast_frame_subclass2str(&f, condition_name, sizeof(condition_name), NULL, 0));
|
||||
|
||||
switch (condition) {
|
||||
case AST_CONTROL_RINGING:
|
||||
|
@ -1731,9 +1753,9 @@ static int chan_pjsip_indicate(struct ast_channel *ast, int condition, const voi
|
|||
ao2_ref(channel->session, +1);
|
||||
#ifdef HAVE_PJSIP_INV_SESSION_REF
|
||||
if (pjsip_inv_add_ref(channel->session->inv_session) != PJ_SUCCESS) {
|
||||
ast_log(LOG_ERROR, "Can't increase the session reference counter\n");
|
||||
ao2_cleanup(channel->session);
|
||||
return -1;
|
||||
SCOPE_EXIT_LOG_RTN_VALUE(-1, LOG_ERROR, "%s: Couldn't increase the session reference counter\n",
|
||||
ast_channel_name(ast));
|
||||
}
|
||||
#endif
|
||||
if (ast_sip_push_task(channel->session->serializer, update_connected_line_information, channel->session)) {
|
||||
|
@ -1823,6 +1845,8 @@ static int chan_pjsip_indicate(struct ast_channel *ast, int condition, const voi
|
|||
break;
|
||||
case AST_CONTROL_STREAM_TOPOLOGY_REQUEST_CHANGE:
|
||||
topology = data;
|
||||
ast_trace(-1, "%s: New topology: %s\n", ast_channel_name(ast),
|
||||
ast_str_tmp(256, ast_stream_topology_to_str(topology, &STR_TMP)));
|
||||
res = handle_topology_request_change(channel->session, topology);
|
||||
break;
|
||||
case AST_CONTROL_STREAM_TOPOLOGY_CHANGED:
|
||||
|
@ -1842,18 +1866,17 @@ static int chan_pjsip_indicate(struct ast_channel *ast, int condition, const voi
|
|||
struct indicate_data *ind_data = indicate_data_alloc(channel->session, condition, response_code, data, datalen);
|
||||
|
||||
if (!ind_data) {
|
||||
return -1;
|
||||
SCOPE_EXIT_LOG_RTN_VALUE(-1, LOG_ERROR, "%s: Couldn't alloc indicate data\n", ast_channel_name(ast));
|
||||
}
|
||||
#ifdef HAVE_PJSIP_INV_SESSION_REF
|
||||
if (pjsip_inv_add_ref(ind_data->session->inv_session) != PJ_SUCCESS) {
|
||||
ast_log(LOG_ERROR, "Can't increase the session reference counter\n");
|
||||
ao2_cleanup(ind_data);
|
||||
return -1;
|
||||
SCOPE_EXIT_LOG_RTN_VALUE(-1, LOG_ERROR, "%s: Couldn't increase the session reference counter\n", ast_channel_name(ast));
|
||||
}
|
||||
#endif
|
||||
if (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(channel->session->endpoint));
|
||||
ast_log(LOG_ERROR, "%s: Cannot send response code %d to endpoint %s. Could not queue task properly\n",
|
||||
ast_channel_name(ast), response_code, ast_sorcery_object_get_id(channel->session->endpoint));
|
||||
#ifdef HAVE_PJSIP_INV_SESSION_REF
|
||||
pjsip_inv_dec_ref(ind_data->session->inv_session);
|
||||
#endif
|
||||
|
@ -1862,7 +1885,7 @@ static int chan_pjsip_indicate(struct ast_channel *ast, int condition, const voi
|
|||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
SCOPE_EXIT_RTN_VALUE(res, "%s\n", ast_channel_name(ast));
|
||||
}
|
||||
|
||||
struct transfer_data {
|
||||
|
@ -3035,9 +3058,10 @@ static int chan_pjsip_incoming_request(struct ast_sip_session *session, struct p
|
|||
RAII_VAR(struct ast_datastore *, datastore, NULL, ao2_cleanup);
|
||||
struct transport_info_data *transport_data;
|
||||
pjsip_tx_data *packet = NULL;
|
||||
SCOPE_ENTER(3, "%s\n", ast_sip_session_get_name(session));
|
||||
|
||||
if (session->channel) {
|
||||
return 0;
|
||||
SCOPE_EXIT_RTN_VALUE(0, "%s: No channel\n", ast_sip_session_get_name(session));
|
||||
}
|
||||
|
||||
/* Check for a to-tag to determine if this is a reinvite */
|
||||
|
@ -3053,17 +3077,17 @@ static int chan_pjsip_incoming_request(struct ast_sip_session *session, struct p
|
|||
*/
|
||||
session->defer_terminate = 0;
|
||||
ast_sip_session_terminate(session, 400);
|
||||
return -1;
|
||||
SCOPE_EXIT_RTN_VALUE(-1, "%s: We have a To tag but no channel. Terminating session\n", ast_sip_session_get_name(session));
|
||||
}
|
||||
|
||||
datastore = ast_sip_session_alloc_datastore(&transport_info, "transport_info");
|
||||
if (!datastore) {
|
||||
return -1;
|
||||
SCOPE_EXIT_LOG_RTN_VALUE(-1, LOG_ERROR, "%s: Couldn't alloc transport_info datastore\n", ast_sip_session_get_name(session));
|
||||
}
|
||||
|
||||
transport_data = ast_calloc(1, sizeof(*transport_data));
|
||||
if (!transport_data) {
|
||||
return -1;
|
||||
SCOPE_EXIT_LOG_RTN_VALUE(-1, LOG_ERROR, "%s: Couldn't alloc transport_info\n", ast_sip_session_get_name(session));
|
||||
}
|
||||
pj_sockaddr_cp(&transport_data->local_addr, &rdata->tp_info.transport->local_addr);
|
||||
pj_sockaddr_cp(&transport_data->remote_addr, &rdata->pkt_info.src_addr);
|
||||
|
@ -3076,12 +3100,12 @@ static int chan_pjsip_incoming_request(struct ast_sip_session *session, struct p
|
|||
ast_sip_session_send_response(session, packet);
|
||||
}
|
||||
|
||||
ast_log(LOG_ERROR, "Failed to allocate new PJSIP channel on incoming SIP INVITE\n");
|
||||
return -1;
|
||||
SCOPE_EXIT_LOG_RTN_VALUE(-1, LOG_ERROR, "%s: Failed to allocate new PJSIP channel on incoming SIP INVITE\n",
|
||||
ast_sip_session_get_name(session));
|
||||
}
|
||||
/* channel gets created on incoming request, but we wait to call start
|
||||
so other supplements have a chance to run */
|
||||
return 0;
|
||||
SCOPE_EXIT_RTN_VALUE(0, "%s\n", ast_sip_session_get_name(session));
|
||||
}
|
||||
|
||||
static int call_pickup_incoming_request(struct ast_sip_session *session, pjsip_rx_data *rdata)
|
||||
|
@ -3179,9 +3203,10 @@ static void chan_pjsip_incoming_response(struct ast_sip_session *session, struct
|
|||
struct pjsip_status_line status = rdata->msg_info.msg->line.status;
|
||||
struct ast_control_pvt_cause_code *cause_code;
|
||||
int data_size = sizeof(*cause_code);
|
||||
SCOPE_ENTER(3, "%s: Status: %d\n", ast_sip_session_get_name(session), status.code);
|
||||
|
||||
if (!session->channel) {
|
||||
return;
|
||||
SCOPE_EXIT_RTN("%s: No channel\n", ast_sip_session_get_name(session));
|
||||
}
|
||||
|
||||
/* Build and send the tech-specific cause information */
|
||||
|
@ -3201,6 +3226,7 @@ static void chan_pjsip_incoming_response(struct ast_sip_session *session, struct
|
|||
|
||||
switch (status.code) {
|
||||
case 180:
|
||||
ast_trace(-1, "%s: Queueing RINGING\n", ast_sip_session_get_name(session));
|
||||
ast_queue_control(session->channel, AST_CONTROL_RINGING);
|
||||
ast_channel_lock(session->channel);
|
||||
if (ast_channel_state(session->channel) != AST_STATE_UP) {
|
||||
|
@ -3209,6 +3235,7 @@ static void chan_pjsip_incoming_response(struct ast_sip_session *session, struct
|
|||
ast_channel_unlock(session->channel);
|
||||
break;
|
||||
case 183:
|
||||
ast_trace(-1, "%s: Queueing PROGRESS\n", ast_sip_session_get_name(session));
|
||||
if (session->endpoint->ignore_183_without_sdp) {
|
||||
pjsip_rdata_sdp_info *sdp = pjsip_rdata_get_sdp_info(rdata);
|
||||
if (sdp && sdp->body.ptr) {
|
||||
|
@ -3219,21 +3246,28 @@ static void chan_pjsip_incoming_response(struct ast_sip_session *session, struct
|
|||
}
|
||||
break;
|
||||
case 200:
|
||||
ast_trace(-1, "%s: Queueing ANSWER\n", ast_sip_session_get_name(session));
|
||||
ast_queue_control(session->channel, AST_CONTROL_ANSWER);
|
||||
break;
|
||||
default:
|
||||
ast_trace(-1, "%s: Not queueing anything\n", ast_sip_session_get_name(session));
|
||||
break;
|
||||
}
|
||||
|
||||
SCOPE_EXIT_RTN("%s\n", ast_sip_session_get_name(session));
|
||||
}
|
||||
|
||||
static int chan_pjsip_incoming_ack(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
|
||||
{
|
||||
SCOPE_ENTER(3, "%s\n", ast_sip_session_get_name(session));
|
||||
|
||||
if (rdata->msg_info.msg->line.req.method.id == PJSIP_ACK_METHOD) {
|
||||
if (session->endpoint->media.direct_media.enabled && session->channel) {
|
||||
ast_trace(-1, "%s: Queueing SRCCHANGE\n", ast_sip_session_get_name(session));
|
||||
ast_queue_control(session->channel, AST_CONTROL_SRCCHANGE);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
SCOPE_EXIT_RTN_VALUE(0, "%s\n", ast_sip_session_get_name(session));
|
||||
}
|
||||
|
||||
static int update_devstate(void *obj, void *arg, int flags)
|
||||
|
|
|
@ -117,6 +117,10 @@ struct ast_sip_session_media {
|
|||
unsigned int changed;
|
||||
/*! \brief Remote media stream label */
|
||||
char *remote_mslabel;
|
||||
/*! \brief Remote stream label */
|
||||
char *remote_label;
|
||||
/*! \brief Stream name */
|
||||
char *stream_name;
|
||||
};
|
||||
|
||||
/*!
|
||||
|
|
|
@ -11029,8 +11029,10 @@ int ast_channel_request_stream_topology_change(struct ast_channel *chan,
|
|||
}
|
||||
|
||||
if (ast_stream_topology_equal(ast_channel_get_stream_topology(chan), topology)) {
|
||||
ast_debug(3, "Topology of %s already matches what is requested so ignoring topology change request\n",
|
||||
ast_channel_name(chan));
|
||||
ast_debug(2, "%s: Topologies already match. Current: %s Requested: %s\n",
|
||||
ast_channel_name(chan),
|
||||
ast_str_tmp(256, ast_stream_topology_to_str(ast_channel_get_stream_topology(chan), &STR_TMP)),
|
||||
ast_str_tmp(256, ast_stream_topology_to_str(topology, &STR_TMP)));
|
||||
ast_channel_unlock(chan);
|
||||
return 0;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue