/** * is Conference Call? * @param handle - call handle * @return boolean - is Conference */ cc_boolean CCAPI_CallInfo_getIsConference(cc_callinfo_ref_t handle){ session_data_t *data = (session_data_t *)handle; char isConf[32]; CCAPP_DEBUG(DEB_F_PREFIX"Entering", DEB_F_PREFIX_ARGS(SIP_CC_PROV, __FUNCTION__)); memset(isConf, 0, sizeof(isConf)); if(platGetPhraseText(CONFERENCE_LOCALE_CODE, isConf, sizeof(isConf)) == CC_FAILURE){ return FALSE; } if( data != NULL){ if( (strcasecmp(data->cld_name, isConf) == 0 && strcasecmp(data->cld_number, "") == 0) || (strcasecmp(data->clg_name, isConf) == 0 && strcasecmp(data->clg_number, "") == 0) ) { return TRUE; } } return FALSE; }
/** * is Conference Call? * @param handle - call handle * @return boolean - is Conference */ cc_boolean CCAPI_CallInfo_getIsConference(cc_callinfo_ref_t handle){ static const char *fname="CCAPI_CallInfo_getIsConference"; session_data_t *data = (session_data_t *)handle; char isConf_buf[32]; char* isConf = &isConf_buf[0]; CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname)); if(platGetPhraseText(CONFERENCE_LOCALE_CODE, isConf, 32) == CC_FAILURE){ return FALSE; } if( data != NULL){ if( (strcasecmp(data->cld_name, isConf) == 0 && strcasecmp(data->cld_number, "") == 0) || (strcasecmp(data->clg_name, isConf) == 0 && strcasecmp(data->clg_number, "") == 0) ) { return TRUE; } } return FALSE; }
/** * Inserts localized strings into existing strings with escape characters. * @param destination the return phrase holder * @param source the phrase with escape characters. * @param len the input length to cap the maximum value * @return pointer to the new string */ cc_string_t ccsnap_EscapeStrToLocaleStr(cc_string_t destination, cc_string_t source, int len) { static const char *fname="ccsnap_EscapeStrToLocaleStr"; char phrase_collector[MAX_LOCALE_STRING_LEN] = { '\0' }; char* phrase_collector_ptr = phrase_collector; char* esc_string_itr = (char*)source; int remaining_length = 0; cc_string_t ret_str = strlib_empty(); if(destination == NULL){ CCAPP_DEBUG(DEB_F_PREFIX"Error: destination is NULL\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname)); return NULL; } if(source == NULL){ CCAPP_DEBUG(DEB_F_PREFIX"Error: source is NULL\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname)); strlib_free(destination); return strlib_empty(); } if(source[0] == '\0'){ strlib_free(destination); return strlib_empty(); } if (len == LEN_UNKNOWN) { len = strlen(source) + MAX_LOCALE_PHRASE_LEN; } if (len <= 0){ CCAPP_DEBUG(DEB_F_PREFIX"Error: cannot write string of length <= 0\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname)); strlib_free(destination); return strlib_empty(); } if (len > MAX_LOCALE_STRING_LEN){ len = MAX_LOCALE_STRING_LEN; } remaining_length = len; while( *esc_string_itr != NUL && remaining_length > 0 && strlen(phrase_collector_ptr) < (size_t)(len-1)) { int rtn = CC_SUCCESS; int phrase_index = 0; char* phrase_bucket_ptr = (char*)cpr_malloc(remaining_length * sizeof(char)); if (phrase_bucket_ptr == NULL) { CCAPP_ERROR(DEB_F_PREFIX"Error: phrase_bucket_ptr is NULL\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname)); strlib_free(destination); return NULL; } phrase_bucket_ptr[0] = '\0'; switch(*esc_string_itr){ case OLD_CUCM_DICTIONARY_ESCAPE_TAG: phrase_index += CALL_CONTROL_PHRASE_OFFSET; // Do not set break to combine common code case NEW_CUCM_DICTIONARY_ESCAPE_TAG: esc_string_itr++; phrase_index += (int)(*esc_string_itr); rtn = platGetPhraseText(phrase_index, phrase_bucket_ptr, remaining_length-1); if(rtn == CC_FAILURE) break; sstrncat(phrase_collector_ptr, (cc_string_t)phrase_bucket_ptr, remaining_length); remaining_length--; break; default: // We need length 2 to concat 1 char and a terminating char sstrncat(phrase_collector_ptr, esc_string_itr, 1 + sizeof(char)); remaining_length--; break; } esc_string_itr++; cpr_free(phrase_bucket_ptr); } ret_str = strlib_malloc(phrase_collector_ptr, len); if (!ret_str) { /* * If a malloc error occurred, give them back what they had. * It's not right, but it's better than nothing. */ ret_str = destination; } else { strlib_free(destination); } CCAPP_DEBUG(DEB_F_PREFIX"Localization String returning %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), ret_str); return (ret_str); }