/* * parse_call_info_node * * Parse call-info node. * * Assumes a_node, participant are not null. */ static void parse_call_info_node (xmlNode * a_node, cc_call_conferenceParticipant_Info_t *participant) { xmlChar *data; xmlNode *cur_node; xmlNode *walker_node; for (cur_node = a_node->children; cur_node != NULL; cur_node = cur_node->next) { if (cur_node->type == XML_ELEMENT_NODE) { if (xmlStrcmp(cur_node->name, (const xmlChar *) "security") == 0) { data = xmlNodeGetContent(cur_node); if (data != NULL) { participant->participantSecurity = convertStringToParticipantSecurity((const char*)data); xmlFree(data); } } else if (xmlStrcmp(cur_node->name, (const xmlChar *) "sip") == 0) { for (walker_node = cur_node->children; walker_node != NULL; walker_node = walker_node->next) { if (cur_node->type == XML_ELEMENT_NODE) { if (xmlStrcmp(walker_node->name, (const xmlChar *) "call-id") == 0) { data = xmlNodeGetContent(walker_node); if (data != NULL) { participant->callid = strlib_update(participant->callid, (const char*)data); xmlFree(data); } } } } } } } }
/* * parse_user_endpoint_node * * Do endpoint specific parsing. * * Assumes a_node, participant is not null. */ static void parse_user_endpoint_node (xmlNode * a_node, cc_call_conferenceParticipant_Info_t *participant, cc_call_conference_Info_t *info) { xmlChar *data; xmlNode *cur_node; for (cur_node = a_node->children; cur_node != NULL; cur_node = cur_node->next) { if (cur_node->type == XML_ELEMENT_NODE) { if (xmlStrcmp(cur_node->name, (const xmlChar *) "status") == 0) { data = xmlNodeGetContent(cur_node); if (data != NULL) { participant->participantStatus = convertStringToParticipantStatus((const char*)data); xmlFree(data); } else { //continue parsing other elements CCAPP_ERROR(DEB_F_PREFIX" Error while getting the data for node: status\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI-CONFPARSE")); } } else if (xmlStrcmp(cur_node->name, (const xmlChar *) "call-info") == 0) { parse_call_info_node(cur_node, participant); } else if (xmlStrcmp(cur_node->name, (const xmlChar *) "self") == 0) { parse_self_node(cur_node, participant); info->myParticipantId = strlib_update(info->myParticipantId, participant->callid); } } } }
/* * Function: update_recv_info_list * * Parameters: * header_field_value - the header field value to match (e.g., * "conference") * info_packages - the Info Packages string to append the header * field value to * * Description: * Checks to see if a handler is registered for the header field value * (e.g., "conference"), if so, append the header field value to * the end of info_packages. * * Returns: * None */ static void update_recv_info_list(const char *header_field_value, string_t *info_packages) { static const char *fname = "update_recv_info_list"; info_index_t info_index; if ((header_field_value == NULL) || (info_packages == NULL) || (*info_packages == NULL)) { CCSIP_DEBUG_ERROR("%s: invalid parameter", fname); return; } info_index = find_info_index(header_field_value); if (info_index != INDEX_NOT_FOUND) { /* Info-Package is supported */ if (**info_packages == '\0') { *info_packages = strlib_update(*info_packages, g_registered_info[info_index]); } else { *info_packages = strlib_append(*info_packages, ", "); *info_packages = strlib_append(*info_packages, g_registered_info[info_index]); } } }
void ccsnap_set_line_label(int btn, cc_string_t label) { CCAPP_ERROR(DEB_F_PREFIX"btn=%d label=%s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "ccsnap_set_line_label"), btn, label); if ( btn > 0 && btn <= MAX_CONFIG_LINES+1 ) { if ( label == NULL ) { label = strlib_empty(); } if ( lineLabels[btn] == NULL ) { lineLabels[btn] = strlib_empty(); } lineLabels[btn] = strlib_update(lineLabels[btn], label); } }
/* * parse_user_node * * Do user node specific parsing. * * Assumes a_node, info are not null. */ static void parse_user_node (xmlNode * a_node, cc_call_conference_Info_t *info) { xmlChar *data; xmlNode *cur_node; cc_call_conferenceParticipant_Info_t *participant; sll_lite_return_e sll_ret_val; //allocate a new participant participant = cpr_malloc(sizeof(cc_call_conferenceParticipant_Info_t)); if (participant == NULL) { CCAPP_ERROR(DEB_F_PREFIX" Malloc failure for participant\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI-CONFPARSE")); return; } else { participant->participantName = strlib_empty(); participant->endpointUri = strlib_empty(); participant->callid = strlib_empty(); participant->participantNumber = strlib_empty(); participant->participantSecurity = CC_SECURITY_NONE; participant->participantStatus = CCAPI_CONFPARTICIPANT_UNKNOWN; participant->canRemoveOtherParticipants = FALSE; } sll_ret_val = sll_lite_link_tail(&info->currentParticipantsList, (sll_lite_node_t *)participant); if (sll_ret_val != SLL_LITE_RET_SUCCESS) { CCAPP_ERROR(DEB_F_PREFIX" Error while trying to insert in the linked list\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI-CONFPARSE")); cpr_free(participant); return; } data = xmlGetProp(a_node, (const xmlChar *) "entity"); if (data != NULL) { char *tmp2; char *tmp1; participant->endpointUri = strlib_update(participant->endpointUri, (const char*)data); // Parse the endpoint URI, to get the Participant number tmp1 = (char *) strstr((const char*)data, "sip:"); if (tmp1) { tmp1 += 4; tmp2 = (char *) strchr(tmp1, '@'); if (tmp2) { *tmp2 = 0; participant->participantNumber = strlib_update(participant->participantNumber, (const char*)tmp1); } } xmlFree(data); } else { //continue parsing other elements CCAPP_ERROR(DEB_F_PREFIX" Error while trying to find the endpoint URI\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI-CONFPARSE")); } for (cur_node = a_node->children; cur_node != NULL; cur_node = cur_node->next) { if (cur_node->type == XML_ELEMENT_NODE) { if (xmlStrcmp(cur_node->name, (const xmlChar *) "endpoint") == 0) { parse_user_endpoint_node(cur_node, participant, info); } else if (xmlStrcmp(cur_node->name, (const xmlChar *) "display-text") == 0) { data = xmlNodeGetContent(cur_node); if (data != NULL) { participant->participantName = strlib_update(participant->participantName, (const char*)data); xmlFree(data); } else { //No display text - continue parsing other elements - CCAPP_ERROR(DEB_F_PREFIX" Error while trying to get the display text\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI-CONFPARSE")); } } } } }