|
|
|
@ -877,7 +877,7 @@ static int chan_pjsip_devicestate(const char *data)
|
|
|
|
|
RAII_VAR(struct ast_sip_endpoint *, endpoint, ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "endpoint", data), ao2_cleanup);
|
|
|
|
|
enum ast_device_state state = AST_DEVICE_UNKNOWN;
|
|
|
|
|
RAII_VAR(struct ast_endpoint_snapshot *, endpoint_snapshot, NULL, ao2_cleanup);
|
|
|
|
|
RAII_VAR(struct stasis_caching_topic *, caching_topic, NULL, ao2_cleanup);
|
|
|
|
|
RAII_VAR(struct stasis_cache *, cache, NULL, ao2_cleanup);
|
|
|
|
|
struct ast_devstate_aggregate aggregate;
|
|
|
|
|
int num, inuse = 0;
|
|
|
|
|
|
|
|
|
@ -894,19 +894,22 @@ static int chan_pjsip_devicestate(const char *data)
|
|
|
|
|
state = AST_DEVICE_NOT_INUSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!endpoint_snapshot->num_channels || !(caching_topic = ast_channel_topic_all_cached())) {
|
|
|
|
|
if (!endpoint_snapshot->num_channels || !(cache = ast_channel_cache())) {
|
|
|
|
|
return state;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ast_devstate_aggregate_init(&aggregate);
|
|
|
|
|
|
|
|
|
|
ao2_ref(caching_topic, +1);
|
|
|
|
|
ao2_ref(cache, +1);
|
|
|
|
|
|
|
|
|
|
for (num = 0; num < endpoint_snapshot->num_channels; num++) {
|
|
|
|
|
RAII_VAR(struct stasis_message *, msg, stasis_cache_get_extended(caching_topic, ast_channel_snapshot_type(),
|
|
|
|
|
endpoint_snapshot->channel_ids[num], 1), ao2_cleanup);
|
|
|
|
|
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
|
|
|
|
|
struct ast_channel_snapshot *snapshot;
|
|
|
|
|
|
|
|
|
|
stasis_topic_wait(ast_channel_topic_all_cached());
|
|
|
|
|
msg = stasis_cache_get(cache, ast_channel_snapshot_type(),
|
|
|
|
|
endpoint_snapshot->channel_ids[num]);
|
|
|
|
|
|
|
|
|
|
if (!msg) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|