mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 11:58:52 +00:00
stasis: Segment channel snapshot to reduce creation cost.
When a channel snapshot was created it used to be done from scratch, copying all data (many strings). This incurs a cost when doing so. This change segments the channel snapshot into different components which can be reused if unchanged from the previous snapshot creation, reducing the cost. In normal cases this results in some pointers being copied with reference count being bumped, some integers being set, and a string or two copied. The other benefit is that it is now possible to determine if a channel snapshot update is redundant and thus stop it before a message is published to stasis. The specific segments in the channel snapshot were split up based on whether they are changed together, how often they are changed, and their general grouping. In practice only 1 (or 0) of the segments actually get changed in normal operation. Invalidation is done by setting a flag on the channel when the segment source is changed, forcing creation of a new segment when the channel snapshot is created. ASTERISK-28119 Change-Id: I5d7ef3df963a88ac47bc187d73c5225c315f8423
This commit is contained in:
@@ -377,7 +377,7 @@ static int ari_bridges_play_helper(const char **args_media,
|
||||
return -1;
|
||||
}
|
||||
|
||||
language = S_OR(args_lang, snapshot->language);
|
||||
language = S_OR(args_lang, snapshot->base->language);
|
||||
|
||||
playback = stasis_app_control_play_uri(control, args_media, args_media_count,
|
||||
language, bridge->uniqueid, STASIS_PLAYBACK_TARGET_BRIDGE, args_skipms,
|
||||
|
@@ -170,8 +170,8 @@ void ast_ari_channels_continue_in_dialplan(
|
||||
}
|
||||
|
||||
if (ast_strlen_zero(args->context)) {
|
||||
context = snapshot->context;
|
||||
exten = S_OR(args->extension, snapshot->exten);
|
||||
context = snapshot->dialplan->context;
|
||||
exten = S_OR(args->extension, snapshot->dialplan->exten);
|
||||
} else {
|
||||
context = args->context;
|
||||
exten = S_OR(args->extension, "s");
|
||||
@@ -203,7 +203,7 @@ void ast_ari_channels_continue_in_dialplan(
|
||||
ipri = args->priority;
|
||||
} else if (ast_strlen_zero(args->context) && ast_strlen_zero(args->extension)) {
|
||||
/* Special case. No exten, context, or priority provided, then move on to the next priority */
|
||||
ipri = snapshot->priority + 1;
|
||||
ipri = snapshot->dialplan->priority + 1;
|
||||
} else {
|
||||
ipri = 1;
|
||||
}
|
||||
@@ -263,10 +263,10 @@ void ast_ari_channels_redirect(struct ast_variable *headers,
|
||||
return;
|
||||
}
|
||||
|
||||
if (strncasecmp(chan_snapshot->type, tech, tech_len)) {
|
||||
if (strncasecmp(chan_snapshot->base->type, tech, tech_len)) {
|
||||
ast_ari_response_error(response, 422, "Unprocessable Entity",
|
||||
"Endpoint technology '%s' does not match channel technology '%s'",
|
||||
tech, chan_snapshot->type);
|
||||
tech, chan_snapshot->base->type);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -628,7 +628,7 @@ static void ari_channels_handle_play(
|
||||
return;
|
||||
}
|
||||
|
||||
language = S_OR(args_lang, snapshot->language);
|
||||
language = S_OR(args_lang, snapshot->base->language);
|
||||
|
||||
playback = stasis_app_control_play_uri(control, args_media, args_media_count, language,
|
||||
args_channel_id, STASIS_PLAYBACK_TARGET_CHANNEL, args_skipms, args_offsetms, args_playback_id);
|
||||
|
Reference in New Issue
Block a user