static char *assign_uuid(const pj_str_t *call_id, const pj_str_t *local_tag, const pj_str_t *remote_tag) { RAII_VAR(struct ast_sip_session *, session, NULL, ao2_cleanup); pjsip_dialog *dlg; char *uuid = NULL; enum hep_uuid_type uuid_type = hepv3_get_uuid_type(); if ((uuid_type == HEP_UUID_TYPE_CHANNEL) && (dlg = pjsip_ua_find_dialog(call_id, local_tag, remote_tag, PJ_FALSE)) && (session = ast_sip_dialog_get_session(dlg)) && (session->channel)) { uuid = ast_strdup(ast_channel_name(session->channel)); } /* If we couldn't get the channel or we never wanted it, default to the call-id */ if (!uuid) { uuid = ast_malloc(pj_strlen(call_id) + 1); if (uuid) { ast_copy_pj_str(uuid, call_id, pj_strlen(call_id) + 1); } } return uuid; }
static char *assign_uuid(const pj_str_t *call_id, const pj_str_t *local_tag, const pj_str_t *remote_tag) { RAII_VAR(struct ast_sip_session *, session, NULL, ao2_cleanup); pjsip_dialog *dlg; char *uuid = NULL; if ((dlg = pjsip_ua_find_dialog(call_id, local_tag, remote_tag, PJ_FALSE)) && (session = ast_sip_dialog_get_session(dlg)) && (session->channel)) { uuid = ast_strdup(ast_channel_name(session->channel)); } else { uuid = ast_malloc(pj_strlen(call_id) + 1); if (uuid) { ast_copy_pj_str(uuid, call_id, pj_strlen(call_id) + 1); } } return uuid; }