mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-13 15:50:59 +00:00
add sipcc to tree for sdp parser
This commit is contained in:
parent
36f89c8b7c
commit
0f00946782
144
libs/sipcc/core/ccapp/CCProvider.h
Executable file
144
libs/sipcc/core/ccapp/CCProvider.h
Executable file
@ -0,0 +1,144 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef __CCPROVIDER_H__
|
||||
#define __CCPROVIDER_H__
|
||||
|
||||
#include "cpr_types.h"
|
||||
#include "cpr_ipc.h"
|
||||
#include "cpr_socket.h"
|
||||
#include "cpr_memory.h"
|
||||
#include "cpr_errno.h"
|
||||
#include "cpr_in.h"
|
||||
#include "cpr_rand.h"
|
||||
#include "cpr_string.h"
|
||||
#include "cpr_threads.h"
|
||||
#include "phone_types.h"
|
||||
#include "session.h"
|
||||
|
||||
#include "cc_constants.h"
|
||||
#include "ccapi_types.h"
|
||||
#include "conf_roster.h"
|
||||
|
||||
#define CC_DEVICE_ID 0
|
||||
#include "ccapi_service.h"
|
||||
|
||||
typedef enum {
|
||||
FAILOVER,
|
||||
FALLBACK,
|
||||
NO_CUCM_SRST_AVAILABLE,
|
||||
NONE_AVAIL,
|
||||
} Cucm_mode_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
cc_reg_state_t state;
|
||||
Cucm_mode_t cucm_mode;
|
||||
cc_boolean inPreservation;
|
||||
session_id_t preservID;
|
||||
unsigned int mode;
|
||||
unsigned int cause;
|
||||
} CCAppGlobal_t;
|
||||
|
||||
typedef struct cc_call_log_t_ {
|
||||
string_t localPartyName;
|
||||
string_t localPartyNumber;
|
||||
string_t remotePartyName[2];
|
||||
string_t remotePartyNumber[2];
|
||||
string_t altPartyNumber[2];
|
||||
cc_log_disposition_t logDisp;
|
||||
cc_call_state_t callState;
|
||||
time_t startTime;
|
||||
cc_uint32_t duration;
|
||||
} cc_call_log_t;
|
||||
|
||||
typedef struct cc_call_info_t_{
|
||||
uint32_t ref_count;
|
||||
session_id_t sess_id;
|
||||
line_t line;
|
||||
callid_t id;
|
||||
uint16_t inst;
|
||||
cc_call_state_t state;
|
||||
cc_call_attr_t attr;
|
||||
cc_call_type_t type;
|
||||
cc_call_security_t security;
|
||||
cc_call_policy_t policy;
|
||||
unsigned int callref;
|
||||
int isSelected;
|
||||
unsigned int log_disp;
|
||||
string_t clg_name;
|
||||
string_t clg_number;
|
||||
string_t alt_number;
|
||||
string_t cld_name;
|
||||
string_t cld_number;
|
||||
string_t orig_called_name;
|
||||
string_t orig_called_number;
|
||||
string_t last_redir_name;
|
||||
string_t last_redir_number;
|
||||
string_t plcd_name;
|
||||
string_t plcd_number;
|
||||
string_t status;
|
||||
char gci[CC_MAX_GCID];
|
||||
cc_int32_t cause;
|
||||
cc_int32_t vid_dir;
|
||||
cc_int32_t vid_offer;
|
||||
cc_boolean is_conf;
|
||||
cc_boolean ringer_start;
|
||||
cc_boolean ringer_once;
|
||||
cc_int32_t ringer_mode;
|
||||
cc_boolean allowed_features[CCAPI_CALL_CAP_MAX];
|
||||
cc_string_t info_package;
|
||||
cc_string_t info_type;
|
||||
cc_string_t info_body;
|
||||
cc_call_log_t call_log;
|
||||
cc_boolean audio_mute;
|
||||
cc_boolean video_mute;
|
||||
cc_call_conference_Info_t call_conference;
|
||||
cc_string_t sdp;
|
||||
unsigned int media_stream_track_id;
|
||||
unsigned int media_stream_id;
|
||||
const cc_media_constraints_t* cc_constraints;
|
||||
} session_data_t;
|
||||
|
||||
typedef enum {
|
||||
NO_ACTION=0,
|
||||
RESET_ACTION,
|
||||
RESTART_ACTION,
|
||||
RE_REGISTER_ACTION,
|
||||
STOP_ACTION,
|
||||
DESTROY_ACTION
|
||||
} cc_action_t;
|
||||
|
||||
#define CCAPP_SERVICE_CMD 1
|
||||
#define CCAPP_CREATE_SESSION 2
|
||||
#define CCAPP_CLOSE_SESSION 3
|
||||
#define CCAPP_INVOKE_FEATURE 4
|
||||
#define CCAPP_SESSION_UPDATE 5
|
||||
#define CCAPP_FEATURE_UPDATE 6
|
||||
#define CCAPP_UPDATELINES 7
|
||||
#define CCAPP_FAILOVER_IND 8
|
||||
#define CCAPP_FALLBACK_IND 9
|
||||
#define CCAPP_MODE_NOTIFY 10
|
||||
#define CCAPP_SHUTDOWN_ACK 11
|
||||
#define CCAPP_REG_ALL_FAIL 12
|
||||
#define CCAPP_INVOKEPROVIDER_FEATURE 13
|
||||
#define CCAPP_SEND_INFO 14
|
||||
#define CCAPP_RCVD_INFO 15
|
||||
#define CCAPP_LOGOUT_RESET 16
|
||||
#define CCAPP_THREAD_UNLOAD 17
|
||||
#define CCAPP_SESSION_MGMT 18
|
||||
|
||||
extern cpr_status_e ccappTaskPostMsg(unsigned int msgId, void * data, uint16_t len, int appId);
|
||||
extern void ccappSyncSessionMgmt(session_mgmt_t *sessMgmt);
|
||||
extern void CCApp_task(void * arg);
|
||||
extern void *findhash(unsigned int key);
|
||||
extern session_id_t createSessionId(line_t line, callid_t call);
|
||||
extern void getLineIdAndCallId (line_t *line_id, callid_t *call_id);
|
||||
extern void ccp_handler(void* msg, int type);
|
||||
extern session_data_t * getDeepCopyOfSessionData(session_data_t *data);
|
||||
extern void cleanSessionData(session_data_t *data);
|
||||
extern cc_call_handle_t ccappGetConnectedCall();
|
||||
|
||||
#endif
|
||||
|
303
libs/sipcc/core/ccapp/call_logger.c
Normal file
303
libs/sipcc/core/ccapp/call_logger.c
Normal file
@ -0,0 +1,303 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "cpr_stdio.h"
|
||||
#include <time.h>
|
||||
#include "sessionHash.h"
|
||||
#include "CCProvider.h"
|
||||
#include "call_logger.h"
|
||||
|
||||
|
||||
|
||||
void calllogger_init_call_log (cc_call_log_t *log)
|
||||
{
|
||||
log->localPartyName = strlib_empty();
|
||||
log->localPartyNumber = strlib_empty();
|
||||
log->remotePartyName[0] = strlib_empty();
|
||||
log->remotePartyName[1] = strlib_empty();
|
||||
log->remotePartyNumber[0] = strlib_empty();
|
||||
log->remotePartyNumber[1] = strlib_empty();
|
||||
log->altPartyNumber[0] = strlib_empty();
|
||||
log->altPartyNumber[1] = strlib_empty();
|
||||
log->startTime = 0;
|
||||
log->duration = 0;
|
||||
|
||||
log->logDisp = CC_LOGD_UNKNWN;
|
||||
log->callState = MAX_CALL_STATES;
|
||||
}
|
||||
|
||||
void calllogger_copy_call_log (cc_call_log_t *dest, cc_call_log_t * src)
|
||||
{
|
||||
dest->localPartyName = strlib_copy(src->localPartyName);
|
||||
dest->localPartyNumber = strlib_copy(src->localPartyNumber);
|
||||
dest->remotePartyName[0] = strlib_copy(src->remotePartyName[0]);
|
||||
dest->remotePartyName[1] = strlib_copy(src->remotePartyName[1]);
|
||||
dest->remotePartyNumber[0] = strlib_copy(src->remotePartyNumber[0]);
|
||||
dest->remotePartyNumber[1] = strlib_copy(src->remotePartyNumber[1]);
|
||||
dest->altPartyNumber[0] = strlib_copy(src->altPartyNumber[0]);
|
||||
dest->altPartyNumber[1] = strlib_copy(src->altPartyNumber[1]);
|
||||
dest->startTime = src->startTime;
|
||||
dest->duration = src->duration;
|
||||
|
||||
dest->logDisp = src->logDisp;
|
||||
dest->callState = src->callState;
|
||||
}
|
||||
|
||||
void calllogger_free_call_log (cc_call_log_t *log)
|
||||
{
|
||||
strlib_free(log->localPartyName);
|
||||
strlib_free(log->localPartyNumber);
|
||||
strlib_free(log->remotePartyName[0]);
|
||||
strlib_free(log->remotePartyName[1]);
|
||||
strlib_free(log->remotePartyNumber[0]);
|
||||
strlib_free(log->remotePartyNumber[1]);
|
||||
strlib_free(log->altPartyNumber[0]);
|
||||
strlib_free(log->altPartyNumber[1]);
|
||||
|
||||
calllogger_init_call_log(log);
|
||||
}
|
||||
|
||||
void calllogger_print_call_log(cc_call_log_t *log)
|
||||
{
|
||||
static const char *fname = "calllogger_print_call_log";
|
||||
|
||||
CCLOG_DEBUG(DEB_F_PREFIX"Entering...\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
CCLOG_DEBUG("Remote ID %s:%s %s:%s\n LocalID %s:%s \n alt %s:%s\n",
|
||||
log->remotePartyName[0], log->remotePartyNumber[0],
|
||||
log->remotePartyName[1], log->remotePartyNumber[1],
|
||||
log->localPartyName, log->localPartyNumber,
|
||||
log->altPartyNumber[0], log->altPartyNumber[1] );
|
||||
CCLOG_DEBUG("state %d \n Disp %d\n", log->callState, log->logDisp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call logger update to be called placed call num update
|
||||
*/
|
||||
void calllogger_setPlacedCallInfo (session_data_t *data)
|
||||
{
|
||||
static const char *fname = "calllogger_setPlacedCallInfo";
|
||||
|
||||
CCLOG_DEBUG(DEB_F_PREFIX"updating placed number for session %x to %s:%s\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->sess_id,
|
||||
data->cld_name, data->cld_number);
|
||||
if ( data->call_log.logDisp == CC_LOGD_RCVD ) { return;}
|
||||
data->call_log.remotePartyName[0] = strlib_copy(data->plcd_name);
|
||||
data->call_log.remotePartyNumber[0] = strlib_copy(data->plcd_number);
|
||||
data->call_log.logDisp = CC_LOGD_SENT;
|
||||
data->call_log.startTime = time(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* call logger api to be called for log disp update
|
||||
*/
|
||||
void calllogger_updateLogDisp (session_data_t *data)
|
||||
{
|
||||
static const char *fname = "calllogger_updateLogDisp";
|
||||
|
||||
CCLOG_DEBUG(DEB_F_PREFIX"updating log disposition for session %x to %d\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->sess_id, data->log_disp);
|
||||
data->call_log.logDisp = data->log_disp;
|
||||
}
|
||||
|
||||
cc_boolean partyInfoPassedTheNumberFilter (cc_string_t partyString)
|
||||
{
|
||||
static const char *fname = "partyInfoPassedTheNumberFilter";
|
||||
|
||||
CCLOG_DEBUG(DEB_F_PREFIX"Entering...\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
// check if partyString is something we should not be logging at this point
|
||||
// Uris: CfwdALL 105
|
||||
// Conference 152
|
||||
if (partyString && strlen(partyString) > 1 &&
|
||||
(partyString[1] == 17 ||
|
||||
partyString[1] == 91 ||
|
||||
partyString[1] == 05 ||
|
||||
partyString[1] == 18 ||
|
||||
partyString[1] == 16 ||
|
||||
partyString[1] == 52 )) {
|
||||
|
||||
CCLOG_DEBUG(DEB_F_PREFIX"Filtering out the partyName=%s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), partyString);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* partyInfoPassedTheNameFilter
|
||||
*
|
||||
* @param partyString String
|
||||
* @return boolean
|
||||
*/
|
||||
cc_boolean partyInfoPassedTheNameFilter(cc_string_t partyString) {
|
||||
static const char *fname = "partyInfoPassedTheNameFilter";
|
||||
|
||||
CCLOG_DEBUG(DEB_F_PREFIX"Entering...\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
// If the name String has Conference, filter it out
|
||||
if (partyString && strlen(partyString) > 1 &&
|
||||
(partyString[1] == 52 || partyString[1] == 53)) {
|
||||
CCLOG_DEBUG(DEB_F_PREFIX"Filtering out the partyName=%s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), partyString);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static cc_string_t missedCallMask=NULL;
|
||||
void calllogger_setMissedCallLoggingConfig(cc_string_t mask) {
|
||||
static const char *fname = "calllogger_setMissedCallLoggingConfig";
|
||||
|
||||
|
||||
CCLOG_DEBUG(DEB_F_PREFIX"Entering... mask=%s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), mask);
|
||||
if ( missedCallMask == NULL) {
|
||||
missedCallMask = strlib_empty();
|
||||
}
|
||||
missedCallMask = strlib_update(missedCallMask, mask);
|
||||
}
|
||||
|
||||
cc_boolean isMissedCallLoggingEnabled (unsigned int line)
|
||||
{
|
||||
static const char *fname = "isMissedCallLoggingEnabled";
|
||||
|
||||
CCLOG_DEBUG(DEB_F_PREFIX"Entering... mask=%s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), missedCallMask);
|
||||
if (missedCallMask == NULL) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ((line > 0) && strlen(missedCallMask) > (line-1)) {
|
||||
if ( missedCallMask[line-1] == '0' ) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void handlePlacedCall (session_data_t *data)
|
||||
{
|
||||
static const char *fname = "handlePlacedCall";
|
||||
|
||||
CCLOG_DEBUG(DEB_F_PREFIX"Entering...\n",DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
//populate calling party if not already populated
|
||||
if ( data->call_log.localPartyNumber == strlib_empty() ) {
|
||||
data->call_log.localPartyNumber = strlib_update(data->call_log.localPartyNumber, data->clg_number);
|
||||
data->call_log.localPartyName = strlib_update(data->call_log.localPartyName, data->clg_name);
|
||||
}
|
||||
|
||||
// first update or update with the same number we update name and number
|
||||
if ( data->call_log.remotePartyNumber[0] == strlib_empty() ||
|
||||
(data->cld_number[0] != 0 && strncmp(data->call_log.remotePartyNumber[0],
|
||||
data->cld_number, strlen(data->cld_number)) == 0 )) {
|
||||
if ( partyInfoPassedTheNameFilter(data->cld_name) &&
|
||||
partyInfoPassedTheNumberFilter(data->cld_number) )
|
||||
data->call_log.remotePartyNumber[0] = strlib_update(data->call_log.remotePartyNumber[0], data->cld_number);
|
||||
data->call_log.remotePartyName[0] = strlib_update(data->call_log.remotePartyName[0], data->cld_name);
|
||||
}
|
||||
|
||||
// Start the duration count once the call reaches connected state.
|
||||
if ( data->state == CONNECTED &&
|
||||
data->call_log.startTime == 0 ) {
|
||||
data->call_log.startTime = time(NULL);
|
||||
}
|
||||
|
||||
if (data->state == ONHOOK ) {
|
||||
// only set the duration if the call entered the connected state
|
||||
if ( data->call_log.startTime != 0 ) {
|
||||
data->call_log.duration = (cc_uint32_t) (time(NULL) - data->call_log.startTime);
|
||||
} else {
|
||||
data->call_log.startTime = time(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
data->call_log.callState = data->state;
|
||||
}
|
||||
|
||||
|
||||
void handleMissedOrReceviedCall ( session_data_t *data )
|
||||
{
|
||||
static const char *fname = "handleMissedOrReceviedCall";
|
||||
int line = GET_LINE_ID(data->sess_id);
|
||||
cc_string_t localName = strlib_empty(), localNumber = strlib_empty();
|
||||
cc_string_t remoteName = strlib_empty(), remoteNumber = strlib_empty();
|
||||
|
||||
CCLOG_DEBUG(DEB_F_PREFIX"Entering...\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if (data->type == CC_CALL_TYPE_INCOMING || data->type == CC_CALL_TYPE_FORWARDED ) {
|
||||
localName = data->cld_name;
|
||||
localNumber = data->cld_number;
|
||||
remoteName = data->clg_name;
|
||||
remoteNumber = data->clg_number;
|
||||
} else {
|
||||
localName = data->clg_name;
|
||||
localNumber = data->clg_number;
|
||||
remoteName = data->cld_name;
|
||||
remoteNumber = data->cld_number;
|
||||
}
|
||||
|
||||
if ( data->call_log.localPartyNumber == strlib_empty() ) {
|
||||
data->call_log.localPartyNumber = strlib_update(data->call_log.localPartyNumber, localNumber);
|
||||
data->call_log.localPartyName = strlib_update(data->call_log.localPartyName, localName);
|
||||
}
|
||||
|
||||
// first update or update with the same number we update name and number
|
||||
if ( data->call_log.remotePartyNumber[0] == strlib_empty() ||
|
||||
(remoteNumber[0] != 0 && strncmp(data->call_log.remotePartyNumber[0],
|
||||
remoteNumber, strlen(remoteNumber)) == 0 )) {
|
||||
data->call_log.remotePartyNumber[0] = strlib_update(data->call_log.remotePartyNumber[0], remoteNumber);
|
||||
data->call_log.altPartyNumber[0] = strlib_update(data->call_log.altPartyNumber[0], data->alt_number);
|
||||
if (data->call_log.remotePartyName[0] == strlib_empty() ) {
|
||||
data->call_log.remotePartyName[0] = strlib_update(data->call_log.remotePartyName[0], remoteName);
|
||||
}
|
||||
} else {
|
||||
// since number doesn't match this is a new leg
|
||||
data->call_log.remotePartyName[1] = strlib_update(data->call_log.remotePartyName[1], remoteName);
|
||||
data->call_log.remotePartyNumber[1] = strlib_update(data->call_log.remotePartyNumber[1], remoteNumber);
|
||||
data->call_log.altPartyNumber[1] = strlib_update(data->call_log.altPartyNumber[1], data->alt_number);
|
||||
}
|
||||
|
||||
if ( data->state == ONHOOK ) {
|
||||
if ( data->call_log.callState == RINGIN ) {
|
||||
data->call_log.startTime = time(NULL);
|
||||
if (isMissedCallLoggingEnabled(line)) {
|
||||
data->call_log.logDisp = CC_LOGD_MISSED;
|
||||
} else {
|
||||
data->call_log.logDisp = CC_LOGD_DELETE;
|
||||
}
|
||||
data->call_log.startTime = time(NULL);
|
||||
data->call_log.duration = 0; //missed call duration is 0
|
||||
} else if ( data->call_log.startTime != 0 ){
|
||||
//connected call going onhook update duration
|
||||
data->call_log.duration = (cc_uint32_t) (time(NULL) - data->call_log.startTime);
|
||||
}
|
||||
}
|
||||
|
||||
if ( data->state == CONNECTED && data->call_log.startTime == 0 ) {
|
||||
data->call_log.logDisp = CC_LOGD_RCVD;
|
||||
data->call_log.startTime = time(NULL);
|
||||
}
|
||||
|
||||
data->call_log.callState = data->state;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call logger update to be called on attr or callinfo or state events
|
||||
*/
|
||||
void calllogger_update (session_data_t *data)
|
||||
{
|
||||
static const char *fname = "calllogger_update";
|
||||
|
||||
CCLOG_DEBUG(DEB_F_PREFIX"Entering...\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
if (data->call_log.logDisp == CC_LOGD_DELETE) {
|
||||
CCLOG_DEBUG(DEB_F_PREFIX"log disposition set to delete. Ignoring call logging for sess_id=%x\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->sess_id);
|
||||
}
|
||||
|
||||
if (data->call_log.logDisp == CC_LOGD_RCVD || data->call_log.logDisp == CC_LOGD_MISSED ||
|
||||
data->type == CC_CALL_TYPE_INCOMING || data->type == CC_CALL_TYPE_FORWARDED ) {
|
||||
handleMissedOrReceviedCall(data);
|
||||
} else if ( data->call_log.logDisp == CC_LOGD_SENT ||
|
||||
data->type == CC_CALL_TYPE_OUTGOING ) {
|
||||
handlePlacedCall (data);
|
||||
}
|
||||
|
||||
}
|
20
libs/sipcc/core/ccapp/call_logger.h
Normal file
20
libs/sipcc/core/ccapp/call_logger.h
Normal file
@ -0,0 +1,20 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef __CALL_LOGGER_H__
|
||||
#define __CALL_LOGGER_H__
|
||||
|
||||
#include "cc_types.h"
|
||||
#include "CCProvider.h"
|
||||
|
||||
void calllogger_init_call_log(cc_call_log_t *log);
|
||||
void calllogger_copy_call_log(cc_call_log_t *dest, cc_call_log_t * src);
|
||||
void calllogger_free_call_log(cc_call_log_t *log);
|
||||
void calllogger_print_call_log(cc_call_log_t *log);
|
||||
void calllogger_setPlacedCallInfo(session_data_t *data);
|
||||
void calllogger_updateLogDisp(session_data_t *data);
|
||||
void calllogger_setMissedCallLoggingConfig(cc_string_t mask);
|
||||
void calllogger_update(session_data_t *data);
|
||||
|
||||
#endif
|
281
libs/sipcc/core/ccapp/capability_set.c
Normal file
281
libs/sipcc/core/ccapp/capability_set.c
Normal file
@ -0,0 +1,281 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "capability_set.h"
|
||||
#include "CCProvider.h"
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// Data Structures Used to Store the Capability Set Information
|
||||
// Settings on kept on a per call state, per feature basis.
|
||||
// Includes all general endpoint capabilities, plus fcp-controlled ones
|
||||
// --------------------------------------------------------------------------------
|
||||
static cc_boolean capability_set[MAX_CALL_STATES][CCAPI_CALL_CAP_MAX];
|
||||
static cc_boolean capability_idleset[CCAPI_CALL_CAP_MAX];
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// Data Structures Used to Store the Parsed FCP information from UCM/FCP file
|
||||
// (after parse will be used to selectively set capabilities in the above also)
|
||||
// --------------------------------------------------------------------------------
|
||||
|
||||
// maximum number of features
|
||||
#define FCP_FEATURE_MAX 9
|
||||
|
||||
char g_fp_version_stamp[MAX_FP_VERSION_STAMP_LEN];
|
||||
static cc_feature_control_policy_info_t cc_feat_control_policy[FCP_FEATURE_MAX];
|
||||
static ccapi_call_capability_e cc_fcp_id_to_capability_map[FCP_FEATURE_MAX+1]; // 0th entry of map is not used/null entry
|
||||
|
||||
|
||||
static const unsigned int CALL_FORWARD_ALL_FCP_INDEX = 1;
|
||||
static const unsigned int CONFERENCE_LIST_FCP_INDEX = 4;
|
||||
static const unsigned int SPEED_DIAL_FCP_INDEX = 5;
|
||||
static const unsigned int CALL_BACK_FCP_INDEX = 6;
|
||||
static const unsigned int REDIAL_FCP_INDEX = 7;
|
||||
|
||||
static int fcp_index = -1;
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
|
||||
|
||||
/*
|
||||
* capset_set_fcp_forwardall - sets the fcp-controlled call forward all feature
|
||||
*
|
||||
*/
|
||||
static void capset_set_fcp_forwardall (cc_boolean state)
|
||||
{
|
||||
CONFIG_DEBUG(DEB_F_PREFIX"FCP Setting CALLFWD Capability to [%d]\n", DEB_F_PREFIX_ARGS(JNI, "capset_set_fcp_forwardall"), (unsigned int)state);
|
||||
|
||||
capability_idleset[CCAPI_CALL_CAP_CALLFWD] = state;
|
||||
capability_set[OFFHOOK][CCAPI_CALL_CAP_CALLFWD] = state;
|
||||
}
|
||||
|
||||
/*
|
||||
* capset_set_fcp_redial - sets the fcp-controlled redial feature
|
||||
*
|
||||
*/
|
||||
static void capset_set_fcp_redial (cc_boolean state)
|
||||
{
|
||||
CONFIG_DEBUG(DEB_F_PREFIX"FCP Setting REDIAL capability to [%d]\n", DEB_F_PREFIX_ARGS(JNI, "capset_set_fcp_redial"), (unsigned int)state);
|
||||
|
||||
capability_idleset[CCAPI_CALL_CAP_REDIAL] = state;
|
||||
capability_set[OFFHOOK][CCAPI_CALL_CAP_REDIAL] = state;
|
||||
capability_set[ONHOOK][CCAPI_CALL_CAP_REDIAL] = state;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
|
||||
|
||||
/*
|
||||
* fcp_set_index - sets a given feture index number (from fcp xml file), maps it to the internal
|
||||
* call capability, and sets the appropriate state-based capability for the feature index
|
||||
*
|
||||
*/
|
||||
static void fcp_set_index (unsigned int fcpCapabilityId, cc_boolean state)
|
||||
{
|
||||
ccapi_call_capability_e capabilityId = CCAPI_CALL_CAP_MAX;
|
||||
|
||||
// range check the capability index
|
||||
if ((fcpCapabilityId <= 0) || (fcpCapabilityId > FCP_FEATURE_MAX))
|
||||
{
|
||||
CONFIG_ERROR(CFG_F_PREFIX "Unable to set capability of unknown feature [%d] in FCP \n", "fcp_set_index", fcpCapabilityId);
|
||||
return;
|
||||
}
|
||||
|
||||
// convert the fcp index to an fcp capability id
|
||||
capabilityId = cc_fcp_id_to_capability_map[fcpCapabilityId];
|
||||
|
||||
|
||||
// based on the capability id, invoke the appropate method specific to that capability
|
||||
switch (capabilityId)
|
||||
{
|
||||
case CCAPI_CALL_CAP_CALLFWD : capset_set_fcp_forwardall (state); break;
|
||||
case CCAPI_CALL_CAP_REDIAL : capset_set_fcp_redial (state); break;
|
||||
default :
|
||||
{
|
||||
CONFIG_ERROR(CFG_F_PREFIX "Unable to update settings for capability [%d]\n", "fcp_set_index", (int)capabilityId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* capset_init - initialize the internal capability data structures to defaults
|
||||
*
|
||||
*/
|
||||
static void capset_init ()
|
||||
{
|
||||
// initialize the 4 tables related to capability set to false
|
||||
memset(capability_idleset, 0, sizeof(capability_idleset));
|
||||
memset(capability_set, 0, sizeof(capability_set));
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// FCP based capabilities
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
CONFIG_DEBUG(DEB_F_PREFIX"FCP Initializing Capabilities to default\n", DEB_F_PREFIX_ARGS(JNI, "capset_init"));
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Non-FCP-based Capabilities
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
// Now, set all the non-FCP based capabilities to appropriate default settings
|
||||
// (some of which may be enabled by default)
|
||||
|
||||
capability_idleset[CCAPI_CALL_CAP_NEWCALL] = TRUE;
|
||||
|
||||
// call-state based settings
|
||||
// offhook
|
||||
capability_set[OFFHOOK][CCAPI_CALL_CAP_ENDCALL] = TRUE;
|
||||
|
||||
// onhook
|
||||
capability_set[ONHOOK][CCAPI_CALL_CAP_NEWCALL] = TRUE;
|
||||
|
||||
// ringout
|
||||
capability_set[RINGOUT][CCAPI_CALL_CAP_ENDCALL] = TRUE;
|
||||
|
||||
// ringing
|
||||
capability_set[RINGIN][CCAPI_CALL_CAP_ANSWER] = TRUE;
|
||||
|
||||
// proceed
|
||||
capability_set[PROCEED][CCAPI_CALL_CAP_ENDCALL] = TRUE;
|
||||
|
||||
// connected
|
||||
capability_set[CONNECTED][CCAPI_CALL_CAP_ENDCALL] = TRUE;
|
||||
capability_set[CONNECTED][CCAPI_CALL_CAP_HOLD] = TRUE;
|
||||
capability_set[CONNECTED][CCAPI_CALL_CAP_TRANSFER] = TRUE;
|
||||
capability_set[CONNECTED][CCAPI_CALL_CAP_CONFERENCE] = TRUE;
|
||||
capability_set[CONNECTED][CCAPI_CALL_CAP_SELECT] = TRUE;
|
||||
|
||||
// hold
|
||||
capability_set[HOLD][CCAPI_CALL_CAP_RESUME] = TRUE;
|
||||
capability_set[REMHOLD][CCAPI_CALL_CAP_RESUME] = TRUE;
|
||||
|
||||
// busy
|
||||
capability_set[BUSY][CCAPI_CALL_CAP_ENDCALL] = TRUE;
|
||||
|
||||
// reorder
|
||||
capability_set[REORDER][CCAPI_CALL_CAP_ENDCALL] = TRUE;
|
||||
|
||||
// dialing
|
||||
capability_set[DIALING][CCAPI_CALL_CAP_ENDCALL] = TRUE;
|
||||
capability_set[DIALING][CCAPI_CALL_CAP_DIAL] = TRUE;
|
||||
capability_set[DIALING][CCAPI_CALL_CAP_SENDDIGIT] = TRUE;
|
||||
capability_set[DIALING][CCAPI_CALL_CAP_BACKSPACE] = TRUE;
|
||||
|
||||
// holdrevert
|
||||
capability_set[HOLDREVERT][CCAPI_CALL_CAP_ANSWER] = TRUE;
|
||||
|
||||
// preservation
|
||||
capability_set[PRESERVATION][CCAPI_CALL_CAP_ENDCALL] = TRUE;
|
||||
|
||||
// waiting for digits
|
||||
capability_set[WAITINGFORDIGITS][CCAPI_CALL_CAP_SENDDIGIT] = TRUE;
|
||||
capability_set[WAITINGFORDIGITS][CCAPI_CALL_CAP_BACKSPACE] = TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* capset_get_idleset - get the set of features associated with idle state
|
||||
*
|
||||
*/
|
||||
void capset_get_idleset ( cc_cucm_mode_t mode, cc_boolean features[])
|
||||
{
|
||||
static const char fname[] = "capset_get_idleset";
|
||||
int i;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"updating idleset",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
for (i=0;i < CCAPI_CALL_CAP_MAX; i++) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"updating line features %d=%d",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), i, capability_idleset[i]);
|
||||
features[i] = capability_idleset[i];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* capset_get_allowed_features - get the set of features
|
||||
*
|
||||
*/
|
||||
void capset_get_allowed_features ( cc_cucm_mode_t mode, cc_call_state_t state, cc_boolean features[])
|
||||
{
|
||||
static const char fname[] = "capset_get_allowed_features";
|
||||
int i;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"updating idleset",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
for (i=0;i < CCAPI_CALL_CAP_MAX; i++) {
|
||||
features[i] = capability_set[state][i];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------
|
||||
// ---------------------------- XML Parse Logic for Feature Control Policy --------------------------------
|
||||
// --------------------------------------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* fcp_set_capabilities - updates the capabilities structure, based on the now parsed information
|
||||
* from fcp xml file
|
||||
*
|
||||
*/
|
||||
|
||||
static void fcp_set_capabilities()
|
||||
{
|
||||
int my_fcp_index = 0;
|
||||
|
||||
if ( (fcp_index+1) >= FCP_FEATURE_MAX) {
|
||||
fcp_index = (FCP_FEATURE_MAX -1);
|
||||
CONFIG_ERROR(CFG_F_PREFIX "Received more than the maximum supported features [%d] in FCP \n", "fcp_set_capabilities", FCP_FEATURE_MAX);
|
||||
|
||||
}
|
||||
// loop over all the FCP features parsed, and for each one, based on ID, and enabled settings,
|
||||
// update the corresponding call capability flags
|
||||
for (my_fcp_index = 0; my_fcp_index <= fcp_index; my_fcp_index++)
|
||||
{ // set the capability if fcp file has it marked as 'enabled'
|
||||
fcp_set_index(cc_feat_control_policy[my_fcp_index].featureId, (cc_feat_control_policy[my_fcp_index].featureEnabled == TRUE));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* fcp_init - initialize the data structure used to store the fcp parse info
|
||||
*
|
||||
*/
|
||||
static void fcp_init()
|
||||
{
|
||||
// master index; set to null
|
||||
fcp_index = -1;
|
||||
|
||||
// initialize the map of fcp xml feature indexes to internal call capabilities
|
||||
cc_fcp_id_to_capability_map[CALL_FORWARD_ALL_FCP_INDEX] = CCAPI_CALL_CAP_CALLFWD;
|
||||
cc_fcp_id_to_capability_map[REDIAL_FCP_INDEX] = CCAPI_CALL_CAP_REDIAL;
|
||||
|
||||
// initialize the capability set data structures
|
||||
capset_init();
|
||||
|
||||
// initialize the version
|
||||
g_fp_version_stamp[0] = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
* capset_set_fcp_forwardall - sets the fcp-controlled call forward all feature
|
||||
*
|
||||
*/
|
||||
int fcp_init_template (const char* fcp_plan_string)
|
||||
{
|
||||
fcp_init();
|
||||
|
||||
if (fcp_plan_string == NULL)
|
||||
{ // set up the default fcp
|
||||
return (0);
|
||||
}
|
||||
|
||||
// update the fcp capabilities structure, based on the parsed feature information
|
||||
fcp_set_capabilities();
|
||||
|
||||
return (0);
|
||||
}
|
||||
// ---------------------------- End Of XML Parse Logic for Feature Control Policy --------------------------
|
33
libs/sipcc/core/ccapp/capability_set.h
Normal file
33
libs/sipcc/core/ccapp/capability_set.h
Normal file
@ -0,0 +1,33 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _CC_CAPABILITY_SET_H_
|
||||
#define _CC_CAPABILITY_SET_H_
|
||||
|
||||
#include "ccapi_types.h"
|
||||
|
||||
extern void capset_get_idleset( cc_cucm_mode_t mode, cc_boolean features[]);
|
||||
extern void capset_get_allowed_features( cc_cucm_mode_t mode, cc_call_state_t state, cc_boolean features[]);
|
||||
|
||||
// FCP (feature control policy) methods
|
||||
int fcp_init_template (const char* fcp_plan_string);
|
||||
|
||||
// FCP Definitions
|
||||
#define FCP_MAX_SIZE 0x5000
|
||||
#define FCP_FEATURE_NAME_MAX 24
|
||||
#define MAX_FP_VERSION_STAMP_LEN (64+1)
|
||||
|
||||
extern char g_fp_version_stamp[MAX_FP_VERSION_STAMP_LEN];
|
||||
|
||||
|
||||
// for each feature in the XML FCP file, we'll receive the
|
||||
// feature name, featureId, and whether or not it is enabled
|
||||
typedef struct cc_feature_control_policy_info_t_
|
||||
{
|
||||
char featureName[FCP_FEATURE_NAME_MAX];
|
||||
unsigned int featureId;
|
||||
cc_boolean featureEnabled;
|
||||
} cc_feature_control_policy_info_t;
|
||||
|
||||
#endif /* _CC_CAPABILITY_SET_H_ */
|
50
libs/sipcc/core/ccapp/cc_blf.c
Normal file
50
libs/sipcc/core/ccapp/cc_blf.c
Normal file
@ -0,0 +1,50 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "cc_blf.h"
|
||||
#include "pres_sub_not_handler.h"
|
||||
|
||||
/**
|
||||
* Initialize the BLF stack
|
||||
* @return
|
||||
*/
|
||||
int CC_BLF_init() {
|
||||
pres_sub_handler_initialized();
|
||||
return CC_SUCCESS;
|
||||
}
|
||||
/**
|
||||
* Start BLF subscription
|
||||
* @param request_id the request id
|
||||
* @param duration the subscription duration
|
||||
* @param watcher the name of subscription watcher
|
||||
* @param presentity
|
||||
* @param app_id the application id for the BLF
|
||||
* @param feature_mask
|
||||
* @return void
|
||||
*/
|
||||
void CC_BLF_subscribe(int request_id,
|
||||
int duration,
|
||||
const char *watcher,
|
||||
const char *presentity,
|
||||
int app_id,
|
||||
cc_blf_feature_mask_t feature_mask) {
|
||||
pres_get_state(request_id, duration, watcher, presentity, app_id, feature_mask);
|
||||
}
|
||||
/**
|
||||
* Unsubscribe the BLF subscription
|
||||
* @param request_id the request id
|
||||
* @return void
|
||||
*/
|
||||
void CC_BLF_unsubscribe(int request_id) {
|
||||
pres_terminate_req(request_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsubscribe all BLF subscription
|
||||
* @return void
|
||||
*/
|
||||
void CC_BLF_unsubscribe_All() {
|
||||
pres_terminate_req_all();
|
||||
}
|
||||
|
681
libs/sipcc/core/ccapp/cc_call_feature.c
Normal file
681
libs/sipcc/core/ccapp/cc_call_feature.c
Normal file
@ -0,0 +1,681 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "cc_call_feature.h"
|
||||
#include "CCProvider.h"
|
||||
#include "sessionConstants.h"
|
||||
#include "sessionTypes.h"
|
||||
#include "lsm.h"
|
||||
#include "phone_debug.h"
|
||||
#include "text_strings.h"
|
||||
#include "ccapi.h"
|
||||
#include "ccapp_task.h"
|
||||
#include "sessionHash.h"
|
||||
#include "cpr_rand.h"
|
||||
|
||||
extern cpr_status_e ccappTaskPostMsg(unsigned int msgId, void * data, uint16_t len, int appId);
|
||||
|
||||
/**
|
||||
* Internal method: create call handle
|
||||
* @param line
|
||||
* @paran call_id
|
||||
*/
|
||||
cc_call_handle_t cc_createCallHandle(cc_lineid_t line, cc_callid_t call_id)
|
||||
{
|
||||
return (CREATE_CALL_HANDLE(line, call_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal method: assign a valid call id.
|
||||
* @param line_id line number
|
||||
* @param call_id call id
|
||||
* @return void
|
||||
*/
|
||||
void cc_getLineIdAndCallId (cc_lineid_t *line_id, cc_callid_t *call_id)
|
||||
{
|
||||
// assign proper line_id and call_id if not already there
|
||||
if ((*line_id) == 0 || (*line_id) == CC_ALL_LINES) {
|
||||
/*
|
||||
* If the filter is the All Calls Complex Filter and the primary line
|
||||
* is at its configured call capacity, the next available line should
|
||||
* be used. In this scenario, sessionUI/Mgr send the line_id as zero.
|
||||
*/
|
||||
(*line_id) = lsm_get_available_line(FALSE);
|
||||
}
|
||||
|
||||
if ((*call_id) == 0) {
|
||||
(*call_id) = cc_get_new_call_id();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke a call feature.
|
||||
*/
|
||||
cc_return_t cc_invokeFeature(cc_call_handle_t call_handle, group_cc_feature_t featureId, cc_sdp_direction_t video_pref, string_t data) {
|
||||
session_feature_t callFeature;
|
||||
callFeature.session_id = (SESSIONTYPE_CALLCONTROL << CC_SID_TYPE_SHIFT) + call_handle;
|
||||
callFeature.featureID = featureId;
|
||||
callFeature.featData.ccData.state = video_pref;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"cc_invokeFeature:sid=%d, line=%d, cid=%d, fid=%d, video_pref=%s data=%s\n",
|
||||
DEB_F_PREFIX_ARGS("cc_call_feature", "cc_invokeFeature"),
|
||||
callFeature.session_id,
|
||||
GET_LINE_ID(call_handle),
|
||||
GET_CALL_ID(call_handle),
|
||||
featureId, SDP_DIRECTION_PRINT(video_pref),
|
||||
((featureId == CC_FEATURE_KEYPRESS) ? "...": data));
|
||||
|
||||
switch (featureId) {
|
||||
case CC_FEATURE_KEYPRESS:
|
||||
case CC_FEATURE_DIALSTR:
|
||||
case CC_FEATURE_SPEEDDIAL:
|
||||
case CC_FEATURE_BLIND_XFER_WITH_DIALSTRING:
|
||||
case CC_FEATURE_END_CALL:
|
||||
case CC_FEATURE_B2BCONF:
|
||||
case CC_FEATURE_CONF:
|
||||
case CC_FEATURE_XFER:
|
||||
case CC_FEATURE_HOLD:
|
||||
callFeature.featData.ccData.info = strlib_malloc(data, strlen(data));
|
||||
callFeature.featData.ccData.info1 = NULL;
|
||||
break;
|
||||
|
||||
default:
|
||||
callFeature.featData.ccData.info = NULL;
|
||||
callFeature.featData.ccData.info1 = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ccappTaskPostMsg(CCAPP_INVOKE_FEATURE, &callFeature, sizeof(session_feature_t), CCAPP_CCPROVIER) == CPR_FAILURE) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"ccappTaskSendMsg failed\n",
|
||||
DEB_F_PREFIX_ARGS("cc_call_feature", "cc_invokeFeature"));
|
||||
return CC_FAILURE;
|
||||
}
|
||||
return CC_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke a call feature.
|
||||
*/
|
||||
cc_return_t cc_invokeFeatureSDPMode(cc_call_handle_t call_handle, group_cc_feature_t featureId, cc_jsep_action_t action,
|
||||
cc_media_stream_id_t stream_id, cc_media_track_id_t track_id, cc_media_type_t media_type,
|
||||
uint16_t level, const cc_media_constraints_t *constraints, string_t data, string_t data1) {
|
||||
session_feature_t callFeature;
|
||||
session_data_t * sessionData;
|
||||
unsigned int session_id = 0;
|
||||
callFeature.session_id = (SESSIONTYPE_CALLCONTROL << CC_SID_TYPE_SHIFT) + call_handle;
|
||||
callFeature.featureID = featureId;
|
||||
callFeature.featData.ccData.action = action;
|
||||
callFeature.featData.ccData.media_type = media_type;
|
||||
callFeature.featData.ccData.stream_id = stream_id;
|
||||
callFeature.featData.ccData.track_id = track_id;
|
||||
callFeature.featData.ccData.level = level;
|
||||
callFeature.featData.ccData.has_constraints = FALSE;
|
||||
|
||||
/* If constraints exist add to session hash */
|
||||
if (constraints) {
|
||||
if (constraints->constraint_count > 0 &&
|
||||
(CC_FEATURE_CREATEOFFER == featureId || CC_FEATURE_CREATEANSWER == featureId )) {
|
||||
/* A random number of 5 digits will not conflict with any
|
||||
* other usage of the hash table */
|
||||
session_id = abs(cpr_rand()) % 60000;
|
||||
sessionData = (session_data_t *)findhash(session_id);
|
||||
sessionData = cpr_malloc(sizeof(session_data_t));
|
||||
memset(sessionData, 0, sizeof(session_data_t));
|
||||
sessionData->cc_constraints = constraints;
|
||||
(void) addhash(session_id, sessionData);
|
||||
callFeature.featData.ccData.sessionid = session_id;
|
||||
callFeature.featData.ccData.has_constraints = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"cc_invokeFeatureSDPMode:sid=%d, line=%d, cid=%d, fid=%d, video_pref=%s data=%s\n",
|
||||
DEB_F_PREFIX_ARGS("cc_call_feature", "cc_invokeFeatureSDPMode"),
|
||||
callFeature.session_id,
|
||||
GET_LINE_ID(call_handle),
|
||||
GET_CALL_ID(call_handle),
|
||||
featureId,
|
||||
((featureId == CC_FEATURE_KEYPRESS) ? "...": data));
|
||||
|
||||
switch (featureId) {
|
||||
case CC_FEATURE_KEYPRESS:
|
||||
case CC_FEATURE_DIALSTR:
|
||||
case CC_FEATURE_SPEEDDIAL:
|
||||
case CC_FEATURE_BLIND_XFER_WITH_DIALSTRING:
|
||||
case CC_FEATURE_END_CALL:
|
||||
case CC_FEATURE_B2BCONF:
|
||||
case CC_FEATURE_CONF:
|
||||
case CC_FEATURE_XFER:
|
||||
case CC_FEATURE_HOLD:
|
||||
case CC_FEATURE_SETLOCALDESC:
|
||||
case CC_FEATURE_SETREMOTEDESC:
|
||||
case CC_FEATURE_SETPEERCONNECTION:
|
||||
callFeature.featData.ccData.info = strlib_malloc(data, strlen(data));
|
||||
callFeature.featData.ccData.info1 = NULL;
|
||||
break;
|
||||
case CC_FEATURE_ADDICECANDIDATE:
|
||||
callFeature.featData.ccData.info = strlib_malloc(data, strlen(data));
|
||||
callFeature.featData.ccData.info1 = strlib_malloc(data1, strlen(data1));
|
||||
break;
|
||||
|
||||
default:
|
||||
callFeature.featData.ccData.info = NULL;
|
||||
callFeature.featData.ccData.info1 = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ccappTaskPostMsg(CCAPP_INVOKE_FEATURE, &callFeature, sizeof(session_feature_t), CCAPP_CCPROVIER) == CPR_FAILURE) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"ccappTaskSendMsg failed\n",
|
||||
DEB_F_PREFIX_ARGS("cc_call_feature", "cc_invokeFeatureSDPMode"));
|
||||
return CC_FAILURE;
|
||||
}
|
||||
return CC_SUCCESS;
|
||||
}
|
||||
|
||||
/***********************************Basic Call Feature Control Methods************************************
|
||||
* This section defines all the call related methods that an upper layer can use to control
|
||||
* a call in progress.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Used to create any outgoing call regular call. The incoming/reverting/consultation call will be
|
||||
* created by the stack. It creates a call place holder and initialize the memory for a call. An user needs
|
||||
* other methods to start the call, such as the method OriginateCall, etc
|
||||
* @param line line number that is invoked and is assigned
|
||||
* @return call handle wich includes the assigned line and call id
|
||||
*/
|
||||
cc_call_handle_t CC_createCall(cc_lineid_t line) {
|
||||
static const char fname[] = "CC_CreateCall";
|
||||
//Create call handle to initialize the memory.
|
||||
cc_call_handle_t call_handle = CC_EMPTY_CALL_HANDLE;
|
||||
cc_lineid_t lineid = line;
|
||||
cc_callid_t callid = CC_NO_CALL_ID;
|
||||
|
||||
|
||||
//Assign line and call id.
|
||||
cc_getLineIdAndCallId(&lineid, &callid);
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, callid, lineid, fname));
|
||||
|
||||
if (lineid == CC_NO_LINE) {
|
||||
lsm_ui_display_notify_str_index(STR_INDEX_ERROR_PASS_LIMIT);
|
||||
return call_handle;
|
||||
}
|
||||
|
||||
call_handle = cc_createCallHandle(lineid, callid);
|
||||
|
||||
return call_handle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the call that was created.
|
||||
* @param the call handle
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
/*move it up...*/
|
||||
cc_return_t CC_CallFeature_originateCall(cc_call_handle_t call_handle, cc_sdp_direction_t video_pref) {
|
||||
static const char fname[] = "CC_CallFeature_originateCall:";
|
||||
//CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
// GET_LINE_ID(call_handle), fname));
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"CC_CallFeature_originateCall:cHandle=%d\n",
|
||||
DEB_F_PREFIX_ARGS("cc_call_feature", fname),
|
||||
call_handle);
|
||||
return cc_invokeFeature(call_handle, CC_FEATURE_OFFHOOK, video_pref, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Terminate or end a normal call.
|
||||
* @param call handle
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CC_CallFeature_terminateCall(cc_call_handle_t call_handle) {
|
||||
static const char fname[] = "CC_CallFeature_TerminateCall";
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), fname));
|
||||
|
||||
return cc_invokeFeature(call_handle, CC_FEATURE_ONHOOK, CC_SDP_MAX_QOS_DIRECTIONS, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Answer an incoming or reverting call.
|
||||
* @param call handle
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CC_CallFeature_answerCall(cc_call_handle_t call_handle, cc_sdp_direction_t video_pref) {
|
||||
static const char fname[] = "CC_CallFeature_AnswerCall";
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), fname));
|
||||
|
||||
return cc_invokeFeature(call_handle, CC_FEATURE_ANSWER, video_pref, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a keypress to a call, it could be a single digit.
|
||||
* @param call handle
|
||||
* @param cc_digit digit pressed
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CC_CallFeature_sendDigit(cc_call_handle_t call_handle, cc_digit_t cc_digit) {
|
||||
static const char fname[] = "CC_CallFeature_SendDigit";
|
||||
char digit;
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), fname));
|
||||
//Demote to eliminate the endian issue
|
||||
digit = cc_digit;
|
||||
return cc_invokeFeature(call_handle, CC_FEATURE_KEYPRESS, CC_SDP_MAX_QOS_DIRECTIONS, (string_t)&digit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a backspace action.
|
||||
* @param call handle
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CC_CallFeature_backSpace(cc_call_handle_t call_handle) {
|
||||
static const char fname[] = "CC_CallFeature_BackSpace";
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), fname));
|
||||
|
||||
return cc_invokeFeature(call_handle, CC_FEATURE_BKSPACE, CC_SDP_MAX_QOS_DIRECTIONS, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a dial digit string on an active call, e.g."9191234567".
|
||||
* @param call handle
|
||||
* @param numbers dialed string
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CC_CallFeature_dial(cc_call_handle_t call_handle, cc_sdp_direction_t video_pref, const string_t numbers) {
|
||||
static const char fname[] = "CC_CallFeature_Dial";
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), fname));
|
||||
|
||||
if (cpr_strcasecmp(numbers, "DIAL") == 0) {
|
||||
return cc_invokeFeature(call_handle, CC_FEATURE_DIAL, video_pref, numbers);
|
||||
}
|
||||
|
||||
return cc_invokeFeature(call_handle, CC_FEATURE_DIALSTR, video_pref, numbers);
|
||||
}
|
||||
|
||||
cc_return_t CC_CallFeature_CreateOffer(cc_call_handle_t call_handle, const cc_media_constraints_t *constraints) {
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), __FUNCTION__));
|
||||
|
||||
return cc_invokeFeatureSDPMode(call_handle, CC_FEATURE_CREATEOFFER, JSEP_NO_ACTION,
|
||||
0, 0, NO_STREAM, 0, constraints, NULL, NULL);
|
||||
}
|
||||
|
||||
cc_return_t CC_CallFeature_CreateAnswer(cc_call_handle_t call_handle, const cc_media_constraints_t *constraints) {
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), __FUNCTION__));
|
||||
|
||||
return cc_invokeFeatureSDPMode(call_handle, CC_FEATURE_CREATEANSWER, JSEP_NO_ACTION,
|
||||
0, 0, NO_STREAM, 0, constraints, NULL, NULL);
|
||||
}
|
||||
|
||||
cc_return_t CC_CallFeature_SetLocalDescription(cc_call_handle_t call_handle, cc_jsep_action_t action, string_t sdp) {
|
||||
const cc_media_constraints_t *constraints = NULL;
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), __FUNCTION__));
|
||||
|
||||
return cc_invokeFeatureSDPMode(call_handle, CC_FEATURE_SETLOCALDESC, action,
|
||||
0, 0, NO_STREAM, 0, constraints, sdp, NULL);
|
||||
}
|
||||
|
||||
cc_return_t CC_CallFeature_SetRemoteDescription(cc_call_handle_t call_handle, cc_jsep_action_t action, string_t sdp) {
|
||||
const cc_media_constraints_t *constraints = NULL;
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), __FUNCTION__));
|
||||
|
||||
return cc_invokeFeatureSDPMode(call_handle, CC_FEATURE_SETREMOTEDESC, action,
|
||||
0, 0, NO_STREAM, 0, constraints, sdp, NULL);
|
||||
}
|
||||
|
||||
cc_return_t CC_CallFeature_SetPeerConnection(cc_call_handle_t call_handle, cc_peerconnection_t pc) {
|
||||
const cc_media_constraints_t *constraints = NULL;
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), __FUNCTION__));
|
||||
|
||||
return cc_invokeFeatureSDPMode(call_handle, CC_FEATURE_SETPEERCONNECTION, JSEP_NO_ACTION,
|
||||
0, 0, NO_STREAM, 0, constraints, pc, NULL);
|
||||
}
|
||||
|
||||
cc_return_t CC_CallFeature_AddStream(cc_call_handle_t call_handle, cc_media_stream_id_t stream_id,
|
||||
cc_media_track_id_t track_id, cc_media_type_t media_type) {
|
||||
const cc_media_constraints_t *constraints = NULL;
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), __FUNCTION__));
|
||||
|
||||
return cc_invokeFeatureSDPMode(call_handle, CC_FEATURE_ADDSTREAM, JSEP_NO_ACTION,
|
||||
stream_id, track_id, media_type, 0, constraints, NULL, NULL);
|
||||
}
|
||||
|
||||
cc_return_t CC_CallFeature_RemoveStream(cc_call_handle_t call_handle, cc_media_stream_id_t stream_id,
|
||||
cc_media_track_id_t track_id, cc_media_type_t media_type) {
|
||||
|
||||
const cc_media_constraints_t *constraints = NULL;
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), __FUNCTION__));
|
||||
|
||||
return cc_invokeFeatureSDPMode(call_handle, CC_FEATURE_REMOVESTREAM, JSEP_NO_ACTION,
|
||||
stream_id, track_id, media_type, 0, constraints, NULL, NULL);
|
||||
}
|
||||
|
||||
cc_return_t CC_CallFeature_AddICECandidate(cc_call_handle_t call_handle, const char* candidate, const char *mid, cc_level_t level) {
|
||||
const cc_media_constraints_t *constraints = NULL;
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), __FUNCTION__));
|
||||
|
||||
return cc_invokeFeatureSDPMode(call_handle, CC_FEATURE_ADDICECANDIDATE, JSEP_NO_ACTION,
|
||||
0, 0, NO_STREAM, (uint16_t)level, constraints, candidate, mid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiate a speed dial.
|
||||
* @param call handle
|
||||
* @param callid call id
|
||||
* @param speed dial numbers.
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CC_CallFeature_speedDial(cc_call_handle_t call_handle, cc_sdp_direction_t video_pref, const string_t speed_dial_number) {
|
||||
static const char fname[] = "CC_CallFeature_SpeedDial";
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), fname));
|
||||
|
||||
return cc_invokeFeature(call_handle, CC_FEATURE_SPEEDDIAL, video_pref, speed_dial_number);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiate a BLF call pickup.
|
||||
* @param call handle
|
||||
* @param speed dial number configured.
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CC_CallFeature_blfCallPickup(cc_call_handle_t call_handle, cc_sdp_direction_t video_pref, const string_t speed_dial_number) {
|
||||
static const char fname[] = "CC_CallFeature_BLFCallPickup";
|
||||
cc_return_t ret = CC_SUCCESS;
|
||||
string_t blf_sd = strlib_malloc(CISCO_BLFPICKUP_STRING, sizeof(CISCO_BLFPICKUP_STRING));
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), fname));
|
||||
|
||||
blf_sd = strlib_append(blf_sd, "-");
|
||||
blf_sd = strlib_append(blf_sd, speed_dial_number);
|
||||
|
||||
ret = cc_invokeFeature(call_handle, CC_FEATURE_SPEEDDIAL, video_pref, blf_sd);
|
||||
//free memory
|
||||
strlib_free(blf_sd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redial the last dial numbers.
|
||||
* @param call handle
|
||||
* @param video_pref the sdp direction
|
||||
* @return SUCCESS or FAILURE
|
||||
* @Notice: if there is no active dial made, this method should not be called.
|
||||
*/
|
||||
cc_return_t CC_CallFeature_redial(cc_call_handle_t call_handle, cc_sdp_direction_t video_pref) {
|
||||
static const char fname[] = "CC_CallFeature_Redial";
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), fname));
|
||||
|
||||
return cc_invokeFeature(call_handle, CC_FEATURE_REDIAL, video_pref, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a media capability for a call.
|
||||
* @param call_handle
|
||||
* @param video_pref the sdp direction
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CC_CallFeature_updateCallMediaCapability(cc_call_handle_t call_handle, cc_sdp_direction_t video_pref) {
|
||||
static const char fname[] = "CC_CallFeature_updateCallMediaCapability";
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), fname));
|
||||
|
||||
return cc_invokeFeature(call_handle, CC_FEATURE_UPD_SESSION_MEDIA_CAP, video_pref, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a call forward all on particular line
|
||||
* @param call handle
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CC_CallFeature_callForwardAll(cc_call_handle_t call_handle) {
|
||||
static const char fname[] = "CC_CallFeature_CallForwardAll";
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), fname));
|
||||
|
||||
return cc_invokeFeature(call_handle, CC_FEATURE_CFWD_ALL, CC_SDP_MAX_QOS_DIRECTIONS, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resume a held call.
|
||||
* @param call handle
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CC_CallFeature_resume(cc_call_handle_t call_handle, cc_sdp_direction_t video_pref) {
|
||||
static const char fname[] = "CC_CallFeature_Resume";
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), fname));
|
||||
|
||||
return cc_invokeFeature(call_handle, CC_FEATURE_RESUME, video_pref, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* End a consultation call.
|
||||
* @param call handle
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CC_CallFeature_endConsultativeCall(cc_call_handle_t call_handle) {
|
||||
static const char fname[] = "CC_CallFeature_EndConsultativeCall";
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), fname));
|
||||
|
||||
return cc_invokeFeature(call_handle, CC_FEATURE_END_CALL, CC_SDP_MAX_QOS_DIRECTIONS, "ACTIVECALLS");
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiate a conference. Steps to make a conference or transfer:
|
||||
* 1. Create a call handle, e.g. chandle1.
|
||||
* 2. Start the call on this call handle.
|
||||
* 3. When the call is answered, invoke:
|
||||
* CC_CallFeature_Conference(chandle1, FALSE, CC_EMPTY_CALL_HANDLE) to start a conference operation.
|
||||
* 4. Upon receiving the consultative call (cHandle2) created from pSipcc system,
|
||||
* invoke:
|
||||
* CC_CallFeature_Dial(cHandle2)
|
||||
* to dial the consultative call.
|
||||
* 5. When the consultative call is in ringout or connected state, invoke:
|
||||
* CC_CallFeature_Conference(cHandle2, FALSE, CC_EMPTY_CALL_HANDLE) to
|
||||
* finish the conference.
|
||||
* Note: 1. in the step 4, a user could kill the consultative call and pickup a hold call (not the parent call that
|
||||
* initiated the conference). In this scenario, a parent call handle should be supplied.
|
||||
* For instance,
|
||||
* CC_CallFeature_Conference(cHandle2, FALSE, cHandle1)
|
||||
* 2. If it's a B2bConf, substitute the "FALSE" with "TRUE"
|
||||
*
|
||||
* @param call_handle the call handle for
|
||||
* 1. the original connected call.
|
||||
* 2. the consultative call or a held call besides the parent call initiated the transfer. This is used
|
||||
* on the second time to finish the transfer.
|
||||
* @param is locall conference or not. If it's a local conference, it's a b2bconf.
|
||||
* @param parent_call_handle if supplied, it will be the targeted parent call handle, which initiated the conference.
|
||||
* @param video_pref the sdp direction
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CC_CallFeature_conference(cc_call_handle_t call_handle,
|
||||
boolean is_local,
|
||||
cc_call_handle_t parent_call_handle, cc_sdp_direction_t video_pref) {
|
||||
static const char fname[] = "CC_CallFeature_Conference";
|
||||
char call_handle_str[10];
|
||||
cc_return_t ret = CC_SUCCESS;
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), fname));
|
||||
if (parent_call_handle == CC_EMPTY_CALL_HANDLE) {
|
||||
if (is_local == FALSE) {
|
||||
return cc_invokeFeature(call_handle, CC_FEATURE_B2BCONF, video_pref, "");
|
||||
} else {
|
||||
return cc_invokeFeature(call_handle, CC_FEATURE_CONF, video_pref, "");
|
||||
}
|
||||
} else {
|
||||
cc_call_handle_t parent = (SESSIONTYPE_CALLCONTROL << CC_SID_TYPE_SHIFT) + parent_call_handle;
|
||||
string_t parent_call_handle_str;
|
||||
snprintf(call_handle_str, sizeof(call_handle_str), "%d", parent);
|
||||
parent_call_handle_str = strlib_malloc(call_handle_str, strlen(call_handle_str));
|
||||
|
||||
if (is_local == FALSE) {
|
||||
ret = cc_invokeFeature(call_handle, CC_FEATURE_B2BCONF, video_pref, parent_call_handle_str);
|
||||
} else {
|
||||
ret = cc_invokeFeature(call_handle, CC_FEATURE_CONF, video_pref, parent_call_handle_str);
|
||||
}
|
||||
strlib_free(parent_call_handle_str);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiate a call transfer. Please refer to Conference feature.
|
||||
* @param call_handle the call handle for
|
||||
* 1. the original connected call.
|
||||
* 2. the consultative call or a held call besides the parent call initiated the transfer. This is used
|
||||
* on the second time to finish the transfer.
|
||||
* @param parent_call_handle if supplied, it will be the parent call handle, which initiated the transfer.
|
||||
* @param video_pref the sdp direction
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CC_CallFeature_transfer(cc_call_handle_t call_handle, cc_call_handle_t parent_call_handle, cc_sdp_direction_t video_pref) {
|
||||
static const char fname[] = "CC_CallFeature_transfer";
|
||||
char call_handle_str[10];
|
||||
cc_return_t ret = CC_SUCCESS;
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), fname));
|
||||
if (parent_call_handle == CC_EMPTY_CALL_HANDLE) {
|
||||
return cc_invokeFeature(call_handle, CC_FEATURE_XFER, video_pref, "");
|
||||
} else {
|
||||
cc_call_handle_t parent = (SESSIONTYPE_CALLCONTROL << CC_SID_TYPE_SHIFT) + parent_call_handle;
|
||||
string_t parent_call_handle_str;
|
||||
snprintf(call_handle_str, sizeof(call_handle_str), "%d", parent);
|
||||
parent_call_handle_str = strlib_malloc(call_handle_str, strlen(call_handle_str));
|
||||
|
||||
ret = cc_invokeFeature(call_handle, CC_FEATURE_XFER, video_pref, parent_call_handle_str);
|
||||
strlib_free(parent_call_handle_str);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Put a connected call on hold.
|
||||
* @param call handle
|
||||
* @param reason the reason to hold. The following values should be used.
|
||||
* CC_HOLD_REASON_NONE,
|
||||
* CC_HOLD_REASON_XFER, //Hold for transfer
|
||||
* CC_HOLD_REASON_CONF, //Hold for conference
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CC_CallFeature_holdCall(cc_call_handle_t call_handle, cc_hold_reason_t reason) {
|
||||
static const char fname[] = "CC_CallFeature_HoldCall";
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), fname));
|
||||
switch (reason) {
|
||||
case CC_HOLD_REASON_XFER:
|
||||
return cc_invokeFeature(call_handle, CC_FEATURE_HOLD, CC_SDP_MAX_QOS_DIRECTIONS, "TRANSFER");
|
||||
case CC_HOLD_REASON_CONF:
|
||||
return cc_invokeFeature(call_handle, CC_FEATURE_HOLD, CC_SDP_MAX_QOS_DIRECTIONS, "CONFERENCE");
|
||||
case CC_HOLD_REASON_SWAP:
|
||||
return cc_invokeFeature(call_handle, CC_FEATURE_HOLD, CC_SDP_MAX_QOS_DIRECTIONS, "SWAP");
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return cc_invokeFeature(call_handle, CC_FEATURE_HOLD, CC_SDP_MAX_QOS_DIRECTIONS, "");
|
||||
}
|
||||
|
||||
/********************************End of basic call feature methods******************************************/
|
||||
|
||||
/*************************************Additional call feature methods***************************************
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Join a call.
|
||||
* @param call_handle call handle
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CC_CallFeature_b2bJoin(cc_call_handle_t call_handle) {
|
||||
static const char fname[] = "CC_CallFeature_b2bJoin";
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), fname));
|
||||
|
||||
return cc_invokeFeature(call_handle, CC_FEATURE_B2B_JOIN, CC_SDP_MAX_QOS_DIRECTIONS, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiate a direct transfer
|
||||
* @param call_handle the call handle for the call to initialize a transfer
|
||||
* @param target_call_handle the call handle for the target transfer call.
|
||||
* @retrun SUCCESS or FAILURE. If the target call handle is empty, a FAILURE will be returned.
|
||||
*/
|
||||
cc_return_t CC_CallFeature_directTransfer(cc_call_handle_t call_handle,
|
||||
cc_call_handle_t target_call_handle) {
|
||||
static const char fname[] = "CC_CallFeature_directTransfer";
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), fname));
|
||||
if (target_call_handle == CC_EMPTY_CALL_HANDLE) {
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX"target call handle is empty.\n", DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), fname));
|
||||
return CC_FAILURE;
|
||||
}
|
||||
return CC_CallFeature_transfer(call_handle, target_call_handle, CC_SDP_MAX_QOS_DIRECTIONS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiate a join across line
|
||||
* @param call_handle the call handle for the call that initializes a join across line (conference).
|
||||
* @param target_call_handle the call handle for the call will be joined.
|
||||
*/
|
||||
cc_return_t CC_CallFeature_joinAcrossLine(cc_call_handle_t call_handle, cc_call_handle_t target_call_handle) {
|
||||
static const char fname[] = "CC_CallFeature_joinAcrossLine";
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), fname));
|
||||
if (target_call_handle == CC_EMPTY_CALL_HANDLE) {
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX"target call handle is empty.\n", DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), fname));
|
||||
return CC_FAILURE;
|
||||
}
|
||||
return CC_CallFeature_conference(call_handle, TRUE, target_call_handle, CC_SDP_MAX_QOS_DIRECTIONS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Select or locked a call.
|
||||
* @param call_handle call handle
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CC_CallFeature_select(cc_call_handle_t call_handle) {
|
||||
static const char fname[] = "CC_CallFeature_select";
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), fname));
|
||||
|
||||
return cc_invokeFeature(call_handle, CC_FEATURE_SELECT, CC_SDP_MAX_QOS_DIRECTIONS, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel a call feature, e.g. when the consultative call is connected and the
|
||||
* user wishes not to make the conference, thie method can be invoked.
|
||||
* @param call_handle call handle
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CC_CallFeature_cancelXfrerCnf(cc_call_handle_t call_handle) {
|
||||
static const char fname[] = "CC_CallFeature_cancelXfrerCnf";
|
||||
CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
|
||||
GET_LINE_ID(call_handle), fname));
|
||||
|
||||
return cc_invokeFeature(call_handle, CC_FEATURE_CANCEL, CC_SDP_MAX_QOS_DIRECTIONS, NULL);
|
||||
}
|
||||
|
||||
void CC_CallFeature_mute(boolean mute) {
|
||||
}
|
||||
|
||||
void CC_CallFeature_speaker(boolean mute) {
|
||||
}
|
||||
|
||||
cc_call_handle_t CC_CallFeature_getConnectedCall() {
|
||||
return ccappGetConnectedCall();
|
||||
}
|
154
libs/sipcc/core/ccapp/cc_config.c
Normal file
154
libs/sipcc/core/ccapp/cc_config.c
Normal file
@ -0,0 +1,154 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "cc_config.h"
|
||||
#include "CCProvider.h"
|
||||
#include "phone_debug.h"
|
||||
#include "cpr_types.h"
|
||||
#include "dialplan.h"
|
||||
#include "capability_set.h"
|
||||
#include "configmgr.h"
|
||||
#include "dialplanint.h"
|
||||
#include "ccapp_task.h"
|
||||
#include "cc_device_manager.h"
|
||||
#include "config_api.h"
|
||||
|
||||
extern int config_parser_main( char *config, int complete_config);
|
||||
/**
|
||||
* Set the maximum line available for registration
|
||||
* @param lines the maximum line could be configured.
|
||||
* @return
|
||||
*/
|
||||
int CC_Config_SetAvailableLines(cc_lineid_t lines) {
|
||||
ccappTaskPostMsg(CCAPP_UPDATELINES, &lines, sizeof(unsigned short), CCAPP_CCPROVIER);
|
||||
return CC_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* The following section defines the configuration methods.
|
||||
*/
|
||||
/**
|
||||
* Defines the CFGID parameter setting methods.
|
||||
* see cfgid.h for all possible configuration parameters
|
||||
* @todo
|
||||
*/
|
||||
void CC_Config_setIntValue(int cfgid, int value) {
|
||||
config_set_value(cfgid, &value, sizeof(int));
|
||||
return;
|
||||
}
|
||||
|
||||
void CC_Config_setBooleanValue(int cfgid, cc_boolean value) {
|
||||
int temp = (int) value;
|
||||
|
||||
// For Now, convert all numeric parameters to Integer. This simplifies
|
||||
// the required SIP and GSM code changes. We will go to the right size
|
||||
// when we implement the "full" JNI.
|
||||
|
||||
// config_set_value(cfg_id, &bool_value, sizeof(boolean));
|
||||
config_set_value(cfgid, &temp, sizeof(int));
|
||||
return;
|
||||
}
|
||||
|
||||
void CC_Config_setStringValue(int cfgid, const char* value) {
|
||||
config_set_string(cfgid, (char *) value);
|
||||
return;
|
||||
}
|
||||
|
||||
void CC_Config_setByteValue(int cfgid, unsigned char value) {
|
||||
int temp = (int) value;
|
||||
|
||||
// For Now, convert all numeric parameters to Integer. This simplifies
|
||||
// the required SIP and GSM code changes. We will go to the right size
|
||||
// when we implement the "full" JNI.
|
||||
|
||||
// config_set_value(cfg_id, &byte_value, sizeof(unsigned char));
|
||||
config_set_value(cfgid, &temp, sizeof(int));
|
||||
return;
|
||||
}
|
||||
|
||||
void CC_Config_setArrayValue(int cfgid, char *byte_array, int length) {
|
||||
unsigned char *byte_ptr;
|
||||
int i;
|
||||
|
||||
byte_ptr = cpr_malloc(length);
|
||||
if (byte_ptr == NULL) {
|
||||
TNP_DEBUG(DEB_F_PREFIX"setPropertyCacheByteArray():malloc failed.\n", DEB_F_PREFIX_ARGS(JNI, "nSetPropertyCacheByteArray"));
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
byte_ptr[i] = (unsigned char) byte_array[i];
|
||||
}
|
||||
config_set_value(cfgid, byte_ptr, length);
|
||||
cpr_free(byte_ptr);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the dialplan file
|
||||
* @param dial_plan_string the dial plan content string
|
||||
* @param length the length of dial plan string, the maximum size will be 0x2000.
|
||||
* @return string dial plan version stamp
|
||||
*/
|
||||
char* CC_Config_setDialPlan(const char *dial_plan_string, int length) {
|
||||
const char fname[] = "CC_Config_setDialPlan";
|
||||
int ret;
|
||||
|
||||
/**
|
||||
* If the string is null, empty or oversized, we will reset the dial
|
||||
* plan by setting the length to 0.
|
||||
*/
|
||||
if (dial_plan_string == NULL || length == 0 || length >= DIALPLAN_MAX_SIZE) {
|
||||
TNP_DEBUG(DEB_F_PREFIX"Setting NULL dialplan string (length [%d] is 0, or length is larger than maximum [%d])\n",
|
||||
DEB_F_PREFIX_ARGS(JNI, fname), length, DIALPLAN_MAX_SIZE);
|
||||
|
||||
dp_init_template (NULL, 0);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
ret = dp_init_template(dial_plan_string, length);
|
||||
TNP_DEBUG(DEB_F_PREFIX"Parsed dial_plan_string. Version=[%s], Length=[%d]\n", DEB_F_PREFIX_ARGS(JNI, fname), g_dp_version_stamp, length);
|
||||
if (ret != 0)
|
||||
{
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
return (g_dp_version_stamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the feature control plan
|
||||
* @param fcp plan string
|
||||
* @param length the length of fcp string
|
||||
* @return string feature version stamp
|
||||
*/
|
||||
|
||||
char* CC_Config_setFcp(const char *fcp_plan_string, int len) {
|
||||
const char fname[] = "CC_Config_setFcp";
|
||||
int ret = 0;
|
||||
|
||||
/**
|
||||
* If the string is null, return null (version)
|
||||
*/
|
||||
|
||||
TNP_DEBUG(DEB_F_PREFIX"FCP Parsing FCP doc\n", DEB_F_PREFIX_ARGS(JNI, fname));
|
||||
if (fcp_plan_string == NULL)
|
||||
{
|
||||
TNP_DEBUG(DEB_F_PREFIX"Null FCP xml document\n",
|
||||
DEB_F_PREFIX_ARGS(JNI, fname));
|
||||
|
||||
fcp_init_template (NULL);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
ret = fcp_init_template (fcp_plan_string);
|
||||
TNP_DEBUG(DEB_F_PREFIX"Parsed FCP xml. Version=[%s]\n", DEB_F_PREFIX_ARGS(JNI, fname), g_fp_version_stamp);
|
||||
if (ret != 0)
|
||||
{
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
return (g_fp_version_stamp);
|
||||
}
|
62
libs/sipcc/core/ccapp/cc_device_feature.c
Normal file
62
libs/sipcc/core/ccapp/cc_device_feature.c
Normal file
@ -0,0 +1,62 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "cc_device_feature.h"
|
||||
#include "sessionConstants.h"
|
||||
#include "sessionTypes.h"
|
||||
#include "CCProvider.h"
|
||||
#include "phone_debug.h"
|
||||
#include "ccapp_task.h"
|
||||
|
||||
/**
|
||||
* Internal method
|
||||
*/
|
||||
void cc_invokeDeviceFeature(session_feature_t *feature) {
|
||||
|
||||
if (ccappTaskPostMsg(CCAPP_INVOKEPROVIDER_FEATURE, feature,
|
||||
sizeof(session_feature_t), CCAPP_CCPROVIER) == CPR_FAILURE) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"cc_invokeDeviceFeature failed\n",
|
||||
DEB_F_PREFIX_ARGS("cc_device_feature", "cc_invokeDeviceFeature"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CC_DeviceFeature_supportsVideo(boolean enable) {
|
||||
session_feature_t feat;
|
||||
|
||||
feat.session_id = (SESSIONTYPE_CALLCONTROL << CC_SID_TYPE_SHIFT);
|
||||
feat.featureID = DEVICE_SUPPORTS_NATIVE_VIDEO;
|
||||
feat.featData.ccData.info = NULL;
|
||||
feat.featData.ccData.info1 = NULL;
|
||||
feat.featData.ccData.state = enable;
|
||||
cc_invokeDeviceFeature(&feat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable video/camera.
|
||||
* @param enable true or false
|
||||
* @return void
|
||||
*/
|
||||
void CC_DeviceFeature_enableVideo(boolean enable) {
|
||||
session_feature_t feat;
|
||||
|
||||
feat.session_id = (SESSIONTYPE_CALLCONTROL << CC_SID_TYPE_SHIFT);
|
||||
feat.featureID = DEVICE_ENABLE_VIDEO;
|
||||
feat.featData.ccData.info = NULL;
|
||||
feat.featData.ccData.info1 = NULL;
|
||||
feat.featData.ccData.state = enable;
|
||||
cc_invokeDeviceFeature(&feat);
|
||||
}
|
||||
|
||||
void CC_DeviceFeature_enableCamera(boolean enable) {
|
||||
session_feature_t feat;
|
||||
|
||||
feat.session_id = (SESSIONTYPE_CALLCONTROL << CC_SID_TYPE_SHIFT);
|
||||
feat.featureID = DEVICE_ENABLE_CAMERA;
|
||||
feat.featData.ccData.info = NULL;
|
||||
feat.featData.ccData.info1 = NULL;
|
||||
feat.featData.ccData.state = enable;
|
||||
cc_invokeDeviceFeature(&feat);
|
||||
}
|
||||
|
593
libs/sipcc/core/ccapp/cc_device_manager.c
Normal file
593
libs/sipcc/core/ccapp/cc_device_manager.c
Normal file
@ -0,0 +1,593 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "cc_constants.h"
|
||||
#include "session.h"
|
||||
#include "ccSession.h"
|
||||
#include "scSession.h"
|
||||
#include "cpr_types.h"
|
||||
#include "cpr_string.h"
|
||||
#include "phone_debug.h"
|
||||
#include "sessuri.h"
|
||||
#include "config_api.h"
|
||||
#include "CCProvider.h"
|
||||
#include "ccapp_task.h"
|
||||
#include "cc_device_manager.h"
|
||||
#include "ccapi_service.h"
|
||||
#include "cc_service.h"
|
||||
#include "subscription_handler.h"
|
||||
#include "ccapi_snapshot.h"
|
||||
#include "util_string.h"
|
||||
|
||||
|
||||
#define STARTUP_NORMAL 0
|
||||
#define STARTUP_UNSPECIFIED 1
|
||||
#define SHUTDOWN_NORMAL 2
|
||||
#define SHUTDOWN_UNSPECIFIED 3
|
||||
#define SHUTDOWN_VERMISMATHC 4
|
||||
#define RSP_TYPE_COMPLETE 5
|
||||
|
||||
|
||||
mgmt_state_t mgmtState = MGMT_STATE_IDLE;
|
||||
//int parse_config_properties (int device_handle, const char *device_name, const char *cfg, int from_memory);
|
||||
static boolean isStartRequestPending = FALSE;
|
||||
static boolean isServiceStopped = TRUE;
|
||||
|
||||
extern cc_boolean is_action_to_be_deferred(cc_action_t action);
|
||||
|
||||
|
||||
char *mgmt_event_to_str (int evt) {
|
||||
|
||||
switch (evt) {
|
||||
case EV_CC_CREATE:
|
||||
return "EV_CC_CREATE";
|
||||
case EV_CC_START:
|
||||
return "EV_CC_START";
|
||||
case EV_CC_CONFIG_RECEIVED:
|
||||
return "EV_CC_CONFIG_RECEIVED";
|
||||
case EV_CC_DO_SOFT_RESET:
|
||||
return "EV_CC_DO_SOFT_RESET";
|
||||
case EV_CC_INSERVICE:
|
||||
return "EV_CC_INSERVICE";
|
||||
case EV_CC_OOS_FAILOVER:
|
||||
return "EV_CC_OOS_FAILOVER";
|
||||
case EV_CC_OOS_FALLBACK:
|
||||
return "EV_CC_OOS_FALLBACK";
|
||||
case EV_CC_OOS_REG_ALL_FAILED:
|
||||
return "EV_CC_OOS_REG_ALL_FAILED";
|
||||
case EV_CC_OOS_SHUTDOWN_ACK:
|
||||
return "EV_CC_OOS_SHUTDOWN_ACK";
|
||||
case EV_CC_RE_REGISTER:
|
||||
return "EV_CC_RE_REGISTER";
|
||||
case EV_CC_STOP:
|
||||
return "EV_CC_STOP";
|
||||
case EV_CC_DESTROY:
|
||||
return "EV_CC_DESTROY";
|
||||
case EV_CC_IP_VALID:
|
||||
return "EV_CC_IP_VALID";
|
||||
case EV_CC_IP_INVALID:
|
||||
return "EV_CC_IP_INVALID";
|
||||
}
|
||||
|
||||
return "EV_INVALID";
|
||||
}
|
||||
|
||||
char *mgmt_state_to_str (int state) {
|
||||
|
||||
switch (state) {
|
||||
case MGMT_STATE_IDLE:
|
||||
return "MGMT_STATE_IDLE";
|
||||
case MGMT_STATE_CREATED:
|
||||
return "MGMT_STATE_CREATED";
|
||||
case MGMT_STATE_REGISTERING:
|
||||
return "MGMT_STATE_REGISTERING";
|
||||
case MGMT_STATE_REGISTERED:
|
||||
return "MGMT_STATE_REGISTERED";
|
||||
case MGMT_STATE_OOS:
|
||||
return "MGMT_STATE_OOS";
|
||||
case MGMT_STATE_OOS_AWAIT_SHUTDOWN_ACK:
|
||||
return "MGMT_STATE_OOS_AWAIT_SHUTDOWN_ACK";
|
||||
case MGMT_STATE_WAITING_FOR_CONFIG_FILE:
|
||||
return "MGMT_STATE_WAITING_FOR_CONFIG_FILE";
|
||||
case MGMT_STATE_OOS_AWAIT_UN_REG_ACK:
|
||||
return "MGMT_STATE_OOS_AWAIT_UN_REG_ACK";
|
||||
case MGMT_STATE_STOP_AWAIT_SHUTDOWN_ACK:
|
||||
return "MGMT_STATE_STOP_AWAIT_SHUTDOWN_ACK";
|
||||
case MGMT_STATE_DESTROY_AWAIT_SHUTDOWN_ACK:
|
||||
return "MGMT_STATE_DESTROY_AWAIT_SHUTDOWN_ACK";
|
||||
}
|
||||
|
||||
return "MGMT_STATE_INVALID";
|
||||
}
|
||||
|
||||
void updateMediaConfigProperties( void )
|
||||
{
|
||||
//TODO: check Java code
|
||||
|
||||
|
||||
}
|
||||
|
||||
void updateVideoConfigProperties( void )
|
||||
{
|
||||
//TODO: check Java code
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* action for handled events for device manager
|
||||
*/
|
||||
int action(int cmd)
|
||||
{
|
||||
int retVal = 0;
|
||||
sessionProvider_cmd_t proCmd;
|
||||
|
||||
memset ( &proCmd, 0, sizeof(sessionProvider_cmd_t));
|
||||
proCmd.sessionType = SESSIONTYPE_CALLCONTROL;
|
||||
proCmd.cmd = cmd;
|
||||
|
||||
if (cmd == CMD_INSERVICE ) {
|
||||
CCAPP_DEBUG("CC_device_manager_action: CMD_INSERVICE \n");
|
||||
updateMediaConfigProperties();
|
||||
updateVideoConfigProperties();
|
||||
proCmd.cmdData.ccData.reason = STARTUP_NORMAL;
|
||||
if (ccappTaskPostMsg(CCAPP_SERVICE_CMD, (cprBuffer_t)&proCmd,
|
||||
sizeof(sessionProvider_cmd_t), CCAPP_CCPROVIER) == CPR_FAILURE) {
|
||||
CCAPP_DEBUG("ccInvokeFeature: ccappTaskSendMsg failed\n");
|
||||
}
|
||||
} else if (cmd == CMD_INIT) {
|
||||
|
||||
CCAPP_DEBUG("CC_device_manager_action: CMD_INIT \n");
|
||||
proCmd.cmdData.ccData.reason = STARTUP_NORMAL;
|
||||
|
||||
if (ccappTaskPostMsg(CCAPP_SERVICE_CMD, (cprBuffer_t)&proCmd,
|
||||
sizeof(sessionProvider_cmd_t), CCAPP_CCPROVIER) == CPR_FAILURE) {
|
||||
CCAPP_DEBUG("ccInvokeFeature: ccappTaskSendMsg failed\n");
|
||||
}
|
||||
} else if (cmd == CMD_RESTART) {
|
||||
|
||||
CCAPP_DEBUG("CC_device_manager_action: CMD_RESTART \n");
|
||||
updateMediaConfigProperties();
|
||||
proCmd.cmdData.ccData.reason = STARTUP_NORMAL;
|
||||
|
||||
if (ccappTaskPostMsg(CCAPP_SERVICE_CMD, (cprBuffer_t)&proCmd,
|
||||
sizeof(sessionProvider_cmd_t), CCAPP_CCPROVIER) == CPR_FAILURE) {
|
||||
CCAPP_DEBUG("ccInvokeFeature: ccappTaskSendMsg failed\n");
|
||||
}
|
||||
|
||||
} else if (cmd == CMD_SHUTDOWN) {
|
||||
|
||||
CCAPP_DEBUG("CC_device_manager_action: CMD_SHUTDOWN \n");
|
||||
proCmd.cmdData.ccData.reason = CC_CAUSE_REG_ALL_FAILED;
|
||||
if (ccappTaskPostMsg(CCAPP_SERVICE_CMD, (cprBuffer_t)&proCmd,
|
||||
sizeof(sessionProvider_cmd_t), CCAPP_CCPROVIER) == CPR_FAILURE) {
|
||||
CCAPP_DEBUG("ccInvokeFeature: ccappTaskSendMsg failed\n");
|
||||
}
|
||||
} else {
|
||||
|
||||
proCmd.cmdData.ccData.reason = STARTUP_NORMAL;
|
||||
CCAPP_DEBUG("CC_device_manager_action: Default \n");
|
||||
if (ccappTaskPostMsg(CCAPP_SERVICE_CMD, (cprBuffer_t)&proCmd,
|
||||
sizeof(sessionProvider_cmd_t), CCAPP_CCPROVIER) == CPR_FAILURE) {
|
||||
CCAPP_DEBUG("ccInvokeFeature: ccappTaskSendMsg failed\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return retVal;
|
||||
|
||||
}
|
||||
|
||||
|
||||
cc_boolean is_phone_registered() {
|
||||
if (mgmtState == MGMT_STATE_REGISTERED) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Wrapper function for settting state for handled events for device manager
|
||||
*/
|
||||
void setState(int st) {
|
||||
DEF_DEBUG("setState: new registration state= %s\n", mgmt_state_to_str(st));
|
||||
mgmtState = st;
|
||||
}
|
||||
|
||||
void processInsToOos (void )
|
||||
{
|
||||
//CCAPP_DEBUG("CC_device_manager: processInsToOoS \n");
|
||||
DEF_DEBUG("CC_device_manager: processInsToOoS \n");
|
||||
sub_hndlr_stop();
|
||||
}
|
||||
|
||||
void prepareForSoftReset()
|
||||
{
|
||||
CCAPP_DEBUG("CC_device_manager: prepareForSoftReset\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
void processInserviceEvent( void)
|
||||
{
|
||||
CCAPP_DEBUG("CC_device_manager: process Inservice Event\n");
|
||||
if (g_deviceInfo.cucm_mode == CC_MODE_CCM ) {
|
||||
if (sub_hndlr_isAvailable() == FALSE) {
|
||||
sub_hndlr_start();
|
||||
}
|
||||
}
|
||||
setState(MGMT_STATE_REGISTERED);
|
||||
//TODO: check Java code
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Event handler for device manager
|
||||
*/
|
||||
void registration_processEvent(int event) {
|
||||
|
||||
boolean ignored=0;
|
||||
|
||||
DEF_DEBUG("registration_processEvent: Event %s, current State %s \n",
|
||||
mgmt_event_to_str(event) , mgmt_state_to_str(mgmtState));
|
||||
|
||||
switch (event) {
|
||||
case EV_CC_CREATE:
|
||||
switch ( mgmtState) {
|
||||
case MGMT_STATE_IDLE:
|
||||
setState(MGMT_STATE_CREATED);
|
||||
init_empty_str(g_cfg_p);
|
||||
CC_Service_create();
|
||||
CC_Service_init();
|
||||
break;
|
||||
case MGMT_STATE_REGISTERED:
|
||||
case MGMT_STATE_REGISTERING:
|
||||
case MGMT_STATE_OOS:
|
||||
case MGMT_STATE_WAITING_FOR_CONFIG_FILE:
|
||||
case MGMT_STATE_CREATED:
|
||||
case MGMT_STATE_OOS_AWAIT_SHUTDOWN_ACK:
|
||||
case MGMT_STATE_OOS_AWAIT_UN_REG_ACK:
|
||||
case MGMT_STATE_STOP_AWAIT_SHUTDOWN_ACK:
|
||||
case MGMT_STATE_DESTROY_AWAIT_SHUTDOWN_ACK:
|
||||
default:
|
||||
ignored = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case EV_CC_START:
|
||||
isServiceStopped = FALSE;
|
||||
switch ( mgmtState) {
|
||||
case MGMT_STATE_CREATED:
|
||||
case MGMT_STATE_WAITING_FOR_CONFIG_FILE:
|
||||
configFetchReq(0);
|
||||
break;
|
||||
case MGMT_STATE_STOP_AWAIT_SHUTDOWN_ACK:
|
||||
DEF_DEBUG("registration_processEvent: delaying start until SHUTDOWN_ACK is received.");
|
||||
isStartRequestPending = TRUE;
|
||||
break;
|
||||
case MGMT_STATE_IDLE:
|
||||
case MGMT_STATE_REGISTERED:
|
||||
case MGMT_STATE_REGISTERING:
|
||||
case MGMT_STATE_OOS:
|
||||
case MGMT_STATE_OOS_AWAIT_SHUTDOWN_ACK:
|
||||
case MGMT_STATE_OOS_AWAIT_UN_REG_ACK:
|
||||
case MGMT_STATE_DESTROY_AWAIT_SHUTDOWN_ACK:
|
||||
default:
|
||||
ignored = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case EV_CC_IP_INVALID:
|
||||
switch ( mgmtState) {
|
||||
case MGMT_STATE_REGISTERED:
|
||||
processInsToOos();
|
||||
case MGMT_STATE_REGISTERING:
|
||||
case MGMT_STATE_OOS:
|
||||
setState(MGMT_STATE_OOS_AWAIT_SHUTDOWN_ACK);
|
||||
action(CMD_UNREGISTER_ALL_LINES);
|
||||
break;
|
||||
case MGMT_STATE_OOS_AWAIT_UN_REG_ACK:
|
||||
setState(MGMT_STATE_OOS_AWAIT_SHUTDOWN_ACK);
|
||||
break;
|
||||
case MGMT_STATE_OOS_AWAIT_SHUTDOWN_ACK:
|
||||
case MGMT_STATE_WAITING_FOR_CONFIG_FILE:
|
||||
case MGMT_STATE_STOP_AWAIT_SHUTDOWN_ACK:
|
||||
case MGMT_STATE_CREATED:
|
||||
case MGMT_STATE_IDLE:
|
||||
case MGMT_STATE_DESTROY_AWAIT_SHUTDOWN_ACK:
|
||||
default:
|
||||
ignored = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case EV_CC_IP_VALID:
|
||||
if (isServiceStopped == TRUE) {
|
||||
ignored = 1;
|
||||
DEF_DEBUG("registration_processEvent: "\
|
||||
"Ignoring IP_VALID as service was not Started ");
|
||||
break;
|
||||
}
|
||||
switch ( mgmtState) {
|
||||
case MGMT_STATE_REGISTERED:
|
||||
if (is_action_to_be_deferred(RE_REGISTER_ACTION)
|
||||
== FALSE) {
|
||||
processInsToOos();
|
||||
prepareForSoftReset();
|
||||
setState(MGMT_STATE_OOS_AWAIT_UN_REG_ACK);
|
||||
action(CMD_SHUTDOWN);
|
||||
}
|
||||
break;
|
||||
case MGMT_STATE_REGISTERING:
|
||||
case MGMT_STATE_OOS:
|
||||
if (is_action_to_be_deferred(RE_REGISTER_ACTION)
|
||||
== FALSE) {
|
||||
prepareForSoftReset();
|
||||
setState(MGMT_STATE_OOS_AWAIT_UN_REG_ACK);
|
||||
action(CMD_SHUTDOWN);
|
||||
}
|
||||
break;
|
||||
case MGMT_STATE_IDLE:
|
||||
case MGMT_STATE_WAITING_FOR_CONFIG_FILE:
|
||||
case MGMT_STATE_CREATED:
|
||||
case MGMT_STATE_STOP_AWAIT_SHUTDOWN_ACK:
|
||||
case MGMT_STATE_OOS_AWAIT_SHUTDOWN_ACK:
|
||||
case MGMT_STATE_OOS_AWAIT_UN_REG_ACK:
|
||||
case MGMT_STATE_DESTROY_AWAIT_SHUTDOWN_ACK:
|
||||
default:
|
||||
ignored = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case EV_CC_DO_SOFT_RESET:
|
||||
switch ( mgmtState) {
|
||||
case MGMT_STATE_REGISTERED:
|
||||
processInsToOos(); /* FALL THROUGH */
|
||||
case MGMT_STATE_REGISTERING:
|
||||
case MGMT_STATE_OOS:
|
||||
prepareForSoftReset();
|
||||
setState(MGMT_STATE_OOS_AWAIT_SHUTDOWN_ACK);
|
||||
action(CMD_SHUTDOWN);
|
||||
break;
|
||||
case MGMT_STATE_WAITING_FOR_CONFIG_FILE:
|
||||
case MGMT_STATE_CREATED:
|
||||
case MGMT_STATE_OOS_AWAIT_SHUTDOWN_ACK:
|
||||
case MGMT_STATE_OOS_AWAIT_UN_REG_ACK:
|
||||
case MGMT_STATE_IDLE:
|
||||
case MGMT_STATE_STOP_AWAIT_SHUTDOWN_ACK:
|
||||
case MGMT_STATE_DESTROY_AWAIT_SHUTDOWN_ACK:
|
||||
default:
|
||||
ignored = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case EV_CC_CONFIG_RECEIVED:
|
||||
switch ( mgmtState) {
|
||||
case MGMT_STATE_CREATED: // This state is only at init
|
||||
// needs handler to be added on receiving message
|
||||
setState(MGMT_STATE_REGISTERING);
|
||||
action(CMD_INSERVICE);
|
||||
break;
|
||||
case MGMT_STATE_WAITING_FOR_CONFIG_FILE:
|
||||
setState(MGMT_STATE_REGISTERING);
|
||||
action(CMD_RESTART);
|
||||
break;
|
||||
case MGMT_STATE_REGISTERING:
|
||||
case MGMT_STATE_REGISTERED:
|
||||
case MGMT_STATE_OOS:
|
||||
case MGMT_STATE_OOS_AWAIT_SHUTDOWN_ACK:
|
||||
case MGMT_STATE_OOS_AWAIT_UN_REG_ACK:
|
||||
case MGMT_STATE_IDLE:
|
||||
case MGMT_STATE_STOP_AWAIT_SHUTDOWN_ACK:
|
||||
case MGMT_STATE_DESTROY_AWAIT_SHUTDOWN_ACK:
|
||||
default:
|
||||
ignored = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case EV_CC_INSERVICE:
|
||||
switch (mgmtState) {
|
||||
case MGMT_STATE_OOS:
|
||||
case MGMT_STATE_REGISTERING:
|
||||
setState(MGMT_STATE_REGISTERED);
|
||||
case MGMT_STATE_REGISTERED:
|
||||
processInserviceEvent();
|
||||
break;
|
||||
case MGMT_STATE_CREATED:
|
||||
case MGMT_STATE_OOS_AWAIT_SHUTDOWN_ACK:
|
||||
case MGMT_STATE_OOS_AWAIT_UN_REG_ACK:
|
||||
case MGMT_STATE_WAITING_FOR_CONFIG_FILE:
|
||||
case MGMT_STATE_IDLE:
|
||||
case MGMT_STATE_STOP_AWAIT_SHUTDOWN_ACK:
|
||||
case MGMT_STATE_DESTROY_AWAIT_SHUTDOWN_ACK:
|
||||
default:
|
||||
ignored = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case EV_CC_OOS_FAILOVER:
|
||||
case EV_CC_OOS_FALLBACK:
|
||||
switch ( mgmtState) {
|
||||
case MGMT_STATE_REGISTERED:
|
||||
processInsToOos();
|
||||
case MGMT_STATE_REGISTERING:
|
||||
setState(MGMT_STATE_OOS);
|
||||
break;
|
||||
case MGMT_STATE_OOS:
|
||||
case MGMT_STATE_CREATED:
|
||||
case MGMT_STATE_OOS_AWAIT_SHUTDOWN_ACK:
|
||||
case MGMT_STATE_OOS_AWAIT_UN_REG_ACK:
|
||||
case MGMT_STATE_WAITING_FOR_CONFIG_FILE:
|
||||
case MGMT_STATE_IDLE:
|
||||
case MGMT_STATE_STOP_AWAIT_SHUTDOWN_ACK:
|
||||
case MGMT_STATE_DESTROY_AWAIT_SHUTDOWN_ACK:
|
||||
default:
|
||||
ignored = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case EV_CC_OOS_REG_ALL_FAILED:
|
||||
switch ( mgmtState) {
|
||||
case MGMT_STATE_REGISTERED:
|
||||
processInsToOos(); /* FALL THROUGH */
|
||||
case MGMT_STATE_OOS:
|
||||
case MGMT_STATE_REGISTERING:
|
||||
setState(MGMT_STATE_OOS_AWAIT_SHUTDOWN_ACK);
|
||||
action(CMD_SHUTDOWN);
|
||||
break;
|
||||
case MGMT_STATE_CREATED:
|
||||
case MGMT_STATE_OOS_AWAIT_SHUTDOWN_ACK:
|
||||
case MGMT_STATE_OOS_AWAIT_UN_REG_ACK:
|
||||
case MGMT_STATE_WAITING_FOR_CONFIG_FILE:
|
||||
case MGMT_STATE_IDLE:
|
||||
case MGMT_STATE_STOP_AWAIT_SHUTDOWN_ACK:
|
||||
case MGMT_STATE_DESTROY_AWAIT_SHUTDOWN_ACK:
|
||||
default:
|
||||
ignored = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
/*
|
||||
*This event shutdown sip stack to facilitate re-registration of
|
||||
* all lines.
|
||||
*/
|
||||
case EV_CC_RE_REGISTER:
|
||||
switch ( mgmtState) {
|
||||
case MGMT_STATE_REGISTERED:
|
||||
processInsToOos();
|
||||
setState(MGMT_STATE_OOS_AWAIT_UN_REG_ACK);
|
||||
action(CMD_UNREGISTER_ALL_LINES);
|
||||
break;
|
||||
case MGMT_STATE_OOS:
|
||||
case MGMT_STATE_REGISTERING:
|
||||
case MGMT_STATE_WAITING_FOR_CONFIG_FILE:
|
||||
case MGMT_STATE_CREATED:
|
||||
case MGMT_STATE_OOS_AWAIT_SHUTDOWN_ACK:
|
||||
case MGMT_STATE_OOS_AWAIT_UN_REG_ACK:
|
||||
case MGMT_STATE_IDLE:
|
||||
case MGMT_STATE_STOP_AWAIT_SHUTDOWN_ACK:
|
||||
case MGMT_STATE_DESTROY_AWAIT_SHUTDOWN_ACK:
|
||||
default:
|
||||
ignored = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case EV_CC_DESTROY:
|
||||
isStartRequestPending = FALSE;
|
||||
isServiceStopped = TRUE;
|
||||
switch ( mgmtState) {
|
||||
case MGMT_STATE_REGISTERED:
|
||||
CC_Service_destroy();
|
||||
processInsToOos();
|
||||
case MGMT_STATE_REGISTERING:
|
||||
case MGMT_STATE_OOS:
|
||||
case MGMT_STATE_WAITING_FOR_CONFIG_FILE:
|
||||
setState(MGMT_STATE_DESTROY_AWAIT_SHUTDOWN_ACK);
|
||||
action(CMD_UNREGISTER_ALL_LINES);
|
||||
break;
|
||||
case MGMT_STATE_STOP_AWAIT_SHUTDOWN_ACK:
|
||||
case MGMT_STATE_OOS_AWAIT_SHUTDOWN_ACK:
|
||||
case MGMT_STATE_OOS_AWAIT_UN_REG_ACK:
|
||||
//setState(MGMT_STATE_DESTROY_AWAIT_SHUTDOWN_ACK);
|
||||
setState(MGMT_STATE_IDLE);
|
||||
CC_Service_destroy();
|
||||
break;
|
||||
case MGMT_STATE_CREATED:
|
||||
CC_Service_destroy();
|
||||
break;
|
||||
case MGMT_STATE_IDLE:
|
||||
CC_Service_destroy();
|
||||
break;
|
||||
case MGMT_STATE_DESTROY_AWAIT_SHUTDOWN_ACK:
|
||||
setState(MGMT_STATE_IDLE);
|
||||
|
||||
default:
|
||||
ignored = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case EV_CC_STOP:
|
||||
isStartRequestPending = FALSE;
|
||||
isServiceStopped = TRUE;
|
||||
switch ( mgmtState) {
|
||||
case MGMT_STATE_REGISTERED:
|
||||
processInsToOos();
|
||||
case MGMT_STATE_REGISTERING:
|
||||
case MGMT_STATE_OOS:
|
||||
case MGMT_STATE_WAITING_FOR_CONFIG_FILE:
|
||||
setState(MGMT_STATE_STOP_AWAIT_SHUTDOWN_ACK);
|
||||
action(CMD_UNREGISTER_ALL_LINES);
|
||||
break;
|
||||
case MGMT_STATE_OOS_AWAIT_SHUTDOWN_ACK:
|
||||
case MGMT_STATE_OOS_AWAIT_UN_REG_ACK:
|
||||
setState(MGMT_STATE_STOP_AWAIT_SHUTDOWN_ACK);
|
||||
break;
|
||||
case MGMT_STATE_STOP_AWAIT_SHUTDOWN_ACK:
|
||||
case MGMT_STATE_CREATED:
|
||||
case MGMT_STATE_IDLE:
|
||||
case MGMT_STATE_DESTROY_AWAIT_SHUTDOWN_ACK:
|
||||
setState(MGMT_STATE_IDLE);
|
||||
//action(CMD_SHUTDOWN);
|
||||
CC_Service_destroy();
|
||||
|
||||
default:
|
||||
ignored = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case EV_CC_OOS_SHUTDOWN_ACK:
|
||||
switch ( mgmtState) {
|
||||
case MGMT_STATE_OOS_AWAIT_UN_REG_ACK:
|
||||
setState(MGMT_STATE_REGISTERING);
|
||||
action(CMD_RESTART);
|
||||
break;
|
||||
case MGMT_STATE_OOS_AWAIT_SHUTDOWN_ACK:
|
||||
setState(MGMT_STATE_WAITING_FOR_CONFIG_FILE);
|
||||
configFetchReq(0);
|
||||
setState(MGMT_STATE_IDLE);
|
||||
break;
|
||||
case MGMT_STATE_STOP_AWAIT_SHUTDOWN_ACK:
|
||||
setState(MGMT_STATE_WAITING_FOR_CONFIG_FILE);
|
||||
if (isStartRequestPending == TRUE) {
|
||||
isStartRequestPending = FALSE;
|
||||
configFetchReq(0);
|
||||
}
|
||||
setState(MGMT_STATE_IDLE);
|
||||
break;
|
||||
case MGMT_STATE_DESTROY_AWAIT_SHUTDOWN_ACK:
|
||||
CC_Service_destroy();
|
||||
break;
|
||||
case MGMT_STATE_REGISTERED:
|
||||
case MGMT_STATE_WAITING_FOR_CONFIG_FILE:
|
||||
case MGMT_STATE_OOS:
|
||||
case MGMT_STATE_REGISTERING:
|
||||
case MGMT_STATE_CREATED:
|
||||
case MGMT_STATE_IDLE:
|
||||
default:
|
||||
ignored = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (ignored) {
|
||||
DEF_DEBUG("registration_processEvent: IGNORED Event %s in State %s \n",
|
||||
mgmt_event_to_str(event) , mgmt_state_to_str(mgmtState));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
43
libs/sipcc/core/ccapp/cc_device_manager.h
Normal file
43
libs/sipcc/core/ccapp/cc_device_manager.h
Normal file
@ -0,0 +1,43 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/**
|
||||
* Management Events
|
||||
*/
|
||||
typedef enum {
|
||||
EV_CC_CREATE=0,
|
||||
EV_CC_START,
|
||||
EV_CC_CONFIG_RECEIVED ,
|
||||
EV_CC_DO_SOFT_RESET ,
|
||||
EV_CC_INSERVICE,
|
||||
EV_CC_OOS_FAILOVER,
|
||||
EV_CC_OOS_FALLBACK,
|
||||
EV_CC_OOS_REG_ALL_FAILED,
|
||||
EV_CC_OOS_SHUTDOWN_ACK,
|
||||
EV_CC_RE_REGISTER,
|
||||
EV_CC_STOP,
|
||||
EV_CC_DESTROY,
|
||||
EV_CC_IP_VALID,
|
||||
EV_CC_IP_INVALID
|
||||
} mgmt_event_t;
|
||||
|
||||
|
||||
/**
|
||||
* Management states
|
||||
*/
|
||||
typedef enum {
|
||||
MGMT_STATE_CREATED=0,
|
||||
MGMT_STATE_IDLE,
|
||||
MGMT_STATE_REGISTERING,
|
||||
MGMT_STATE_REGISTERED,
|
||||
MGMT_STATE_OOS,
|
||||
MGMT_STATE_OOS_AWAIT_SHUTDOWN_ACK,
|
||||
MGMT_STATE_WAITING_FOR_CONFIG_FILE,
|
||||
MGMT_STATE_OOS_AWAIT_UN_REG_ACK,
|
||||
MGMT_STATE_STOP_AWAIT_SHUTDOWN_ACK,
|
||||
MGMT_STATE_DESTROY_AWAIT_SHUTDOWN_ACK
|
||||
} mgmt_state_t;
|
||||
|
||||
extern void registration_processEvent(int event);
|
||||
cc_boolean is_phone_registered();
|
43
libs/sipcc/core/ccapp/cc_info.c
Normal file
43
libs/sipcc/core/ccapp/cc_info.c
Normal file
@ -0,0 +1,43 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "cc_info.h"
|
||||
#include "sessionTypes.h"
|
||||
#include "phone_debug.h"
|
||||
#include "CCProvider.h"
|
||||
#include "sessionConstants.h"
|
||||
#include "ccapp_task.h"
|
||||
|
||||
/**
|
||||
* Send call information.
|
||||
* @param call_handle call handle
|
||||
* @param info_package the Info-Package header of the Info Package
|
||||
* @param info_type the Content-Type header of the Info Package
|
||||
* @param info_body the message body of the Info Package
|
||||
* @return void
|
||||
*/
|
||||
void CC_Info_sendInfo(cc_call_handle_t call_handle,
|
||||
string_t info_package,
|
||||
string_t info_type,
|
||||
string_t info_body) {
|
||||
static const char *fname = "CC_Info_sendInfo";
|
||||
session_send_info_t send_info;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"entry... call_handle=0x%x\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_SES, fname), call_handle);
|
||||
|
||||
send_info.sessionID= (SESSIONTYPE_CALLCONTROL << CC_SID_TYPE_SHIFT) + call_handle;;
|
||||
send_info.generic_raw.info_package = strlib_malloc(info_package, strlen(info_package));
|
||||
send_info.generic_raw.content_type = strlib_malloc(info_type, strlen(info_type));
|
||||
send_info.generic_raw.message_body = strlib_malloc(info_body, strlen(info_body));
|
||||
|
||||
/* Once the msg is posted to ccapp_msgq, ccapp 'owns' these strings */
|
||||
// ccappTaskPostMsg does a shallow copy of *send_info
|
||||
if (ccappTaskPostMsg(CCAPP_SEND_INFO, &send_info,
|
||||
sizeof(session_send_info_t), CCAPP_CCPROVIER) != CPR_SUCCESS) {
|
||||
CCAPP_ERROR(DEB_F_PREFIX"ccappTaskPostMsg failed\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_SES, fname));
|
||||
}
|
||||
|
||||
}
|
229
libs/sipcc/core/ccapp/cc_service.c
Normal file
229
libs/sipcc/core/ccapp/cc_service.c
Normal file
@ -0,0 +1,229 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "cc_service.h"
|
||||
#include "phone_debug.h"
|
||||
#include "CCProvider.h"
|
||||
#include "sessionConstants.h"
|
||||
#include "ccsip_messaging.h"
|
||||
#include "ccapp_task.h"
|
||||
|
||||
/**
|
||||
* External init.c methods
|
||||
*/
|
||||
extern int ccPreInit ();
|
||||
extern int ccInit ();
|
||||
extern int ccUnload ();
|
||||
extern void protCfgTblInit();
|
||||
|
||||
extern cc_int32_t SipDebugMessage;
|
||||
extern cc_int32_t SipDebugState;
|
||||
extern cc_int32_t SipDebugTask;
|
||||
extern cc_int32_t SipDebugRegState;
|
||||
extern cc_int32_t GSMDebug;
|
||||
extern cc_int32_t FIMDebug;
|
||||
extern cc_int32_t LSMDebug;
|
||||
extern cc_int32_t FSMDebugSM;
|
||||
extern int32_t CSMDebugSM;
|
||||
extern cc_int32_t CCDebug;
|
||||
extern cc_int32_t CCDebugMsg;
|
||||
extern cc_int32_t AuthDebug;
|
||||
extern cc_int32_t ConfigDebug;
|
||||
extern cc_int32_t DpintDebug;
|
||||
extern cc_int32_t KpmlDebug;
|
||||
extern cc_int32_t VCMDebug;
|
||||
extern cc_int32_t PLATDebug;
|
||||
extern cc_int32_t CCEVENTDebug;
|
||||
extern cc_int32_t g_CCAppDebug;
|
||||
extern cc_int32_t g_CCLogDebug;
|
||||
extern cc_int32_t TNPDebug;
|
||||
|
||||
/**
|
||||
* Initialize all the debug variables
|
||||
*/
|
||||
void dbg_init(void)
|
||||
{
|
||||
/* This is for the RT/TNP products */
|
||||
SipDebugMessage = 1;
|
||||
SipDebugState = 1;
|
||||
SipDebugTask = 1;
|
||||
SipDebugRegState = 1;
|
||||
GSMDebug = 1;
|
||||
FIMDebug = 1;
|
||||
LSMDebug = 1;
|
||||
FSMDebugSM = 1;
|
||||
CSMDebugSM = 0;
|
||||
VCMDebug = 1;
|
||||
PLATDebug = 1;
|
||||
CCEVENTDebug = 0;
|
||||
CCDebug = 0;
|
||||
CCDebugMsg = 0;
|
||||
AuthDebug = 1;
|
||||
TNPDebug = 1;
|
||||
ConfigDebug = 1;
|
||||
DpintDebug = 0;
|
||||
KpmlDebug = 0;
|
||||
g_CCAppDebug = 1;
|
||||
g_CCLogDebug = 1;
|
||||
TNPDebug = 1;
|
||||
g_NotifyCallDebug = 0;
|
||||
g_NotifyLineDebug = 0;
|
||||
}
|
||||
/**
|
||||
* Defines the management methods.
|
||||
*/
|
||||
/**
|
||||
* The following methods are defined to bring up the pSipcc stack
|
||||
*/
|
||||
/**
|
||||
* Initialize the pSipcc stack.
|
||||
* @return
|
||||
*/
|
||||
cc_return_t CC_Service_init() {
|
||||
//Initialize stack
|
||||
return ccInit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Pre-initialize the pSipcc stack.
|
||||
* @return
|
||||
*/
|
||||
cc_return_t CC_Service_create() {
|
||||
//Preinitialize memory
|
||||
ccPreInit();
|
||||
|
||||
//Initialize debug settings
|
||||
dbg_init();
|
||||
|
||||
//Prepopulate the Configuration data table
|
||||
protCfgTblInit();
|
||||
|
||||
return CC_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gracefully unload the pSipcc stack
|
||||
* @return
|
||||
*/
|
||||
cc_return_t CC_Service_destroy() {
|
||||
ccUnload();
|
||||
return CC_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bring up the pSipcc stack in service
|
||||
* @return
|
||||
*/
|
||||
cc_return_t CC_Service_start() {
|
||||
sessionProvider_cmd_t proCmd;
|
||||
|
||||
CCAPP_DEBUG("CC_Service_start \n");
|
||||
|
||||
memset ( &proCmd, 0, sizeof(sessionProvider_cmd_t));
|
||||
proCmd.sessionType = SESSIONTYPE_CALLCONTROL; //Not used
|
||||
proCmd.cmd = CMD_INSERVICE;
|
||||
|
||||
if (ccappTaskPostMsg(CCAPP_SERVICE_CMD, (cprBuffer_t)&proCmd,
|
||||
sizeof(sessionProvider_cmd_t), CCAPP_CCPROVIER) == CPR_FAILURE) {
|
||||
CCAPP_DEBUG("CC_Service_start: ccappTaskSendMsg failed\n");
|
||||
return CC_FAILURE;
|
||||
}
|
||||
return CC_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shutdown pSipcc stack for restarting
|
||||
* @param mgmt_reason the reason to shutdown pSipcc stack
|
||||
* @param reason_string literal string for shutdown
|
||||
* @return
|
||||
*/
|
||||
cc_return_t CC_Service_shutdown(cc_shutdown_reason_t mgmt_reason, string_t reason_string) {
|
||||
sessionProvider_cmd_t proCmd;
|
||||
|
||||
CCAPP_DEBUG("CC_Service_shutdown \n");
|
||||
|
||||
memset ( &proCmd, 0, sizeof(sessionProvider_cmd_t));
|
||||
proCmd.sessionType = SESSIONTYPE_CALLCONTROL; //Not used
|
||||
proCmd.cmd = CMD_SHUTDOWN;
|
||||
|
||||
if (ccappTaskPostMsg(CCAPP_SERVICE_CMD, (cprBuffer_t)&proCmd,
|
||||
sizeof(sessionProvider_cmd_t), CCAPP_CCPROVIER) == CPR_FAILURE) {
|
||||
CCAPP_DEBUG("CC_Service_shutdown: ccappTaskSendMsg failed\n");
|
||||
return CC_FAILURE;
|
||||
}
|
||||
return CC_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister all lines of a phone
|
||||
* @param mgmt_reason the reason to bring down the registration
|
||||
* @param reason_string the literal string for unregistration
|
||||
* @return
|
||||
*/
|
||||
cc_return_t CC_Service_unregisterAllLines(cc_shutdown_reason_t mgmt_reason, string_t reason_string) {
|
||||
sessionProvider_cmd_t proCmd;
|
||||
|
||||
CCAPP_DEBUG("CC_Service_shutdown \n");
|
||||
|
||||
memset ( &proCmd, 0, sizeof(sessionProvider_cmd_t));
|
||||
proCmd.sessionType = SESSIONTYPE_CALLCONTROL; //Not used
|
||||
proCmd.cmd = CMD_SHUTDOWN;
|
||||
proCmd.cmdData.ccData.reason = mgmt_reason;
|
||||
proCmd.cmdData.ccData.reason_info = reason_string;
|
||||
|
||||
if (ccappTaskPostMsg(CCAPP_SERVICE_CMD, (cprBuffer_t)&proCmd,
|
||||
sizeof(sessionProvider_cmd_t), CCAPP_CCPROVIER) == CPR_FAILURE) {
|
||||
CCAPP_DEBUG("CC_Service_shutdown: ccappTaskSendMsg failed\n");
|
||||
return CC_FAILURE;
|
||||
}
|
||||
return CC_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register all lines for a phone.
|
||||
* @param mgmt_reason the reason of registration
|
||||
* @param reason_string the literal string of the registration
|
||||
* @return
|
||||
*/
|
||||
cc_return_t CC_Service_registerAllLines(cc_shutdown_reason_t mgmt_reason, string_t reason_string) {
|
||||
sessionProvider_cmd_t proCmd;
|
||||
|
||||
CCAPP_DEBUG("CC_Service_registerAllLines \n");
|
||||
|
||||
memset ( &proCmd, 0, sizeof(sessionProvider_cmd_t));
|
||||
proCmd.sessionType = SESSIONTYPE_CALLCONTROL; //Not used
|
||||
proCmd.cmd = CMD_REGISTER_ALL_LINES;
|
||||
proCmd.cmdData.ccData.reason = mgmt_reason;
|
||||
proCmd.cmdData.ccData.reason_info = reason_string;
|
||||
|
||||
if (ccappTaskPostMsg(CCAPP_SERVICE_CMD, (cprBuffer_t)&proCmd,
|
||||
sizeof(sessionProvider_cmd_t), CCAPP_CCPROVIER) == CPR_FAILURE) {
|
||||
CCAPP_DEBUG("CC_Service_registerAllLines: ccappTaskSendMsg failed\n");
|
||||
return CC_FAILURE;
|
||||
}
|
||||
return CC_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restart pSipcc stack
|
||||
* @return
|
||||
*/
|
||||
cc_return_t CC_Service_restart() {
|
||||
sessionProvider_cmd_t proCmd;
|
||||
|
||||
CCAPP_DEBUG("CC_Service_restart \n");
|
||||
|
||||
memset ( &proCmd, 0, sizeof(sessionProvider_cmd_t));
|
||||
proCmd.sessionType = SESSIONTYPE_CALLCONTROL; //Not used
|
||||
proCmd.cmd = CMD_RESTART;
|
||||
|
||||
if (ccappTaskPostMsg(CCAPP_SERVICE_CMD, (cprBuffer_t)&proCmd,
|
||||
sizeof(sessionProvider_cmd_t), CCAPP_CCPROVIER) == CPR_FAILURE) {
|
||||
CCAPP_DEBUG("CC_Service_restart: ccappTaskSendMsg failed\n");
|
||||
return CC_FAILURE;
|
||||
}
|
||||
return CC_SUCCESS;
|
||||
}
|
||||
|
||||
|
375
libs/sipcc/core/ccapp/ccapi_call.c
Normal file
375
libs/sipcc/core/ccapp/ccapi_call.c
Normal file
@ -0,0 +1,375 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "cpr_stdio.h"
|
||||
#include "ccapi_call.h"
|
||||
#include "sessionHash.h"
|
||||
#include "CCProvider.h"
|
||||
#include "cc_call_feature.h"
|
||||
#include "cc_info.h"
|
||||
#include "lsm.h"
|
||||
#include "prot_configmgr.h"
|
||||
#include "ccapi_call_info.h"
|
||||
#include "util_string.h"
|
||||
|
||||
/**
|
||||
* Get call info snapshot
|
||||
* @param [in] handle - call handle
|
||||
* @return cc_call_info_snap_t
|
||||
*/
|
||||
cc_callinfo_ref_t CCAPI_Call_getCallInfo(cc_call_handle_t handle) {
|
||||
unsigned int session_id = ccpro_get_sessionId_by_callid(GET_CALL_ID(handle));
|
||||
cc_callinfo_ref_t snapshot=NULL;
|
||||
session_data_t * data;
|
||||
|
||||
if ( session_id != 0 ) {
|
||||
data = findhash(session_id);
|
||||
if ( data != NULL ) {
|
||||
snapshot = getDeepCopyOfSessionData(data);
|
||||
if (snapshot == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
snapshot->ref_count = 1;
|
||||
}
|
||||
}
|
||||
return snapshot;
|
||||
}
|
||||
/**
|
||||
* Retain the snapshot
|
||||
* @param cc_callinfo_ref_t - refrence to the block to be retained
|
||||
* @return void
|
||||
*/
|
||||
void CCAPI_Call_retainCallInfo(cc_callinfo_ref_t ref) {
|
||||
if (ref != NULL ) {
|
||||
ref->ref_count++;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Free the snapshot
|
||||
* @param cc_callinfo_ref_t - refrence to the block to be freed
|
||||
* @return void
|
||||
*/
|
||||
void CCAPI_Call_releaseCallInfo(cc_callinfo_ref_t ref) {
|
||||
if (ref != NULL ) {
|
||||
DEF_DEBUG(DEB_F_PREFIX"ref=0x%x: count=%d",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI_Call_releaseCallInfo"), ref, ref->ref_count);
|
||||
ref->ref_count--;
|
||||
if ( ref->ref_count == 0 ) {
|
||||
cleanSessionData(ref);
|
||||
cpr_free(ref);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the line associated with this call
|
||||
* @param [in] handle - call handle
|
||||
* @return cc_lineid_t
|
||||
*/
|
||||
cc_lineid_t CCAPI_Call_getLine(cc_call_handle_t call_handle){
|
||||
static const char *fname="CCAPI_Call_getLine";
|
||||
|
||||
if ( call_handle != 0 ) {
|
||||
cc_lineid_t lineid = GET_LINE_ID(call_handle);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %u\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), lineid);
|
||||
return lineid;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Originate call
|
||||
* Goes offhook and dials digits if specified
|
||||
* @param [in] handle - call handle
|
||||
* @param [in] video_pref - video direction desired on call
|
||||
* @param [in] digits - digits to be dialed
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CCAPI_Call_originateCall(cc_call_handle_t handle, cc_sdp_direction_t video_pref, cc_string_t digits){
|
||||
return CC_CallFeature_dial(handle, video_pref, digits);
|
||||
}
|
||||
|
||||
cc_return_t CCAPI_CreateOffer(cc_call_handle_t handle, const cc_media_constraints_t *constraints) {
|
||||
return CC_CallFeature_CreateOffer(handle, constraints);
|
||||
}
|
||||
|
||||
cc_return_t CCAPI_CreateAnswer(cc_call_handle_t handle, const cc_media_constraints_t *constraints) {
|
||||
return CC_CallFeature_CreateAnswer(handle, constraints);
|
||||
}
|
||||
|
||||
cc_return_t CCAPI_SetLocalDescription(cc_call_handle_t handle, cc_jsep_action_t action, cc_string_t sdp) {
|
||||
return CC_CallFeature_SetLocalDescription(handle, action, sdp);
|
||||
}
|
||||
|
||||
cc_return_t CCAPI_SetRemoteDescription(cc_call_handle_t handle, cc_jsep_action_t action, cc_string_t sdp) {
|
||||
return CC_CallFeature_SetRemoteDescription(handle, action, sdp);
|
||||
}
|
||||
|
||||
cc_return_t CCAPI_SetPeerConnection(cc_call_handle_t handle, cc_peerconnection_t pc) {
|
||||
return CC_CallFeature_SetPeerConnection(handle, pc);
|
||||
}
|
||||
|
||||
cc_return_t CCAPI_AddStream(cc_call_handle_t handle, cc_media_stream_id_t stream_id, cc_media_track_id_t track_id, cc_media_type_t media_type) {
|
||||
return CC_CallFeature_AddStream(handle, stream_id, track_id, media_type);
|
||||
}
|
||||
|
||||
cc_return_t CCAPI_RemoveStream(cc_call_handle_t handle, cc_media_stream_id_t stream_id, cc_media_track_id_t track_id, cc_media_type_t media_type) {
|
||||
return CC_CallFeature_RemoveStream(handle, stream_id, track_id, media_type);
|
||||
}
|
||||
|
||||
cc_return_t CCAPI_AddICECandidate(cc_call_handle_t handle, cc_string_t candidate, cc_string_t mid, cc_level_t level) {
|
||||
return CC_CallFeature_AddICECandidate(handle, candidate, mid, level);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dial digits on the call
|
||||
* @param [in] handle - call handle
|
||||
* @paraqm [in] digits - digits to be dialed
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CCAPI_Call_sendDigit(cc_call_handle_t handle, cc_digit_t digit){
|
||||
return CC_CallFeature_sendDigit(handle, digit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Backspace
|
||||
* @param [in] handle - call handle
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CCAPI_Call_backspace(cc_call_handle_t handle){
|
||||
return CC_CallFeature_backSpace(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Answer Call
|
||||
* @param [in] handle - call handle
|
||||
* @param [in] video_pref - video direction desired on call
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CCAPI_Call_answerCall(cc_call_handle_t handle, cc_sdp_direction_t video_pref) {
|
||||
return CC_CallFeature_answerCall(handle, video_pref);
|
||||
}
|
||||
|
||||
/**
|
||||
* Redial
|
||||
* @param [in] handle - call handle
|
||||
* @param [in] video_pref - video direction desired on call
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CCAPI_Call_redial(cc_call_handle_t handle, cc_sdp_direction_t video_pref){
|
||||
return CC_CallFeature_redial(handle, video_pref);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiate Call Forward All
|
||||
* @param [in] handle - call handle
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CCAPI_Call_initiateCallForwardAll(cc_call_handle_t handle){
|
||||
return CC_CallFeature_callForwardAll(handle);
|
||||
}
|
||||
/**
|
||||
* Hold
|
||||
* @param [in] handle - call handle
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CCAPI_Call_hold(cc_call_handle_t handle, cc_hold_reason_t reason){
|
||||
return CC_CallFeature_holdCall(handle, reason);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resume
|
||||
* @param [in] handle - call handle
|
||||
* @param [in] video_pref - video direction desired on call
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CCAPI_Call_resume(cc_call_handle_t handle, cc_sdp_direction_t video_pref) {
|
||||
return CC_CallFeature_resume(handle, video_pref);
|
||||
}
|
||||
|
||||
/**
|
||||
* end Consult leg
|
||||
* @param [in] handle - call handle
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CCAPI_Call_endConsultativeCall(cc_call_handle_t handle){
|
||||
cc_callinfo_ref_t info_handle = CCAPI_Call_getCallInfo(handle);
|
||||
cc_call_attr_t attr = CCAPI_CallInfo_getCallAttr(info_handle);
|
||||
if (attr != CC_ATTR_CONF_CONSULT &&
|
||||
attr != CC_ATTR_XFR_CONSULT &&
|
||||
attr != CC_ATTR_LOCAL_CONF_CONSULT &&
|
||||
attr != CC_ATTR_LOCAL_XFER_CONSULT) {
|
||||
DEF_DEBUG(DEB_F_PREFIX"This method only calls on a consultative call",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI_Call_endConsultativeCall"), handle);
|
||||
return CC_FAILURE;
|
||||
}
|
||||
|
||||
return CC_CallFeature_endConsultativeCall(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* end Call
|
||||
* @param [in] handle - call handle
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CCAPI_Call_endCall(cc_call_handle_t handle){
|
||||
return CC_CallFeature_terminateCall(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiate a conference
|
||||
* @param [in] handle - call handle
|
||||
* @param [in] video_pref - video direction desired on consult call
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CCAPI_Call_conferenceStart(cc_call_handle_t handle, cc_sdp_direction_t video_pref){
|
||||
return CC_CallFeature_conference(handle, TRUE,//not used
|
||||
CC_EMPTY_CALL_HANDLE, video_pref);
|
||||
}
|
||||
|
||||
/**
|
||||
* complete conference
|
||||
* @param [in] handle - call handle
|
||||
* @param [in] phandle - call handle of the other leg
|
||||
* @param [in] video_pref - video direction desired on consult call
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CCAPI_Call_conferenceComplete(cc_call_handle_t handle, cc_call_handle_t phandle,
|
||||
cc_sdp_direction_t video_pref){
|
||||
return CC_CallFeature_conference(handle, TRUE,//not used
|
||||
phandle, video_pref);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* start transfer
|
||||
* @param [in] handle - call handle
|
||||
* @param [in] video_pref - video direction desired on consult call
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CCAPI_Call_transferStart(cc_call_handle_t handle, cc_sdp_direction_t video_pref){
|
||||
return CC_CallFeature_transfer(handle, CC_EMPTY_CALL_HANDLE, video_pref);
|
||||
}
|
||||
|
||||
/**
|
||||
* complete transfer
|
||||
* @param [in] handle - call handle
|
||||
* @param [in] phandle - call handle of the other leg
|
||||
* @param [in] video_pref - video direction desired on consult call
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CCAPI_Call_transferComplete(cc_call_handle_t handle, cc_call_handle_t phandle,
|
||||
cc_sdp_direction_t video_pref){
|
||||
return CC_CallFeature_transfer(handle, phandle, video_pref);
|
||||
}
|
||||
|
||||
/**
|
||||
* cancel conference or transfer
|
||||
* @param [in] handle - call handle
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CCAPI_Call_cancelTransferOrConferenceFeature(cc_call_handle_t handle){
|
||||
return CC_CallFeature_cancelXfrerCnf(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* direct Transfer
|
||||
* @param [in] handle - call handle
|
||||
* @param [in] handle - transfer target call
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CCAPI_Call_directTransfer(cc_call_handle_t handle, cc_call_handle_t target){
|
||||
return CC_CallFeature_directTransfer(handle, target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Join Across line
|
||||
* @param [in] handle - call handle
|
||||
* @param [in] handle - join target
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CCAPI_Call_joinAcrossLine(cc_call_handle_t handle, cc_call_handle_t target){
|
||||
return CC_CallFeature_joinAcrossLine(handle, target);
|
||||
}
|
||||
|
||||
/**
|
||||
* BLF Call Pickup
|
||||
* @param [in] handle - call handle
|
||||
* @param [in] speed - speedDial Number
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CCAPI_Call_blfCallPickup(cc_call_handle_t handle,
|
||||
cc_sdp_direction_t video_pref, cc_string_t speed){
|
||||
return CC_CallFeature_blfCallPickup(handle, video_pref, speed);
|
||||
}
|
||||
|
||||
/**
|
||||
* Select a call
|
||||
* @param [in] handle - call handle
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CCAPI_Call_select(cc_call_handle_t handle){
|
||||
return CC_CallFeature_select(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Video Media Cap for the call
|
||||
* @param [in] handle - call handle
|
||||
* @param [in] video_pref - video direction desired on call
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CCAPI_Call_updateVideoMediaCap (cc_call_handle_t handle, cc_sdp_direction_t video_pref) {
|
||||
return CC_CallFeature_updateCallMediaCapability(handle, video_pref);
|
||||
}
|
||||
|
||||
/**
|
||||
* send INFO method for the call
|
||||
* @param [in] handle - call handle
|
||||
* @param [in] infopackage - Info-Package header value
|
||||
* @param [in] infotype - Content-Type header val
|
||||
* @param [in] infobody - Body of the INFO message
|
||||
* @return SUCCESS or FAILURE
|
||||
*/
|
||||
cc_return_t CCAPI_Call_sendInfo (cc_call_handle_t handle, cc_string_t infopackage, cc_string_t infotype, cc_string_t infobody)
|
||||
{
|
||||
CC_Info_sendInfo(handle, infopackage, infotype, infobody);
|
||||
return CC_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* API to mute/unmute audio
|
||||
* @param [in] val - TRUE=> mute FALSE => unmute
|
||||
* @return SUCCESS or FAILURE
|
||||
* NOTE: The mute state is persisted within the stack and shall be remembered across hold/resume.
|
||||
* This API doesn't perform the mute operation but simply caches the mute state of the session.
|
||||
*/
|
||||
cc_return_t CCAPI_Call_setAudioMute (cc_call_handle_t handle, cc_boolean val) {
|
||||
unsigned int session_id = ccpro_get_sessionId_by_callid(GET_CALL_ID(handle));
|
||||
session_data_t * sess_data_p = (session_data_t *)findhash(session_id);
|
||||
DEF_DEBUG(DEB_F_PREFIX": val=%d, handle=%d datap=%x",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI_Call_setAudioMute"), val, handle, sess_data_p);
|
||||
if ( sess_data_p != NULL ) {
|
||||
sess_data_p->audio_mute = val;
|
||||
}
|
||||
return CC_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* API to mute/unmute Video
|
||||
* @param [in] val - TRUE=> mute FALSE => unmute
|
||||
* @return SUCCESS or FAILURE
|
||||
* NOTE: The mute state is persisted within the stack and shall be remembered across hold/resume
|
||||
* This API doesn't perform the mute operation but simply caches the mute state of the session.
|
||||
*/
|
||||
cc_return_t CCAPI_Call_setVideoMute (cc_call_handle_t handle, cc_boolean val){
|
||||
unsigned int session_id = ccpro_get_sessionId_by_callid(GET_CALL_ID(handle));
|
||||
session_data_t * sess_data_p = (session_data_t *)findhash(session_id);
|
||||
DEF_DEBUG(DEB_F_PREFIX": val=%d, handle=%d datap=%x",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI_Call_setVideoMute"), val, handle, sess_data_p);
|
||||
if ( sess_data_p != NULL ) {
|
||||
sess_data_p->video_mute = val;
|
||||
lsm_set_video_mute(GET_CALL_ID(handle), val);
|
||||
}
|
||||
return CC_SUCCESS;
|
||||
}
|
784
libs/sipcc/core/ccapp/ccapi_call_info.c
Normal file
784
libs/sipcc/core/ccapp/ccapi_call_info.c
Normal file
@ -0,0 +1,784 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "cpr_stdio.h"
|
||||
#include "ccapi_call.h"
|
||||
#include "sessionHash.h"
|
||||
#include "CCProvider.h"
|
||||
#include "text_strings.h"
|
||||
#include "phone_debug.h"
|
||||
#include "peer_connection_types.h"
|
||||
|
||||
/**
|
||||
* get Line on which this call is
|
||||
* @param [in] handle - call handle
|
||||
* @return cc_line_id_t - line ID
|
||||
*/
|
||||
cc_lineid_t CCAPI_CallInfo_getLine(cc_callinfo_ref_t handle)
|
||||
{
|
||||
static const char *fname="CCAPI_CallInfo_getLine";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %u\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), GET_LINE_ID(CREATE_CALL_HANDLE_FROM_SESSION_ID(data->sess_id)));
|
||||
return GET_LINE_ID(CREATE_CALL_HANDLE_FROM_SESSION_ID(data->sess_id));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* get Call state
|
||||
* @param handle - call handle
|
||||
* @return call state
|
||||
*/
|
||||
cc_call_state_t CCAPI_CallInfo_getCallState(cc_callinfo_ref_t handle){
|
||||
static const char *fname="CCAPI_CallInfo_getCallState";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %02X\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->state);
|
||||
return data->state;
|
||||
}
|
||||
|
||||
return ONHOOK;
|
||||
}
|
||||
|
||||
/**
|
||||
* get call attributes
|
||||
* @param handle - call handle
|
||||
* @return call attributes
|
||||
*/
|
||||
cc_call_attr_t CCAPI_CallInfo_getCallAttr(cc_callinfo_ref_t handle){
|
||||
static const char *fname="CCAPI_CallInfo_getCallAttr";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %02X\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->attr);
|
||||
return data->attr;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* get Call Type
|
||||
* @param handle - call handle
|
||||
* @return call type
|
||||
*/
|
||||
cc_call_type_t CCAPI_CallInfo_getCallType(cc_callinfo_ref_t handle){
|
||||
static const char *fname="CCAPI_CallInfo_getCallType";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %02X\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->type);
|
||||
return data->type;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* get Called party name
|
||||
* @param handle - call handle
|
||||
* @return called party name
|
||||
*/
|
||||
cc_string_t CCAPI_CallInfo_getCalledPartyName(cc_callinfo_ref_t handle){
|
||||
static const char *fname="CCAPI_CallInfo_getCalledPartyName";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->cld_name);
|
||||
return data->cld_name;
|
||||
}
|
||||
|
||||
return strlib_empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* get Called party number
|
||||
* @param handle - call handle
|
||||
* @return called party number
|
||||
*/
|
||||
cc_string_t CCAPI_CallInfo_getCalledPartyNumber(cc_callinfo_ref_t handle){
|
||||
static const char *fname="CCAPI_CallInfo_getCalledPartyNumber";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->cld_number);
|
||||
return data->cld_number;
|
||||
}
|
||||
|
||||
return strlib_empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* get Calling party name
|
||||
* @param handle - call handle
|
||||
* @return calling party name
|
||||
*/
|
||||
cc_string_t CCAPI_CallInfo_getCallingPartyName(cc_callinfo_ref_t handle){
|
||||
static const char *fname="CCAPI_CallInfo_getCallingPartyName";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->clg_name);
|
||||
return data->clg_name;
|
||||
}
|
||||
|
||||
return strlib_empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* get Calling party number
|
||||
* @param handle - call handle
|
||||
* @return calling party number
|
||||
*/
|
||||
cc_string_t CCAPI_CallInfo_getCallingPartyNumber(cc_callinfo_ref_t handle){
|
||||
static const char *fname="CCAPI_CallInfo_getCallingPartyNumber";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->clg_number);
|
||||
return data->clg_number;
|
||||
}
|
||||
|
||||
return strlib_empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* get alternate number
|
||||
* @param handle - call handle
|
||||
* @return calling party number
|
||||
*/
|
||||
cc_string_t CCAPI_CallInfo_getAlternateNumber(cc_callinfo_ref_t handle){
|
||||
static const char *fname="CCAPI_CallInfo_getAlternateNumber";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->alt_number);
|
||||
return data->alt_number;
|
||||
}
|
||||
|
||||
return strlib_empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* get Original Called party name
|
||||
* @param handle - call handle
|
||||
* @return original called party name
|
||||
*/
|
||||
cc_string_t CCAPI_CallInfo_getOriginalCalledPartyName(cc_callinfo_ref_t handle){
|
||||
static const char *fname="CCAPI_CallInfo_getOriginalCalledPartyName";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->orig_called_name);
|
||||
return data->orig_called_name;
|
||||
}
|
||||
|
||||
return strlib_empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* get Original Called party number
|
||||
* @param handle - call handle
|
||||
* @return original called party number
|
||||
*/
|
||||
cc_string_t CCAPI_CallInfo_getOriginalCalledPartyNumber(cc_callinfo_ref_t handle){
|
||||
static const char *fname="CCAPI_CallInfo_getOriginalCalledPartyNumber";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->orig_called_number);
|
||||
return data->orig_called_number;
|
||||
}
|
||||
|
||||
return strlib_empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* get last redirecting party name
|
||||
* @param handle - call handle
|
||||
* @return last redirecting party name
|
||||
*/
|
||||
cc_string_t CCAPI_CallInfo_getLastRedirectingPartyName(cc_callinfo_ref_t handle){
|
||||
static const char *fname="CCAPI_CallInfo_getLastRedirectingPartyName";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->last_redir_name);
|
||||
return data->last_redir_name;
|
||||
}
|
||||
|
||||
return strlib_empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* get past redirecting party number
|
||||
* @param handle - call handle
|
||||
* @return last redirecting party number
|
||||
*/
|
||||
cc_string_t CCAPI_CallInfo_getLastRedirectingPartyNumber(cc_callinfo_ref_t handle){
|
||||
static const char *fname="CCAPI_CallInfo_getLastRedirectingPartyNumber";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->last_redir_number);
|
||||
return data->last_redir_number;
|
||||
}
|
||||
|
||||
return strlib_empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* get placed call party name
|
||||
* @param handle - call handle
|
||||
* @return placed party name
|
||||
*/
|
||||
cc_string_t CCAPI_CallInfo_getPlacedCallPartyName(cc_callinfo_ref_t handle){
|
||||
static const char *fname="CCAPI_CallInfo_getPlacedCallPartyName";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->plcd_name);
|
||||
return data->plcd_name;
|
||||
}
|
||||
|
||||
return strlib_empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* get placed call party number
|
||||
* @param handle - call handle
|
||||
* @return placed party number
|
||||
*/
|
||||
cc_string_t CCAPI_CallInfo_getPlacedCallPartyNumber(cc_callinfo_ref_t handle){
|
||||
static const char *fname="CCAPI_CallInfo_getPlacedCallPartyNumber";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->plcd_number);
|
||||
return data->plcd_number;
|
||||
}
|
||||
|
||||
return strlib_empty();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get call instance number
|
||||
* @param handle - call handle
|
||||
* @return
|
||||
*/
|
||||
cc_int32_t CCAPI_CallInfo_getCallInstance(cc_callinfo_ref_t handle){
|
||||
static const char *fname="CCAPI_CallInfo_getCallInstance";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->inst);
|
||||
return data->inst;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* get call status prompt
|
||||
* @param handle - call handle
|
||||
* @return call status
|
||||
*/
|
||||
cc_string_t CCAPI_CallInfo_getStatus(cc_callinfo_ref_t handle){
|
||||
static const char *fname="CCAPI_CallInfo_getStatus";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->status);
|
||||
return data->status;
|
||||
}
|
||||
|
||||
return strlib_empty();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* get call security
|
||||
* @param handle - call handle
|
||||
* @return call security status
|
||||
*/
|
||||
cc_call_security_t CCAPI_CallInfo_getSecurity(cc_callinfo_ref_t handle){
|
||||
static const char *fname="CCAPI_CallInfo_getSecurity";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %02X\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->security);
|
||||
return data->security;
|
||||
}
|
||||
|
||||
return CC_SECURITY_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* * get Call Selection Status
|
||||
* * @param [in] handle - call info handle
|
||||
* * @return cc_boolean - TRUE => selected
|
||||
* */
|
||||
cc_boolean CCAPI_CallInfo_getSelectionStatus(cc_callinfo_ref_t handle){
|
||||
static const char *fname="CCAPI_CallInfo_getSelectionStatus";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %02X\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->isSelected);
|
||||
return data->isSelected;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* get call policy
|
||||
* @param handle - call handle
|
||||
* @return call policy
|
||||
*/
|
||||
cc_call_policy_t CCAPI_CallInfo_getPolicy(cc_callinfo_ref_t handle){
|
||||
static const char *fname="CCAPI_CallInfo_getPolicy";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %02X\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->policy);
|
||||
return data->policy;
|
||||
}
|
||||
|
||||
return CC_POLICY_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* get GCID
|
||||
* @param handle - call handle
|
||||
* @return GCID
|
||||
*/
|
||||
cc_string_t CCAPI_CallInfo_getGCID(cc_callinfo_ref_t handle){
|
||||
static const char *fname="CCAPI_CallInfo_getGCID";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->gci);
|
||||
return data->gci;
|
||||
}
|
||||
|
||||
return strlib_empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* get ringer state.
|
||||
* @param handle - call handle
|
||||
* @return ringer state
|
||||
*/
|
||||
cc_boolean CCAPI_CallInfo_getRingerState(cc_callinfo_ref_t handle)
|
||||
{
|
||||
static const char *fname="CCAPI_CallInfo_getRingerState";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->ringer_start);
|
||||
return data->ringer_start;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* get ringer mode
|
||||
* @param handle - call handle
|
||||
* @return ringer mode
|
||||
*/
|
||||
int CCAPI_CallInfo_getRingerMode(cc_callinfo_ref_t handle)
|
||||
{
|
||||
static const char *fname="CCAPI_CallInfo_getRingerMode";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->ringer_mode);
|
||||
return (int)(data->ringer_mode);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* get ringer loop count
|
||||
* @param handle - call handle
|
||||
* @return once Vs continuous
|
||||
*/
|
||||
cc_boolean CCAPI_CallInfo_getIsRingOnce(cc_callinfo_ref_t handle)
|
||||
{
|
||||
static const char *fname="CCAPI_CallInfo_getIsRingOnce";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->ringer_once);
|
||||
return (int)(data->ringer_once);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* get onhook reason
|
||||
* @param handle - call handle
|
||||
* @return onhook reason
|
||||
*/
|
||||
cc_int32_t CCAPI_CallInfo_getOnhookReason(cc_callinfo_ref_t handle){
|
||||
static const char *fname="CCAPI_CallInfo_getOnhookReason";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->cause);
|
||||
return data->cause;
|
||||
}
|
||||
|
||||
return CC_CAUSE_NORMAL;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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\n", 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* getStream Statistics
|
||||
* @param handle - call handle
|
||||
* @return stream stats
|
||||
*/
|
||||
cc_return_t CCAPI_CallInfo_getStreamStatistics(cc_callinfo_ref_t handle, cc_int32_t stats[], cc_int32_t *count)
|
||||
{
|
||||
static const char *fname="CCAPI_CallInfo_getStreamStatistics";
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned CC_SUCCESS (default)\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
// todo
|
||||
return CC_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* has capability - is the feature allowed
|
||||
* @param handle - call handle
|
||||
* @param feat_id - feature id
|
||||
* @return boolean - is Allowed
|
||||
*/
|
||||
cc_boolean CCAPI_CallInfo_hasCapability(cc_callinfo_ref_t handle, cc_int32_t feat_id){
|
||||
static const char *fname="CCAPI_CallInfo_hasCapability";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"feature id: %d , value returned %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname),feat_id, data->allowed_features[feat_id]);
|
||||
return data->allowed_features[feat_id];
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* get Allowed Feature set
|
||||
* @param handle - call handle
|
||||
* @return boolean array that can be indexed using CCAPI_CALL_CAP_XXXX to check if feature is enabled
|
||||
*/
|
||||
cc_boolean CCAPI_CallInfo_getCapabilitySet(cc_callinfo_ref_t handle, cc_int32_t feat_set[]){
|
||||
static const char *fname="CCAPI_CallInfo_getCapabilitySet";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
int feat_id;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
for (feat_id = 0; feat_id < CCAPI_CALL_CAP_MAX; feat_id++) {
|
||||
feat_set[feat_id] = data->allowed_features[feat_id];
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"feature id: %d , value %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname),feat_id, feat_set[feat_id]);
|
||||
}
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned CC_SUCCESS\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
return CC_SUCCESS;
|
||||
}
|
||||
|
||||
return CC_FAILURE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call selection status
|
||||
* @param [in] handle - call handle
|
||||
* @return cc_boolean - selection status
|
||||
*/
|
||||
cc_boolean CCAPI_CallInfo_isCallSelected(cc_callinfo_ref_t handle){
|
||||
static const char *fname="CCAPI_CallInfo_isCallSelected";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->isSelected);
|
||||
return data->isSelected;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call negotiated video direction
|
||||
* @param [in] handle - call handle
|
||||
* @return cc_sdp_direction_t - video direction
|
||||
*/
|
||||
cc_sdp_direction_t CCAPI_CallInfo_getVideoDirection(cc_callinfo_ref_t handle){
|
||||
static const char *fname="CCAPI_CallInfo_getVideoDirection";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->vid_dir);
|
||||
return (data->vid_dir);
|
||||
}
|
||||
|
||||
return CC_SDP_DIRECTION_INACTIVE;
|
||||
}
|
||||
|
||||
/**
|
||||
* INFO Package for RECEIVED_INFO event
|
||||
* @param [in] handle - call info handle
|
||||
* @return cc_string_t - Info package header
|
||||
*/
|
||||
cc_string_t CCAPI_CallInfo_getINFOPack (cc_callinfo_ref_t handle)
|
||||
{
|
||||
static const char *fname="CCAPI_CallInfo_getINFOPackage";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->info_package);
|
||||
return data->info_package;
|
||||
}
|
||||
|
||||
return strlib_empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* INFO type for RECEIVED_INFO event
|
||||
* @param [in] handle - call info handle
|
||||
* @return cc_string_t - content-type header
|
||||
*/
|
||||
cc_string_t CCAPI_CallInfo_getINFOType (cc_callinfo_ref_t handle)
|
||||
{
|
||||
static const char *fname="CCAPI_CallInfo_getINFOType";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->info_type);
|
||||
return data->info_type;
|
||||
}
|
||||
|
||||
return strlib_empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* INFO body for RECEIVED_INFO event
|
||||
* @param [in] handle - call info handle
|
||||
* @return cc_string_t - INFO body
|
||||
*/
|
||||
cc_string_t CCAPI_CallInfo_getINFOBody (cc_callinfo_ref_t handle)
|
||||
{
|
||||
static const char *fname="CCAPI_CallInfo_getINFOBody";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->info_body);
|
||||
return data->info_body;
|
||||
}
|
||||
|
||||
return strlib_empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the call log reference
|
||||
* @param [in] handle - call info handle
|
||||
* @return cc_string_t - INFO body
|
||||
* NOTE: Memory associated with the call log is tied to the cc_callinfo_ref_t handle
|
||||
* this would be freed when the callinfo ref is freed.
|
||||
*/
|
||||
cc_calllog_ref_t CCAPI_CallInfo_getCallLogRef(cc_callinfo_ref_t handle)
|
||||
{
|
||||
static const char *fname="CCAPI_CallInfo_getCallLogRef";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %x\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), &data->call_log);
|
||||
return &data->call_log;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the Audio mute state for this call
|
||||
* @return boolean true=muted false=not muted
|
||||
*/
|
||||
cc_boolean CCAPI_CallInfo_isAudioMuted (cc_callinfo_ref_t handle){
|
||||
static const char *fname="CCAPI_CallInfo_isAudioMuted";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
session_data_t * sess_data_p;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
if ( data != NULL){
|
||||
sess_data_p = (session_data_t *)findhash(data->sess_id);
|
||||
if ( sess_data_p != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), sess_data_p->audio_mute);
|
||||
return sess_data_p->audio_mute;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Video mute state for this call
|
||||
* @return boolean true=muted false=not muted
|
||||
*/
|
||||
cc_boolean CCAPI_CallInfo_isVideoMuted (cc_callinfo_ref_t handle){
|
||||
static const char *fname="CCAPI_CallInfo_isVideoMuted";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
session_data_t * sess_data_p;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
if ( data != NULL){
|
||||
sess_data_p = (session_data_t *)findhash(data->sess_id);
|
||||
if ( sess_data_p != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), sess_data_p->video_mute);
|
||||
return sess_data_p->video_mute;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* get SDP for CreateOffer\Create answer success callback
|
||||
* @param handle - call handle
|
||||
* @return sdp
|
||||
*/
|
||||
cc_string_t CCAPI_CallInfo_getSDP(cc_callinfo_ref_t handle){
|
||||
static const char *fname="CCAPI_CallInfo_getSDP";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if (data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->sdp);
|
||||
return data->sdp;
|
||||
}
|
||||
|
||||
return strlib_empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* get status code from internal JSEP functions
|
||||
* @param handle - call handle
|
||||
* @return status code
|
||||
*/
|
||||
cc_int32_t CCAPI_CallInfo_getStatusCode(cc_callinfo_ref_t handle){
|
||||
static const char *fname="CCAPI_CallInfo_getStatusCode";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( data != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->cause);
|
||||
return data->cause;
|
||||
}
|
||||
|
||||
return CC_CAUSE_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get media stream table
|
||||
* @param handle - call handle
|
||||
* @return status MediaStreamTable
|
||||
*/
|
||||
MediaStreamTable* CCAPI_CallInfo_getMediaStreams(cc_callinfo_ref_t handle) {
|
||||
static const char *fname="CCAPI_CallInfo_getMediaStreams";
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
MediaTrack track;
|
||||
MediaStreamTable* table = cpr_malloc(sizeof(MediaStreamTable));
|
||||
if (!table)
|
||||
return NULL;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if (data != NULL) {
|
||||
table->media_stream_id = data->media_stream_id;
|
||||
table->num_tracks = 1; /* this will change when we have multiple tracks per stream */
|
||||
track.media_stream_track_id = data->media_stream_track_id;
|
||||
track.video = FALSE;
|
||||
table->track[0] = track;
|
||||
|
||||
/*
|
||||
* Partly implemented multi-track handling
|
||||
cc_table = data->media_tracks;
|
||||
table->stream_id = (unsigned int)cc_table->stream_id;
|
||||
table->num_tracks = (unsigned int)cc_table->num_tracks;
|
||||
track.track_id = cc_table->track[0].ref_id;
|
||||
table->track[0] = track;
|
||||
*/
|
||||
return table;
|
||||
}
|
||||
|
||||
return table;
|
||||
}
|
108
libs/sipcc/core/ccapp/ccapi_config.c
Normal file
108
libs/sipcc/core/ccapp/ccapi_config.c
Normal file
@ -0,0 +1,108 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "phone_debug.h"
|
||||
#include "CCProvider.h"
|
||||
#include "sessionConstants.h"
|
||||
#include "prot_configmgr.h"
|
||||
#include "cc_types.h"
|
||||
#include "config_parser.h"
|
||||
#include "config_api.h"
|
||||
#include "ccapi_snapshot.h"
|
||||
#include "ccapi_device.h"
|
||||
#include "ccapi_device_info.h"
|
||||
#include "cc_device_manager.h"
|
||||
#include "ccapi_service.h"
|
||||
#include "util_string.h"
|
||||
|
||||
extern boolean apply_config;
|
||||
extern cc_apply_config_result_t apply_config_result;
|
||||
cc_boolean parse_setup_properties (int device_handle, const char *device_name, const char *sipUser, const char *sipPassword, const char *sipDomain);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
void CCAPI_Start_response(int device_handle, const char *device_name, const char *sipUser, const char *sipPassword, const char *sipDomain) {
|
||||
static const char fname[] = "CCAPI_Start_response";
|
||||
|
||||
if (is_empty_str((char*)sipUser) || is_empty_str((char*)sipDomain)) {
|
||||
CCAPP_ERROR(DEB_F_PREFIX" invalid registration details user=%x, domain=%x\n", DEB_F_PREFIX_ARGS(CC_API, fname), sipUser, sipDomain);
|
||||
return;
|
||||
}
|
||||
|
||||
g_dev_hdl = device_handle;
|
||||
sstrncpy(g_dev_name, device_name, sizeof(g_dev_name));
|
||||
|
||||
if (is_phone_registered() == FALSE) {
|
||||
|
||||
if (parse_setup_properties(device_handle, device_name, sipUser, sipPassword, sipDomain)) {
|
||||
registration_processEvent(EV_CC_CONFIG_RECEIVED);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* New Function
|
||||
Register without using config file downloaded from cucm
|
||||
*/
|
||||
cc_boolean parse_setup_properties (int device_handle, const char *device_name, const char *sipUser, const char *sipPassword, const char *sipDomain) {
|
||||
CC_Config_setStringValue(CFGID_DEVICE_NAME, device_name);
|
||||
|
||||
config_setup_main(sipUser, sipPassword, sipDomain);
|
||||
|
||||
ccsnap_device_init();
|
||||
ccsnap_line_init();
|
||||
ccsnap_gen_deviceEvent(CCAPI_DEVICE_EV_CONFIG_CHANGED, CC_DEVICE_ID);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
cc_boolean CCAPI_Config_set_server_address(const char *ip_address) {
|
||||
config_setup_server_address(ip_address);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
cc_boolean CCAPI_Config_set_transport_udp(const cc_boolean is_udp) {
|
||||
config_setup_transport_udp(is_udp);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
cc_boolean CCAPI_Config_set_local_voip_port(const int port) {
|
||||
config_setup_local_voip_control_port(port);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
cc_boolean CCAPI_Config_set_remote_voip_port(const int port) {
|
||||
config_setup_remote_voip_control_port(port);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int CCAPI_Config_get_local_voip_port() {
|
||||
return config_get_local_voip_control_port();
|
||||
}
|
||||
|
||||
int CCAPI_Config_get_remote_voip_port() {
|
||||
return config_get_remote_voip_control_port();
|
||||
}
|
||||
|
||||
const char* CCAPI_Config_get_version() {
|
||||
return config_get_version();
|
||||
}
|
||||
|
||||
cc_boolean CCAPI_Config_set_p2p_mode(const cc_boolean is_p2p) {
|
||||
config_setup_p2p_mode(is_p2p);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
cc_boolean CCAPI_Config_set_sdp_mode(const cc_boolean is_sdp) {
|
||||
config_setup_sdp_mode(is_sdp);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
cc_boolean CCAPI_Config_set_avp_mode(const cc_boolean is_rtpsavpf) {
|
||||
config_setup_avp_mode(is_rtpsavpf);
|
||||
return TRUE;
|
||||
}
|
290
libs/sipcc/core/ccapp/ccapi_device.c
Normal file
290
libs/sipcc/core/ccapp/ccapi_device.c
Normal file
@ -0,0 +1,290 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "cpr_stdlib.h"
|
||||
#include "string_lib.h"
|
||||
#include "ccapi_snapshot.h"
|
||||
#include "ccapi_device.h"
|
||||
#include "CCProvider.h"
|
||||
#include "cc_config.h"
|
||||
#include "cc_call_feature.h"
|
||||
#include "cc_device_feature.h"
|
||||
#include "ccsip_messaging.h"
|
||||
#include "ccapi_call_info.h"
|
||||
#include "cc_device_manager.h"
|
||||
#include "cc_service_listener.h"
|
||||
#include "platform_api.h"
|
||||
#include "util_string.h"
|
||||
#include "ccapi_service.h"
|
||||
#include "ccapi_device_info.h"
|
||||
|
||||
char g_new_signaling_ip[MAX_IPADDR_STR_LEN];
|
||||
|
||||
dock_undock_event_t g_dock_undock_event = MEDIA_INTERFACE_UPDATE_NOT_REQUIRED;
|
||||
extern accessory_cfg_info_t g_accessoryCfgInfo;
|
||||
|
||||
extern void escalateDeescalate();
|
||||
|
||||
int signaling_interface_type;
|
||||
|
||||
/**
|
||||
* Get device reference handle
|
||||
* @return cc_deviceinfo_ref_t - reference handle of the device
|
||||
*/
|
||||
cc_device_handle_t CCAPI_Device_getDeviceID()
|
||||
{
|
||||
return CC_DEVICE_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get device reference handle
|
||||
* @param handle - device handle
|
||||
* @return cc_deviceinfo_ref_t - reference handle of the device
|
||||
*/
|
||||
cc_deviceinfo_ref_t CCAPI_Device_getDeviceInfo(cc_device_handle_t handle)
|
||||
{
|
||||
cc_device_info_t *device_info = (cc_device_info_t*)cpr_malloc(sizeof(cc_device_info_t));
|
||||
|
||||
if (device_info) {
|
||||
*device_info = g_deviceInfo;
|
||||
device_info->name = strlib_copy(g_deviceInfo.name);
|
||||
if (device_info->name == NULL) {
|
||||
device_info->name = strlib_empty();
|
||||
}
|
||||
device_info->not_prompt = strlib_copy(g_deviceInfo.not_prompt);
|
||||
if (device_info->not_prompt == NULL) {
|
||||
device_info->not_prompt = strlib_empty();
|
||||
}
|
||||
device_info->ref_count = 1;
|
||||
}
|
||||
return device_info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retain the deviceInfo snapshot
|
||||
* @param handle - device handle
|
||||
* @param cc_deviceinfo_ref_t - refrence to the block to be retained
|
||||
* @return void
|
||||
*/
|
||||
void CCAPI_Device_retainDeviceInfo(cc_deviceinfo_ref_t ref){
|
||||
cc_device_info_t *device_info = ref;
|
||||
if (device_info) {
|
||||
device_info->ref_count++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set device configuration file location
|
||||
* @param [in] ref - refrence to the block to be freed
|
||||
* @param [in] file_path - device config file full path
|
||||
* @return void
|
||||
*/
|
||||
void CCAPI_Device_configUpdate(cc_device_handle_t handle, file_path_t file_path) {
|
||||
CC_Config_setStringValue(CFGID_CONFIG_FILE, file_path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Release the deviceInfo snapshot
|
||||
* @param handle - device handle
|
||||
* @param cc_deviceinfo_ref_t - refrence to the block to be released
|
||||
* @return void
|
||||
*/
|
||||
void CCAPI_Device_releaseDeviceInfo(cc_deviceinfo_ref_t ref){
|
||||
cc_device_info_t *device_info = ref;
|
||||
|
||||
if (device_info) {
|
||||
device_info->ref_count--;
|
||||
if ( device_info->ref_count == 0 ) {
|
||||
strlib_free(device_info->name);
|
||||
strlib_free(device_info->not_prompt);
|
||||
cpr_free(device_info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a call on the device
|
||||
* @param handle - device handle
|
||||
* @return cc_call_handle_t - handle of the call created
|
||||
*/
|
||||
cc_call_handle_t CCAPI_Device_CreateCall(cc_device_handle_t handle)
|
||||
{
|
||||
return CC_createCall(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable or disable video capability of the device.
|
||||
* @param handle - device handle
|
||||
* @param enable - a flag to indicate that application wants to enable of
|
||||
* disable video capability of the device.
|
||||
* @return void
|
||||
*/
|
||||
void CCAPI_Device_enableVideo(cc_device_handle_t handle, cc_boolean enable)
|
||||
{
|
||||
CC_DeviceFeature_enableVideo(enable);
|
||||
g_accessoryCfgInfo.video = ACCSRY_CFGD_APK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable or disable camera capability of the device.
|
||||
* @param handle - device handle
|
||||
* @param enable - a flag to indicate that application wants to enable of
|
||||
* disable camera capability of the device.
|
||||
* @return void
|
||||
*/
|
||||
void CCAPI_Device_enableCamera(cc_device_handle_t handle, cc_boolean enable)
|
||||
{
|
||||
CC_DeviceFeature_enableCamera(enable);
|
||||
g_accessoryCfgInfo.camera = ACCSRY_CFGD_APK;
|
||||
}
|
||||
|
||||
/**
|
||||
* CCAPI_Device_setDigestNamePasswd
|
||||
*
|
||||
* @param handle - device handle
|
||||
* @param name - The Digest auth name
|
||||
* @param passwd - The password for that name for the line
|
||||
* @return void
|
||||
*/
|
||||
void CCAPI_Device_setDigestNamePasswd (cc_device_handle_t handle,
|
||||
char *name, char *pw)
|
||||
{
|
||||
int line;
|
||||
|
||||
for(line = 0; line < MAX_CONFIG_LINES; line++) {
|
||||
CC_Config_setStringValue(CFGID_LINE_AUTHNAME + line, name);
|
||||
CC_Config_setStringValue(CFGID_LINE_PASSWORD + line, pw);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* CCAPI_Device_IP_Update
|
||||
*
|
||||
* There is a change in the IP address and the values of new set
|
||||
* of signaling and media IP addresses are provided.
|
||||
* These value are compared with the current IP address values
|
||||
* and depending on what changed, restart and/or re-invite
|
||||
* action is taken.
|
||||
*
|
||||
* The case being addressed.
|
||||
* 1) If the signaling IP change happens during a call,
|
||||
* the change is deferred till phone is idle.
|
||||
* 2)If media IP change happens during a call, it is applied immediately.
|
||||
* 3) If both change, and call is active, that is treated same
|
||||
* combination of case 1) and 2).
|
||||
* 4) If no call is present, and signaling IP change,
|
||||
* sipcc will re-register with new IP.
|
||||
*
|
||||
* @param handle - device handle
|
||||
* @param signaling_ip - IP address that Must be used for signalling
|
||||
* @param signaling_interface - Interface Name associaed with signaling IP
|
||||
* @param signaling_int_type - Interface type associaed with signaling IP
|
||||
* @param media_ip - IP address that Must be used for media
|
||||
* @param media_interface - Interface nmae associaed with media IP
|
||||
* @param media_interface - Interface Type associaed with media IP
|
||||
* @return void
|
||||
*/
|
||||
void CCAPI_Device_IP_Update (cc_device_handle_t handle,
|
||||
const char *signaling_ip,
|
||||
const char *signaling_interface,
|
||||
int signaling_int_type,
|
||||
const char *media_ip,
|
||||
const char *media_interface,
|
||||
int media_int_type)
|
||||
{
|
||||
static const char fname[] = "CCAPI_Device_IP_Update";
|
||||
char curr_signaling_ip[MAX_IPADDR_STR_LEN];
|
||||
char curr_media_ip[MAX_IPADDR_STR_LEN];
|
||||
cpr_ip_addr_t sig_ip;
|
||||
|
||||
signaling_interface_type = signaling_int_type;
|
||||
|
||||
// init the ip addr string to empty string
|
||||
init_empty_str(curr_signaling_ip);
|
||||
init_empty_str(curr_media_ip);
|
||||
init_empty_str(g_new_signaling_ip);
|
||||
|
||||
config_get_value(CFGID_MY_IP_ADDR, &sig_ip, sizeof(cpr_ip_addr_t));
|
||||
sig_ip.type = CPR_IP_ADDR_IPV4;
|
||||
util_ntohl(&sig_ip, &sig_ip);
|
||||
ipaddr2dotted(curr_signaling_ip, &sig_ip);
|
||||
|
||||
config_get_string(CFGID_MEDIA_IP_ADDR, curr_media_ip,
|
||||
MAX_IPADDR_STR_LEN);
|
||||
|
||||
DEF_DEBUG(DEB_F_PREFIX"New sig_ip=%s media_ip=%s Current: sig_ip: %s,"\
|
||||
"media_ip: %s \n",
|
||||
DEB_F_PREFIX_ARGS(CC_API, fname),
|
||||
signaling_ip,
|
||||
media_ip,
|
||||
curr_signaling_ip,
|
||||
curr_media_ip);
|
||||
|
||||
/*
|
||||
* If signaling and media IP are empty, stop the
|
||||
* SIP service and return;
|
||||
*/
|
||||
if ((is_empty_str((char *)signaling_ip) ||
|
||||
(strncmp(signaling_ip, "0.0.0.0", MAX_IPADDR_STR_LEN) == 0))
|
||||
&& (is_empty_str((char *)media_ip) ||
|
||||
(strncmp(media_ip, "0.0.0.0", MAX_IPADDR_STR_LEN) == 0))) {
|
||||
CC_Config_setStringValue(CFGID_MY_IP_ADDR, "0.0.0.0");
|
||||
CC_Config_setStringValue(CFGID_MEDIA_IP_ADDR, EMPTY_STR);
|
||||
DEF_DEBUG(DEB_F_PREFIX"Media and Signaling IP Not provided."\
|
||||
"Shutdown sip stack", DEB_F_PREFIX_ARGS(CC_API, fname));
|
||||
if ((strncmp(curr_signaling_ip, signaling_ip,
|
||||
MAX_IPADDR_STR_LEN) != 0)) {
|
||||
registration_processEvent(EV_CC_IP_INVALID);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* There is a change in the signaling IP, set the
|
||||
* new IP as the platform signaling IP and re-register
|
||||
*/
|
||||
if ((signaling_ip != NULL) &&
|
||||
(strncmp(curr_signaling_ip, signaling_ip, MAX_IPADDR_STR_LEN) != 0)) {
|
||||
CC_Config_setStringValue(CFGID_MY_IP_ADDR, signaling_ip);
|
||||
DEF_DEBUG(DEB_F_PREFIX"Signaling IP changed. Re-register, if needed.",
|
||||
DEB_F_PREFIX_ARGS(CC_API, fname));
|
||||
registration_processEvent(EV_CC_IP_VALID);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* There is a change in the media IP, set the
|
||||
* new IP as the platform media IP and post the call to GSM
|
||||
* to initiate re-inivite for all relevane calls
|
||||
*/
|
||||
if ((media_ip != NULL) &&
|
||||
(strncmp(curr_media_ip, media_ip, MAX_IPADDR_STR_LEN) != 0)) {
|
||||
CC_Config_setStringValue(CFGID_MEDIA_IP_ADDR, media_ip);
|
||||
if (g_dock_undock_event != MEDIA_INTERFACE_UPDATE_IN_PROCESS) {
|
||||
g_dock_undock_event = MEDIA_INTERFACE_UPDATE_STARTED;
|
||||
DEF_DEBUG(DEB_F_PREFIX" MEDIA_INTERFACE_UPDATE received. escalateDeescalate.",
|
||||
DEB_F_PREFIX_ARGS(CC_API, fname));
|
||||
escalateDeescalate();
|
||||
}else {
|
||||
DEF_DEBUG(DEB_F_PREFIX"MEDIA_INTERFACE_UPDATE received but escalateDeescalate already in progress:%d",
|
||||
DEB_F_PREFIX_ARGS(CC_API, fname), g_dock_undock_event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* CCAPI_Device_setVideoAutoTxPreference
|
||||
*
|
||||
* @param handle - device handle
|
||||
* @param txPref - TRUE=> auto Tx Video prefered
|
||||
* @return void
|
||||
*/
|
||||
void CCAPI_Device_setVideoAutoTxPreference (cc_device_handle_t handle, cc_boolean txPref)
|
||||
{
|
||||
CCAPP_DEBUG("CCAPI_Device_setVideoAutoTxPreference: updated to %d\n", txPref);
|
||||
cc_media_setVideoAutoTxPref(txPref);
|
||||
}
|
||||
|
||||
|
475
libs/sipcc/core/ccapp/ccapi_device_info.c
Normal file
475
libs/sipcc/core/ccapp/ccapi_device_info.c
Normal file
@ -0,0 +1,475 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "string_lib.h"
|
||||
#include "cc_constants.h"
|
||||
#include "ccapi_snapshot.h"
|
||||
#include "ccapi_device_info.h"
|
||||
#include "sessionHash.h"
|
||||
#include "CCProvider.h"
|
||||
#include "phone_debug.h"
|
||||
#include "ccapi_snapshot.h"
|
||||
#include "ccapi_device_info.h"
|
||||
#include "util_string.h"
|
||||
|
||||
|
||||
/**
|
||||
* gets the device name
|
||||
* @returns - a pointer to the device name
|
||||
*/
|
||||
cc_deviceinfo_ref_t CCAPI_DeviceInfo_getDeviceHandle ()
|
||||
{
|
||||
static const char *fname="CCAPI_DeviceInfo_getDeviceHandle";
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned 0 (default)\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the device name
|
||||
* @returns - a pointer to the device name
|
||||
*/
|
||||
cc_string_t CCAPI_DeviceInfo_getDeviceName (cc_deviceinfo_ref_t handle)
|
||||
{
|
||||
static const char *fname="CCAPI_DeviceInfo_getDeviceName";
|
||||
cc_device_info_t *device = handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( device != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), device->name);
|
||||
return device->name;
|
||||
}
|
||||
|
||||
return strlib_empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the device idle status
|
||||
* @param [in] handle - reference to device info
|
||||
* @returns boolean - idle status
|
||||
*/
|
||||
cc_boolean CCAPI_DeviceInfo_isPhoneIdle(cc_deviceinfo_ref_t handle)
|
||||
{
|
||||
static const char *fname="CCAPI_DeviceInfo_isPhoneIdle";
|
||||
boolean ret = TRUE;
|
||||
hashItr_t itr;
|
||||
session_data_t * session_data;
|
||||
cc_call_state_t call_state;
|
||||
|
||||
hashItrInit(&itr);
|
||||
|
||||
while ((session_data = hashItrNext(&itr)) != NULL) {
|
||||
call_state = session_data->state;
|
||||
if (call_state != ONHOOK &&
|
||||
call_state != REMINUSE) {
|
||||
ret = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"idle state=%d session_id=0x%x call-state=%d handle=%x\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), ret,
|
||||
(session_data != NULL)? session_data->sess_id: 0,
|
||||
(session_data != NULL)? session_data->state: 0,
|
||||
(handle)? handle:0);
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the service state
|
||||
* @param [in] handle - reference to device info
|
||||
* @returns cc_service_state_t - INS/OOS
|
||||
*/
|
||||
cc_service_state_t CCAPI_DeviceInfo_getServiceState (cc_deviceinfo_ref_t handle)
|
||||
{
|
||||
static const char *fname="CCAPI_DeviceInfo_getServiceState";
|
||||
cc_device_info_t *device = handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( device != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %02X\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), device->ins_state);
|
||||
return device->ins_state;
|
||||
}
|
||||
|
||||
return CC_STATE_IDLE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the service cause
|
||||
* @param [in] handle - reference to device info
|
||||
* @returns cc_service_cause_t - reason for service state
|
||||
*/
|
||||
cc_service_cause_t CCAPI_DeviceInfo_getServiceCause (cc_deviceinfo_ref_t handle)
|
||||
{
|
||||
static const char *fname="CCAPI_DeviceInfo_getServiceCause";
|
||||
cc_device_info_t *device = handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( device != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %02X\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), device->ins_cause);
|
||||
return device->ins_cause;
|
||||
}
|
||||
|
||||
return CC_CAUSE_NONE;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the cucm mode
|
||||
* @returns cc_cucm_mode_t - CUCM mode
|
||||
*/
|
||||
cc_cucm_mode_t CCAPI_DeviceInfo_getCUCMMode (cc_deviceinfo_ref_t handle)
|
||||
{
|
||||
static const char *fname="CCAPI_DeviceInfo_getCUCMMode";
|
||||
cc_device_info_t *device = handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( device != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %02X\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), device->cucm_mode);
|
||||
return device->cucm_mode;
|
||||
}
|
||||
|
||||
return CC_MODE_INVALID;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets list of handles to calls on the device
|
||||
* @param handle - device handle
|
||||
* @param handles - array of call handle to be returned
|
||||
* @param count[in/out] number allocated in array/elements returned
|
||||
* @returns
|
||||
*/
|
||||
void CCAPI_DeviceInfo_getCalls (cc_deviceinfo_ref_t handle, cc_call_handle_t handles[], cc_uint16_t *count)
|
||||
{
|
||||
static const char *fname="CCAPI_DeviceInfo_getCalls";
|
||||
hashItr_t itr;
|
||||
session_data_t *data;
|
||||
int i=0;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
hashItrInit(&itr);
|
||||
while ( (data = (session_data_t*)hashItrNext(&itr)) != NULL &&
|
||||
i<*count ) {
|
||||
handles[i++] = CREATE_CALL_HANDLE_FROM_SESSION_ID(data->sess_id);
|
||||
}
|
||||
*count=i;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Finished (no return) \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
}
|
||||
|
||||
/**
|
||||
* gets list of handles to calls on the device by State
|
||||
* @param handle - device handle
|
||||
* @param state - state for whcih calls are requested
|
||||
* @param handles - array of call handle to be returned
|
||||
* @param count[in/out] number allocated in array/elements returned
|
||||
* @returns
|
||||
*/
|
||||
void CCAPI_DeviceInfo_getCallsByState (cc_deviceinfo_ref_t handle, cc_call_state_t state,
|
||||
cc_call_handle_t handles[], cc_uint16_t *count)
|
||||
{
|
||||
static const char *fname="CCAPI_DeviceInfo_getCallsByState";
|
||||
hashItr_t itr;
|
||||
session_data_t *data;
|
||||
int i=0;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
hashItrInit(&itr);
|
||||
while ( (data = (session_data_t*)hashItrNext(&itr)) != NULL &&
|
||||
i<*count ) {
|
||||
if ( data->state == state ) {
|
||||
handles[i++] = CREATE_CALL_HANDLE_FROM_SESSION_ID(data->sess_id);
|
||||
}
|
||||
}
|
||||
*count=i;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Finished (no return) \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
}
|
||||
|
||||
/**
|
||||
* gets list of handles to lines on the device
|
||||
* @param handles[in,out] - array of line handle to be returned
|
||||
* @param count[in/out] number allocated in array/elements returned
|
||||
* @returns
|
||||
*/
|
||||
void CCAPI_DeviceInfo_getLines (cc_deviceinfo_ref_t handle, cc_lineid_t handles[], cc_uint16_t *count)
|
||||
{
|
||||
static const char *fname="CCAPI_DeviceInfo_getLines";
|
||||
cc_line_info_t *line;
|
||||
int i=1, j=0;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
CCAPP_DEBUG(" LINES Start ");
|
||||
|
||||
while ( (line = ccsnap_getLineInfo(i++)) != NULL &&
|
||||
j<*count ) {
|
||||
CCAPP_DEBUG(" LINE handle[%d]=%d", j, line->button );
|
||||
/* We will use button as line handles */
|
||||
handles[j++] = line->button;
|
||||
}
|
||||
*count=j;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Finished (no return) \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
}
|
||||
|
||||
/**
|
||||
* gets list of handles to features on the device
|
||||
* @param handles[in,out] - array of feature handle to be returned
|
||||
* @param count[in/out] number allocated in array/elements returned
|
||||
* @returns
|
||||
*/
|
||||
void CCAPI_DeviceInfo_getFeatures (cc_deviceinfo_ref_t handle, cc_featureinfo_ref_t handles[], cc_uint16_t *count)
|
||||
{
|
||||
static const char *fname="CCAPI_DeviceInfo_getFeatures";
|
||||
cc_featureinfo_ref_t feature;
|
||||
int i=0, j=0;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
for (i=1;i<=MAX_CONFIG_LINES && j<*count;i++) {
|
||||
feature = (cc_featureinfo_ref_t) ccsnap_getFeatureInfo(i);
|
||||
if(feature != NULL){
|
||||
handles[j++] = feature;
|
||||
}
|
||||
}
|
||||
*count=j;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Finished (no return) \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
}
|
||||
|
||||
/**
|
||||
* gets handles of call agent servers
|
||||
* @param handles - array of handles to call agent servers
|
||||
* @param count[in/out] number allocated in array/elements returned
|
||||
* @returns
|
||||
*/
|
||||
void CCAPI_DeviceInfo_getCallServers (cc_deviceinfo_ref_t handle, cc_callserver_ref_t handles[], cc_uint16_t *count)
|
||||
{
|
||||
static const char *fname="CCAPI_DeviceInfo_getCallServers";
|
||||
int i, j=0;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
for (i=0;i<CCAPI_MAX_SERVERS && i< *count; i++) {
|
||||
if (g_deviceInfo.ucm[i].name != 0 && strlen(g_deviceInfo.ucm[i].name)) {
|
||||
handles[j++] = &g_deviceInfo.ucm[i];
|
||||
}
|
||||
}
|
||||
*count = j;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Finished (no return) \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
}
|
||||
|
||||
/**
|
||||
* gets call server name
|
||||
* @param handle - handle of call server
|
||||
* @returns name of the call server
|
||||
* NOTE: The memory for the string will be freed once the device info reference is freed. No need to free this memory explicitly.
|
||||
*/
|
||||
cc_string_t CCAPI_DeviceInfo_getCallServerName (cc_callserver_ref_t handle)
|
||||
{
|
||||
static const char *fname="CCAPI_DeviceInfo_getCallServerName";
|
||||
cc_call_server_t *ref = (cc_call_server_t *) handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if (ref != NULL && ref->name != 0) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), ref->name);
|
||||
return ref->name;
|
||||
}
|
||||
return strlib_empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* gets call server mode
|
||||
* @param handle - handle of call server
|
||||
* @returns - mode of the call server
|
||||
*/
|
||||
cc_cucm_mode_t CCAPI_DeviceInfo_getCallServerMode (cc_callserver_ref_t handle)
|
||||
{
|
||||
static const char *fname="CCAPI_DeviceInfo_getCallServerMode";
|
||||
cc_call_server_t *ref = (cc_call_server_t *) handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if (ref != NULL) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %02X\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), ref->type);
|
||||
return ref->type;
|
||||
}
|
||||
|
||||
return CC_MODE_INVALID;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets calls erver name
|
||||
* @param handle - handle of call server
|
||||
* @returns status of the call server
|
||||
*/
|
||||
cc_ccm_status_t CCAPI_DeviceInfo_getCallServerStatus (cc_callserver_ref_t handle)
|
||||
{
|
||||
static const char *fname="CCAPI_DeviceInfo_getCallServerStatus";
|
||||
cc_call_server_t *ref = (cc_call_server_t *) handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if (ref != NULL) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %02X\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), (ref->status));
|
||||
return ref->status;
|
||||
}
|
||||
|
||||
return CC_CCM_STATUS_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the NOTIFICATION PROMPT
|
||||
* @param [in] handle - reference to device info
|
||||
* @returns
|
||||
*/
|
||||
cc_string_t CCAPI_DeviceInfo_getNotifyPrompt (cc_deviceinfo_ref_t handle)
|
||||
{
|
||||
static const char *fname="CCAPI_DeviceInfo_getNotifyPrompt";
|
||||
cc_device_info_t *ref = (cc_device_info_t *) handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if (ref != NULL) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %02X\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), (ref->not_prompt));
|
||||
return ref->not_prompt;
|
||||
}
|
||||
|
||||
return strlib_empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* get the NOTIFICATION PROMPT PRIORITY
|
||||
* @param [in] handle - reference to device info
|
||||
* @returns
|
||||
*/
|
||||
cc_uint32_t CCAPI_DeviceInfo_getNotifyPromptPriority (cc_deviceinfo_ref_t handle)
|
||||
{
|
||||
static const char *fname="CCAPI_DeviceInfo_getNotifyPromptPriority";
|
||||
cc_device_info_t *ref = (cc_device_info_t *) handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if (ref != NULL) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %02X\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), (ref->not_prompt_prio));
|
||||
return ref->not_prompt_prio;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the NOTIFICATION PROMPT PROGRESS
|
||||
* @param [in] handle - reference to device info
|
||||
* @returns
|
||||
*/
|
||||
cc_uint32_t CCAPI_DeviceInfo_getNotifyPromptProgress (cc_deviceinfo_ref_t handle)
|
||||
{
|
||||
static const char *fname="CCAPI_DeviceInfo_getNotifyPromptProgress";
|
||||
cc_device_info_t *ref = (cc_device_info_t *) handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if (ref != NULL) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %02X\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), (ref->not_prompt_prog));
|
||||
return ref->not_prompt_prog;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets provisioing for missed call logging
|
||||
* @param [in] handle - reference to device info
|
||||
* @returns boolean - false => disabled true => enabled
|
||||
*/
|
||||
cc_boolean CCAPI_DeviceInfo_isMissedCallLoggingEnabled (cc_deviceinfo_ref_t handle)
|
||||
{
|
||||
static const char *fname="CCAPI_DeviceInfo_isMissedCallLoggingEnabled";
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX" return val %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), ccsnap_isMissedCallLoggingEnabled());
|
||||
return ccsnap_isMissedCallLoggingEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* gets provisioing for placed call logging
|
||||
* @param [in] handle - reference to device info
|
||||
* @returns boolean - false => disabled true => enabled
|
||||
*/
|
||||
cc_boolean CCAPI_DeviceInfo_isPlacedCallLoggingEnabled (cc_deviceinfo_ref_t handle)
|
||||
{
|
||||
static const char *fname="CCAPI_DeviceInfo_isPlacedCallLoggingEnabled";
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX" return val %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), ccsnap_isPlacedCallLoggingEnabled());
|
||||
return ccsnap_isPlacedCallLoggingEnabled();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gets provisioing for received call logging
|
||||
* @param [in] handle - reference to device info
|
||||
* @returns boolean - false => disabled true => enabled
|
||||
*/
|
||||
cc_boolean CCAPI_DeviceInfo_isReceivedCallLoggingEnabled (cc_deviceinfo_ref_t handle)
|
||||
{
|
||||
static const char *fname="CCAPI_DeviceInfo_isReceivedCallLoggingEnabled";
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX" return val %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), ccsnap_isReceivedCallLoggingEnabled());
|
||||
return ccsnap_isReceivedCallLoggingEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* gets time registration completed successfully
|
||||
* @param [in] handle - reference to device info
|
||||
* @returns long - the time registration completed successfully
|
||||
*/
|
||||
long long CCAPI_DeviceInfo_getRegTime (cc_deviceinfo_ref_t handle)
|
||||
{
|
||||
return (g_deviceInfo.reg_time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns dot notation IP address phone used for registration purpose. If phone is not
|
||||
* registered, then "0.0.0.0" is returned.
|
||||
* @return char IP address used to register phone.
|
||||
*/
|
||||
cc_string_t CCAPI_DeviceInfo_getSignalingIPAddress(cc_deviceinfo_ref_t handle)
|
||||
{
|
||||
static const char *fname="CCAPI_DeviceInfo_getSignalingIPAddress";
|
||||
cpr_ip_addr_t ip_addr = {0,{0}};
|
||||
|
||||
sip_config_get_net_device_ipaddr(&ip_addr);
|
||||
ipaddr2dotted(g_deviceInfo.registration_ip_addr, &ip_addr);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), g_deviceInfo.registration_ip_addr);
|
||||
return g_deviceInfo.registration_ip_addr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns camera admin enable/disable status
|
||||
* @param [in] handle - reference to device info
|
||||
* @return cc_boolean - TRUE => enabled
|
||||
*/
|
||||
cc_boolean CCAPI_DeviceInfo_isCameraEnabled(cc_deviceinfo_ref_t handle) {
|
||||
// returns the current status not the snapshot status
|
||||
return cc_media_isTxCapEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Video Capability admin enable/disable status
|
||||
* @param [in] handle - reference to device info
|
||||
* @return cc_boolean - TRUE => enabled
|
||||
*/
|
||||
cc_boolean CCAPI_DeviceInfo_isVideoCapEnabled(cc_deviceinfo_ref_t handle) {
|
||||
// returns the current status not the snapshot status
|
||||
return cc_media_isVideoCapEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the device mwi_lamp state
|
||||
* @param [in] handle - reference to device info
|
||||
* @returns boolean - mwi_lamp state
|
||||
*/
|
||||
cc_boolean CCAPI_DeviceInfo_getMWILampState(cc_deviceinfo_ref_t handle)
|
||||
{
|
||||
static const char *fname="CCAPI_DeviceInfo_getMWILampState";
|
||||
cc_device_info_t *device = handle;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( device != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), device->mwi_lamp);
|
||||
return device->mwi_lamp;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
154
libs/sipcc/core/ccapp/ccapi_feature_info.c
Normal file
154
libs/sipcc/core/ccapp/ccapi_feature_info.c
Normal file
@ -0,0 +1,154 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "ccapi_snapshot.h"
|
||||
#include "sessionHash.h"
|
||||
#include "CCProvider.h"
|
||||
#include "phone_debug.h"
|
||||
|
||||
/**
|
||||
* Get the physical button number on which this feature is configured
|
||||
* @param feature - feature reference handle
|
||||
* @return cc_int32_t - button assigned to the feature
|
||||
*/
|
||||
cc_int32_t CCAPI_featureInfo_getButton(cc_featureinfo_ref_t feature)
|
||||
{
|
||||
static const char *fname="CCAPI_featureInfo_getButton";
|
||||
cc_feature_info_t *info;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
info = (cc_feature_info_t *) feature;
|
||||
if ( info != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->button);
|
||||
return info->button;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the featureID
|
||||
* @param feature - feature reference handle
|
||||
* @return cc_int32_t - type of to the feature
|
||||
*/
|
||||
cc_int32_t CCAPI_featureInfo_getFeatureID(cc_featureinfo_ref_t feature)
|
||||
{
|
||||
static const char *fname="CCAPI_featureInfo_getFeatureID";
|
||||
cc_feature_info_t *info;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
info = (cc_feature_info_t *) feature;
|
||||
if ( info != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->feature_id);
|
||||
return info->feature_id;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the feature Label Name
|
||||
* @param feature - feature reference handle
|
||||
* @return cc_string_t - name of the feature created
|
||||
*/
|
||||
cc_string_t CCAPI_featureInfo_getDisplayName(cc_featureinfo_ref_t feature) {
|
||||
static const char *fname="CCAPI_featureInfo_getDisplayName";
|
||||
cc_feature_info_t *info;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
info = (cc_feature_info_t *) feature;
|
||||
if ( info != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->name);
|
||||
return ccsnap_get_line_label(info->button);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the speeddial Number
|
||||
* @param feature - feature reference handle
|
||||
* @return cc_string_t - speeddial number of the feature created
|
||||
*/
|
||||
cc_string_t CCAPI_featureInfo_getSpeedDialNumber(cc_featureinfo_ref_t feature) {
|
||||
static const char *fname="CCAPI_featureInfo_getSpeedDialNumber";
|
||||
cc_feature_info_t *info;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
info = (cc_feature_info_t *) feature;
|
||||
if ( info != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->speedDialNumber);
|
||||
return info->speedDialNumber;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the contact
|
||||
* @param feature - feature reference handle
|
||||
* @return cc_string_t - contact of the feature created
|
||||
*/
|
||||
cc_string_t CCAPI_featureInfo_getContact(cc_featureinfo_ref_t feature) {
|
||||
static const char *fname="CCAPI_featureInfo_getContact";
|
||||
cc_feature_info_t *info;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
info = (cc_feature_info_t *) feature;
|
||||
if ( info != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->contact);
|
||||
return info->contact;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the retrieval prefix
|
||||
* @param feature - feature reference handle
|
||||
* @return cc_string_t - retrieval prefix of the feature created
|
||||
*/
|
||||
cc_string_t CCAPI_featureInfo_getRetrievalPrefix(cc_featureinfo_ref_t feature) {
|
||||
static const char *fname="CCAPI_featureInfo_getRetrievalPrefix";
|
||||
cc_feature_info_t *info;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
info = (cc_feature_info_t *) feature;
|
||||
if ( info != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->retrievalPrefix);
|
||||
return info->retrievalPrefix;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get BLF state
|
||||
* @param feature - feature reference handle
|
||||
* @return cc_string_t - handle of the feature created
|
||||
*/
|
||||
cc_blf_state_t CCAPI_featureInfo_getBLFState(cc_featureinfo_ref_t feature) {
|
||||
static const char *fname="CCAPI_featureInfo_getBLFState";
|
||||
cc_feature_info_t *info = (cc_feature_info_t *)feature;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( info != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->blf_state);
|
||||
return info->blf_state;
|
||||
}
|
||||
return CC_SIP_BLF_UNKNOWN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the feature option mask
|
||||
* @param feature - feature reference handle
|
||||
* @return cc_int32_t - feature option mask for the feature
|
||||
*/
|
||||
cc_int32_t CCAPI_featureInfo_getFeatureOptionMask(cc_featureinfo_ref_t feature)
|
||||
{
|
||||
static const char *fname="CCAPI_featureInfo_getFeatureOptionMask";
|
||||
cc_feature_info_t *info;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
info = (cc_feature_info_t *) feature;
|
||||
if ( info != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->featureOptionMask);
|
||||
return info->featureOptionMask;
|
||||
}
|
||||
return -1;
|
||||
}
|
81
libs/sipcc/core/ccapp/ccapi_line.c
Normal file
81
libs/sipcc/core/ccapp/ccapi_line.c
Normal file
@ -0,0 +1,81 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "cpr_stdlib.h"
|
||||
#include "string_lib.h"
|
||||
#include "cc_call_feature.h"
|
||||
#include "ccapi_snapshot.h"
|
||||
#include "ccapi_line.h"
|
||||
|
||||
extern cc_line_info_t lineInfo[MAX_CONFIG_LINES+1];
|
||||
|
||||
/**
|
||||
* Get reference handle for the line
|
||||
* @return cc_call_handle_t - handle of the call created
|
||||
*/
|
||||
cc_lineinfo_ref_t CCAPI_Line_getLineInfo(cc_uint32_t lineID)
|
||||
{
|
||||
cc_line_info_t *line_info = NULL;
|
||||
int i;
|
||||
|
||||
for (i=1;i<=MAX_CONFIG_LINES;i++) {
|
||||
if ( (cc_uint32_t)lineInfo[i].button == lineID ) {
|
||||
line_info = (cc_line_info_t*)cpr_malloc(sizeof(cc_line_info_t));
|
||||
|
||||
if (line_info) {
|
||||
*line_info = lineInfo[i];
|
||||
line_info->ref_count = 1;
|
||||
line_info->name = strlib_copy(lineInfo[i].name);
|
||||
line_info->dn = strlib_copy(lineInfo[i].dn);
|
||||
line_info->cfwd_dest = strlib_copy(lineInfo[i].cfwd_dest);
|
||||
line_info->externalNumber =
|
||||
strlib_copy(lineInfo[i].externalNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
return line_info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a call on the line
|
||||
* @param [in] line - lineID
|
||||
* @return cc_call_handle_t - handle of the call created
|
||||
*/
|
||||
cc_call_handle_t CCAPI_Line_CreateCall(cc_lineid_t line)
|
||||
{
|
||||
// do we need to check the line on which this gets created?
|
||||
return CC_createCall(line);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reatin the lineInfo snapshot
|
||||
* @param cc_callinfo_ref_t - refrence to the block to be retained
|
||||
* @return void
|
||||
*/
|
||||
void CCAPI_Line_retainLineInfo(cc_lineinfo_ref_t ref){
|
||||
cc_line_info_t *line_info = ref;
|
||||
|
||||
line_info->ref_count++;
|
||||
}
|
||||
/**
|
||||
* Free the lineInfo snapshot
|
||||
* @param cc_callinfo_ref_t - refrence to the block to be freed
|
||||
* @return void
|
||||
*/
|
||||
void CCAPI_Line_releaseLineInfo(cc_lineinfo_ref_t ref){
|
||||
cc_line_info_t *line_info = ref;
|
||||
|
||||
if (line_info) {
|
||||
line_info->ref_count--;
|
||||
if ( line_info->ref_count == 0) {
|
||||
strlib_free(line_info->name);
|
||||
strlib_free(line_info->dn);
|
||||
strlib_free(line_info->cfwd_dest);
|
||||
strlib_free(line_info->externalNumber);
|
||||
cpr_free(line_info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
425
libs/sipcc/core/ccapp/ccapi_line_info.c
Normal file
425
libs/sipcc/core/ccapp/ccapi_line_info.c
Normal file
@ -0,0 +1,425 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "ccapi_snapshot.h"
|
||||
#include "ccapi_line.h"
|
||||
#include "sessionHash.h"
|
||||
#include "CCProvider.h"
|
||||
#include "phone_debug.h"
|
||||
|
||||
/**
|
||||
* Get the line ID
|
||||
* @param line - line reference handle
|
||||
* @return line ID
|
||||
*/
|
||||
cc_int32_t CCAPI_lineInfo_getID(cc_lineinfo_ref_t line)
|
||||
{
|
||||
static const char *fname="CCAPI_lineInfo_getID";
|
||||
cc_line_info_t *info = (cc_line_info_t *) line;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
/* We will use button as line ID */
|
||||
if ( info != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->button);
|
||||
return info->button;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the line Name
|
||||
* @param line - line reference handle
|
||||
* @return cc_string_t - handle of the call created
|
||||
*/
|
||||
cc_string_t CCAPI_lineInfo_getName(cc_lineinfo_ref_t line) {
|
||||
static const char *fname="CCAPI_lineInfo_getName";
|
||||
cc_line_info_t *info = (cc_line_info_t *) line;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( info != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->dn);
|
||||
return info->dn;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the line Label
|
||||
* @param [in] line - line reference handle
|
||||
* @return cc_string_t - line Label
|
||||
* NOTE: The memory for return string doesn't need to be freed it will be freed when the info reference is freed
|
||||
*/
|
||||
cc_string_t CCAPI_lineInfo_getLabel(cc_lineinfo_ref_t line) {
|
||||
static const char *fname="CCAPI_lineInfo_getLabel";
|
||||
cc_line_info_t *info = (cc_line_info_t *) line;
|
||||
cc_string_t label = strlib_empty();
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( info != NULL ) {
|
||||
label = ccsnap_get_line_label(info->button);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), label);
|
||||
}
|
||||
return label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the line DN Number
|
||||
* @param line - line reference handle
|
||||
* @return cc_string_t - handle of the call created
|
||||
*/
|
||||
cc_string_t CCAPI_lineInfo_getNumber(cc_lineinfo_ref_t line) {
|
||||
static const char *fname="CCAPI_lineInfo_getNumber";
|
||||
cc_line_info_t *info = (cc_line_info_t *) line;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( info != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->name);
|
||||
return info->name;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the line External Number
|
||||
* @param line - line reference handle
|
||||
* @return cc_string_t - handle of the call created
|
||||
*/
|
||||
cc_string_t CCAPI_lineInfo_getExternalNumber(cc_lineinfo_ref_t line) {
|
||||
static const char *fname="CCAPI_lineInfo_getExternalNumber";
|
||||
cc_line_info_t *info = (cc_line_info_t *) line;
|
||||
char externalNumberMask[MAX_EXTERNAL_NUMBER_MASK_SIZE];
|
||||
memset(externalNumberMask, 0, sizeof(externalNumberMask));
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
config_get_string(CFGID_CCM_EXTERNAL_NUMBER_MASK, externalNumberMask, MAX_EXTERNAL_NUMBER_MASK_SIZE);
|
||||
if ( info != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->name);
|
||||
if (strlen(externalNumberMask) > 0) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"number with mask applied == %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->externalNumber);
|
||||
return info->externalNumber;
|
||||
} else {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"number without mask == %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->name);
|
||||
return info->name;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the physical button number on which this line is configured
|
||||
* @param line - line reference handle
|
||||
* @return cc_uint32_t - button number
|
||||
*/
|
||||
cc_uint32_t CCAPI_lineInfo_getButton(cc_lineinfo_ref_t line){
|
||||
static const char *fname="CCAPI_lineInfo_getButton";
|
||||
cc_line_info_t *info = (cc_line_info_t *) line;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( info != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->button);
|
||||
return info->button;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Line Type
|
||||
* @param [in] line - line reference handle
|
||||
* @return cc_uint32_t - line featureID ( Line )
|
||||
*/
|
||||
cc_line_feature_t CCAPI_lineInfo_getLineType(cc_lineinfo_ref_t line){
|
||||
static const char *fname="CCAPI_lineInfo_getLineType";
|
||||
cc_line_info_t *info = (cc_line_info_t *) line;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( info != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->line_type);
|
||||
return info->line_type;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the CFWDAll status for the line
|
||||
* @param line - line reference handle
|
||||
* @return cc_boolean - isForwarded
|
||||
*/
|
||||
cc_boolean CCAPI_lineInfo_isCFWDActive(cc_lineinfo_ref_t line)
|
||||
{
|
||||
static const char *fname="CCAPI_lineInfo_isCFWDActive";
|
||||
cc_line_info_t *info = (cc_line_info_t *) line;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( info != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->isCFWD);
|
||||
return info->isCFWD;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the CFWDAll destination
|
||||
* @param line - line reference handle
|
||||
* @return cc_string_t - cfwd target
|
||||
*/
|
||||
cc_string_t CCAPI_lineInfo_getCFWDName(cc_lineinfo_ref_t line)
|
||||
{
|
||||
static const char *fname="CCAPI_lineInfo_getCFWDName";
|
||||
cc_line_info_t *info = (cc_line_info_t *) line;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( info != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->cfwd_dest);
|
||||
return info->cfwd_dest;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the MWI Status
|
||||
* @param line - line reference handle
|
||||
* @return cc_uint32_t - MWI status (boolean 0 => no MWI)
|
||||
*/
|
||||
cc_uint32_t CCAPI_lineInfo_getMWIStatus(cc_lineinfo_ref_t line)
|
||||
{
|
||||
static const char *fname="CCAPI_lineInfo_getMWIStatus";
|
||||
cc_line_info_t *info = (cc_line_info_t *) line;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( info != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %d, status %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->mwi, info->mwi.status);
|
||||
return info->mwi.status;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the MWI Type
|
||||
* @param line - line reference handle
|
||||
* @return cc_uint32_t - MWI Type
|
||||
*/
|
||||
cc_uint32_t CCAPI_lineInfo_getMWIType(cc_lineinfo_ref_t line)
|
||||
{
|
||||
static const char *fname="CCAPI_lineInfo_getMWIType";
|
||||
cc_line_info_t *info = (cc_line_info_t *) line;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( info != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %d, type %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->mwi, info->mwi.type);
|
||||
return info->mwi.type;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the MWI new msg count
|
||||
* @param line - line reference handle
|
||||
* @return cc_uint32_t - MWI new msg count
|
||||
*/
|
||||
cc_uint32_t CCAPI_lineInfo_getMWINewMsgCount(cc_lineinfo_ref_t line)
|
||||
{
|
||||
static const char *fname="CCAPI_lineInfo_getMWINewMsgCount";
|
||||
cc_line_info_t *info = (cc_line_info_t *) line;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( info != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %d, new count %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->mwi, info->mwi.new_count);
|
||||
return info->mwi.new_count;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* Get the MWI old msg count
|
||||
* @param line - line reference handle
|
||||
* @return cc_uint32_t - MWI old msg count
|
||||
*/
|
||||
cc_uint32_t CCAPI_lineInfo_getMWIOldMsgCount(cc_lineinfo_ref_t line)
|
||||
{
|
||||
static const char *fname="CCAPI_lineInfo_getMWIOldMsgCount";
|
||||
cc_line_info_t *info = (cc_line_info_t *) line;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( info != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %d, old_count %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->mwi, info->mwi.old_count);
|
||||
return info->mwi.old_count;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the MWI high priority new msg count
|
||||
* @param line - line reference handle
|
||||
* @return cc_uint32_t - MWI new msg count
|
||||
*/
|
||||
cc_uint32_t CCAPI_lineInfo_getMWIPrioNewMsgCount(cc_lineinfo_ref_t line)
|
||||
{
|
||||
static const char *fname="CCAPI_lineInfo_getMWIPrioNewMsgCount";
|
||||
cc_line_info_t *info = (cc_line_info_t *) line;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( info != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %d , pri_new count %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->mwi, info->mwi.pri_new_count);
|
||||
return info->mwi.pri_new_count;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* Get the MWI high priority old msg count
|
||||
* @param line - line reference handle
|
||||
* @return cc_uint32_t - MWI old msg count
|
||||
*/
|
||||
cc_uint32_t CCAPI_lineInfo_getMWIPrioOldMsgCount(cc_lineinfo_ref_t line)
|
||||
{
|
||||
static const char *fname="CCAPI_lineInfo_getMWIPrioOldMsgCount";
|
||||
cc_line_info_t *info = (cc_line_info_t *) line;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( info != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %d, pri old_count %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->mwi, info->mwi.pri_old_count);
|
||||
return info->mwi.pri_old_count;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get calls on line
|
||||
* @param [in] line - lineID
|
||||
* @param [out] callref[] - Array of callinfo references
|
||||
* @param [in/out] count - count of call references populated
|
||||
* @return void
|
||||
*/
|
||||
|
||||
void CCAPI_LineInfo_getCalls(cc_lineid_t line, cc_call_handle_t handles[], int *count)
|
||||
{
|
||||
static const char *fname="CCAPI_Line_getCalls";
|
||||
hashItr_t itr;
|
||||
session_data_t *data;
|
||||
int i=0;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
hashItrInit(&itr);
|
||||
while ( (data = (session_data_t*)hashItrNext(&itr)) != NULL &&
|
||||
i<*count ) {
|
||||
if ( GET_LINE_ID(data->sess_id) == line ){
|
||||
handles[i++] = CREATE_CALL_HANDLE_FROM_SESSION_ID(data->sess_id);
|
||||
}
|
||||
}
|
||||
*count=i;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Finished (no return) \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get calls on line
|
||||
* @param [in] line - lineID
|
||||
* @param [out] callref[] - Array of callinfo references
|
||||
* @param [in/out] count - count of call references populated
|
||||
* @return void
|
||||
*/
|
||||
void CCAPI_LineInfo_getCallsByState(cc_lineid_t line, cc_call_state_t state,
|
||||
cc_call_handle_t handles[], int *count)
|
||||
{
|
||||
static const char *fname="CCAPI_Line_getCallsByState";
|
||||
hashItr_t itr;
|
||||
session_data_t *data;
|
||||
int i=0;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
hashItrInit(&itr);
|
||||
while ( (data = (session_data_t*)hashItrNext(&itr)) != NULL &&
|
||||
i<*count ) {
|
||||
if ( GET_LINE_ID(data->sess_id) == line && data->state ==state ){
|
||||
handles[i++] = CREATE_CALL_HANDLE_FROM_SESSION_ID(data->sess_id);
|
||||
}
|
||||
}
|
||||
*count=i;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Finished (no return) \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the physical button number on which this line is configured
|
||||
* @param [in] line - line reference handle
|
||||
* @return cc_uint32_t - button number
|
||||
*/
|
||||
cc_boolean CCAPI_lineInfo_getRegState(cc_lineinfo_ref_t line)
|
||||
{
|
||||
static const char *fname="CCAPI_lineInfo_getRegState";
|
||||
cc_line_info_t *info = (cc_line_info_t *) line;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( info != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->reg_state);
|
||||
return info->reg_state;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* has capability - is the feature allowed
|
||||
* @param [in] line - line reference handle
|
||||
* @param [in] feat_id - feature id
|
||||
* @return boolean - is Allowed
|
||||
*/
|
||||
cc_boolean CCAPI_LineInfo_hasCapability (cc_lineinfo_ref_t line, cc_int32_t feat_id){
|
||||
static const char *fname="CCAPI_LineInfo_hasCapability";
|
||||
cc_line_info_t *info = (cc_line_info_t *) line;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( info != NULL){
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"feature id: %d , value returned %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname),feat_id, info->allowed_features[feat_id]);
|
||||
return info->allowed_features[feat_id];
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get Allowed Feature set
|
||||
* @param [in] line - line reference handle
|
||||
* @param [in,out] feat_set - array of len CC_CALL_CAP_MAX
|
||||
* @return cc_return_t - CC_SUCCESS or CC_FAILURE
|
||||
*/
|
||||
cc_return_t CCAPI_LineInfo_getCapabilitySet (cc_lineinfo_ref_t line, cc_int32_t feat_set[]){
|
||||
static const char *fname="CCAPI_LineInfo_getCapabilitySet";
|
||||
cc_line_info_t *info = (cc_line_info_t *) line;
|
||||
int feat_id;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
if ( info != NULL){
|
||||
for (feat_id = 0; feat_id < CCAPI_CALL_CAP_MAX; feat_id++) {
|
||||
feat_set[feat_id] = info->allowed_features[feat_id];
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"feature id: %d , value %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname),feat_id, feat_set[feat_id]);
|
||||
}
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"returned CC_SUCCESS\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
return CC_SUCCESS;
|
||||
}
|
||||
|
||||
return CC_FAILURE;
|
||||
}
|
||||
|
||||
|
166
libs/sipcc/core/ccapp/ccapi_service.c
Normal file
166
libs/sipcc/core/ccapp/ccapi_service.c
Normal file
@ -0,0 +1,166 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "ccapi_service.h"
|
||||
#include "cc_device_manager.h"
|
||||
#include "cc_service.h"
|
||||
#include "phone_debug.h"
|
||||
#include "CCProvider.h"
|
||||
#include "sessionConstants.h"
|
||||
#include "ccsip_messaging.h"
|
||||
#include "ccapp_task.h"
|
||||
#include "config_api.h"
|
||||
#include "ccapi_device.h"
|
||||
#include "ccapi_device_info.h"
|
||||
#include "cc_device_listener.h"
|
||||
#include "cc_service_listener.h"
|
||||
#include "plat_api.h"
|
||||
#include "util_string.h"
|
||||
|
||||
int sendResetUpdates = 0; // default is not to send updates
|
||||
|
||||
// Global Variables
|
||||
int g_dev_hdl;
|
||||
char g_dev_name[G_DEV_NAME_SIZE];
|
||||
char g_cfg_p[G_CFG_P_SIZE];
|
||||
int g_compl_cfg;
|
||||
|
||||
// Externs
|
||||
extern void setState();
|
||||
extern void resetReady();
|
||||
extern void resetNotReady();
|
||||
extern void ccpro_handleserviceControlNotify();
|
||||
|
||||
|
||||
extern cc_srv_ctrl_cmd_t reset_type;
|
||||
boolean isServiceStartRequestPending = FALSE;
|
||||
cc_boolean is_action_to_be_deferred(cc_action_t action);
|
||||
extern cc_action_t pending_action_type;
|
||||
//cc_boolean parse_config_properties (int device_handle, const char *device_name, const char *cfg, int from_memory);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Defines the management methods.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Pre-initialize the Sipcc stack.
|
||||
* @return
|
||||
*/
|
||||
cc_return_t CCAPI_Service_create() {
|
||||
CCAPP_ERROR("CCAPI_Service_create - calling CC_Service_create \n");
|
||||
|
||||
registration_processEvent(EV_CC_CREATE);
|
||||
return (CC_SUCCESS);
|
||||
//return (service_processEvent(EV_SRVC_CREATE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gracefully unload the Sipcc stack
|
||||
* @return
|
||||
*/
|
||||
cc_return_t CCAPI_Service_destroy() {
|
||||
CCAPP_ERROR("CCAPI_Service_destroy - calling CC_Service_destroy \n");
|
||||
|
||||
// if (is_action_to_be_deferred(STOP_ACTION) == TRUE) {
|
||||
// return CC_SUCCESS;
|
||||
// }
|
||||
// initialize the config to empty
|
||||
init_empty_str(g_cfg_p);
|
||||
isServiceStartRequestPending = FALSE;
|
||||
registration_processEvent(EV_CC_DESTROY);
|
||||
return (CC_SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bring up the Sipcc stack in service
|
||||
* @return
|
||||
*/
|
||||
cc_return_t CCAPI_Service_start() {
|
||||
|
||||
if (isServiceStartRequestPending == TRUE) {
|
||||
DEF_DEBUG("CCAPI_Service_start request is already pending. Ignoring this.\n");
|
||||
return CC_SUCCESS;
|
||||
}
|
||||
|
||||
DEF_DEBUG("CCAPI_Service_start - \n");
|
||||
isServiceStartRequestPending = TRUE;
|
||||
|
||||
registration_processEvent(EV_CC_START);
|
||||
|
||||
return (CC_SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop Sipcc stack service
|
||||
* @return
|
||||
*/
|
||||
cc_return_t CCAPI_Service_stop() {
|
||||
|
||||
int sdpmode = 0;
|
||||
|
||||
CCAPP_ERROR("CCAPI_Service_stop - calling registration stop \n");
|
||||
|
||||
config_get_value(CFGID_SDPMODE, &sdpmode, sizeof(sdpmode));
|
||||
if (!sdpmode) {
|
||||
if (is_action_to_be_deferred(STOP_ACTION) == TRUE) {
|
||||
return CC_SUCCESS;
|
||||
}
|
||||
}
|
||||
sendResetUpdates = 0; // reset to default is not to send updates
|
||||
isServiceStartRequestPending = FALSE;
|
||||
registration_processEvent(EV_CC_STOP);
|
||||
return CC_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* reregister the Sipcc stack service, without downloading the config file
|
||||
*
|
||||
*/
|
||||
cc_return_t CCAPI_Service_reregister(int device_handle, const char *device_name,
|
||||
const char *cfg,
|
||||
int complete_config)
|
||||
{
|
||||
CCAPP_ERROR("CCAPI_Service_reregister - initiate reregister \n");
|
||||
|
||||
if (is_action_to_be_deferred(RE_REGISTER_ACTION) == TRUE) {
|
||||
return CC_SUCCESS;
|
||||
}
|
||||
if (pending_action_type != NO_ACTION) {
|
||||
CCAPP_ERROR("Reset/Restart is pending, reregister Ignored! \n");
|
||||
return CC_FAILURE;
|
||||
}
|
||||
|
||||
if (is_empty_str((char*)cfg)) {
|
||||
CCAPP_ERROR("Reregister request with empty config. Exiting.\n");
|
||||
return CC_FAILURE;
|
||||
}
|
||||
|
||||
g_dev_hdl = device_handle;
|
||||
sstrncpy(g_dev_name, device_name, sizeof(g_dev_name));
|
||||
sstrncpy(g_cfg_p, cfg, sizeof(g_cfg_p));
|
||||
CCAPP_DEBUG("CCAPI_Service_reregister - devce name [%s], cfg [%s] \n", g_dev_name, g_cfg_p);
|
||||
g_compl_cfg = complete_config;
|
||||
|
||||
registration_processEvent(EV_CC_RE_REGISTER);
|
||||
|
||||
return (CC_SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset Manager has request a reset, send the current state and
|
||||
* start sending updates.
|
||||
*/
|
||||
void CCAPI_Service_reset_request() {
|
||||
cc_deviceinfo_ref_t handle = 0;
|
||||
sendResetUpdates = 1;
|
||||
if (CCAPI_DeviceInfo_isPhoneIdle(handle) == TRUE) {
|
||||
resetReady();
|
||||
} else {
|
||||
resetNotReady();
|
||||
}
|
||||
|
||||
}
|
715
libs/sipcc/core/ccapp/ccapi_snapshot.c
Normal file
715
libs/sipcc/core/ccapp/ccapi_snapshot.c
Normal file
@ -0,0 +1,715 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "string.h"
|
||||
#include "string_lib.h"
|
||||
#include "text_strings.h"
|
||||
#include "ccapi_snapshot.h"
|
||||
#include "ccapi_device.h"
|
||||
#include "ccapi_device_listener.h"
|
||||
#include "ccapi_line.h"
|
||||
#include "ccapi_line_listener.h"
|
||||
#include "ccapi_line_info.h"
|
||||
#include "ccapi_call.h"
|
||||
#include "ccapi_call_listener.h"
|
||||
#include "CCProvider.h"
|
||||
#include "capability_set.h"
|
||||
#include "phone_debug.h"
|
||||
|
||||
cc_device_info_t g_deviceInfo;
|
||||
accessory_cfg_info_t g_accessoryCfgInfo;
|
||||
cc_line_info_t lineInfo[MAX_CONFIG_LINES+1];
|
||||
cc_feature_info_t featureInfo[MAX_CONFIG_LINES+1];
|
||||
|
||||
static void printCallInfo(cc_callinfo_ref_t info, const char* fname);
|
||||
static void printFeatureInfo (ccapi_device_event_e type, cc_featureinfo_ref_t feature_info, const char* fname);
|
||||
|
||||
cc_string_t lineLabels[MAX_CONFIG_LINES+1] = {0};
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
cc_string_t ccsnap_get_line_label(int btn) {
|
||||
if ( btn > 0 && btn <= MAX_CONFIG_LINES+1 ) {
|
||||
return lineLabels[btn];
|
||||
}
|
||||
return strlib_empty();
|
||||
}
|
||||
|
||||
/*
|
||||
* The below two functions are borrowed from CUCM/CUP as they both perform
|
||||
* identical functions. That is, taking a DN 1555 and
|
||||
* a mask 919476XXXX to build a true external number 9194761555.
|
||||
*/
|
||||
static void stringInsert(char *string, int num, char ch)
|
||||
{
|
||||
|
||||
int len = strlen(string);
|
||||
int k, j;
|
||||
char tempString[100];
|
||||
sstrncpy(tempString, string, 100);
|
||||
|
||||
for (k = 0; k < num; k++)
|
||||
string[k] = ch;
|
||||
|
||||
for (j = 0; j < len; j++)
|
||||
string[k++] = tempString[j];
|
||||
|
||||
string[k] = 0;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Taken from CUCM/CUP code as they have done this already.
|
||||
*/
|
||||
cc_string_t CCAPI_ApplyTranslationMask (const char *ext, const char *mask)
|
||||
{
|
||||
|
||||
char translationMask[100] = {'\0'};
|
||||
char dn[100] = {'\0'};
|
||||
char translatedString[100] = {'\0'};
|
||||
cc_string_t result;
|
||||
unsigned int maskLen,
|
||||
dnLen,
|
||||
i, j = 0;
|
||||
|
||||
if ((ext == NULL) || (mask == NULL)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
maskLen = strlen(mask);
|
||||
dnLen = strlen(ext);
|
||||
|
||||
if ((dnLen == 0) || (maskLen == 0)) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"CCAPI_ApplyTranslationMask DN or mask has len=0\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI_ApplyTranslationMask"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* make sure there's enough space in the buffer to
|
||||
* hold the translated string.
|
||||
*/
|
||||
if (dnLen + maskLen > 99) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"CCAPI_ApplyTranslationMask length overflow\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI_ApplyTranslationMask"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sstrncpy(translationMask, mask, 100);
|
||||
sstrncpy(dn, ext, 100);
|
||||
|
||||
/* make sure DN is numeric only */
|
||||
for (i=0; i< dnLen; i++) {
|
||||
if (isalpha(dn[i])) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (maskLen > dnLen) {
|
||||
stringInsert(dn, maskLen - dnLen, '?');
|
||||
}
|
||||
|
||||
/* if the digit string is longer than the translation mask
|
||||
* prepad the translation mask with '%'.
|
||||
*/
|
||||
if (dnLen > maskLen) {
|
||||
stringInsert(translationMask, dnLen - maskLen, '%');
|
||||
}
|
||||
|
||||
dnLen = strlen(dn);
|
||||
|
||||
for (i=0; i < dnLen; i++) {
|
||||
if (translationMask[i] == '%')
|
||||
continue;
|
||||
else if (translationMask[i] == 'X')
|
||||
translatedString[j++] = dn[i];
|
||||
else
|
||||
translatedString[j++] = translationMask[i];
|
||||
}
|
||||
|
||||
translatedString[j] = 0;
|
||||
result = strlib_malloc(translatedString, strlen(translatedString));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Before initing the line_info release any memory which has been used
|
||||
* so we do not leak any here.
|
||||
*/
|
||||
void ccsnap_line_pre_init () {
|
||||
int i;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering line_pre_init to clear it out to avoid mem leaks\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "ccsnap_line_pre_init"));
|
||||
|
||||
for (i=1;i<MAX_CONFIG_LINES;i++) {
|
||||
if ((lineInfo[i].name) && (strlen(lineInfo[i].name) > 0)) {
|
||||
strlib_free(lineInfo[i].name);
|
||||
}
|
||||
if ((lineInfo[i].dn) && (strlen(lineInfo[i].dn) > 0)) {
|
||||
strlib_free(lineInfo[i].dn);
|
||||
}
|
||||
if ((lineInfo[i].cfwd_dest) && (strlen(lineInfo[i].cfwd_dest) > 0)) {
|
||||
strlib_free(lineInfo[i].cfwd_dest);
|
||||
}
|
||||
if ((lineInfo[i].externalNumber) &&
|
||||
(strlen(lineInfo[i].externalNumber) > 0)) {
|
||||
strlib_free(lineInfo[i].externalNumber);
|
||||
}
|
||||
if ((featureInfo[i].speedDialNumber) &&
|
||||
(strlen(featureInfo[i].speedDialNumber) > 0)) {
|
||||
strlib_free(featureInfo[i].speedDialNumber);
|
||||
}
|
||||
if ((featureInfo[i].contact) && (strlen(featureInfo[i].contact) > 0)) {
|
||||
strlib_free(featureInfo[i].contact);
|
||||
}
|
||||
if ((featureInfo[i].name) && (strlen(featureInfo[i].name) > 0)) {
|
||||
strlib_free(featureInfo[i].name);
|
||||
}
|
||||
if ((featureInfo[i].retrievalPrefix) &&
|
||||
(strlen(featureInfo[i].retrievalPrefix) > 0)) {
|
||||
strlib_free(featureInfo[i].retrievalPrefix);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize lineinfo and featureinfo arrays
|
||||
*/
|
||||
void ccsnap_line_init() {
|
||||
int i;
|
||||
cc_uint32_t tmpInt;
|
||||
char tempStr[MAX_URL_LENGTH];
|
||||
char maskStr[MAX_EXTERNAL_NUMBER_MASK_SIZE];
|
||||
|
||||
/* clean up structure if need be */
|
||||
ccsnap_line_pre_init();
|
||||
|
||||
memset(lineInfo, 0, MAX_CONFIG_LINES*sizeof(cc_line_info_t));
|
||||
memset(featureInfo, 0, MAX_CONFIG_LINES*sizeof(cc_feature_info_t));
|
||||
for (i=1;i<=MAX_CONFIG_LINES;i++) {
|
||||
config_get_line_value(CFGID_LINE_FEATURE, &tmpInt, sizeof(tmpInt), i);
|
||||
if ( tmpInt == cfgLineFeatureDN ) {
|
||||
lineInfo[i].button = i;
|
||||
lineInfo[i].line_type = tmpInt;
|
||||
config_get_line_value(CFGID_LINE_INDEX, &tmpInt, sizeof(tmpInt), i);
|
||||
lineInfo[i].line_id = tmpInt;
|
||||
config_get_line_value(CFGID_LINE_DISPLAYNAME_STRING, tempStr,
|
||||
MAX_URL_LENGTH, i);
|
||||
lineInfo[i].dn = strlib_malloc(tempStr, strlen(tempStr));
|
||||
config_get_line_value(CFGID_LINE_NAME_STRING, tempStr,
|
||||
MAX_URL_LENGTH, i);
|
||||
lineInfo[i].name = strlib_malloc(tempStr, strlen(tempStr));
|
||||
config_get_line_value(CFGID_LINE_CFWDALL, tempStr,
|
||||
MAX_URL_LENGTH, i);
|
||||
lineInfo[i].cfwd_dest = strlib_malloc(tempStr, strlen(tempStr));
|
||||
config_get_line_value(CFGID_LINE_SPEEDDIAL_NUMBER_STRING, tempStr,
|
||||
MAX_URL_LENGTH, i);
|
||||
memset(maskStr, 0, sizeof(maskStr));
|
||||
config_get_string(CFGID_CCM_EXTERNAL_NUMBER_MASK, maskStr, MAX_EXTERNAL_NUMBER_MASK_SIZE);
|
||||
if (strlen(maskStr) > 0) {
|
||||
lineInfo[i].externalNumber = CCAPI_ApplyTranslationMask(lineInfo[i].name, maskStr);
|
||||
CCAPP_DEBUG("Setting lineInfo[i].externalNumber to %s\n", lineInfo[i].externalNumber);
|
||||
} else {
|
||||
lineInfo[i].externalNumber = strlib_empty();
|
||||
}
|
||||
} else {
|
||||
lineInfo[i].line_id = MAX_CONFIG_LINES+1; // invalid line id
|
||||
lineInfo[i].button = i;
|
||||
lineInfo[i].dn = strlib_empty();
|
||||
lineInfo[i].name = strlib_empty();
|
||||
lineInfo[i].cfwd_dest = strlib_empty();
|
||||
lineInfo[i].externalNumber = strlib_empty();
|
||||
}
|
||||
capset_get_idleset(CC_MODE_CCM, lineInfo[i].allowed_features);
|
||||
|
||||
// get feature again because it might have been changed if it is a DN
|
||||
// and the tmpInt might have a different value
|
||||
config_get_line_value(CFGID_LINE_FEATURE, &tmpInt, sizeof(tmpInt), i);
|
||||
|
||||
// features which have no properties
|
||||
if ( tmpInt == cfgLineFeatureAllCalls ||
|
||||
tmpInt == cfgLineFeatureMaliciousCallID ||
|
||||
tmpInt == cfgLineFeatureRedial || tmpInt == cfgLineFeatureAnswerOldest || tmpInt == cfgLineFeatureServices ) {
|
||||
featureInfo[i].feature_id = tmpInt;
|
||||
featureInfo[i].button = i;
|
||||
featureInfo[i].speedDialNumber = strlib_empty();
|
||||
featureInfo[i].contact = strlib_empty();
|
||||
featureInfo[i].name = strlib_empty();
|
||||
featureInfo[i].retrievalPrefix = strlib_empty();
|
||||
featureInfo[i].featureOptionMask = 0;
|
||||
} else if ( tmpInt == cfgLineFeatureSpeedDialBLF || tmpInt == cfgLineFeatureSpeedDial){
|
||||
featureInfo[i].feature_id = tmpInt;
|
||||
featureInfo[i].button = i;
|
||||
config_get_line_value(CFGID_LINE_SPEEDDIAL_NUMBER_STRING, tempStr,
|
||||
MAX_URL_LENGTH, i);
|
||||
featureInfo[i].speedDialNumber = strlib_malloc(tempStr, strlen(tempStr));
|
||||
featureInfo[i].contact = strlib_empty();
|
||||
config_get_line_value(CFGID_LINE_NAME_STRING, tempStr,
|
||||
MAX_URL_LENGTH, i);
|
||||
featureInfo[i].name = strlib_malloc(tempStr, strlen(tempStr));
|
||||
featureInfo[i].retrievalPrefix = strlib_empty();
|
||||
config_get_line_value(CFGID_LINE_FEATURE_OPTION_MASK, &tmpInt, sizeof(tmpInt), i);
|
||||
featureInfo[i].featureOptionMask = tmpInt;
|
||||
featureInfo[i].blf_state = CC_SIP_BLF_UNKNOWN;
|
||||
} else {
|
||||
featureInfo[i].feature_id = 0;
|
||||
featureInfo[i].button = MAX_CONFIG_LINES+1; // invalid button value
|
||||
featureInfo[i].speedDialNumber = strlib_empty();
|
||||
featureInfo[i].contact = strlib_empty();
|
||||
featureInfo[i].name = strlib_empty();
|
||||
featureInfo[i].retrievalPrefix = strlib_empty();
|
||||
featureInfo[i].featureOptionMask = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cc_line_info_t* ccsnap_getLineInfo(int lineID)
|
||||
{
|
||||
int i;
|
||||
cc_lineid_t line = (cc_lineid_t)lineID;
|
||||
|
||||
for (i=1;i<=MAX_CONFIG_LINES;i++) {
|
||||
if ( lineInfo[i].line_id == line ) {
|
||||
return &lineInfo[i];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cc_line_info_t* ccsnap_getLineInfoFromBtn(int btnID)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=1;i<=MAX_CONFIG_LINES;i++) {
|
||||
if ( lineInfo[i].button == btnID ) {
|
||||
return &lineInfo[i];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cc_boolean allowedFeature(int fid){
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
cc_feature_info_t* ccsnap_getFeatureInfo(int featureIndex)
|
||||
{
|
||||
if ( ( featureIndex<=MAX_CONFIG_LINES ) &&
|
||||
( featureIndex>= 1 ) &&
|
||||
( featureInfo[featureIndex].button == featureIndex ) ) {
|
||||
if ( allowedFeature(featureInfo[featureIndex].feature_id) ){
|
||||
return &featureInfo[featureIndex];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Release any used mem to avoid a leak.
|
||||
*/
|
||||
void ccsnap_device_pre_init () {
|
||||
int i = 0;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering device_pre_init to clear it out to avoid mem leaks\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "ccsnap_device_pre_init"));
|
||||
if ((g_deviceInfo.name) && (strlen(g_deviceInfo.name) > 0)) {
|
||||
strlib_free(g_deviceInfo.name);
|
||||
}
|
||||
if ((g_deviceInfo.not_prompt) && (strlen(g_deviceInfo.not_prompt) > 0)) {
|
||||
strlib_free(g_deviceInfo.not_prompt);
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while (i < CCAPI_MAX_SERVERS) {
|
||||
if ((g_deviceInfo.ucm[i].name) &&
|
||||
(strlen(g_deviceInfo.ucm[i].name) > 0)) {
|
||||
strlib_free(g_deviceInfo.ucm[i].name);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
void ccsnap_device_init() {
|
||||
char temp[MAX_SIP_URL_LENGTH];
|
||||
|
||||
/* clean up structure if need be */
|
||||
ccsnap_device_pre_init();
|
||||
|
||||
memset (&g_deviceInfo, 0, sizeof(g_deviceInfo));
|
||||
g_deviceInfo.name =strlib_empty();
|
||||
g_deviceInfo.not_prompt =strlib_empty();
|
||||
|
||||
g_deviceInfo.not_prompt_prio = 0;
|
||||
g_deviceInfo.not_prompt_prog = 0;
|
||||
g_deviceInfo.mwi_lamp = FALSE;
|
||||
g_deviceInfo.cucm_mode = CC_MODE_CCM;
|
||||
g_deviceInfo.ins_state = CC_STATE_IDLE;
|
||||
g_deviceInfo.ins_cause = CC_CAUSE_NONE;
|
||||
g_deviceInfo.reg_time = 0;
|
||||
|
||||
config_get_string(CFGID_CCM1_ADDRESS, temp, MAX_SIP_URL_LENGTH);
|
||||
g_deviceInfo.ucm[0].name = strlib_malloc(temp, strlen(temp));
|
||||
g_deviceInfo.ucm[0].type = CC_MODE_CCM;
|
||||
g_deviceInfo.ucm[0].status = CC_CCM_STATUS_NONE;
|
||||
|
||||
config_get_string(CFGID_CCM2_ADDRESS, temp, MAX_SIP_URL_LENGTH);
|
||||
g_deviceInfo.ucm[1].name = strlib_malloc(temp, strlen(temp));
|
||||
g_deviceInfo.ucm[1].type = CC_MODE_CCM;
|
||||
g_deviceInfo.ucm[1].status = CC_CCM_STATUS_NONE;
|
||||
|
||||
config_get_string(CFGID_CCM3_ADDRESS, temp, MAX_SIP_URL_LENGTH);
|
||||
g_deviceInfo.ucm[2].name = strlib_malloc(temp, strlen(temp));
|
||||
g_deviceInfo.ucm[2].type = CC_MODE_CCM;
|
||||
g_deviceInfo.ucm[2].status = CC_CCM_STATUS_NONE;
|
||||
|
||||
config_get_string(CFGID_CCM_TFTP_IP_ADDR, temp, MAX_SIP_URL_LENGTH);
|
||||
g_deviceInfo.ucm[3].name = strlib_malloc(temp, strlen(temp));
|
||||
g_deviceInfo.ucm[3].type = CC_MODE_CCM;
|
||||
g_deviceInfo.ucm[3].status = CC_CCM_STATUS_NONE;
|
||||
|
||||
g_accessoryCfgInfo.camera = ACCSRY_CFGD_CFG;
|
||||
g_accessoryCfgInfo.video = ACCSRY_CFGD_CFG;
|
||||
}
|
||||
|
||||
void ccsnap_gen_deviceEvent(ccapi_device_event_e event, cc_device_handle_t handle){
|
||||
const char* fname = "ccsnap_gen_deviceEvent";
|
||||
|
||||
cc_device_info_t *device_info = CCAPI_Device_getDeviceInfo(handle);
|
||||
if ( device_info != NULL ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->ref_count=%d \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), device_info->ref_count);
|
||||
|
||||
switch (event) {
|
||||
case CCAPI_DEVICE_EV_NOTIFYPROMPT:
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->not_prompt=%s \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), device_info->not_prompt);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->not_prompt_prio=%d \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), device_info->not_prompt_prio);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->not_prompt_prog=%d \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), device_info->not_prompt_prog);
|
||||
break;
|
||||
case CCAPI_DEVICE_EV_STATE:
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"setting property %s to %s\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), "FullyRegistered", ((device_info->ins_state == CC_STATE_INS) ? "1" : "0"));
|
||||
//intentional follow through to let the debugs get printed.
|
||||
default:
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->name=%s \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), device_info->name);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->mwi_lamp=%d \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), device_info->mwi_lamp);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->ins_state=%02X \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), device_info->ins_state);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->cucm_mode=%02X \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), device_info->cucm_mode);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->ins_cause=%02X \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), device_info->ins_cause);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
CCAPI_DeviceListener_onDeviceEvent(event, handle, device_info);
|
||||
}
|
||||
CCAPI_Device_releaseDeviceInfo(device_info);
|
||||
}
|
||||
|
||||
void ccsnap_gen_lineEvent(ccapi_line_event_e event, cc_lineid_t handle){
|
||||
const char* fname = "ccsnap_gen_lineEvent";
|
||||
cc_line_info_t *line_info = CCAPI_Line_getLineInfo(handle);
|
||||
|
||||
if ( line_info != NULL ) {
|
||||
if (g_CCAppDebug) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->ref_count=%d \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), line_info->ref_count);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->line_id=%d \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), line_info->line_id);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->button=%d \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), line_info->button);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->reg_state=%d \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), line_info->reg_state);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->isCFWD=%d \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), line_info->isCFWD);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->isLocalCFWD=%d \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), line_info->isLocalCFWD);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->mwi=%d \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), line_info->mwi);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->name=%s \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), line_info->name);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->dn=%s \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), line_info->dn);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->cfwd_dest=%s \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), line_info->cfwd_dest);
|
||||
}
|
||||
CCAPI_LineListener_onLineEvent(event, handle, line_info);
|
||||
}
|
||||
CCAPI_Line_releaseLineInfo(line_info);
|
||||
}
|
||||
|
||||
void ccsnap_gen_callEvent(ccapi_call_event_e event, cc_call_handle_t handle){
|
||||
|
||||
session_data_t *call_info = CCAPI_Call_getCallInfo(handle);
|
||||
|
||||
if ( call_info == NULL ) {
|
||||
call_info = getDeepCopyOfSessionData(NULL);
|
||||
}
|
||||
|
||||
//print all info
|
||||
if (g_CCAppDebug) {
|
||||
printCallInfo(call_info, "ccsnap_gen_callEvent");
|
||||
}
|
||||
|
||||
CCAPI_CallListener_onCallEvent(event, handle, call_info);
|
||||
CCAPI_Call_releaseCallInfo(call_info);
|
||||
}
|
||||
|
||||
void ccsnap_update_ccm_status(cc_string_t addr, cc_ccm_status_t status)
|
||||
{
|
||||
int i;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"entry ccm %s status=%d\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, "ccsnap_update_ccm_status"), addr, status);
|
||||
|
||||
for (i=0;i< CCAPI_MAX_SERVERS;i++) {
|
||||
if ( g_deviceInfo.ucm[i].status == status ) {
|
||||
//move the status to the new addr
|
||||
g_deviceInfo.ucm[i].status = CC_CCM_STATUS_NONE;
|
||||
}
|
||||
if ( !strcmp(addr, g_deviceInfo.ucm[i].name) ) {
|
||||
g_deviceInfo.ucm[i].status = status;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"server %s is now status=%d\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, "ccsnap_update_ccm_status"),
|
||||
g_deviceInfo.ucm[i].name, status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ccsnap_handle_mnc_reached (cc_line_info_t *line_info, cc_boolean mnc_reached, cc_cucm_mode_t mode)
|
||||
{
|
||||
cc_call_handle_t handles[MAX_CALLS];
|
||||
int count = MAX_CALLS, i;
|
||||
session_data_t *cinfo;
|
||||
|
||||
if (mnc_reached) {
|
||||
line_info->allowed_features[CCAPI_CALL_CAP_NEWCALL] = FALSE;
|
||||
line_info->allowed_features[CCAPI_CALL_CAP_REDIAL] = FALSE;
|
||||
line_info->allowed_features[CCAPI_CALL_CAP_CALLFWD] = FALSE;
|
||||
} else {
|
||||
capset_get_idleset(mode, line_info->allowed_features);
|
||||
}
|
||||
|
||||
// update connected calls caps on this line
|
||||
CCAPI_LineInfo_getCallsByState(line_info->line_id, CONNECTED, handles, &count);
|
||||
for ( i=0; i<count; i++) {
|
||||
cinfo = CCAPI_Call_getCallInfo(handles[i]);
|
||||
if (cinfo) {
|
||||
if ( cinfo->attr == (cc_call_attr_t) CONF_CONSULT ||
|
||||
cinfo->attr == (cc_call_attr_t) XFR_CONSULT ) {
|
||||
CCAPI_Call_releaseCallInfo(cinfo);
|
||||
continue;
|
||||
}
|
||||
cinfo->allowed_features[CCAPI_CALL_CAP_TRANSFER] = mnc_reached?FALSE:TRUE;
|
||||
cinfo->allowed_features[CCAPI_CALL_CAP_CONFERENCE] = mnc_reached?FALSE:TRUE;
|
||||
//print call info
|
||||
if (g_CCAppDebug) {
|
||||
printCallInfo(cinfo, "ccsnap_handle_mnc_reached");
|
||||
}
|
||||
CCAPI_CallListener_onCallEvent(CCAPI_CALL_EV_CAPABILITY, handles[i], cinfo);
|
||||
}
|
||||
}
|
||||
// update RIU call caps on this line
|
||||
CCAPI_LineInfo_getCallsByState(line_info->line_id, REMINUSE, handles, &count);
|
||||
for ( i=0; i<count; i++) {
|
||||
cinfo = CCAPI_Call_getCallInfo(handles[i]);
|
||||
if (cinfo) {
|
||||
cinfo->allowed_features[CCAPI_CALL_CAP_BARGE] = mnc_reached?FALSE:TRUE;
|
||||
//print call info
|
||||
if (g_CCAppDebug) {
|
||||
printCallInfo(cinfo, "ccsnap_handle_mnc_reached");
|
||||
}
|
||||
CCAPI_CallListener_onCallEvent(CCAPI_CALL_EV_CAPABILITY, handles[i], cinfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ccsnap_gen_blfFeatureEvent(cc_blf_state_t state, int appId)
|
||||
{
|
||||
cc_feature_info_t *feature_info = NULL;
|
||||
|
||||
feature_info = ccsnap_getFeatureInfo(appId);
|
||||
|
||||
// if the feature exists
|
||||
if (feature_info != NULL) {
|
||||
feature_info->blf_state = state;
|
||||
printFeatureInfo(CCAPI_DEVICE_EV_BLF, feature_info, "ccsnap_gen_blfFeatureEvent");
|
||||
CCAPI_DeviceListener_onFeatureEvent(CCAPI_DEVICE_EV_BLF, CC_DEVICE_ID, feature_info);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
static boolean missed, placed, received;
|
||||
void ccsnap_set_phone_services_provisioning(boolean misd, boolean plcd, boolean rcvd) {
|
||||
CCAPP_ERROR(DEB_F_PREFIX"missed=%d placed=%d received=%d\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, "ccsnap_set_phone_services_provisioning"), misd, plcd, rcvd);
|
||||
missed = misd;
|
||||
placed = plcd;
|
||||
received = rcvd;
|
||||
}
|
||||
|
||||
boolean ccsnap_isMissedCallLoggingEnabled()
|
||||
{
|
||||
return missed;
|
||||
}
|
||||
|
||||
boolean ccsnap_isReceivedCallLoggingEnabled()
|
||||
{
|
||||
return received;
|
||||
}
|
||||
|
||||
boolean ccsnap_isPlacedCallLoggingEnabled()
|
||||
{
|
||||
return placed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method
|
||||
*/
|
||||
|
||||
static void printCallInfo(cc_callinfo_ref_t info, const char* fname) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->ref_count=%d \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->ref_count);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->sess_id=%d \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->sess_id);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->line=%02X \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->line);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->id=%u \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->id);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->inst=%d \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->inst);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->state=%02X \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->state);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->attr=%02X \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->attr);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->type=%02X \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->type);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->security=%02X \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->security);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->policy=%02X \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->policy);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->isSelected=%d \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->isSelected);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->log_disp=%u \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->log_disp);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->clg_name=%s \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->clg_name);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->clg_number=%s \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->clg_number);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->alt_number=%s \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->alt_number);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->cld_name=%s \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->cld_name);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->cld_number=%s \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->cld_number);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->orig_called_name=%s \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->orig_called_name);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->orig_called_number=%s \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->orig_called_number);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->last_redir_name=%s \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->last_redir_name);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->last_redir_number=%s \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->last_redir_number);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->plcd_name=%s \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->plcd_name);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->plcd_number=%s \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->plcd_number);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->status=%s \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->status);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->gci=%s \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->gci);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->cause=%d \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->cause);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->vid_dir=%d \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->vid_dir);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->vid_offer=%d \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->vid_offer);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->is_conf=%d \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->is_conf);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->ringer_start=%d \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->ringer_start);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->ringer_mode=%d \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->ringer_mode);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->ringer_once=%d \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), info->ringer_once);
|
||||
}
|
||||
|
||||
static void printFeatureInfo (ccapi_device_event_e type, cc_featureinfo_ref_t feature_info, const char* fname) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->button=%d \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), feature_info->button);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->contact=%s \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), feature_info->contact);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->featureOptionMask=%d \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), feature_info->featureOptionMask);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->feature_id=%d \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), feature_info->feature_id);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->name=%s \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), feature_info->name);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->retrievalPrefix=%s \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), feature_info->retrievalPrefix);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->speedDialNumber=%s \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), feature_info->speedDialNumber);
|
||||
if (type == CCAPI_DEVICE_EV_BLF) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"data->blf_state=%d \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), feature_info->blf_state);
|
||||
}
|
||||
|
||||
}
|
114
libs/sipcc/core/ccapp/ccapi_snapshot.h
Normal file
114
libs/sipcc/core/ccapp/ccapi_snapshot.h
Normal file
@ -0,0 +1,114 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _CCAPI_SNAPSHOT_H_
|
||||
#define _CCAPI_SNAPSHOT_H_
|
||||
|
||||
#include "ccsip_platform.h"
|
||||
#include "prot_configmgr.h"
|
||||
#include "ccapi_line.h"
|
||||
|
||||
/*
|
||||
* MWI info
|
||||
*/
|
||||
typedef struct cc_mwi_info_t_ {
|
||||
cc_uint32_t status;
|
||||
cc_uint32_t type;
|
||||
cc_uint32_t new_count;
|
||||
cc_uint32_t old_count;
|
||||
cc_uint32_t pri_new_count;
|
||||
cc_uint32_t pri_old_count;
|
||||
} cc_mwi_info_t;
|
||||
|
||||
/*
|
||||
* line reference data structure
|
||||
*/
|
||||
typedef struct cc_line_info_t_ {
|
||||
cc_uint32_t ref_count;
|
||||
cc_uint32_t line_id;
|
||||
cc_uint32_t line_type;
|
||||
cc_int32_t button;
|
||||
cc_boolean reg_state;
|
||||
cc_boolean isCFWD;
|
||||
cc_boolean isLocalCFWD;
|
||||
cc_mwi_info_t mwi;
|
||||
cc_string_t name;
|
||||
cc_string_t dn;
|
||||
cc_string_t cfwd_dest;
|
||||
cc_boolean allowed_features[CCAPI_CALL_CAP_MAX];
|
||||
cc_string_t externalNumber;
|
||||
cc_boolean fwd_caller_name_display;
|
||||
cc_boolean fwd_caller_number_display;
|
||||
cc_boolean fwd_redirected_number_display;
|
||||
cc_boolean fwd_dialed_number_display;
|
||||
} cc_line_info_t;
|
||||
|
||||
typedef struct cc_feature_info_t_ {
|
||||
cc_int32_t feature_id;
|
||||
cc_int32_t button;
|
||||
cc_string_t speedDialNumber;
|
||||
cc_string_t contact;
|
||||
cc_string_t name;
|
||||
cc_string_t retrievalPrefix;
|
||||
cc_uint32_t featureOptionMask;
|
||||
cc_blf_state_t blf_state;
|
||||
} cc_feature_info_t;
|
||||
|
||||
typedef struct cc_call_server_t_ {
|
||||
cc_string_t name;
|
||||
cc_ccm_status_t status;
|
||||
cc_int32_t type;
|
||||
} cc_call_server_t;
|
||||
|
||||
typedef struct cc_device_info_t_ {
|
||||
cc_uint32_t ref_count;
|
||||
cc_string_t name;
|
||||
cc_string_t not_prompt;
|
||||
char registration_ip_addr[MAX_IPADDR_STR_LEN];
|
||||
cc_int32_t not_prompt_prio;
|
||||
cc_boolean not_prompt_prog;
|
||||
cc_boolean mwi_lamp;
|
||||
cc_cucm_mode_t cucm_mode;
|
||||
cc_service_state_t ins_state;
|
||||
cc_service_cause_t ins_cause;
|
||||
long long reg_time;
|
||||
cc_call_server_t ucm[CCAPI_MAX_SERVERS];
|
||||
} cc_device_info_t;
|
||||
|
||||
typedef enum {
|
||||
ACCSRY_CFGD_CFG, //accessory last configured by configuration file.
|
||||
ACCSRY_CFGD_APK, //accessory last configured by another application.
|
||||
} accsry_cfgd_by_t;
|
||||
|
||||
typedef struct accessory_cfg_info_t_ {
|
||||
accsry_cfgd_by_t camera;
|
||||
accsry_cfgd_by_t video;
|
||||
} accessory_cfg_info_t;
|
||||
|
||||
extern accessory_cfg_info_t g_accessoryCfgInfo;
|
||||
extern cc_device_info_t g_deviceInfo;
|
||||
extern cc_line_info_t lineInfo[MAX_CONFIG_LINES+1];
|
||||
|
||||
cc_line_info_t* ccsnap_getLineInfo(int lineID);
|
||||
cc_line_info_t* ccsnap_getLineInfoFromBtn(int btnID);
|
||||
void ccsnap_line_init();
|
||||
void ccsnap_device_init();
|
||||
void ccsnap_gen_deviceEvent(ccapi_device_event_e event, cc_device_handle_t handle);
|
||||
void ccsnap_gen_lineEvent(ccapi_line_event_e event, cc_lineid_t handle);
|
||||
void ccsnap_gen_callEvent(ccapi_call_event_e event, cc_call_handle_t handle);
|
||||
void ccsnap_update_ccm_status(cc_string_t addr, cc_ccm_status_t status);
|
||||
void ccsnap_handle_mnc_reached (cc_line_info_t *line_info,
|
||||
cc_boolean mnc_reached, cc_cucm_mode_t mode);
|
||||
cc_feature_info_t* ccsnap_getFeatureInfo(int featureIndex);
|
||||
void ccsnap_gen_blfFeatureEvent(cc_blf_state_t state, int appId);
|
||||
cc_string_t ccsnap_EscapeStrToLocaleStr(cc_string_t destination, cc_string_t source, int len);
|
||||
void ccsnap_set_phone_services_provisioning(boolean misd, boolean plcd, boolean rcvd);
|
||||
boolean ccsnap_isMissedCallLoggingEnabled();
|
||||
boolean ccsnap_isReceivedCallLoggingEnabled();
|
||||
boolean ccsnap_isPlacedCallLoggingEnabled();
|
||||
void ccsnap_set_line_label(int btn, cc_string_t label);
|
||||
cc_string_t ccsnap_get_line_label(int btn);
|
||||
|
||||
#endif
|
||||
|
177
libs/sipcc/core/ccapp/ccapp_task.c
Normal file
177
libs/sipcc/core/ccapp/ccapp_task.c
Normal file
@ -0,0 +1,177 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "ccapp_task.h"
|
||||
#include "phone.h"
|
||||
#include "CCProvider.h"
|
||||
#include "platform_api.h"
|
||||
|
||||
extern cprMsgQueue_t ccapp_msgq;
|
||||
extern void CCAppInit();
|
||||
static sll_lite_list_t sll_list;
|
||||
|
||||
/**
|
||||
* Add/Get ccapp task listener
|
||||
*/
|
||||
void addCcappListener(appListener* listener, int type) {
|
||||
|
||||
listener_t *alistener = NULL;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entered: listenr=0x%x, type=%d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "addCcappListener"),
|
||||
listener, type);
|
||||
|
||||
if (listener == NULL)
|
||||
{
|
||||
CCAPP_ERROR(DEB_F_PREFIX"listener is NULL, returning\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "addCcappListener"));
|
||||
return;
|
||||
}
|
||||
|
||||
alistener = cpr_malloc(sizeof(listener_t));
|
||||
if (alistener == NULL) {
|
||||
CCAPP_ERROR(DEB_F_PREFIX"alistener is NULL, returning\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "addCcappListener"));
|
||||
return;
|
||||
}
|
||||
|
||||
alistener->type = type;
|
||||
alistener->listener_p = listener;
|
||||
|
||||
sll_lite_link_tail(&sll_list, (sll_lite_node_t *)alistener);
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Added: listenr=0x%x, type=%d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "addCcappListener"),
|
||||
alistener->listener_p, alistener->type);
|
||||
}
|
||||
|
||||
appListener *getCcappListener(int type) {
|
||||
static const char fname[] ="getCcappListener";
|
||||
listener_t *temp_info;
|
||||
sll_lite_node_t *iterator;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"entered: for app[%d]\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname),
|
||||
type);
|
||||
|
||||
iterator = sll_list.head_p;
|
||||
while (iterator) {
|
||||
temp_info = (listener_t *)iterator;
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"appid=%d, listener=0x%x\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), temp_info->type, temp_info->listener_p);
|
||||
if (temp_info->type == type) {
|
||||
{
|
||||
return temp_info->listener_p;
|
||||
}
|
||||
}
|
||||
iterator = iterator->next_p;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* CC Provider wrapper for posting msg to CCAPP
|
||||
*
|
||||
* @param msgId - message ID
|
||||
* @param data - ptr to data
|
||||
* @param len - len of data
|
||||
*
|
||||
* @return CPR_SUCCESS/CPR_FAILURE
|
||||
*
|
||||
* @pre None
|
||||
*/
|
||||
|
||||
cpr_status_e ccappTaskPostMsg(unsigned int msgId, void * data, uint16_t len, int appId)
|
||||
{
|
||||
cprBuffer_t *msg;
|
||||
static const char fname[] = "ccappPostMsg";
|
||||
cpr_status_e retval = CPR_SUCCESS;
|
||||
|
||||
msg = (cprBuffer_t *) cpr_malloc(len);
|
||||
if (msg == NULL) {
|
||||
CCAPP_ERROR(DEB_F_PREFIX"failed to allocate message.\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
return CPR_FAILURE;
|
||||
}
|
||||
|
||||
memcpy(msg, data, len);
|
||||
|
||||
if ((retval=ccappTaskSendMsg(msgId, msg, len, appId)) == CPR_FAILURE) {
|
||||
cpr_free(msg);
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* CC Provider wrapper for cprSendMessage
|
||||
*
|
||||
* @param cmd - Command
|
||||
* @param msg - msg ptr
|
||||
* @param len - len of msg
|
||||
* @param usr -
|
||||
*
|
||||
* @return CPR_SUCCESS/CPR_FAILURE
|
||||
*
|
||||
* @pre msg is a malloc mem ptr
|
||||
*/
|
||||
cpr_status_e
|
||||
ccappTaskSendMsg (uint32_t cmd, void *msg, uint16_t len, uint32_t UsrInfo)
|
||||
{
|
||||
phn_syshdr_t *syshdr;
|
||||
|
||||
syshdr = (phn_syshdr_t *) cprGetSysHeader(msg);
|
||||
if (!syshdr) {
|
||||
return CPR_FAILURE;
|
||||
}
|
||||
syshdr->Cmd = cmd;
|
||||
syshdr->Len = len;
|
||||
syshdr->Usr.UsrInfo = UsrInfo;
|
||||
|
||||
if (cprSendMessage(ccapp_msgq , (cprBuffer_t*)msg, (void **)&syshdr) == CPR_FAILURE) {
|
||||
cprReleaseSysHeader(syshdr);
|
||||
return CPR_FAILURE;
|
||||
}
|
||||
return CPR_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* CCApp Provider main routine.
|
||||
*
|
||||
* @param arg - CCApp msg queue
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @pre None
|
||||
*/
|
||||
void CCApp_task(void * arg)
|
||||
{
|
||||
static const char fname[] = "CCApp_task";
|
||||
phn_syshdr_t *syshdr = NULL;
|
||||
appListener *listener = NULL;
|
||||
void * msg;
|
||||
|
||||
//initialize the listener list
|
||||
sll_lite_init(&sll_list);
|
||||
|
||||
CCAppInit();
|
||||
|
||||
while (1) {
|
||||
msg = cprGetMessage(ccapp_msgq, TRUE, (void **) &syshdr);
|
||||
if ( msg) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Received Cmd[%d] for app[%d]\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname),
|
||||
syshdr->Cmd, syshdr->Usr.UsrInfo);
|
||||
|
||||
listener = getCcappListener(syshdr->Usr.UsrInfo);
|
||||
if (listener != NULL) {
|
||||
(* ((appListener)(listener)))(msg, syshdr->Cmd);
|
||||
} else {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Event[%d] doesn't have a dedicated listener.\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname),
|
||||
syshdr->Usr.UsrInfo);
|
||||
}
|
||||
cprReleaseSysHeader(syshdr);
|
||||
cpr_free(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
20
libs/sipcc/core/ccapp/ccapp_task.h
Normal file
20
libs/sipcc/core/ccapp/ccapp_task.h
Normal file
@ -0,0 +1,20 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "sll_lite.h"
|
||||
|
||||
//Define app id for ccapp task
|
||||
#define CCAPP_CCPROVIER 1
|
||||
#define CCAPP_MSPROVIDER 2
|
||||
|
||||
typedef void(* appListener) (void *message, int type);
|
||||
typedef struct {
|
||||
sll_lite_node_t node;
|
||||
int type;
|
||||
appListener *listener_p;
|
||||
} listener_t;
|
||||
|
||||
extern void addCcappListener(appListener* listener, int type);
|
||||
appListener *getCcappListener(int type);
|
||||
cpr_status_e ccappTaskSendMsg (uint32_t cmd, void *msg, uint16_t len, uint32_t usrInfo);
|
2238
libs/sipcc/core/ccapp/ccprovider.c
Executable file
2238
libs/sipcc/core/ccapp/ccprovider.c
Executable file
File diff suppressed because it is too large
Load Diff
401
libs/sipcc/core/ccapp/conf_roster.c
Normal file
401
libs/sipcc/core/ccapp/conf_roster.c
Normal file
@ -0,0 +1,401 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "sll_lite.h"
|
||||
#include "cc_constants.h"
|
||||
#include "cc_types.h"
|
||||
#include "cc_config.h"
|
||||
#include "phone_debug.h"
|
||||
#include "debug.h"
|
||||
#include "CCProvider.h"
|
||||
#include "ccapi_call_info.h"
|
||||
#include "conf_roster.h"
|
||||
#include "ccapi.h"
|
||||
#include "ccapp_task.h"
|
||||
|
||||
cc_conf_participant_status_t
|
||||
convertStringToParticipantStatus(const char *data)
|
||||
{
|
||||
if (strcmp(data, "connected") == 0) {
|
||||
return CCAPI_CONFPARTICIPANT_CONNECTED;
|
||||
} else if (strcmp(data, "alerting") == 0) {
|
||||
return CCAPI_CONFPARTICIPANT_ALERTING;
|
||||
} else if (strcmp(data, "dialing-out") == 0) {
|
||||
return CCAPI_CONFPARTICIPANT_DIALING_OUT;
|
||||
} else if (strcmp(data, "on-hold") == 0) {
|
||||
return CCAPI_CONFPARTICIPANT_ON_HOLD;
|
||||
} else if (strcmp(data, "disconnected") == 0) {
|
||||
return CCAPI_CONFPARTICIPANT_DISCONNECTED;
|
||||
} else {
|
||||
return CCAPI_CONFPARTICIPANT_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
cc_call_security_t
|
||||
convertStringToParticipantSecurity(const char *data)
|
||||
{
|
||||
|
||||
if (strcmp(data, "NotAuthenticated") == 0) {
|
||||
return CC_SECURITY_NOT_AUTHENTICATED;
|
||||
} else if (strcmp(data, "Authenticated") == 0) {
|
||||
return CC_SECURITY_AUTHENTICATED;
|
||||
} else if (strcmp(data, "Encrypted") == 0) {
|
||||
return CC_SECURITY_ENCRYPTED;
|
||||
} else if (strcmp(data, "Unknown") == 0) {
|
||||
return CC_SECURITY_UNKNOWN;
|
||||
} else {
|
||||
return CC_SECURITY_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void conf_roster_init_call_conference (cc_call_conference_Info_t *info)
|
||||
{
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"in init_call_conference \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI-CONFPARSE"));
|
||||
|
||||
info->participantMax = 0;
|
||||
info->participantCount = 0;
|
||||
info->myParticipantId = strlib_empty();
|
||||
|
||||
sll_lite_init(&info->currentParticipantsList);
|
||||
}
|
||||
|
||||
void conf_roster_free_call_conference (cc_call_conference_Info_t *confInfo)
|
||||
{
|
||||
cc_call_conferenceParticipant_Info_t *participant;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"in free_call_confrerence \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI-CONFPARSE"));
|
||||
|
||||
while((participant=(cc_call_conferenceParticipant_Info_t *)
|
||||
sll_lite_unlink_head(&confInfo->currentParticipantsList)) != NULL)
|
||||
{
|
||||
strlib_free(participant->participantName);
|
||||
strlib_free(participant->endpointUri);
|
||||
strlib_free(participant->callid);
|
||||
strlib_free(participant->participantNumber);
|
||||
|
||||
participant->participantSecurity = CC_SECURITY_NONE;
|
||||
participant->participantStatus = CCAPI_CONFPARTICIPANT_UNKNOWN;
|
||||
participant->canRemoveOtherParticipants = FALSE;
|
||||
|
||||
cpr_free(participant);
|
||||
participant = NULL;
|
||||
}
|
||||
|
||||
strlib_free(confInfo->myParticipantId);
|
||||
conf_roster_init_call_conference(confInfo);
|
||||
}
|
||||
|
||||
void conf_roster_copy_call_conferance (cc_call_conference_Info_t *dest, cc_call_conference_Info_t * src)
|
||||
{
|
||||
cc_call_conferenceParticipant_Info_t *destParticipant;
|
||||
cc_call_conferenceParticipant_Info_t *srcParticipant;
|
||||
sll_lite_node_t *iterator;
|
||||
sll_lite_return_e sll_ret_val;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"in copy_call_confrerence \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI-CONFPARSE"));
|
||||
|
||||
iterator = src->currentParticipantsList.head_p;
|
||||
conf_roster_init_call_conference(dest);
|
||||
|
||||
dest->participantMax = src->participantMax;
|
||||
dest->participantCount = src->participantCount;
|
||||
dest->myParticipantId = strlib_copy(src->myParticipantId);
|
||||
|
||||
while (iterator) {
|
||||
srcParticipant = (cc_call_conferenceParticipant_Info_t *)iterator;
|
||||
|
||||
destParticipant = cpr_malloc(sizeof(cc_call_conferenceParticipant_Info_t));
|
||||
if (destParticipant == NULL) {
|
||||
CCAPP_ERROR(DEB_F_PREFIX" Malloc failure for participant\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI-CONFPARSE"));
|
||||
return;
|
||||
} else {
|
||||
destParticipant->participantName = strlib_copy(srcParticipant->participantName);
|
||||
destParticipant->endpointUri = strlib_copy(srcParticipant->endpointUri);
|
||||
destParticipant->callid = strlib_copy(srcParticipant->callid);
|
||||
|
||||
destParticipant->participantNumber = strlib_copy(srcParticipant->participantNumber);
|
||||
destParticipant->participantSecurity = srcParticipant->participantSecurity;
|
||||
destParticipant->participantStatus = srcParticipant->participantStatus;
|
||||
destParticipant->canRemoveOtherParticipants = srcParticipant->canRemoveOtherParticipants;
|
||||
}
|
||||
|
||||
sll_ret_val = sll_lite_link_tail(&dest->currentParticipantsList, (sll_lite_node_t *)destParticipant);
|
||||
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(destParticipant);
|
||||
return;
|
||||
}
|
||||
|
||||
iterator = iterator->next_p;
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------
|
||||
// API Implementation
|
||||
// -------------------
|
||||
|
||||
/**
|
||||
* Get Conference Participants
|
||||
* @param [in] handle - call handle
|
||||
* @param [in/out] participantHandles - array of participant handles to be returned
|
||||
* @param [in/out] count - in: size of array provided in participantHandles; out: number of entries populated (up to original value provided)
|
||||
* @return void
|
||||
*/
|
||||
void CCAPI_CallInfo_getConfParticipants (cc_callinfo_ref_t handle, cc_participant_ref_t participantHandles[], int* count)
|
||||
{
|
||||
cc_call_conference_ref_t callConference = NULL; // conference reference (from call info)
|
||||
cc_call_conference_participant_ref_t participant = NULL; // participant reference
|
||||
cc_uint16_t participantIndex = 0; // participant index
|
||||
cc_uint16_t nodeCount = 0; // linked list node count
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering: CCAPI_CallInfo_getConfParticipants\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI-CONF"));
|
||||
|
||||
// get conference reference from the call info
|
||||
callConference = getCallConferenceRef(handle);
|
||||
if (callConference == NULL)
|
||||
{
|
||||
CCAPP_ERROR(DEB_F_PREFIX"Unable to get conference handle\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI-CONF"));
|
||||
*count = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
nodeCount = SLL_LITE_NODE_COUNT(&(callConference->currentParticipantsList));
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"SLL NODE COUNT = [%d]\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI-CONF"), nodeCount);
|
||||
if (nodeCount <= 0)
|
||||
{
|
||||
*count = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
participant = (cc_call_conference_participant_ref_t)SLL_LITE_LINK_HEAD(&callConference->currentParticipantsList);
|
||||
while (participant != NULL)
|
||||
{
|
||||
if (participantIndex >= *count)
|
||||
{
|
||||
CCAPP_ERROR(DEB_F_PREFIX"Not Enough Room Provided To List All Participants. Listed [%d] of [%d]\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI-CONF"), count, nodeCount);
|
||||
return;
|
||||
}
|
||||
|
||||
// add this participant to our list of particpiants
|
||||
participantHandles[participantIndex] = (participant->callid);
|
||||
|
||||
// step to the next stored participant in the list
|
||||
participant = (cc_call_conference_participant_ref_t)SLL_LITE_LINK_NEXT_NODE(participant);
|
||||
participantIndex++;
|
||||
}
|
||||
|
||||
// sanity check
|
||||
if (participantIndex != nodeCount)
|
||||
{ // did not find the expected number of participants!
|
||||
CCAPP_ERROR(DEB_F_PREFIX"Detected mismatch between counted participants [%d] and SLL returned nodecount [%d]\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI-CONF"),
|
||||
participantIndex, nodeCount);
|
||||
*count = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// return number of participants
|
||||
*count = nodeCount;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Maximum Number of Conference Participants ( in case gui wants to show %full conference info )
|
||||
* @param [in] handle - call handle
|
||||
* @return maximum number of conference participants
|
||||
*/
|
||||
cc_uint16_t CCAPI_CallInfo_getConfParticipantMax (cc_callinfo_ref_t handle)
|
||||
{ //
|
||||
cc_call_conference_ref_t callConference; // conference reference (from call info)
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Entering: CCAPI_CallInfo_getConfParticipantMax\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI-CONF"));
|
||||
|
||||
// get conference reference from the call info
|
||||
callConference = getCallConferenceRef(handle);
|
||||
if (callConference == NULL)
|
||||
{
|
||||
// no conference reference available
|
||||
CCAPP_ERROR(DEB_F_PREFIX"Unable to get conference reference\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI-CONF"));
|
||||
return (0);
|
||||
}
|
||||
|
||||
// return the max
|
||||
return (callConference->participantMax);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Participant Name
|
||||
* @param [in] handle - call info handle
|
||||
* @param [in] participantHandle - specific handle for conference participant
|
||||
* @return display name of the conference participant
|
||||
*/
|
||||
cc_string_t CCAPI_CallInfo_getConfParticipantName (cc_callinfo_ref_t handle, cc_participant_ref_t participantHandle)
|
||||
{
|
||||
cc_call_conference_participant_ref_t participant = getConferenceParticipantRef (handle, participantHandle);
|
||||
if (participant == NULL)
|
||||
{
|
||||
return strlib_empty();
|
||||
}
|
||||
|
||||
return (participant->participantName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Participant Number
|
||||
* @param [in] handle - handle of call
|
||||
* @param [in] participantHandle - handle of conference participant
|
||||
* @return display number of the conference participant
|
||||
*/
|
||||
cc_string_t CCAPI_CallInfo_getConfParticipantNumber (cc_callinfo_ref_t handle, cc_participant_ref_t participantHandle)
|
||||
{
|
||||
cc_call_conference_participant_ref_t participant = getConferenceParticipantRef (handle, participantHandle);
|
||||
if (participant == NULL)
|
||||
{
|
||||
return strlib_empty();
|
||||
}
|
||||
|
||||
return (participant->participantNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Conference Participant Status
|
||||
* @param [in] handle - call handle
|
||||
* @param [in] participantHandle - handle of conference participant
|
||||
* @return conference participant status
|
||||
*/
|
||||
cc_conf_participant_status_t CCAPI_CallInfo_getConfParticipantStatus (cc_callinfo_ref_t handle, cc_participant_ref_t participantHandle)
|
||||
{
|
||||
cc_call_conference_participant_ref_t participant = getConferenceParticipantRef (handle, participantHandle);
|
||||
if (participant == NULL)
|
||||
{
|
||||
return (CCAPI_CONFPARTICIPANT_UNKNOWN);
|
||||
}
|
||||
|
||||
return (participant->participantStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Participant Security
|
||||
* @param [in] handle - call handle
|
||||
* @param [in] participantHandle - handle of conference participant
|
||||
* @return security setting of the specific conference participant
|
||||
*/
|
||||
cc_call_security_t CCAPI_CallInfo_getConfParticipantSecurity (cc_callinfo_ref_t handle, cc_participant_ref_t participantHandle)
|
||||
{
|
||||
cc_call_conference_participant_ref_t participant = getConferenceParticipantRef (handle, participantHandle);
|
||||
if (participant == NULL)
|
||||
{
|
||||
return (CC_SECURITY_NONE);
|
||||
}
|
||||
|
||||
return (participant->participantSecurity);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
cc_boolean CCAPI_CallInfo_isConfSelfParticipant (cc_callinfo_ref_t handle, cc_participant_ref_t participantHandle)
|
||||
{
|
||||
cc_call_conference_ref_t callConference; // conference reference (from call info)
|
||||
|
||||
// get conference reference from the call info
|
||||
callConference = getCallConferenceRef(handle);
|
||||
if (callConference == NULL)
|
||||
{
|
||||
// error - log
|
||||
CCAPP_ERROR(DEB_F_PREFIX"Unable to get conference reference\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI-CONF"));
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
return (strcmp((callConference->myParticipantId), participantHandle) == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
cc_participant_ref_t CCAPI_CallInfo_getConfSelfParticipant (cc_callinfo_ref_t handle)
|
||||
{
|
||||
cc_call_conference_ref_t callConference; // conference reference (from call info)
|
||||
|
||||
// get conference reference from the call info
|
||||
callConference = getCallConferenceRef(handle);
|
||||
if (callConference == NULL)
|
||||
{
|
||||
// unexpected error
|
||||
CCAPP_ERROR(DEB_F_PREFIX"Unable to get conference reference\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI-CONF"));
|
||||
return strlib_empty();
|
||||
}
|
||||
|
||||
return (callConference->myParticipantId);
|
||||
}
|
||||
|
||||
// -----
|
||||
/**
|
||||
* Get the call conference reference
|
||||
* @param [in] handle - call info handle
|
||||
* @return cc_call_conference_Info_t
|
||||
*/
|
||||
cc_call_conference_ref_t getCallConferenceRef(cc_callinfo_ref_t handle)
|
||||
{
|
||||
session_data_t *data = (session_data_t *)handle;
|
||||
|
||||
if (!CCAPI_CallInfo_getIsConference(handle))
|
||||
{
|
||||
CCAPP_ERROR(DEB_F_PREFIX"Conference API Invoked, but Not In Conference Call\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI-CONF"));
|
||||
return (NULL);
|
||||
};
|
||||
|
||||
if (data == NULL)
|
||||
{
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
return (&data->call_conference);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------
|
||||
// getConferenceParticipantRef: returns participant ref (pointer) to a specific participant handle
|
||||
// ------------------------------------------------------------------------------------------------------------------
|
||||
cc_call_conference_participant_ref_t getConferenceParticipantRef(cc_callinfo_ref_t handle, cc_participant_ref_t participantHandle)
|
||||
{
|
||||
cc_call_conference_ref_t callConference; // conference reference (from call info)
|
||||
cc_call_conference_participant_ref_t participant;
|
||||
|
||||
// get conference reference from the call info
|
||||
callConference = getCallConferenceRef(handle);
|
||||
if (callConference == NULL)
|
||||
{
|
||||
// no conference reference available
|
||||
CCAPP_ERROR(DEB_F_PREFIX"Unable to get conference reference\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI-CONF"));
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
// see if participantHandle is legit...
|
||||
if (participantHandle == NULL)
|
||||
{
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"Received query for null participant\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI-CONF"));
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if (SLL_LITE_NODE_COUNT(&(callConference->currentParticipantsList)) <= 0)
|
||||
{
|
||||
CCAPP_ERROR(DEB_F_PREFIX"Participant list node count is 0, returning NULL\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI-CONF"));
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
participant = (cc_call_conference_participant_ref_t)SLL_LITE_LINK_HEAD(&callConference->currentParticipantsList);
|
||||
while (participant != NULL)
|
||||
{
|
||||
// see if we've found the participant we're looking for
|
||||
if (strcmp(participant->callid, participantHandle) == 0)
|
||||
{
|
||||
return (participant);
|
||||
}
|
||||
|
||||
// no match so far, so look at the next item in the list...
|
||||
participant = (cc_call_conference_participant_ref_t)SLL_LITE_LINK_NEXT_NODE(participant);
|
||||
}
|
||||
|
||||
CCAPP_ERROR(DEB_F_PREFIX" Did Not Find participant!\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI-CONF"));
|
||||
return (NULL);
|
||||
}
|
49
libs/sipcc/core/ccapp/conf_roster.h
Normal file
49
libs/sipcc/core/ccapp/conf_roster.h
Normal file
@ -0,0 +1,49 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef __CONFROSTER_H__
|
||||
#define __CONFROSTER_H__
|
||||
|
||||
#include "sll_lite.h"
|
||||
#include "cpr_string.h"
|
||||
#include "cc_constants.h"
|
||||
#include "cpr_stdio.h"
|
||||
#include "ccapi_conf_roster.h"
|
||||
|
||||
// structure for individual participant/user info
|
||||
typedef struct cc_call_conferenceParticipant_Info_t_ {
|
||||
sll_lite_node_t node;
|
||||
cc_participant_ref_t callid;
|
||||
string_t participantName;
|
||||
string_t participantNumber;
|
||||
cc_conf_participant_status_t participantStatus;
|
||||
cc_call_security_t participantSecurity;
|
||||
string_t endpointUri;
|
||||
cc_boolean canRemoveOtherParticipants;
|
||||
} cc_call_conferenceParticipant_Info_t;
|
||||
|
||||
// reference to above structure
|
||||
typedef struct cc_call_conferenceParticipant_Info_t_* cc_call_conference_participant_ref_t;
|
||||
|
||||
// main structure (one instance kept per conference (per call))
|
||||
typedef struct cc_call_conference_Info_t_ {
|
||||
int32_t participantMax;
|
||||
int32_t participantCount;
|
||||
cc_participant_ref_t myParticipantId;
|
||||
sll_lite_list_t currentParticipantsList;
|
||||
} cc_call_conference_Info_t;
|
||||
|
||||
// reference to above structure
|
||||
typedef struct cc_call_conference_Info_t_* cc_call_conference_ref_t;
|
||||
|
||||
void conf_roster_init_call_conference (cc_call_conference_Info_t *info);
|
||||
cc_call_conference_ref_t getCallConferenceRef(cc_callinfo_ref_t handle);
|
||||
cc_call_conference_participant_ref_t getConferenceParticipantRef(cc_callinfo_ref_t handle, cc_participant_ref_t participantHandle);
|
||||
void conf_roster_free_call_conference (cc_call_conference_Info_t *confInfo);
|
||||
void conf_roster_copy_call_conferance (cc_call_conference_Info_t *dest, cc_call_conference_Info_t * src);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
305
libs/sipcc/core/ccapp/sessionHash.c
Executable file
305
libs/sipcc/core/ccapp/sessionHash.c
Executable file
@ -0,0 +1,305 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifdef UNIT_TEST
|
||||
#define cpr_malloc malloc
|
||||
#define cpr_free free
|
||||
#define CCAPP_DEBUG printf
|
||||
#else
|
||||
#include "cpr_stdlib.h"
|
||||
#endif
|
||||
|
||||
#include "sessionHash.h"
|
||||
|
||||
#define HASHBUCKETS 67
|
||||
|
||||
hash_table_t *hashtable[HASHBUCKETS]={0};
|
||||
|
||||
void hashItrInit(hashItr_t *itr)
|
||||
{
|
||||
itr->bucket = 0;
|
||||
itr->node = NULL;
|
||||
}
|
||||
|
||||
void * hashItrNext(hashItr_t *itr)
|
||||
{
|
||||
int i;
|
||||
|
||||
if ( itr->node != NULL ) {
|
||||
if ( itr->node->next != NULL ) {
|
||||
itr->node = itr->node->next;
|
||||
return itr->node->data;
|
||||
}
|
||||
// We just iterated to the end of the list.
|
||||
// Increment the bucket to search next
|
||||
itr->bucket++;
|
||||
}
|
||||
|
||||
for(i=itr->bucket; i< HASHBUCKETS; i++) {
|
||||
if (hashtable[i] != NULL) {
|
||||
itr->bucket = i;
|
||||
itr->node = hashtable[i];
|
||||
return itr->node->data;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* sessionHash
|
||||
* function to add generate hash given the key
|
||||
*
|
||||
* @param key -
|
||||
*
|
||||
* @return the hash index
|
||||
*/
|
||||
unsigned int sessionHash (unsigned int key)
|
||||
{
|
||||
// since the key is session_id create the hashval to be line_id + call_id
|
||||
unsigned int hashval = key + ((key & 0xFFFF0000)>>16);
|
||||
|
||||
return hashval%67;
|
||||
}
|
||||
|
||||
/**
|
||||
* addhash
|
||||
* function to add data for a given key in the table
|
||||
*
|
||||
* @param key
|
||||
* @param data - pointer to data stored
|
||||
*
|
||||
* @return - 0 for success
|
||||
*/
|
||||
|
||||
int addhash (unsigned int key, void *data)
|
||||
{
|
||||
hash_table_t *newhash;
|
||||
hash_table_t *cur_hash;
|
||||
unsigned int hashval;
|
||||
|
||||
newhash = (hash_table_t *)(cpr_malloc(sizeof(hash_table_t)));
|
||||
if (newhash == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
newhash->key = key;
|
||||
|
||||
newhash->data = data;
|
||||
|
||||
hashval = sessionHash(key);
|
||||
|
||||
if (hashtable[hashval] == NULL) {
|
||||
hashtable[hashval] = newhash;
|
||||
hashtable[hashval]->prev = NULL;
|
||||
hashtable[hashval]->next = NULL;
|
||||
}
|
||||
else {
|
||||
cur_hash=hashtable[hashval];
|
||||
while(cur_hash->next != NULL) {
|
||||
cur_hash=cur_hash->next;
|
||||
}
|
||||
cur_hash->next = newhash;
|
||||
newhash->next = NULL;
|
||||
newhash->prev = cur_hash;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the session id given a callid
|
||||
* @param call_id
|
||||
* @return sessionID or 0
|
||||
*/
|
||||
|
||||
unsigned int ccpro_get_sessionId_by_callid(unsigned short call_id) {
|
||||
int i;
|
||||
hash_table_t *cur_hash;
|
||||
|
||||
for ( i=0; i<HASHBUCKETS ;i++){
|
||||
cur_hash = hashtable[i];
|
||||
while ( cur_hash) {
|
||||
if ( (cur_hash->key & 0xffff) == call_id ) {
|
||||
return cur_hash->key;
|
||||
}
|
||||
cur_hash = cur_hash->next;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* findhash
|
||||
* function retrieve the data for the given key
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @return the data ptr or NULL
|
||||
*/
|
||||
|
||||
void *findhash(unsigned int key)
|
||||
{
|
||||
unsigned int hashval;
|
||||
hash_table_t *cur_hash;
|
||||
|
||||
hashval = 0;
|
||||
|
||||
hashval = sessionHash(key);
|
||||
|
||||
|
||||
cur_hash = hashtable[hashval];
|
||||
while ( cur_hash != NULL ) {
|
||||
if ( cur_hash->key == key) {
|
||||
return cur_hash->data;
|
||||
}
|
||||
cur_hash = cur_hash->next;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* delhash
|
||||
* function to remove the hash entry for a given key
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @return - 0 for success
|
||||
*/
|
||||
|
||||
int delhash(unsigned int key)
|
||||
{
|
||||
unsigned int hashval;
|
||||
hash_table_t *cur_hash;
|
||||
|
||||
hashval = 0;
|
||||
|
||||
hashval = sessionHash(key);
|
||||
|
||||
|
||||
if (hashtable[hashval] == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (hashtable[hashval]->key == key) {
|
||||
cur_hash = hashtable[hashval];
|
||||
hashtable[hashval] = cur_hash->next;
|
||||
if ( hashtable[hashval] != NULL ) {
|
||||
hashtable[hashval]->prev = NULL;
|
||||
}
|
||||
cpr_free(cur_hash);
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
|
||||
cur_hash = hashtable[hashval]->next;
|
||||
|
||||
while (cur_hash != NULL) {
|
||||
if (cur_hash->key == key) {
|
||||
cur_hash->prev->next = cur_hash->next;
|
||||
if (cur_hash->next != NULL) {
|
||||
cur_hash->next->prev = cur_hash->prev;
|
||||
}
|
||||
cpr_free(cur_hash);
|
||||
return 0;
|
||||
}
|
||||
cur_hash = cur_hash->next;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef UNIT_TEST
|
||||
|
||||
void hashstats(int detail)
|
||||
{
|
||||
static const char *fname="hashstats";
|
||||
int max, total, i, nodes, used;
|
||||
double avg;
|
||||
hash_table_t *cur_hash;
|
||||
|
||||
max = total = i = nodes = used = 0;
|
||||
avg = 0;
|
||||
|
||||
if (detail > 0) {
|
||||
for (i = 0; i < HASHBUCKETS; i++) {
|
||||
if (hashtable[i] != NULL) {
|
||||
used++;
|
||||
nodes = 0;
|
||||
cur_hash = hashtable[i];
|
||||
while(cur_hash != NULL) {
|
||||
nodes++;
|
||||
if (detail > 3) {
|
||||
CCAPPDEBUG(DEB_F_PREFIX"%lx -> %lx: (%lx) (%lx) -> %lx\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname),
|
||||
cur_hash->prev, cur_hash, cur_hash->key, cur_hash->data, cur_hash->next);
|
||||
}
|
||||
cur_hash = cur_hash->next;
|
||||
}
|
||||
if (nodes != 0) total += nodes;
|
||||
if (nodes > max) {
|
||||
max = nodes;
|
||||
}
|
||||
if (detail > 1) {
|
||||
CCAPPDEBUG(DEB_F_PREFIX"i: %d\n", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), i);
|
||||
}
|
||||
}
|
||||
}
|
||||
avg = (double)(total) / (double)(used);
|
||||
CCAPPDEBUG(DEB_F_PREFIX"total: %d\n", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), total);
|
||||
CCAPPDEBUG(DEB_F_PREFIX"max: %d\n", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), max);
|
||||
CCAPPDEBUG(DEB_F_PREFIX"used: %lf\n", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), 100 * ((double)(used) / (double)(HASHBUCKETS)));
|
||||
CCAPPDEBUG(DEB_F_PREFIX"average: %lf\n", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), avg);
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
static const char *fname="main";
|
||||
hashItr_t itr;
|
||||
void * data;
|
||||
|
||||
addhash(0x01010001,0x1234);
|
||||
addhash(0x01060001,0x4567);
|
||||
addhash(0x01060002,0x9324);
|
||||
addhash(0x01070002,0x4321);
|
||||
addhash(0x01070004,0x2134);
|
||||
addhash(0x01080005,0x1324);
|
||||
addhash(0x01030001,0x1243);
|
||||
hashstats(7);
|
||||
|
||||
hashItrInit(&itr);
|
||||
while ( data = hashItrNext(&itr) ) {
|
||||
CCAPPDEBUG(DEB_F_PREFIX"Itr found %lx\n", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), data);
|
||||
}
|
||||
|
||||
CCAPPDEBUG(DEB_F_PREFIX"%lx\n", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01010001));
|
||||
CCAPPDEBUG(DEB_F_PREFIX"%lx\n", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01060001));
|
||||
CCAPPDEBUG(DEB_F_PREFIX"%lx\n", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01060002));
|
||||
CCAPPDEBUG(DEB_F_PREFIX"%lx\n", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01070002));
|
||||
CCAPPDEBUG(DEB_F_PREFIX"%lx\n", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01070004));
|
||||
CCAPPDEBUG(DEB_F_PREFIX"%lx\n", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01080005));
|
||||
CCAPPDEBUG(DEB_F_PREFIX"%lx\n", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01030001));
|
||||
|
||||
delhash(0x01030001);
|
||||
delhash(0x01060001);
|
||||
hashstats(7);
|
||||
|
||||
hashItrInit(&itr);
|
||||
while ( data = hashItrNext(&itr) ) {
|
||||
CCAPPDEBUG(DEB_F_PREFIX"Itr found %lx\n", DEB_F_PREFIX_ARGS(SIP_SES_HAS, fname), data);
|
||||
}
|
||||
|
||||
CCAPPDEBUG(DEB_F_PREFIX"%lx\n", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01010001));
|
||||
CCAPPDEBUG(DEB_F_PREFIX"%lx\n", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01060001));
|
||||
CCAPPDEBUG(DEB_F_PREFIX"%lx\n", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01060002));
|
||||
CCAPPDEBUG(DEB_F_PREFIX"%lx\n", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01070002));
|
||||
CCAPPDEBUG(DEB_F_PREFIX"%lx\n", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01070004));
|
||||
CCAPPDEBUG(DEB_F_PREFIX"%lx\n", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01080005));
|
||||
CCAPPDEBUG(DEB_F_PREFIX"%lx\n", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01030001));
|
||||
}
|
||||
#endif
|
||||
|
23
libs/sipcc/core/ccapp/sessionHash.h
Executable file
23
libs/sipcc/core/ccapp/sessionHash.h
Executable file
@ -0,0 +1,23 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
typedef struct hash_table {
|
||||
struct hash_table *next;
|
||||
struct hash_table *prev;
|
||||
unsigned int key;
|
||||
void *data;
|
||||
} hash_table_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned int bucket;
|
||||
hash_table_t *node;
|
||||
} hashItr_t;
|
||||
|
||||
|
||||
extern void hashItrInit(hashItr_t *itr) ;
|
||||
extern void * hashItrNext(hashItr_t *itr);
|
||||
extern int addhash (unsigned int key, void *data) ;
|
||||
extern int delhash(unsigned int key);
|
||||
extern void *findhash(unsigned int key);
|
||||
extern unsigned int ccpro_get_sessionId_by_callid(unsigned short call_id);
|
415
libs/sipcc/core/common/cfgfile_utils.c
Executable file
415
libs/sipcc/core/common/cfgfile_utils.c
Executable file
@ -0,0 +1,415 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "cpr_types.h"
|
||||
#include "cpr_stdio.h"
|
||||
#include "cpr_stdlib.h"
|
||||
#include "cpr_string.h"
|
||||
#include "cpr_socket.h"
|
||||
#include "cpr_in.h"
|
||||
#include <text_strings.h>
|
||||
#include <cfgfile_utils.h>
|
||||
#include <config.h>
|
||||
#include <phone_debug.h>
|
||||
#include "util_string.h"
|
||||
|
||||
#define IN6ADDRSZ 16
|
||||
#define INT16SZ 2
|
||||
#define INADDRSZ 4
|
||||
#define IS_DIGIT(ch) ((ch >= '0') && (ch <= '9'))
|
||||
|
||||
/*
|
||||
* Parse ascii dotted ip address notation into binary representation
|
||||
* only parses and makes sure the address is in the form:
|
||||
* digits.digits.digits.digits
|
||||
* Requires minimum of 1 digit per each section and digits cannot
|
||||
* exceed 255. It does NOT attempt to validate if the end result
|
||||
* is a valid ip address or not (eg. 0.0.0.0) is accepted.
|
||||
* The parsed address is returned in the Telecaster "byte reversed"
|
||||
* order. Eg. 0xf8332ca1 = 161.44.51.248
|
||||
*/
|
||||
int
|
||||
str2ip (const char *str, cpr_ip_addr_t *cpr_addr)
|
||||
{
|
||||
uint32_t ip_addr;
|
||||
unsigned int num;
|
||||
int dot_cnt;
|
||||
char ch;
|
||||
int digit_flag;
|
||||
uint32_t *addr = (uint32_t *)&(cpr_addr->u.ip4);
|
||||
|
||||
dot_cnt = 0;
|
||||
num = 0;
|
||||
ip_addr = 0;
|
||||
digit_flag = 0;
|
||||
cpr_addr->type = CPR_IP_ADDR_INVALID;
|
||||
|
||||
while (1) {
|
||||
ch = *str++;
|
||||
if (!ch)
|
||||
break; /* end of string */
|
||||
/*
|
||||
* Check for digits 0 through 9
|
||||
*/
|
||||
if (IS_DIGIT(ch)) {
|
||||
digit_flag = 1;
|
||||
num = num * 10 + (ch - '0');
|
||||
if (num > 255) {
|
||||
return (1);
|
||||
}
|
||||
continue;
|
||||
} else if (ch == ':') {
|
||||
//must be ipv6 address
|
||||
cpr_addr->type = CPR_IP_ADDR_IPV6;
|
||||
return(cpr_inet_pton(AF_INET6, str, addr));
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for DOT. Must also have seen at least 1 digit prior
|
||||
*/
|
||||
if ((ch == '.') && (digit_flag)) {
|
||||
dot_cnt++;
|
||||
ip_addr = ((ip_addr << 8) | num);
|
||||
num = 0;
|
||||
digit_flag = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* if get here invalid dotted IP character or missing digit */
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Must have seen 3 dots exactly and at least 1 trailing digit
|
||||
*/
|
||||
if ((dot_cnt != 3) || (!digit_flag)) {
|
||||
return (1);
|
||||
}
|
||||
|
||||
ip_addr = ((ip_addr << 8) | num);
|
||||
|
||||
ip_addr = ntohl(ip_addr); /* convert to Telecaster format */
|
||||
cpr_addr->type = CPR_IP_ADDR_IPV4;
|
||||
*addr = ip_addr;
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Parse an IP address.
|
||||
* If the IP address value is set to "" or to "UNPROVISIONED" it
|
||||
* is set to its' default value.
|
||||
*/
|
||||
int
|
||||
cfgfile_parse_ip (const var_t *entry, const char *value)
|
||||
{
|
||||
// RAC - Defaults will need to be handled on the Java Side.
|
||||
// if ((*value == NUL) || (cpr_strcasecmp(value, "UNPROVISIONED") == 0)) {
|
||||
// cfgfile_set_default(entry);
|
||||
// return (0);
|
||||
// } else {
|
||||
return (str2ip(value, (cpr_ip_addr_t *) entry->addr));
|
||||
// }
|
||||
}
|
||||
|
||||
/*
|
||||
* Print (format) an IP address.
|
||||
* The IP address to be printed is in the Telecaster "byte reversed"
|
||||
* order. Eg. 0xf8332ca1 = 248.51.44.161
|
||||
*/
|
||||
int
|
||||
cfgfile_print_ip (const var_t *entry, char *buf, int len)
|
||||
{
|
||||
// RT phones receive the IP address in this order: 0xf8332ca1 = 161.44.51.248
|
||||
cpr_ip_addr_t *cprIpAddrPtr = (cpr_ip_addr_t *)entry->addr;
|
||||
|
||||
if (cprIpAddrPtr->type == CPR_IP_ADDR_IPV4) {
|
||||
sprint_ip(buf, cprIpAddrPtr->u.ip4);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Print (format) an IP address.
|
||||
* The IP address to be printed is in the non-Telecaster "byte reversed"
|
||||
* order - which is really network order. Eg. 0xa12c33f8 = 161.44.51.248
|
||||
*/
|
||||
int
|
||||
cfgfile_print_ip_ntohl (const var_t *entry, char *buf, int len)
|
||||
{
|
||||
uint32_t ip;
|
||||
|
||||
ip = *(uint32_t *) entry->addr;
|
||||
return (snprintf(buf, len, get_debug_string(DEBUG_IP_PRINT),
|
||||
((ip >> 24) & (0xff)), ((ip >> 16) & (0xff)),
|
||||
((ip >> 8) & (0xff)), ((ip >> 0) & (0xff))));
|
||||
}
|
||||
|
||||
/*
|
||||
* parse (copy) an ascii string
|
||||
*/
|
||||
int
|
||||
cfgfile_parse_str (const var_t *entry, const char *value)
|
||||
{
|
||||
int str_len;
|
||||
|
||||
/* fixme: this could use malloc, or offer a different */
|
||||
/* fixme: parser routine that does like parse_str_ptr */
|
||||
/* fixme: in that case, free the old string and */
|
||||
/* fixme: strdup the new string */
|
||||
|
||||
str_len = strlen(value);
|
||||
if (str_len + 1 > entry->length) {
|
||||
err_msg(get_debug_string(DEBUG_PARSER_STRING_TOO_LARGE),
|
||||
entry->length, str_len);
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy string into config block
|
||||
*/
|
||||
sstrncpy((char *)entry->addr, value, entry->length);
|
||||
return (0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Print (format) at string
|
||||
*/
|
||||
int
|
||||
cfgfile_print_str (const var_t *entry, char *buf, int len)
|
||||
{
|
||||
return (snprintf(buf, len, "%s", (char *)entry->addr));
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse an ascii integer into binary
|
||||
*/
|
||||
int
|
||||
cfgfile_parse_int (const var_t *entry, const char *value)
|
||||
{
|
||||
unsigned int num;
|
||||
char ch;
|
||||
|
||||
num = 0;
|
||||
|
||||
if (strcmp(value, "UNPROVISIONED") == 0) {
|
||||
num = 0;
|
||||
} else {
|
||||
while (1) {
|
||||
ch = *value++;
|
||||
if (!ch)
|
||||
break; /* end of string */
|
||||
/*
|
||||
* Check for digits 0 through 9
|
||||
*/
|
||||
if (IS_DIGIT(ch)) {
|
||||
num = num * 10 + (ch - '0');
|
||||
continue;
|
||||
}
|
||||
|
||||
/* if get here invalid decimal character */
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
switch (entry->length) {
|
||||
case 1:
|
||||
*(uint8_t *) entry->addr = (uint8_t) num;
|
||||
break;
|
||||
case 2:
|
||||
*(uint16_t *) entry->addr = (uint16_t) num;
|
||||
break;
|
||||
case 4:
|
||||
*(uint32_t *) entry->addr = num;
|
||||
break;
|
||||
default:
|
||||
*(unsigned int *) entry->addr = num;
|
||||
break;
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* print (format) an Integer
|
||||
*/
|
||||
int
|
||||
cfgfile_print_int (const var_t *entry, char *buf, int len)
|
||||
{
|
||||
unsigned int value;
|
||||
|
||||
switch (entry->length) {
|
||||
case 1:
|
||||
value = *(uint8_t *) entry->addr;
|
||||
break;
|
||||
case 2:
|
||||
value = *(uint16_t *) entry->addr;
|
||||
break;
|
||||
case 4:
|
||||
value = *(uint32_t *) entry->addr;
|
||||
break;
|
||||
default:
|
||||
value = *(unsigned int *) entry->addr;
|
||||
break;
|
||||
}
|
||||
return (snprintf(buf, len, "%u", value));
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse a keytable. A key table is a list of keywords. For each
|
||||
* keyword there is an associated enum value (key value).
|
||||
* search the keyword table for a matching keyword, and if found
|
||||
* set the variable to the matching emum value.
|
||||
*/
|
||||
int
|
||||
cfgfile_parse_key (const var_t *entry, const char *value)
|
||||
{
|
||||
const key_table_entry_t *keytable;
|
||||
|
||||
keytable = entry->key_table;
|
||||
|
||||
if (keytable == NULL) {
|
||||
err_msg(get_debug_string(DEBUG_PARSER_NULL_KEY_TABLE));
|
||||
return (1);
|
||||
}
|
||||
|
||||
// RAC - This (If Needed) Will need to be moved to the Java Side.
|
||||
// /* check for nulled out keys and set to the default value */
|
||||
// if ((cpr_strcasecmp(value,"UNPROVISIONED") == 0) ||
|
||||
// (value[0] == 0)) {
|
||||
// err_msg(get_debug_string(DEBUG_PARSER_SET_DEFAULT),
|
||||
// entry->name, entry->default_value);
|
||||
// cfgfile_set_default(entry);
|
||||
// return(0);
|
||||
// }
|
||||
|
||||
while (keytable->name) {
|
||||
if (cpr_strcasecmp(value, keytable->name) == 0) {
|
||||
*(unsigned int *) entry->addr = keytable->value;
|
||||
return (0);
|
||||
}
|
||||
keytable++;
|
||||
}
|
||||
|
||||
err_msg(get_debug_string(DEBUG_PARSER_UNKNOWN_KEY), value);
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* print (format) a key value. Search the table for the matching
|
||||
* enum type, then format as output the keyname associated with it.
|
||||
*/
|
||||
int
|
||||
cfgfile_print_key (const var_t *entry, char *buf, int len)
|
||||
{
|
||||
const key_table_entry_t *keytable;
|
||||
int value;
|
||||
|
||||
keytable = entry->key_table;
|
||||
value = *(int *) entry->addr;
|
||||
|
||||
while (keytable->name) {
|
||||
if (value == keytable->value) {
|
||||
return (snprintf(buf, len, "%s", keytable->name));
|
||||
}
|
||||
keytable++;
|
||||
}
|
||||
|
||||
err_msg(get_debug_string(DEBUG_PARSER_UNKNOWN_KEY_ENUM), value);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Sprintf an IP address in dotted notation.
|
||||
*/
|
||||
int
|
||||
sprint_ip (char *buf, uint32_t ip)
|
||||
{
|
||||
return (sprintf(buf, get_debug_string(DEBUG_IP_PRINT),
|
||||
((ip >> 0) & (0xff)), ((ip >> 8) & (0xff)),
|
||||
((ip >> 16) & (0xff)), ((ip >> 24) & (0xff))));
|
||||
}
|
||||
|
||||
/*
|
||||
* print (format) a MAC address
|
||||
*/
|
||||
int
|
||||
cfgfile_print_mac (const var_t *entry, char *buf, int len)
|
||||
{
|
||||
return (snprintf(buf, len, get_debug_string(DEBUG_MAC_PRINT),
|
||||
((uint8_t *) entry->addr)[0] * 256 +
|
||||
((uint8_t *) entry->addr)[1],
|
||||
((uint8_t *) entry->addr)[2] * 256 +
|
||||
((uint8_t *) entry->addr)[3],
|
||||
((uint8_t *) entry->addr)[4] * 256 +
|
||||
((uint8_t *) entry->addr)[5]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a keytable. A key table is a list of keywords. For each
|
||||
* keyword there is an associated enum value (key value).
|
||||
* search the keyword table for a matching keyword, and if found
|
||||
* save the entire key etnry into the table.
|
||||
*
|
||||
* @param[in] entry - pointer ot var_t.
|
||||
* @param[in] value - pointer to const. string of configuration value.
|
||||
*
|
||||
* @return 1 - failed to parsed the configuration.
|
||||
* 0 - succesfull parsed the configuration value.
|
||||
*
|
||||
* @pre (entry != NULL)
|
||||
* @pre (value != NULL)
|
||||
*/
|
||||
int
|
||||
cfgfile_parse_key_entry (const var_t *entry, const char *value)
|
||||
{
|
||||
const key_table_entry_t *keytable;
|
||||
|
||||
keytable = entry->key_table;
|
||||
|
||||
if (keytable == NULL) {
|
||||
err_msg(get_debug_string(DEBUG_PARSER_NULL_KEY_TABLE));
|
||||
return (1);
|
||||
}
|
||||
|
||||
while (keytable->name) {
|
||||
if (cpr_strcasecmp(value, keytable->name) == 0) {
|
||||
/* keep the entire entry */
|
||||
*(key_table_entry_t *)entry->addr = *keytable;
|
||||
return (0);
|
||||
}
|
||||
keytable++;
|
||||
}
|
||||
|
||||
err_msg(get_debug_string(DEBUG_PARSER_UNKNOWN_KEY), value);
|
||||
return (1);
|
||||
}
|
||||
|
||||
/**
|
||||
* print (format) a key value. Print the name of the key out.
|
||||
*
|
||||
* @param[in] entry - pointer ot var_t.
|
||||
* @param[in] value - pointer to const. string of configuration value.
|
||||
*
|
||||
* @return always return 0.
|
||||
*
|
||||
* @pre (entry != NULL)
|
||||
* @pre (value != NULL)
|
||||
*/
|
||||
int
|
||||
cfgfile_print_key_entry (const var_t *entry, char *buf, int len)
|
||||
{
|
||||
key_table_entry_t *key;
|
||||
|
||||
key = (key_table_entry_t *) entry->addr;
|
||||
if (key->name != NULL) {
|
||||
return (snprintf(buf, len, "%s", key->name));
|
||||
} else {
|
||||
/* the entry is not even configured */
|
||||
return (0);
|
||||
}
|
||||
}
|
96
libs/sipcc/core/common/cfgfile_utils.h
Executable file
96
libs/sipcc/core/common/cfgfile_utils.h
Executable file
@ -0,0 +1,96 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _CFGFILE_UTILS_H_
|
||||
#define _CFGFILE_UTILS_H_
|
||||
|
||||
#include "cpr_types.h"
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// Structure/Type definitions
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
struct var_struct;
|
||||
|
||||
typedef int (*parse_func_t)(const struct var_struct *, const char *);
|
||||
typedef int (*print_func_t)(const struct var_struct *, char *, int);
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
int value;
|
||||
} key_table_entry_t;
|
||||
|
||||
#define NULL_KEY (-1)
|
||||
|
||||
typedef struct var_struct {
|
||||
const char *name;
|
||||
void *addr;
|
||||
int length;
|
||||
parse_func_t parse_func;
|
||||
print_func_t print_func;
|
||||
const key_table_entry_t *key_table;
|
||||
} var_t;
|
||||
|
||||
/*********************************************************
|
||||
*
|
||||
* Config Table "Helper" Routines
|
||||
*
|
||||
* These #defines are routines that are called from the
|
||||
* config table entries to parse (PA), print (PR),
|
||||
* and export (XP), different config entries. These are the
|
||||
* "common" helper routines. Protocol-specific routines
|
||||
* are located in prot_configmgr_private.h
|
||||
*
|
||||
*********************************************************/
|
||||
#define PA_IP cfgfile_parse_ip
|
||||
#define PR_IP cfgfile_print_ip
|
||||
#define PR_IPN cfgfile_print_ip_ntohl
|
||||
#define PA_STR cfgfile_parse_str
|
||||
#define PR_STR cfgfile_print_str
|
||||
#define PA_INT cfgfile_parse_int
|
||||
#define PR_INT cfgfile_print_int
|
||||
#define PA_KEY cfgfile_parse_key
|
||||
#define PA_KEYE cfgfile_parse_key_entry
|
||||
#define PR_KEY cfgfile_print_key
|
||||
#define PR_KEYE cfgfile_print_key_entry
|
||||
#define PR_MAC cfgfile_print_mac
|
||||
#define XP_NONE 0
|
||||
|
||||
/*********************************************************
|
||||
*
|
||||
* Config Table "Helper" Macros
|
||||
*
|
||||
* These macros are used to help build the actual config
|
||||
* table. They provide the address and length of the
|
||||
* entries. They also tell which table the entry is
|
||||
* stored in.
|
||||
*
|
||||
*********************************************************/
|
||||
#define CFGADDR(field) ((void*)&(prot_cfg_block.field))
|
||||
#define CFGLEN(field) (sizeof(prot_cfg_block.field))
|
||||
#define CFGVAR(field) CFGADDR(field),CFGLEN(field)
|
||||
|
||||
/* generic config file parsing functions */
|
||||
int cfgfile_parse_ip(const var_t *, const char *value);
|
||||
int cfgfile_parse_str(const var_t *, const char *value);
|
||||
int cfgfile_parse_int(const var_t *, const char *value);
|
||||
int cfgfile_parse_key(const var_t *, const char *value);
|
||||
int cfgfile_parse_key_entry(const var_t *, const char *value);
|
||||
|
||||
/* generic config file printing functions */
|
||||
int cfgfile_print_ip(const var_t *, char *buf, int);
|
||||
int cfgfile_print_ip_ntohl(const var_t *, char *buf, int);
|
||||
int cfgfile_print_str(const var_t *, char *buf, int);
|
||||
int cfgfile_print_int(const var_t *, char *buf, int);
|
||||
int cfgfile_print_key(const var_t *, char *buf, int);
|
||||
int cfgfile_print_key_entry(const var_t *, char *buf, int);
|
||||
|
||||
/* generic config file export (print) functions */
|
||||
int sprint_ip(char *, uint32_t ip);
|
||||
int sprint_mac(char *, const unsigned char *ptr);
|
||||
int cfgfile_print_mac(const var_t *entry, char *buf, int);
|
||||
|
||||
#endif /* _CFGFILE_UTILS_H_ */
|
498
libs/sipcc/core/common/config_api.c
Executable file
498
libs/sipcc/core/common/config_api.c
Executable file
@ -0,0 +1,498 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "cpr_types.h"
|
||||
#include "cpr_stdio.h"
|
||||
#include "cpr_string.h"
|
||||
#include "config.h"
|
||||
#include "dns_utils.h"
|
||||
#include "phone_debug.h"
|
||||
#include "ccapi.h"
|
||||
#include "debug.h"
|
||||
|
||||
cc_int32_t ConfigDebug;
|
||||
|
||||
/*
|
||||
* This file contains the API routines that are used to
|
||||
* access the config table.
|
||||
*
|
||||
* Avoid writing more of these routines.
|
||||
* Try and reuse these routines as much as possible.
|
||||
*
|
||||
* We should be able to set and retrieve any type of value
|
||||
* using one of these routines.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Function: config_get_string()
|
||||
*
|
||||
* Description: Get any arbitrary config entry as a string
|
||||
*
|
||||
* Parameters: id - The id of the config string to get
|
||||
* buffer - Empty buffer where string will be copied
|
||||
* buffer_len - length of the buffer where string will be copied
|
||||
*
|
||||
* Returns: None
|
||||
*/
|
||||
void
|
||||
config_get_string (int id, char *buffer, int buffer_len)
|
||||
{
|
||||
const var_t *entry;
|
||||
char *buf_start;
|
||||
|
||||
/*
|
||||
* Set the result to be empty in case we can't find anything
|
||||
*/
|
||||
buffer[0] = 0;
|
||||
if ((id >= 0) && (id < CFGID_PROTOCOL_MAX)) {
|
||||
entry = &prot_cfg_table[id];
|
||||
if (entry->length > buffer_len) {
|
||||
CONFIG_ERROR(CFG_F_PREFIX"insufficient buffer: %d\n", "config_get_string",
|
||||
id);
|
||||
} else {
|
||||
buf_start = buffer;
|
||||
entry->print_func(entry, buffer, buffer_len);
|
||||
CONFIG_DEBUG(DEB_F_PREFIX"CFGID %d: get str: %s = %s\n", DEB_F_PREFIX_ARGS(CONFIG_API, "config_get_string"), id, entry->name,
|
||||
buf_start);
|
||||
}
|
||||
} else {
|
||||
CONFIG_ERROR(CFG_F_PREFIX"Invalid ID: %d\n", "config_get_string", id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Function: config_set_string()
|
||||
*
|
||||
* Parameters: id - The id of the config string to set
|
||||
* buffer - The new value for the string
|
||||
*
|
||||
* Description: Set any arbitrary config entry as a string
|
||||
*
|
||||
* Returns: None
|
||||
*/
|
||||
void
|
||||
config_set_string (int id, char *buffer)
|
||||
{
|
||||
const var_t *entry;
|
||||
|
||||
if ((id >= 0) && (id < CFGID_PROTOCOL_MAX)) {
|
||||
entry = &prot_cfg_table[id];
|
||||
if (entry->parse_func(entry, buffer)) {
|
||||
/* Parse function returned an error */
|
||||
CONFIG_ERROR(CFG_F_PREFIX"Parse function failed. ID: %d %s:%s\n", "config_set_string", id, entry->name, buffer);
|
||||
} else {
|
||||
CONFIG_DEBUG(DEB_F_PREFIX"CFGID %d: %s set str to %s\n", DEB_F_PREFIX_ARGS(CONFIG_API, "config_set_string"), id, entry->name,
|
||||
buffer);
|
||||
}
|
||||
} else {
|
||||
CONFIG_ERROR(CFG_F_PREFIX"Invalid ID: %d\n", "config_set_string", id);
|
||||
}
|
||||
}
|
||||
|
||||
#define MAX_CONFIG_VAL_PRINT_LEN 256
|
||||
/*
|
||||
* Function: print_config_value()
|
||||
*
|
||||
* Description: If debug is enabled then print value contained in
|
||||
* the buffer. Cast and dereference the buffer ptr
|
||||
* according to length. If no match to char, short,
|
||||
* int or long then just print each byte (ex: MacAddr).
|
||||
* Called by config_set/get_value() function.
|
||||
*
|
||||
* Parameters: id - the id of the config value to get
|
||||
* get_set - config action (get val or set val)
|
||||
* entry_name - config id name
|
||||
* buffer - buffer containing the value
|
||||
* length - number of bytes in the buffer
|
||||
*
|
||||
* Returns: none
|
||||
*/
|
||||
/*
|
||||
* Some logical upper limit to avoid long print out in case
|
||||
* of large length value
|
||||
*/
|
||||
void
|
||||
print_config_value (int id, char *get_set, const char *entry_name,
|
||||
void *buffer, int length)
|
||||
{
|
||||
long long_val = 0;
|
||||
int int_val = 0;
|
||||
short short_val = 0;
|
||||
char char_val = 0;
|
||||
char str[MAX_CONFIG_VAL_PRINT_LEN];
|
||||
char *in_ptr;
|
||||
char *str_ptr;
|
||||
|
||||
if (length == sizeof(char)) {
|
||||
char_val = *(char *) buffer;
|
||||
long_val = (long) char_val;
|
||||
CONFIG_DEBUG(DEB_F_PREFIX"CFGID %d: %s: %s = %ld\n", DEB_F_PREFIX_ARGS(CONFIG_API, "print_config_value"), id, get_set, entry_name,
|
||||
long_val);
|
||||
} else if (length == sizeof(short)) {
|
||||
short_val = *(short *) buffer;
|
||||
long_val = (long) short_val;
|
||||
CONFIG_DEBUG(DEB_F_PREFIX"CFGID %d: %s: %s = %ld\n", DEB_F_PREFIX_ARGS(CONFIG_API, "print_config_value"), id, get_set, entry_name,
|
||||
long_val);
|
||||
} else if (length == sizeof(int)) {
|
||||
int_val = *(int *) buffer;
|
||||
long_val = (long) int_val;
|
||||
CONFIG_DEBUG(DEB_F_PREFIX"CFGID %d: %s: %s = %ld\n", DEB_F_PREFIX_ARGS(CONFIG_API, "print_config_value"), id, get_set, entry_name,
|
||||
long_val);
|
||||
} else if (length == sizeof(long)) {
|
||||
long_val = *(long *) buffer;
|
||||
CONFIG_DEBUG(DEB_F_PREFIX"CFGID %d: %s: %s = %ld\n", DEB_F_PREFIX_ARGS(CONFIG_API, "print_config_value"), id, get_set, entry_name,
|
||||
long_val);
|
||||
} else if (length < MAX_CONFIG_VAL_PRINT_LEN / 2) {
|
||||
|
||||
in_ptr = (char *) buffer;
|
||||
str_ptr = &str[0];
|
||||
while (length--) {
|
||||
sprintf(str_ptr++, "%02x", *in_ptr++);
|
||||
str_ptr++;
|
||||
}
|
||||
*str_ptr = '\0';
|
||||
CONFIG_DEBUG(DEB_F_PREFIX"CFGID %d: %s: %s = %s\n", DEB_F_PREFIX_ARGS(CONFIG_API, "print_config_value"), id, get_set, entry_name, str);
|
||||
} else {
|
||||
CONFIG_ERROR(CFG_F_PREFIX"cfg_id = %d length too long -> %d\n", "print_config_value",
|
||||
id, length);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: config_get_value()
|
||||
*
|
||||
* Description: Get any arbitrary config entry as a raw data value.
|
||||
* If the length doesn't match the actual length of the field,
|
||||
* nothing will be copied.
|
||||
*
|
||||
* Parameters: id - The id of the config value to get
|
||||
* buffer - Empty buffer where value will be copied
|
||||
* length - The number of bytes to get
|
||||
*
|
||||
* Returns: None
|
||||
*/
|
||||
void
|
||||
config_get_value (int id, void *buffer, int length)
|
||||
{
|
||||
const var_t *entry;
|
||||
|
||||
/*
|
||||
* Retrieve raw entry from table.....
|
||||
*/
|
||||
if ((id >= 0) && (id < CFGID_PROTOCOL_MAX)) {
|
||||
entry = &prot_cfg_table[id];
|
||||
if (length == entry->length) {
|
||||
memcpy(buffer, entry->addr, entry->length);
|
||||
|
||||
if (ConfigDebug) {
|
||||
print_config_value(id, "Get Val", entry->name, buffer, length);
|
||||
}
|
||||
} else {
|
||||
CONFIG_ERROR(CFG_F_PREFIX"%s size error\n", "config_get_value",
|
||||
entry->name);
|
||||
}
|
||||
} else {
|
||||
CONFIG_ERROR(CFG_F_PREFIX"Invalid ID: %d\n", "config_get_value", id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Function: config_set_value()
|
||||
*
|
||||
* Description: Set arbitrary config entry as a raw data value.
|
||||
* If the length doesn't match the actual length of the field,
|
||||
* nothing will be copied.
|
||||
*
|
||||
* Parameters: id - The id of the config value to set
|
||||
* buffer - The new value to be set
|
||||
* length - The number of bytes to set
|
||||
*
|
||||
* Returns: None
|
||||
*/
|
||||
void
|
||||
config_set_value (int id, void *buffer, int length)
|
||||
{
|
||||
const var_t *entry;
|
||||
|
||||
/*
|
||||
* Retrieve entry from table.....
|
||||
*/
|
||||
if ((id >= 0) && (id < CFGID_PROTOCOL_MAX)) {
|
||||
entry = &prot_cfg_table[id];
|
||||
if (entry->length != length) {
|
||||
CONFIG_ERROR(CFG_F_PREFIX" %s size error entry size=%d, len=%d\n",
|
||||
"config_set_value", entry->name, entry->length, length);
|
||||
return;
|
||||
}
|
||||
memcpy(entry->addr, buffer, entry->length);
|
||||
if (ConfigDebug) {
|
||||
print_config_value(id, "Set Val", entry->name, buffer, length);
|
||||
}
|
||||
} else {
|
||||
CONFIG_ERROR(CFG_F_PREFIX"Invalid ID: %d\n", "config_set_value", id);
|
||||
}
|
||||
}
|
||||
|
||||
/* Function: get_printable_cfg()
|
||||
*
|
||||
* Description: prints the config value in the buf
|
||||
*
|
||||
* Parameters: indx, buf, len
|
||||
*
|
||||
* Returns: buf
|
||||
*/
|
||||
char *
|
||||
get_printable_cfg(unsigned int indx, char *buf, unsigned int len)
|
||||
{
|
||||
const var_t *table;
|
||||
buf[0]=0;
|
||||
|
||||
table = &prot_cfg_table[indx];
|
||||
// If this field has a password, print the param name, but NOT the
|
||||
// real password
|
||||
if (indx>=CFGID_LINE_PASSWORD && indx < CFGID_LINE_PASSWORD+MAX_CONFIG_LINES) {
|
||||
// and add an invisible one
|
||||
sstrncpy(buf, "**********", MAX_CONFIG_VAL_PRINT_LEN);
|
||||
} else if ( table->print_func ) {
|
||||
table->print_func(table, buf, len);
|
||||
}
|
||||
|
||||
if ( buf[0] == 0 ) {
|
||||
sstrncpy(buf,"EMPTY", len);
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: show_config_cmd()
|
||||
*
|
||||
* Description: Callback passed in the config init routine for show config
|
||||
*
|
||||
* Parameters: argc, argv
|
||||
*
|
||||
* Returns: zero(0)
|
||||
*/
|
||||
|
||||
cc_int32_t
|
||||
show_config_cmd (cc_int32_t argc, const char *argv[])
|
||||
{
|
||||
const var_t *table;
|
||||
char buf[MAX_CONFIG_VAL_PRINT_LEN];
|
||||
int i, feat;
|
||||
|
||||
debugif_printf("\n------ Current *Cache* Configuration ------\n");
|
||||
table = prot_cfg_table;
|
||||
|
||||
for ( i=0; i < CFGID_LINE_FEATURE; i++ ) {
|
||||
if (table->print_func) {
|
||||
table->print_func(table, buf, sizeof(buf));
|
||||
|
||||
// If this field has a password, print the param name, but NOT the
|
||||
// real password
|
||||
if (strstr(table->name, "Password") != 0) {
|
||||
// and add an invisible one
|
||||
sstrncpy(buf, "**********", sizeof(buf));
|
||||
}
|
||||
debugif_printf("%s : %s\n", table->name, buf);
|
||||
}
|
||||
table++;
|
||||
}
|
||||
|
||||
debugif_printf("%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s\n",
|
||||
prot_cfg_table[CFGID_LINE_INDEX].name,
|
||||
prot_cfg_table[CFGID_LINE_FEATURE].name,
|
||||
prot_cfg_table[CFGID_LINE_MAXNUMCALLS].name,
|
||||
prot_cfg_table[CFGID_LINE_BUSY_TRIGGER].name,
|
||||
prot_cfg_table[CFGID_PROXY_ADDRESS].name,
|
||||
prot_cfg_table[CFGID_PROXY_PORT].name,
|
||||
prot_cfg_table[CFGID_LINE_CALL_WAITING].name,
|
||||
prot_cfg_table[CFGID_LINE_MSG_WAITING_LAMP].name,
|
||||
prot_cfg_table[CFGID_LINE_MESSAGE_WAITING_AMWI].name,
|
||||
prot_cfg_table[CFGID_LINE_RING_SETTING_IDLE].name,
|
||||
prot_cfg_table[CFGID_LINE_RING_SETTING_ACTIVE].name,
|
||||
prot_cfg_table[CFGID_LINE_NAME].name,
|
||||
prot_cfg_table[CFGID_LINE_AUTOANSWER_ENABLED].name,
|
||||
prot_cfg_table[CFGID_LINE_AUTOANSWER_MODE].name,
|
||||
prot_cfg_table[CFGID_LINE_AUTHNAME].name,
|
||||
prot_cfg_table[CFGID_LINE_PASSWORD].name,
|
||||
prot_cfg_table[CFGID_LINE_DISPLAYNAME].name,
|
||||
prot_cfg_table[CFGID_LINE_CONTACT].name);
|
||||
|
||||
for (i=0; i< MAX_CONFIG_LINES; i++) {
|
||||
config_get_value(CFGID_LINE_FEATURE+i, &feat, sizeof(feat));
|
||||
if ( feat != CC_FEATURE_NONE ){
|
||||
debugif_printf("%3s ", get_printable_cfg(CFGID_LINE_INDEX+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
|
||||
debugif_printf("%4s ", get_printable_cfg(CFGID_LINE_FEATURE+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
|
||||
debugif_printf("%3s ", get_printable_cfg(CFGID_LINE_MAXNUMCALLS+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
|
||||
debugif_printf("%3s ", get_printable_cfg(CFGID_LINE_BUSY_TRIGGER+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
|
||||
debugif_printf("%12s ", get_printable_cfg(CFGID_PROXY_ADDRESS+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
|
||||
debugif_printf("%s ", get_printable_cfg(CFGID_PROXY_PORT+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
|
||||
debugif_printf("%3s ", get_printable_cfg(CFGID_LINE_CALL_WAITING+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
|
||||
debugif_printf("%6s ", get_printable_cfg(CFGID_LINE_MSG_WAITING_LAMP+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
|
||||
debugif_printf("%6s ", get_printable_cfg(CFGID_LINE_MESSAGE_WAITING_AMWI+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
|
||||
debugif_printf("%6s ", get_printable_cfg(CFGID_LINE_RING_SETTING_IDLE+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
|
||||
debugif_printf("%6s ", get_printable_cfg(CFGID_LINE_RING_SETTING_ACTIVE+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
|
||||
debugif_printf(" %s ", get_printable_cfg(CFGID_LINE_NAME+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
|
||||
debugif_printf("%s ", get_printable_cfg(CFGID_LINE_AUTOANSWER_ENABLED+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
|
||||
debugif_printf("%s ", get_printable_cfg(CFGID_LINE_AUTOANSWER_MODE+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
|
||||
debugif_printf("%s ", get_printable_cfg(CFGID_LINE_AUTHNAME+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
|
||||
debugif_printf("%s ", get_printable_cfg(CFGID_LINE_PASSWORD+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
|
||||
debugif_printf("%s ", get_printable_cfg(CFGID_LINE_DISPLAYNAME+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
|
||||
debugif_printf("%s\n", get_printable_cfg(CFGID_LINE_CONTACT+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/**********************************************
|
||||
* Line-Based Config API
|
||||
**********************************************/
|
||||
|
||||
/*
|
||||
* Function: config_get_line_id()
|
||||
*
|
||||
* Description: Given the line and the line-specific ID, this function
|
||||
* will return the actual ID used to access the value in the
|
||||
* config table.
|
||||
*
|
||||
* Parameters: id - The id config value to get
|
||||
* line - The line that the ID is associated with
|
||||
*
|
||||
* Returns: TRUE if the entry is found
|
||||
* FALSE otherwise.
|
||||
*/
|
||||
static int
|
||||
config_get_line_id (int id, int line)
|
||||
{
|
||||
int line_id = 0;
|
||||
const var_t *entry;
|
||||
|
||||
if ((line == 0) || (line > MAX_REG_LINES)) {
|
||||
entry = &prot_cfg_table[id]; // XXX set but not used
|
||||
(void) entry;
|
||||
CONFIG_ERROR(CFG_F_PREFIX"ID=%d- line %d out of range\n", "config_get_line_id", id, line);
|
||||
return (0);
|
||||
}
|
||||
line_id = id + line - 1;
|
||||
|
||||
return (line_id);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Function: config_get_line_string()
|
||||
*
|
||||
* Description: Get any arbitrary line config entry as a string
|
||||
*
|
||||
* Parameters: id - The id of the config string to get
|
||||
* buffer - Empty buffer where string will be copied
|
||||
* line - The line that the ID is associated with
|
||||
* buffer_len - length of the output buffer
|
||||
*
|
||||
* Returns: None
|
||||
*/
|
||||
void
|
||||
config_get_line_string (int id, char *buffer, int line, int buffer_len)
|
||||
{
|
||||
int line_id = 0;
|
||||
|
||||
line_id = config_get_line_id(id, line);
|
||||
if (line_id) {
|
||||
config_get_string(line_id, buffer, buffer_len);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Function: config_set_line_string()
|
||||
*
|
||||
* Description: Set any arbitrary line config entry as a string
|
||||
*
|
||||
* Parameters: id - The id of the config string to set
|
||||
* buffer - The new value for the string
|
||||
* line - The line that the ID is associated with
|
||||
*
|
||||
* Returns: None
|
||||
*/
|
||||
void
|
||||
config_set_line_string (int id, char *buffer, int line)
|
||||
{
|
||||
int line_id = 0;
|
||||
|
||||
line_id = config_get_line_id(id, line);
|
||||
if (line_id) {
|
||||
config_set_string(line_id, buffer);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: config_get_line_value()
|
||||
*
|
||||
* Parameters: id - The id of the config value to get
|
||||
* *buffer - Empty buffer where value will be copied
|
||||
* length - The number of bytes to get
|
||||
* line - The line that the ID is associated with
|
||||
*
|
||||
* Description: Get any arbitrary line config entry as a raw data value.
|
||||
* If the length doesn't match the actual length of the field,
|
||||
* nothing will be copied.
|
||||
*
|
||||
* Returns: None
|
||||
*/
|
||||
void
|
||||
config_get_line_value (int id, void *buffer, int length, int line)
|
||||
{
|
||||
int line_id = 0;
|
||||
|
||||
line_id = config_get_line_id(id, line);
|
||||
if (line_id) {
|
||||
config_get_value(line_id, buffer, length);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: config_set_line_value()
|
||||
*
|
||||
* Description: Set arbitrary config entry as a raw data value.
|
||||
* If the length doesn't match the actual length of the field,
|
||||
* nothing will be copied.
|
||||
*
|
||||
* Parameters: id - The id of the config value to set
|
||||
* buffer - The new value to be set
|
||||
* length - The number of bytes to set
|
||||
* line - The line that the ID is associated with
|
||||
*
|
||||
* Returns: None
|
||||
*/
|
||||
void
|
||||
config_set_line_value (int id, void *buffer, int length, int line)
|
||||
{
|
||||
int line_id = 0;
|
||||
|
||||
line_id = config_get_line_id(id, line);
|
||||
if (line_id) {
|
||||
config_set_value(line_id, buffer, length);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: config_init()
|
||||
*
|
||||
* Description: Initialize the Config Debug command
|
||||
*
|
||||
* Parameters: none
|
||||
*
|
||||
* Returns: none
|
||||
*
|
||||
*/
|
||||
void
|
||||
config_init (void)
|
||||
{
|
||||
/* Place holder for future init related actions */
|
||||
}
|
640
libs/sipcc/core/common/config_parser.c
Normal file
640
libs/sipcc/core/common/config_parser.c
Normal file
@ -0,0 +1,640 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "cc_constants.h"
|
||||
#include "cc_types.h"
|
||||
#include "cc_config.h"
|
||||
#include "phone_debug.h"
|
||||
#include "debug.h"
|
||||
#include "ccapi.h"
|
||||
#include "prot_configmgr.h"
|
||||
#include "call_logger.h"
|
||||
#include "sip_common_transport.h"
|
||||
#include "sip_ccm_transport.h"
|
||||
#include "config_parser.h"
|
||||
#include "cc_device_feature.h"
|
||||
#include "ccapi_snapshot.h"
|
||||
#include "config_api.h"
|
||||
#include "capability_set.h"
|
||||
#include "util_string.h"
|
||||
|
||||
#define MAC_ADDR_SIZE 6
|
||||
#define FILE_PATH 256
|
||||
#define MAX_MULTI_LEVEL_CONFIG 2
|
||||
|
||||
#define MLCFG_VIDEO_CAPABILITY 0
|
||||
#define MLCFG_CISCO_CAMERA 1
|
||||
#define MLCFG_CAPABILITY_MAX 2
|
||||
#define MLCFG_NOT_SET -1
|
||||
|
||||
#define VERSION_LENGTH_MAX 100
|
||||
|
||||
#define ID_BLOCK_PREF1 1
|
||||
#define ID_BLOCK_PREF3 3
|
||||
/*
|
||||
* File location is hardcoded for getting mac and IP addr
|
||||
*/
|
||||
#define IP_ADDR_FILE "/sdcard/myip.txt"
|
||||
static char autoreg_name[MAX_LINE_NAME_SIZE];
|
||||
|
||||
static char fcpTemplateFile[FILE_PATH] = "";
|
||||
|
||||
char g_cfg_version_stamp[MAX_CFG_VERSION_STAMP_LEN + 1] = {0};
|
||||
int line = -1; //initialize line to -1, as 0 is valid line
|
||||
boolean apply_config = FALSE;
|
||||
cc_apply_config_result_t apply_config_result = APPLY_CONFIG_NONE;
|
||||
extern var_t prot_cfg_table[];
|
||||
void print_config_value (int id, char *get_set, const char *entry_name, void *buffer, int length);
|
||||
|
||||
static int sip_port[MAX_CCM];
|
||||
static int secured_sip_port[MAX_CCM];
|
||||
static int security_mode = 3; /*SECURE*/
|
||||
extern accessory_cfg_info_t g_accessoryCfgInfo;
|
||||
|
||||
// Configurable settings
|
||||
static int gTransportLayerProtocol = 4; // 4 = tcp, 2 = udp
|
||||
static boolean gP2PSIP = FALSE;
|
||||
static boolean gSDPMODE = FALSE;
|
||||
static int gVoipControlPort = 5060;
|
||||
static int gCcm1_sip_port = 5060;
|
||||
|
||||
/*
|
||||
* This function determine whether the passed config parameter should be used
|
||||
* in comparing the new and old config value for apply-config purpose. Only
|
||||
* those config ids on whose change phone needs to restart are part of this
|
||||
* function. For remaining parameters, it is assumed that any change can be
|
||||
* applied dynamically.
|
||||
*
|
||||
*/
|
||||
boolean is_cfgid_in_restart_list(int cfgid) {
|
||||
|
||||
if ((cfgid >= CFGID_LINE_FEATURE && cfgid < (CFGID_LINE_FEATURE + MAX_CONFIG_LINES)) ||
|
||||
(cfgid >= CFGID_LINE_INDEX && cfgid < (CFGID_LINE_INDEX + MAX_CONFIG_LINES)) ||
|
||||
(cfgid >= CFGID_PROXY_ADDRESS && cfgid < (CFGID_PROXY_ADDRESS + MAX_CONFIG_LINES)) ||
|
||||
(cfgid >= CFGID_PROXY_PORT && cfgid < (CFGID_PROXY_PORT + MAX_CONFIG_LINES)) ||
|
||||
(cfgid >= CFGID_LINE_NAME && cfgid < (CFGID_LINE_NAME + MAX_CONFIG_LINES)) ||
|
||||
(cfgid >= CFGID_LINE_DISPLAYNAME && cfgid < (CFGID_LINE_DISPLAYNAME + MAX_CONFIG_LINES)) ||
|
||||
(cfgid >= CFGID_LINE_SPEEDDIAL_NUMBER && cfgid < (CFGID_LINE_SPEEDDIAL_NUMBER + MAX_CONFIG_LINES)) ||
|
||||
(cfgid >= CFGID_LINE_MESSAGES_NUMBER && cfgid < (CFGID_LINE_MESSAGES_NUMBER + MAX_CONFIG_LINES)) ||
|
||||
(cfgid >= CFGID_LINE_FWD_CALLER_NAME_DIPLAY && cfgid < (CFGID_LINE_FWD_CALLER_NAME_DIPLAY + MAX_CONFIG_LINES)) ||
|
||||
(cfgid >= CFGID_LINE_FWD_CALLER_NUMBER_DIPLAY && cfgid < (CFGID_LINE_FWD_CALLER_NUMBER_DIPLAY + MAX_CONFIG_LINES)) ||
|
||||
(cfgid >= CFGID_LINE_FWD_REDIRECTED_NUMBER_DIPLAY && cfgid < (CFGID_LINE_FWD_REDIRECTED_NUMBER_DIPLAY + MAX_CONFIG_LINES)) ||
|
||||
(cfgid >= CFGID_LINE_FWD_DIALED_NUMBER_DIPLAY && cfgid < (CFGID_LINE_FWD_DIALED_NUMBER_DIPLAY + MAX_CONFIG_LINES)) ||
|
||||
(cfgid >= CFGID_LINE_CALL_WAITING && cfgid < (CFGID_LINE_CALL_WAITING + MAX_CONFIG_LINES)) ||
|
||||
(cfgid >= CFGID_LINE_AUTHNAME && cfgid < (CFGID_LINE_AUTHNAME + MAX_CONFIG_LINES)) ||
|
||||
(cfgid >= CFGID_LINE_PASSWORD && cfgid < (CFGID_LINE_PASSWORD + MAX_CONFIG_LINES)) ||
|
||||
(cfgid >= CFGID_LINE_FEATURE_OPTION_MASK && cfgid < (CFGID_LINE_FEATURE_OPTION_MASK + MAX_CONFIG_LINES)) ||
|
||||
(cfgid >= CFGID_LINE_MSG_WAITING_LAMP && cfgid < (CFGID_LINE_MSG_WAITING_LAMP + MAX_CONFIG_LINES)) ||
|
||||
(cfgid >= CFGID_LINE_MESSAGE_WAITING_AMWI && cfgid < (CFGID_LINE_MESSAGE_WAITING_AMWI + MAX_CONFIG_LINES)) ||
|
||||
(cfgid >= CFGID_LINE_RING_SETTING_IDLE && cfgid < (CFGID_LINE_RING_SETTING_IDLE + MAX_CONFIG_LINES)) ||
|
||||
(cfgid >= CFGID_LINE_RING_SETTING_ACTIVE && cfgid < (CFGID_LINE_RING_SETTING_ACTIVE + MAX_CONFIG_LINES)) ||
|
||||
(cfgid >= CFGID_LINE_CONTACT && cfgid < (CFGID_LINE_CONTACT + MAX_CONFIG_LINES)) ||
|
||||
(cfgid >= CFGID_LINE_MAXNUMCALLS && cfgid < (CFGID_LINE_MAXNUMCALLS + MAX_CONFIG_LINES)) ||
|
||||
(cfgid >= CFGID_LINE_BUSY_TRIGGER && cfgid < (CFGID_LINE_BUSY_TRIGGER + MAX_CONFIG_LINES)) ||
|
||||
(cfgid >= CFGID_LINE_AUTOANSWER_ENABLED && cfgid < (CFGID_LINE_AUTOANSWER_ENABLED + MAX_CONFIG_LINES)) ||
|
||||
(cfgid >= CFGID_LINE_AUTOANSWER_MODE && cfgid < (CFGID_LINE_AUTOANSWER_MODE + MAX_CONFIG_LINES))
|
||||
)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
switch (cfgid) {
|
||||
case CFGID_CCM1_ADDRESS:
|
||||
case CFGID_CCM2_ADDRESS:
|
||||
case CFGID_CCM3_ADDRESS:
|
||||
case CFGID_CCM1_SIP_PORT:
|
||||
case CFGID_CCM2_SIP_PORT:
|
||||
case CFGID_CCM3_SIP_PORT:
|
||||
|
||||
case CFGID_PROXY_BACKUP:
|
||||
case CFGID_PROXY_BACKUP_PORT:
|
||||
case CFGID_PROXY_EMERGENCY:
|
||||
case CFGID_PROXY_EMERGENCY_PORT:
|
||||
case CFGID_OUTBOUND_PROXY:
|
||||
case CFGID_OUTBOUND_PROXY_PORT:
|
||||
|
||||
case CFGID_PROXY_REGISTER:
|
||||
case CFGID_REMOTE_CC_ENABLED:
|
||||
|
||||
case CFGID_SIP_INVITE_RETX:
|
||||
case CFGID_SIP_RETX:
|
||||
case CFGID_TIMER_INVITE_EXPIRES:
|
||||
case CFGID_TIMER_KEEPALIVE_EXPIRES:
|
||||
case CFGID_TIMER_SUBSCRIBE_EXPIRES:
|
||||
case CFGID_TIMER_SUBSCRIBE_DELTA:
|
||||
case CFGID_TIMER_T1:
|
||||
case CFGID_TIMER_T2:
|
||||
|
||||
case CFGID_SIP_MAX_FORWARDS:
|
||||
case CFGID_REMOTE_PARTY_ID:
|
||||
case CFGID_REG_USER_INFO:
|
||||
|
||||
case CFGID_PREFERRED_CODEC:
|
||||
case CFGID_VOIP_CONTROL_PORT:
|
||||
case CFGID_NAT_ENABLE:
|
||||
case CFGID_NAT_ADDRESS:
|
||||
case CFGID_NAT_RECEIVED_PROCESSING:
|
||||
|
||||
case CFGID_DTMF_AVT_PAYLOAD:
|
||||
case CFGID_DTMF_DB_LEVEL:
|
||||
case CFGID_DTMF_OUTOFBAND:
|
||||
|
||||
case CFGID_KPML_ENABLED:
|
||||
case CFGID_MEDIA_PORT_RANGE_START:
|
||||
case CFGID_TRANSPORT_LAYER_PROT:
|
||||
|
||||
case CFGID_TIMER_REGISTER_EXPIRES:
|
||||
case CFGID_TIMER_REGISTER_DELTA:
|
||||
case CFGID_DSCP_FOR_CALL_CONTROL:
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This function either compare the new and old config value or set the value
|
||||
* for the config_id passed depending upon whether apply-config is true or not.
|
||||
*/
|
||||
void compare_or_set_byte_value(int cfgid, unsigned char value, const unsigned char * config_name) {
|
||||
int temp_value ;
|
||||
const var_t *entry;
|
||||
if (apply_config == TRUE) {
|
||||
if (is_cfgid_in_restart_list(cfgid) == TRUE) {
|
||||
config_get_value(cfgid, &temp_value, sizeof(temp_value));
|
||||
if (((int)value) != temp_value) {
|
||||
apply_config_result = RESTART_NEEDED;
|
||||
entry = &prot_cfg_table[cfgid];
|
||||
print_config_value(cfgid, "changed Get Val", entry->name, &temp_value, sizeof(temp_value));
|
||||
DEF_DEBUG(CFG_F_PREFIX "config %s[%d] changed. Old value=%d new value=%d\n", "compare_or_set_byte_value", config_name, cfgid, temp_value, value);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CC_Config_setByteValue(cfgid, value);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This function either compare the new and old config value or set the value
|
||||
* for the config_id passed depending upon whether apply-config is true or not.
|
||||
*/
|
||||
void compare_or_set_boolean_value(int cfgid, cc_boolean value, const unsigned char * config_name) {
|
||||
int temp_value ;
|
||||
const var_t *entry;
|
||||
if (apply_config == TRUE) {
|
||||
if (is_cfgid_in_restart_list(cfgid) == TRUE) {
|
||||
config_get_value(cfgid, &temp_value, sizeof(temp_value));
|
||||
if (((int)value) != temp_value) {
|
||||
apply_config_result = RESTART_NEEDED;
|
||||
entry = &prot_cfg_table[cfgid];
|
||||
print_config_value(cfgid, "changed Get Val", entry->name, &temp_value, sizeof(temp_value));
|
||||
DEF_DEBUG(CFG_F_PREFIX "config %s[%d] changed. Old value=%d new value=%d\n", "compare_or_set_boolean_value", config_name, cfgid, temp_value, value);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CC_Config_setBooleanValue(cfgid, value);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This function either compare the new and old config value or set the value
|
||||
* for the config_id passed depending upon whether apply-config is true or not.
|
||||
*/
|
||||
void compare_or_set_int_value(int cfgid, int value, const unsigned char * config_name) {
|
||||
int temp_value;
|
||||
const var_t *entry;
|
||||
if (apply_config == TRUE) {
|
||||
if (is_cfgid_in_restart_list(cfgid) == TRUE) {
|
||||
config_get_value(cfgid, &temp_value, sizeof(temp_value));
|
||||
if (value != temp_value) {
|
||||
apply_config_result = RESTART_NEEDED;
|
||||
entry = &prot_cfg_table[cfgid];
|
||||
print_config_value(cfgid, "changed Get Val", entry->name, &temp_value, sizeof(temp_value));
|
||||
|
||||
DEF_DEBUG(CFG_F_PREFIX "config %s[%d] changed. new value=%d Old value=%d\n", "compare_or_set_int_value", config_name, cfgid, value, temp_value);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CC_Config_setIntValue(cfgid, value);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This function either compare the new and old config value or set the value
|
||||
* for the config_id passed depending upon whether apply-config is true or not.
|
||||
*/
|
||||
void compare_or_set_string_value (int cfgid, const char* value, const unsigned char * config_name) {
|
||||
static char temp_value[MAX_SIP_URL_LENGTH];
|
||||
const var_t *entry;
|
||||
if (apply_config == TRUE ) {
|
||||
if (is_cfgid_in_restart_list(cfgid) == TRUE) {
|
||||
config_get_string(cfgid, temp_value, MAX_SIP_URL_LENGTH);
|
||||
if (strcmp(value, temp_value) != 0) {
|
||||
apply_config_result = RESTART_NEEDED;
|
||||
entry = &prot_cfg_table[cfgid];
|
||||
print_config_value(cfgid, "changed Get Val", entry->name, &temp_value, sizeof(temp_value));
|
||||
DEF_DEBUG(CFG_F_PREFIX "config %s[%d] changed. new value=%s Old value=%s\n", "compare_or_set_string_value", config_name, cfgid, value, temp_value);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CC_Config_setStringValue(cfgid, value);
|
||||
}
|
||||
}
|
||||
|
||||
int lineConfig = 0;
|
||||
int portConfig = 0;
|
||||
int proxyConfig = 0;
|
||||
|
||||
/*
|
||||
* config_set_autoreg_properties
|
||||
*
|
||||
*/
|
||||
void config_set_autoreg_properties ()
|
||||
{
|
||||
CC_Config_setIntValue(CFGID_LINE_INDEX + 0, 1);
|
||||
CC_Config_setIntValue(CFGID_LINE_FEATURE + 0, 9);
|
||||
CC_Config_setStringValue(CFGID_PROXY_ADDRESS + 0, "USECALLMANAGER");
|
||||
CC_Config_setIntValue(CFGID_PROXY_PORT + 0, 5060);
|
||||
CC_Config_setStringValue(CFGID_LINE_NAME + 0, autoreg_name);
|
||||
CC_Config_setBooleanValue(CFGID_PROXY_REGISTER, 1);
|
||||
CC_Config_setIntValue(CFGID_TRANSPORT_LAYER_PROT, 2);
|
||||
|
||||
/* timerRegisterExpires = 3600 */
|
||||
CC_Config_setIntValue(CFGID_TIMER_REGISTER_EXPIRES, 3600);
|
||||
/* sipRetx = 10 */
|
||||
CC_Config_setIntValue(CFGID_SIP_RETX, 10);
|
||||
/* sipInviteRetx = 6 */
|
||||
CC_Config_setIntValue(CFGID_SIP_INVITE_RETX, 6);
|
||||
/* timerRegisterDelta = 5 */
|
||||
CC_Config_setIntValue(CFGID_TIMER_REGISTER_DELTA, 5);
|
||||
/* MaxRedirects = 70 */
|
||||
CC_Config_setIntValue(CFGID_SIP_MAX_FORWARDS, 70);
|
||||
/* timerInviteExpires = 180 */
|
||||
CC_Config_setIntValue(CFGID_TIMER_INVITE_EXPIRES, 180);
|
||||
/* timerSubscribeDelta = 5 */
|
||||
CC_Config_setIntValue(CFGID_TIMER_SUBSCRIBE_DELTA, 5);
|
||||
/* timerSubscribeExpires = 120 */
|
||||
CC_Config_setIntValue(CFGID_TIMER_SUBSCRIBE_EXPIRES, 120);
|
||||
|
||||
CC_Config_setIntValue(CFGID_REMOTE_CC_ENABLED, 1);
|
||||
CC_Config_setIntValue(CFGID_VOIP_CONTROL_PORT, 5060);
|
||||
}
|
||||
|
||||
/*
|
||||
* update_security_mode_and_ports
|
||||
*
|
||||
*/
|
||||
void update_security_mode_and_ports(void) {
|
||||
sec_level_t sec_level = NON_SECURE;
|
||||
|
||||
// convert security mode (from UCM xml) into internal enum
|
||||
switch (security_mode)
|
||||
{
|
||||
case 1: sec_level = NON_SECURE; break;
|
||||
case 2: sec_level = AUTHENTICATED; break;
|
||||
case 3: sec_level = ENCRYPTED; break;
|
||||
default:
|
||||
CONFIG_ERROR(CFG_F_PREFIX "unable to translate securite mode [%d]\n", "update_security_mode_and_ports", (int)security_mode);
|
||||
break;
|
||||
}
|
||||
|
||||
compare_or_set_int_value(CFGID_CCM1_SEC_LEVEL, sec_level,
|
||||
(const unsigned char *)"deviceSecurityMode");
|
||||
compare_or_set_int_value(CFGID_CCM2_SEC_LEVEL, sec_level,
|
||||
(const unsigned char *)"deviceSecurityMode");
|
||||
compare_or_set_int_value(CFGID_CCM3_SEC_LEVEL, sec_level,
|
||||
(const unsigned char *)"deviceSecurityMode");
|
||||
|
||||
if (sec_level == NON_SECURE) {
|
||||
compare_or_set_int_value(CFGID_CCM1_SIP_PORT, sip_port[0],
|
||||
(const unsigned char *)"ccm1_sip_port");
|
||||
compare_or_set_int_value(CFGID_CCM2_SIP_PORT, sip_port[1],
|
||||
(const unsigned char *)"ccm2_sip_port");
|
||||
compare_or_set_int_value(CFGID_CCM3_SIP_PORT, sip_port[2],
|
||||
(const unsigned char *)"ccm3_sip_port");
|
||||
} else {
|
||||
compare_or_set_int_value(CFGID_CCM1_SIP_PORT, secured_sip_port[0],
|
||||
(const unsigned char *)"ccm1_secured_sip_port");
|
||||
compare_or_set_int_value(CFGID_CCM2_SIP_PORT, secured_sip_port[1],
|
||||
(const unsigned char *)"ccm2_secured_sip_port");
|
||||
compare_or_set_int_value(CFGID_CCM3_SIP_PORT, secured_sip_port[2],
|
||||
(const unsigned char *)"ccm3_secured_sip_port");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define MISSEDCALLS "Application:Cisco/MissedCalls"
|
||||
#define PLACEDCALLS "Application:Cisco/PlacedCalls"
|
||||
#define RECEIVEDCALLS "Application:Cisco/ReceivedCalls"
|
||||
|
||||
/*
|
||||
* config_get_mac_addr
|
||||
*
|
||||
* Get the filename that has the mac address and parse the string
|
||||
* convert it into an mac address stored in the bytearray maddr
|
||||
*/
|
||||
void config_get_mac_addr (char *maddr)
|
||||
{
|
||||
platGetMacAddr(maddr);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the MAC address in the config table
|
||||
*/
|
||||
void config_set_ccm_ip_mac ()
|
||||
{
|
||||
|
||||
char macaddr[MAC_ADDR_SIZE];
|
||||
|
||||
compare_or_set_int_value(CFGID_DSCP_FOR_CALL_CONTROL , 1, (const unsigned char *) "DscpCallControl");
|
||||
compare_or_set_int_value(CFGID_SPEAKER_ENABLED, 1, (const unsigned char *) "speakerEnabled");
|
||||
|
||||
if (apply_config == FALSE) {
|
||||
config_get_mac_addr(macaddr);
|
||||
|
||||
CONFIG_DEBUG(CFG_F_PREFIX ": MAC Address IS: %x:%x:%x:%x:%x:%x \n",
|
||||
"config_get_mac_addr", macaddr[0], macaddr[1],
|
||||
macaddr[2], macaddr[3], macaddr[4], macaddr[5]);
|
||||
|
||||
CC_Config_setArrayValue(CFGID_MY_MAC_ADDR, macaddr, MAC_ADDR_SIZE);
|
||||
CC_Config_setArrayValue(CFGID_MY_ACTIVE_MAC_ADDR, macaddr, MAC_ADDR_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* config_setup_element
|
||||
* Setup elements that once were downloaded from CUCM in an XML file.
|
||||
* Settings are stored in config.h
|
||||
*/
|
||||
void config_setup_elements (const char *sipUser, const char *sipPassword, const char *sipDomain)
|
||||
{
|
||||
unsigned int i;
|
||||
char buf[MAX_SIP_URL_LENGTH] = {'\0'};
|
||||
char ip[MAX_SIP_URL_LENGTH] = {'\0'};
|
||||
char option[MAX_SIP_URL_LENGTH] = {'\0'};
|
||||
int line = 0;
|
||||
cc_boolean isSecure = FALSE, isValid = TRUE;
|
||||
char macaddr[MAC_ADDR_SIZE];
|
||||
|
||||
compare_or_set_int_value(CFGID_MEDIA_PORT_RANGE_START, gStartMediaPort, (const unsigned char *) "startMediaPort");
|
||||
compare_or_set_int_value(CFGID_MEDIA_PORT_RANGE_END, gStopMediaPort, (const unsigned char *) "stopMediaPort");
|
||||
compare_or_set_boolean_value(CFGID_CALLERID_BLOCKING, gCallerIdBlocking, (const unsigned char *) "callerIdBlocking");
|
||||
compare_or_set_boolean_value(CFGID_ANONYMOUS_CALL_BLOCK, gAnonblock, (const unsigned char *) "anonymousCallBlock");
|
||||
compare_or_set_string_value(CFGID_PREFERRED_CODEC, gPreferredCodec, (const unsigned char *) "preferredCodec");
|
||||
compare_or_set_string_value(CFGID_DTMF_OUTOFBAND, gDtmfOutOfBand, (const unsigned char *) "dtmfOutofBand");
|
||||
compare_or_set_int_value(CFGID_DTMF_AVT_PAYLOAD, gDtmfAvtPayload, (const unsigned char *) "dtmfAvtPayload");
|
||||
compare_or_set_int_value(CFGID_DTMF_DB_LEVEL, gDtmfDbLevel, (const unsigned char *) "dtmfDbLevel");
|
||||
compare_or_set_int_value(CFGID_SIP_RETX, gSipRetx, (const unsigned char *) "sipRetx");
|
||||
compare_or_set_int_value(CFGID_SIP_INVITE_RETX, gSipInviteRetx, (const unsigned char *) "sipInviteRetx");
|
||||
compare_or_set_int_value(CFGID_TIMER_T1, gTimerT1, (const unsigned char *) "timerT1");
|
||||
compare_or_set_int_value(CFGID_TIMER_T2, gTimerT2, (const unsigned char *) "timerT2");
|
||||
compare_or_set_int_value(CFGID_TIMER_INVITE_EXPIRES, gTimerInviteExpires, (const unsigned char *) "timerInviteExpires");
|
||||
compare_or_set_int_value(CFGID_TIMER_REGISTER_EXPIRES, gTimerRegisterExpires, (const unsigned char *) "timerRegisterExpires");
|
||||
compare_or_set_boolean_value(CFGID_PROXY_REGISTER, gRegisterWithProxy, (const unsigned char *) "registerWithProxy");
|
||||
compare_or_set_string_value(CFGID_PROXY_BACKUP, gBackupProxy, (const unsigned char *) "backupProxy");
|
||||
compare_or_set_int_value(CFGID_PROXY_BACKUP_PORT, gBackupProxyPort, (const unsigned char *) "backupProxyPort");
|
||||
compare_or_set_string_value(CFGID_PROXY_EMERGENCY, gEmergencyProxy, (const unsigned char *) "emergencyProxy");
|
||||
compare_or_set_int_value(CFGID_PROXY_EMERGENCY_PORT, gEmergencyProxyPort, (const unsigned char *) "emergencyProxyPort");
|
||||
compare_or_set_string_value(CFGID_OUTBOUND_PROXY, gOutboundProxy, (const unsigned char *) "outboundProxy");
|
||||
compare_or_set_int_value(CFGID_OUTBOUND_PROXY_PORT, gOutboundProxyPort, (const unsigned char *) "outboundProxyPort");
|
||||
compare_or_set_boolean_value(CFGID_NAT_RECEIVED_PROCESSING, gNatRecievedProcessing, (const unsigned char *) "natRecievedProcessing");
|
||||
compare_or_set_string_value(CFGID_REG_USER_INFO, gUserInfo, (const unsigned char *) "userInfo");
|
||||
compare_or_set_boolean_value(CFGID_REMOTE_PARTY_ID, gRemotePartyID, (const unsigned char *) "remotePartyID");
|
||||
compare_or_set_boolean_value (CFGID_SEMI_XFER, gSemiAttendedTransfer, (const unsigned char *) "semiAttendedTransfer");
|
||||
compare_or_set_int_value(CFGID_CALL_HOLD_RINGBACK, gCallHoldRingback, (const unsigned char *) "callHoldRingback");
|
||||
compare_or_set_boolean_value(CFGID_STUTTER_MSG_WAITING, gStutterMsgWaiting, (const unsigned char *) "stutterMsgWaiting");
|
||||
compare_or_set_string_value(CFGID_CALL_FORWARD_URI, gCallForwardURI, (const unsigned char *) "callForwardURI");
|
||||
compare_or_set_boolean_value(CFGID_CALL_STATS, gCallStats, (const unsigned char *) "callStats");
|
||||
compare_or_set_int_value(CFGID_TIMER_REGISTER_DELTA, gTimerRegisterDelta, (const unsigned char *) "timerRegisterDelta");
|
||||
compare_or_set_int_value(CFGID_SIP_MAX_FORWARDS, gMaxRedirects, (const unsigned char *) "maxRedirects");
|
||||
compare_or_set_boolean_value(CFGID_2543_HOLD, gRfc2543Hold, (const unsigned char *) "rfc2543Hold");
|
||||
compare_or_set_boolean_value(CFGID_LOCAL_CFWD_ENABLE, gLocalCfwdEnable, (const unsigned char *) "localCfwdEnable");
|
||||
compare_or_set_int_value(CFGID_CONN_MONITOR_DURATION, gConnectionMonitorDuration, (const unsigned char *) "connectionMonitorDuration");
|
||||
compare_or_set_int_value(CFGID_CALL_LOG_BLF_ENABLED, gCallLogBlfEnabled, (const unsigned char *) "callLogBlfEnabled");
|
||||
compare_or_set_boolean_value(CFGID_RETAIN_FORWARD_INFORMATION, gRetainForwardInformation, (const unsigned char *) "retainForwardInformation");
|
||||
compare_or_set_int_value(CFGID_REMOTE_CC_ENABLED, gRemoteCcEnable, (const unsigned char *) "remoteCcEnable");
|
||||
compare_or_set_int_value(CFGID_TIMER_KEEPALIVE_EXPIRES, gTimerKeepAliveExpires, (const unsigned char *) "timerKeepAliveExpires");
|
||||
compare_or_set_int_value(CFGID_TIMER_SUBSCRIBE_EXPIRES, gTimerSubscribeExpires, (const unsigned char *) "timerSubscribeExpires");
|
||||
compare_or_set_int_value(CFGID_TIMER_SUBSCRIBE_DELTA, gTimerSubscribeDelta, (const unsigned char *) "timerSubscribeDelta");
|
||||
compare_or_set_int_value(CFGID_TRANSPORT_LAYER_PROT, gTransportLayerProtocol, (const unsigned char *) "transportLayerProtocol");
|
||||
compare_or_set_int_value(CFGID_KPML_ENABLED, gKpml, (const unsigned char *) "kpml");
|
||||
compare_or_set_boolean_value(CFGID_NAT_ENABLE, gNatEnabled, (const unsigned char *) "natEnabled");
|
||||
compare_or_set_string_value(CFGID_NAT_ADDRESS, gNatAddress, (const unsigned char *) "natAddress");
|
||||
compare_or_set_int_value(CFGID_VOIP_CONTROL_PORT, gVoipControlPort, (const unsigned char *) "voipControlPort");
|
||||
compare_or_set_boolean_value(CFGID_ENABLE_VAD, gAnableVad, (const unsigned char *) "enableVad");
|
||||
compare_or_set_boolean_value(CFGID_AUTOANSWER_IDLE_ALTERNATE, gAutoAnswerAltBehavior, (const unsigned char *) "autoAnswerAltBehavior");
|
||||
compare_or_set_int_value(CFGID_AUTOANSWER_TIMER, gAutoAnswerTimer, (const unsigned char *) "autoAnswerTimer");
|
||||
compare_or_set_boolean_value(CFGID_AUTOANSWER_OVERRIDE, gAutoAnswerOverride, (const unsigned char *) "autoAnswerOverride");
|
||||
compare_or_set_int_value(CFGID_OFFHOOK_TO_FIRST_DIGIT_TIMER, gOffhookToFirstDigitTimer, (const unsigned char *) "offhookToFirstDigitTimer");
|
||||
compare_or_set_int_value(CFGID_CALL_WAITING_SILENT_PERIOD, gSilentPeriodBetweenCallWaitingBursts, (const unsigned char *) "silentPeriodBetweenCallWaitingBursts");
|
||||
compare_or_set_int_value(CFGID_RING_SETTING_BUSY_POLICY, gRingSettingBusyStationPolicy, (const unsigned char *) "ringSettingBusyStationPolicy");
|
||||
compare_or_set_int_value (CFGID_BLF_ALERT_TONE_IDLE, gBlfAudibleAlertSettingOfIdleStation, (const unsigned char *) "blfAudibleAlertSettingOfIdleStation");
|
||||
compare_or_set_int_value (CFGID_BLF_ALERT_TONE_BUSY, gBlfAudibleAlertSettingOfBusyStation, (const unsigned char *) "blfAudibleAlertSettingOfBusyStation");
|
||||
compare_or_set_int_value (CFGID_JOIN_ACROSS_LINES, gJoinAcrossLines, (const unsigned char *) "joinAcrossLines");
|
||||
compare_or_set_boolean_value(CFGID_CNF_JOIN_ENABLE, gCnfJoinEnabled, (const unsigned char *) "cnfJoinEnabled");
|
||||
compare_or_set_int_value (CFGID_ROLLOVER, gRollover, (const unsigned char *) "rollover");
|
||||
compare_or_set_boolean_value(CFGID_XFR_ONHOOK_ENABLED, gTransferOnhookEnabled, (const unsigned char *) "transferOnhookEnabled");
|
||||
compare_or_set_int_value(CFGID_DSCP_AUDIO, gDscpForAudio, (const unsigned char *) "dscpForAudio");
|
||||
compare_or_set_int_value(CFGID_DSCP_VIDEO, gDscpVideo, (const unsigned char *) "dscpVideo");
|
||||
compare_or_set_int_value(CFGID_INTER_DIGIT_TIMER, gT302Timer, (const unsigned char *) "T302Timer");
|
||||
|
||||
// TODO(emannion): You had line=1; line<= ....
|
||||
// Debugging suggests that alghouth *line* is 1-indexed, the config entries
|
||||
// are 1-indexed. See. config_get_line_id().
|
||||
// You may want to rewrite this in terms of config_get_line_id().
|
||||
// Please check -- EKR
|
||||
for(line = 0; line < MAX_REG_LINES; line++) {
|
||||
|
||||
compare_or_set_int_value(CFGID_LINE_INDEX + line, gLineIndex, (const unsigned char *)"lineIndex");
|
||||
compare_or_set_int_value(CFGID_LINE_FEATURE + line, gFeatureID, (const unsigned char *) "featureID");
|
||||
compare_or_set_string_value(CFGID_PROXY_ADDRESS + line, gProxy, (const unsigned char *) "proxy");
|
||||
compare_or_set_int_value(CFGID_PROXY_PORT + line, gPort, (const unsigned char *) "port");
|
||||
|
||||
if ( apply_config == FALSE ) {
|
||||
ccsnap_set_line_label(line+1, "LINELABEL");
|
||||
}
|
||||
|
||||
compare_or_set_string_value(CFGID_LINE_NAME + line, sipUser, (const unsigned char *) "name");
|
||||
compare_or_set_string_value(CFGID_LINE_DISPLAYNAME + line, gDisplayName, (const unsigned char *) "displayName");
|
||||
compare_or_set_string_value(CFGID_LINE_MESSAGES_NUMBER + line, gMessagesNumber, (const unsigned char *) "messagesNumber");
|
||||
compare_or_set_boolean_value(CFGID_LINE_FWD_CALLER_NAME_DIPLAY + line, gCallerName, (const unsigned char *) "callerName");
|
||||
compare_or_set_boolean_value(CFGID_LINE_FWD_CALLER_NUMBER_DIPLAY + line, gCallerNumber, (const unsigned char *) "callerNumber");
|
||||
compare_or_set_boolean_value(CFGID_LINE_FWD_REDIRECTED_NUMBER_DIPLAY + line, gRedirectedNumber, (const unsigned char *) "redirectedNumber");
|
||||
compare_or_set_boolean_value(CFGID_LINE_FWD_DIALED_NUMBER_DIPLAY + line, gDialedNumber, (const unsigned char *) "dialedNumber");
|
||||
compare_or_set_byte_value(CFGID_LINE_MSG_WAITING_LAMP + line, gMessageWaitingLampPolicy, (const unsigned char *) "messageWaitingLampPolicy");
|
||||
compare_or_set_byte_value(CFGID_LINE_MESSAGE_WAITING_AMWI + line, gMessageWaitingAMWI, (const unsigned char *) "messageWaitingAMWI");
|
||||
compare_or_set_byte_value(CFGID_LINE_RING_SETTING_IDLE + line, gRingSettingIdle, (const unsigned char *) "ringSettingIdle");
|
||||
compare_or_set_byte_value(CFGID_LINE_RING_SETTING_ACTIVE + line, gRingSettingActive, (const unsigned char *) "ringSettingActive");
|
||||
compare_or_set_string_value(CFGID_LINE_CONTACT + line, sipUser, (const unsigned char *) "contact");
|
||||
compare_or_set_int_value(CFGID_LINE_MAXNUMCALLS + line, gMaxNumCalls, (const unsigned char *) "maxNumCalls");
|
||||
compare_or_set_int_value(CFGID_LINE_BUSY_TRIGGER + line, gBusyTrigger, (const unsigned char *) "busyTrigger");
|
||||
compare_or_set_byte_value(CFGID_LINE_AUTOANSWER_ENABLED + line, gAutoAnswerEnabled, (const unsigned char *) "autoAnswerEnabled");
|
||||
compare_or_set_byte_value(CFGID_LINE_CALL_WAITING + line, gCallWaiting, (const unsigned char *) "callWaiting");
|
||||
compare_or_set_string_value(CFGID_LINE_AUTHNAME + line, sipUser, (const unsigned char *)"authName");
|
||||
compare_or_set_string_value(CFGID_LINE_PASSWORD + line, sipPassword, (const unsigned char *)"authPassword");
|
||||
}
|
||||
|
||||
compare_or_set_int_value(CFGID_CCM1_SEC_LEVEL, gDeviceSecurityMode,(const unsigned char *)"deviceSecurityMode");
|
||||
compare_or_set_int_value(CFGID_CCM1_SIP_PORT, gCcm1_sip_port,(const unsigned char *)"ccm1_sip_port");
|
||||
compare_or_set_int_value(CFGID_CCM2_SIP_PORT, gCcm2_sip_port,(const unsigned char *)"ccm2_sip_port");
|
||||
compare_or_set_int_value(CFGID_CCM3_SIP_PORT, gCcm3_sip_port, (const unsigned char *)"ccm3_sip_port");
|
||||
|
||||
|
||||
isSecure = FALSE;
|
||||
sstrncpy(ip, "", MAX_SIP_URL_LENGTH);
|
||||
sstrncpy(option, "User Specific", MAX_SIP_URL_LENGTH);
|
||||
|
||||
compare_or_set_string_value(CFGID_CCM1_ADDRESS+0, sipDomain, (const unsigned char *) "ccm1_addr");
|
||||
compare_or_set_boolean_value(CFGID_CCM1_IS_VALID + 0, gCcm1_isvalid, (const unsigned char *)"ccm1_isvalid");
|
||||
compare_or_set_int_value(CFGID_DSCP_FOR_CALL_CONTROL , gDscpCallControl, (const unsigned char *) "DscpCallControl");
|
||||
compare_or_set_int_value(CFGID_SPEAKER_ENABLED, gSpeakerEnabled, (const unsigned char *) "speakerEnabled");
|
||||
|
||||
if (apply_config == FALSE) {
|
||||
config_get_mac_addr(macaddr);
|
||||
|
||||
CONFIG_DEBUG(CFG_F_PREFIX ": MAC Address IS: %x:%x:%x:%x:%x:%x \n",
|
||||
"config_get_mac_addr", macaddr[0], macaddr[1],
|
||||
macaddr[2], macaddr[3], macaddr[4], macaddr[5]);
|
||||
|
||||
CC_Config_setArrayValue(CFGID_MY_MAC_ADDR, macaddr, MAC_ADDR_SIZE);
|
||||
CC_Config_setArrayValue(CFGID_MY_ACTIVE_MAC_ADDR, macaddr, MAC_ADDR_SIZE);
|
||||
}
|
||||
|
||||
CONFIG_DEBUG(CFG_F_PREFIX "%s \n", "config_parse_element", "phoneServices");
|
||||
CONFIG_DEBUG(CFG_F_PREFIX "%s \n", "config_parse_element", "versionStamp");
|
||||
CONFIG_ERROR(CFG_F_PREFIX "%s new=%s old=%s \n", "config_parser_element", "versionStamp",
|
||||
"1284570837-bbc096ed-7392-427d-9694-5ce49d5c3acb", g_cfg_version_stamp);
|
||||
|
||||
if (apply_config == FALSE) {
|
||||
memset(g_cfg_version_stamp, 0, sizeof(g_cfg_version_stamp));
|
||||
i = strlen("1284570837-bbc096ed-7392-427d-9694-5ce49d5c3acb");
|
||||
if (i > MAX_CFG_VERSION_STAMP_LEN) {
|
||||
CONFIG_ERROR(CFG_F_PREFIX "config version %d, bigger than allocated space %d\n", "config_parser_element", i, MAX_CFG_VERSION_STAMP_LEN);
|
||||
}
|
||||
|
||||
sstrncpy(g_cfg_version_stamp, "1284570837-bbc096ed-7392-427d-9694-5ce49d5c3acb", sizeof(g_cfg_version_stamp));
|
||||
}
|
||||
else {
|
||||
CONFIG_ERROR(CFG_F_PREFIX "got NULL value for %s\n", "config_parser_element", "versionStamp");
|
||||
}
|
||||
|
||||
CONFIG_DEBUG(CFG_F_PREFIX "%s \n", "config_parser_element", "externalNumberMask");
|
||||
compare_or_set_string_value(CFGID_CCM_EXTERNAL_NUMBER_MASK, gExternalNumberMask, (const unsigned char *) "externalNumberMask");
|
||||
|
||||
/* Set SIP P2P boolean */
|
||||
compare_or_set_boolean_value(CFGID_P2PSIP, gP2PSIP, (const unsigned char *) "p2psip");
|
||||
|
||||
/* Set product version */
|
||||
compare_or_set_string_value(CFGID_VERSION, gVersion, (const unsigned char *) "version");
|
||||
|
||||
/* Set rtcp-mux, right now to always true */
|
||||
compare_or_set_boolean_value(CFGID_RTCPMUX, gRTCPMUX, (const unsigned char *) "rtcpmux");
|
||||
|
||||
/* Set RTP/SAVPF, right now to always true */
|
||||
compare_or_set_boolean_value(CFGID_RTPSAVPF, gRTPSAVPF, (const unsigned char *) "rtpsavpf");
|
||||
|
||||
compare_or_set_boolean_value(CFGID_MAXAVBITRATE, gMAXAVBITRATE, (const unsigned char *) "maxavbitrate");
|
||||
|
||||
compare_or_set_boolean_value(CFGID_MAXCODEDAUDIOBW, gMAXCODEDAUDIOBW, (const unsigned char *) "maxcodedaudiobw");
|
||||
|
||||
compare_or_set_boolean_value(CFGID_USEDTX, gUSEDTX, (const unsigned char *) "usedtx");
|
||||
|
||||
compare_or_set_boolean_value(CFGID_STEREO, gSTEREO, (const unsigned char *) "stereo");
|
||||
|
||||
compare_or_set_boolean_value(CFGID_USEINBANDFEC, gUSEINBANDFEC, (const unsigned char *) "useinbandfec");
|
||||
|
||||
compare_or_set_boolean_value(CFGID_CBR, gCBR, (const unsigned char *) "cbr");
|
||||
|
||||
compare_or_set_boolean_value(CFGID_MAXPTIME, gMAXPTIME, (const unsigned char *) "maxptime");
|
||||
|
||||
compare_or_set_int_value(CFGID_SCTP_PORT, gSCTPPort, (const unsigned char *) "sctp_port");
|
||||
|
||||
compare_or_set_int_value(CFGID_NUM_DATA_STREAMS, gNumDataStreams, (const unsigned char *) "num_data_streams");
|
||||
|
||||
(void) isSecure; // XXX set but not used
|
||||
(void) isValid; // XXX set but not used
|
||||
}
|
||||
|
||||
void config_setup_server_address (const char *sipDomain) {
|
||||
compare_or_set_string_value(CFGID_CCM1_ADDRESS+0, sipDomain, (const unsigned char *) "ccm1_addr");
|
||||
}
|
||||
|
||||
void config_setup_transport_udp(const cc_boolean is_udp) {
|
||||
gTransportLayerProtocol = is_udp ? 2 : 4;
|
||||
compare_or_set_int_value(CFGID_TRANSPORT_LAYER_PROT, gTransportLayerProtocol, (const unsigned char *) "transportLayerProtocol");
|
||||
}
|
||||
|
||||
void config_setup_local_voip_control_port(const int voipControlPort) {
|
||||
gVoipControlPort = voipControlPort;
|
||||
compare_or_set_int_value(CFGID_VOIP_CONTROL_PORT, voipControlPort, (const unsigned char *) "voipControlPort");
|
||||
}
|
||||
|
||||
void config_setup_remote_voip_control_port(const int voipControlPort) {
|
||||
gCcm1_sip_port = voipControlPort;
|
||||
compare_or_set_int_value(CFGID_CCM1_SIP_PORT, voipControlPort,(const unsigned char *)"ccm1_sip_port");
|
||||
}
|
||||
|
||||
int config_get_local_voip_control_port() {
|
||||
return gVoipControlPort;
|
||||
}
|
||||
|
||||
int config_get_remote_voip_control_port() {
|
||||
return gCcm1_sip_port;
|
||||
}
|
||||
|
||||
const char* config_get_version() {
|
||||
return gVersion;
|
||||
}
|
||||
|
||||
void config_setup_p2p_mode(const cc_boolean is_p2p) {
|
||||
gP2PSIP = is_p2p;
|
||||
compare_or_set_boolean_value(CFGID_P2PSIP, is_p2p, (const unsigned char *) "p2psip");
|
||||
}
|
||||
|
||||
void config_setup_sdp_mode(const cc_boolean is_sdp) {
|
||||
gSDPMODE = is_sdp;
|
||||
compare_or_set_boolean_value(CFGID_SDPMODE, is_sdp, (const unsigned char *) "sdpsip");
|
||||
}
|
||||
|
||||
void config_setup_avp_mode(const cc_boolean is_rtpsavpf) {
|
||||
gRTPSAVPF = is_rtpsavpf;
|
||||
compare_or_set_boolean_value(CFGID_RTPSAVPF, is_rtpsavpf, (const unsigned char *) "rtpsavpf");
|
||||
}
|
||||
|
||||
/**
|
||||
* Process/Parse the FCP file if specified in the master config file.
|
||||
*/
|
||||
void config_parser_handle_fcp_file (char* fcpTemplateFile)
|
||||
{
|
||||
|
||||
// if no fcp file specified in master config file, then set the default dialplan
|
||||
if (strcmp (fcpTemplateFile, "") == 0)
|
||||
{
|
||||
CC_Config_setFcp(NULL, 0);
|
||||
ccsnap_gen_deviceEvent(CCAPI_DEVICE_EV_CONFIG_CHANGED, CC_DEVICE_ID);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
ccsnap_gen_deviceEvent(CCAPI_DEVICE_EV_CONFIG_CHANGED, CC_DEVICE_ID);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function called as part of registration without using cnf device file download.
|
||||
*/
|
||||
int config_setup_main( const char *sipUser, const char *sipPassword, const char *sipDomain)
|
||||
{
|
||||
config_setup_elements(sipUser, sipPassword, sipDomain);
|
||||
update_security_mode_and_ports();
|
||||
|
||||
// Take care of Fetch and apply of FCP and DialPlan if configured and necessary
|
||||
if (apply_config == FALSE) {
|
||||
config_parser_handle_fcp_file (fcpTemplateFile);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
173
libs/sipcc/core/common/config_parser.h
Normal file
173
libs/sipcc/core/common/config_parser.h
Normal file
@ -0,0 +1,173 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef CONFIG_PARSER_H_
|
||||
#define CONFIG_PARSER_H_
|
||||
|
||||
#include "cc_constants.h"
|
||||
#include "cc_types.h"
|
||||
#include "cc_config.h"
|
||||
#include "ccapi.h"
|
||||
#include "phone_debug.h"
|
||||
#include "debug.h"
|
||||
#include "prot_configmgr.h"
|
||||
#include "call_logger.h"
|
||||
#include "sip_common_transport.h"
|
||||
#include "sip_ccm_transport.h"
|
||||
|
||||
#define MAX_CFG_VERSION_STAMP_LEN 80
|
||||
|
||||
/*
|
||||
* This function determine whether the passed config parameter should be used
|
||||
* in comparing the new and old config value for apply-config purpose. Only
|
||||
* those config ids on whose change phone needs to restart are part of this
|
||||
* function. For remaining parameters, it is assumed that any change can be
|
||||
* applied dynamically.
|
||||
*
|
||||
*/
|
||||
boolean is_cfgid_in_restart_list(int cfgid);
|
||||
|
||||
/*
|
||||
* This function either compare the new and old config value or set the value
|
||||
* for the config_id passed depending upon whether apply-config is true or not.
|
||||
*/
|
||||
void compare_or_set_byte_value(int cfgid, unsigned char value, const unsigned char * config_name);
|
||||
|
||||
/*
|
||||
* This function either compare the new and old config value or set the value
|
||||
* for the config_id passed depending upon whether apply-config is true or not.
|
||||
*/
|
||||
void compare_or_set_boolean_value(int cfgid, cc_boolean value, const unsigned char * config_name);
|
||||
|
||||
/*
|
||||
* This function either compare the new and old config value or set the value
|
||||
* for the config_id passed depending upon whether apply-config is true or not.
|
||||
*/
|
||||
void compare_or_set_int_value(int cfgid, int value, const unsigned char * config_name);
|
||||
|
||||
/*
|
||||
* This function either compare the new and old config value or set the value
|
||||
* for the config_id passed depending upon whether apply-config is true or not.
|
||||
*/
|
||||
void compare_or_set_string_value (int cfgid, const char* value, const unsigned char * config_name);
|
||||
|
||||
/*
|
||||
* config_fetch_dialplan() called to retrieve the dialplan
|
||||
*
|
||||
*/
|
||||
void config_fetch_dialplan(char *filename);
|
||||
|
||||
/*
|
||||
* config_fetch_fcp() called to retrieve the fcp
|
||||
*
|
||||
*/
|
||||
void config_fetch_fcp(char *filename);
|
||||
|
||||
/*
|
||||
* config_set_autoreg_properties
|
||||
*
|
||||
*/
|
||||
void config_set_autoreg_properties ();
|
||||
|
||||
/*
|
||||
* update_security_mode_and_ports
|
||||
*
|
||||
*/
|
||||
void update_security_mode_and_ports(void);
|
||||
|
||||
/*
|
||||
* config_get_mac_addr
|
||||
*
|
||||
* Get the filename that has the mac address and parse the string
|
||||
* convert it into an mac address stored in the bytearray maddr
|
||||
*/
|
||||
void config_get_mac_addr (char *maddr);
|
||||
|
||||
/*
|
||||
* Set the IP and MAC address in the config table
|
||||
*/
|
||||
void config_set_ccm_ip_mac ();
|
||||
|
||||
|
||||
/*
|
||||
* Set up configuration without XML config file.
|
||||
*/
|
||||
void config_setup_elements ( const char *sipUser, const char *sipPassword, const char *sipDomain);
|
||||
|
||||
/*
|
||||
* Set server ip address into config
|
||||
* Same ip address is also used to make a P2P call
|
||||
*/
|
||||
void config_setup_server_address (const char *sipDomain);
|
||||
|
||||
/*
|
||||
* set transport protocol, limited to udp or tcp for now
|
||||
*/
|
||||
void config_setup_transport_udp(const cc_boolean is_udp);
|
||||
|
||||
/*
|
||||
* set local voip port defaults to 5060
|
||||
*/
|
||||
void config_setup_local_voip_control_port(const int voipControlPort);
|
||||
|
||||
/*
|
||||
* set remote voip port defaults to 5060
|
||||
*/
|
||||
void config_setup_remote_voip_control_port(const int voipControlPort);
|
||||
|
||||
/*
|
||||
* get local voip port defaults to 5060
|
||||
*/
|
||||
int config_get_local_voip_control_port();
|
||||
|
||||
/*
|
||||
* get remote voip port defaults to 5060
|
||||
*/
|
||||
int config_get_remote_voip_control_port();
|
||||
|
||||
/*
|
||||
* get ikran version
|
||||
*/
|
||||
const char* config_get_version();
|
||||
|
||||
/*
|
||||
* set p2p mode on or off
|
||||
*/
|
||||
void config_setup_p2p_mode(const cc_boolean is_p2p);
|
||||
|
||||
/*
|
||||
* set sdp mode on or off
|
||||
*/
|
||||
void config_setup_sdp_mode(const cc_boolean is_sdp);
|
||||
|
||||
/*
|
||||
* set avp mode (true == RTP/SAVPF, false = RTP/SAVP)
|
||||
*/
|
||||
void config_setup_avp_mode(const cc_boolean is_rtpsavpf);
|
||||
|
||||
/**
|
||||
* config_minimum_check:
|
||||
*
|
||||
* @a_node: the initial xml node to consider.
|
||||
* @doc: The DOM tree of the xml file
|
||||
*
|
||||
* Check if minimum set of elements are present in the config file and
|
||||
* have values that can be used by sipstack
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Parse the file that is passed in,
|
||||
* walk down the DOM that is created , and get the
|
||||
* xml elements nodes.
|
||||
*/
|
||||
int config_parser_main( char *config, int complete_config);
|
||||
|
||||
/*
|
||||
* Set up configuration without XML config file.
|
||||
*/
|
||||
int config_setup_main( const char *sipUser, const char *sipPassword, const char *sipDomain);
|
||||
|
||||
|
||||
#endif /* CONFIG_PARSER_H_ */
|
576
libs/sipcc/core/common/init.c
Executable file
576
libs/sipcc/core/common/init.c
Executable file
@ -0,0 +1,576 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "cpr.h"
|
||||
#include "cpr_in.h"
|
||||
#include "cpr_stdlib.h"
|
||||
#include "cpr_ipc.h"
|
||||
#include "phntask.h"
|
||||
#include <stdarg.h>
|
||||
#include "configmgr.h"
|
||||
#include "debug.h"
|
||||
#include "config.h"
|
||||
#include "vcm.h"
|
||||
#include "dialplan.h"
|
||||
#include "debug.h"
|
||||
#include "phone_debug.h"
|
||||
#include "CCProvider.h"
|
||||
#include "ccsip_task.h"
|
||||
#include "gsm.h"
|
||||
#include "misc_apps_task.h"
|
||||
#include "plat_api.h"
|
||||
#include "ccapp_task.h"
|
||||
|
||||
#include "phone_platform_constants.h"
|
||||
/** The following defines are used to tune the total memory that pSIPCC
|
||||
* allocates and uses. */
|
||||
/** Block size for emulated heap space, i.e. 1kB */
|
||||
#define BLK_SZ 1024
|
||||
|
||||
/** 5 MB Heap Based on 0.5 MB initial use + 4 MB for calls (20K * 200) + 0.5 MB misc */
|
||||
/** The number of supported blocks for the emulated heap space */
|
||||
#define MEM_BASE_BLK 500 //500 blocks, ~ 0.5M
|
||||
#define MEM_MISC_BLK 500 //500 blocks, ~ 0.5M
|
||||
/** Size of the emulated heap space. This is the value passed to the memory
|
||||
* management pre-init procedure. The total memory allocated is
|
||||
* "PRIVATE_SYS_MEM_SIZE + 2*64" where the additional numbers are for a gaurd
|
||||
* band. */
|
||||
#define MEM_PER_CALL_BLK 20 //20 block, ~20k
|
||||
#define PRIVATE_SYS_MEM_SIZE ((MEM_BASE_BLK + MEM_MISC_BLK + (MEM_PER_CALL_BLK) * MAX_CALLS) * BLK_SZ)
|
||||
|
||||
// used in early init code where config has not been setup
|
||||
const boolean gHardCodeSDPMode = TRUE;
|
||||
boolean gStopTickTask = FALSE;
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
* Local definitions
|
||||
*--------------------------------------------------------------------------
|
||||
*/
|
||||
#define GSMSTKSZ 61440
|
||||
|
||||
/*
|
||||
* CNU thread queue sizes.
|
||||
*
|
||||
* On CNU, the message queue size can hold up to 31 entries only.
|
||||
* This is too small for a phone that can support the MAX_CALLS that
|
||||
* is close to or higher than 31 calls simultaneously. In a scenario when
|
||||
* the number of active calls on the phone reaches its MAC_CALLS then
|
||||
* there can be a potential MAX_CALLS that is great ther than 31 events on
|
||||
* a queue to GSM or SIP thread.
|
||||
*
|
||||
* One known scenario is a 7970 phone having 50 held calls where all
|
||||
* calls are not from the same CCM that this phone registers with but
|
||||
* still within the same cluster. If that CCM is restarted, the CCM that
|
||||
* this phone registers with will terminate these calls on the phone by
|
||||
* sending BYEs, SUBSCRIBE (to terminate) DTMF digi collection and etc. to
|
||||
* all these calls very quickly together. Handling these SIP messages
|
||||
* can generate many internal events between SIP and GSM threads including
|
||||
* events that are sent to self (such as GSM which includes applications
|
||||
* that runs as part of GSM). The amount of the events posted on the queues
|
||||
* during this time can be far exceeding than 31 and MAX_CALLS entries.
|
||||
*
|
||||
* The followings define queue sizes for GSM, SIP and the other threads.
|
||||
* The GSM's queue size is defined to be larger than SIP's queue size to
|
||||
* account for self sending event. The formular below is based on the
|
||||
* testing with the above scenario and with 8-3-x phone load. The maximum
|
||||
* queue depth observed for GSM under
|
||||
* this condition is 129 entries and the maximum queue depth of
|
||||
* SIP under the same condition is about 67 entries. Therefore, the queue
|
||||
* depth of GSM thread is given to 3 times MAX_CALLS (or 153) and
|
||||
* 2 times (or 102) for SIP thread for 7970 case.
|
||||
*
|
||||
*/
|
||||
#define GSMQSZ (MAX_CALLS*3) /* GSM message queue size */
|
||||
#define SIPQSZ (MAX_CALLS*2) /* SIP message queue size */
|
||||
#define DEFQSZ 0 /* default message queue size */
|
||||
#define DEFAPPQSZ MAX_REG_LINES
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
* Global data
|
||||
*--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
cprMsgQueue_t ccapp_msgq;
|
||||
cprThread_t ccapp_thread;
|
||||
|
||||
cprMsgQueue_t sip_msgq;
|
||||
cprThread_t sip_thread;
|
||||
#ifdef NO_SOCKET_POLLING
|
||||
cprThread_t sip_msgqwait_thread;
|
||||
#endif
|
||||
|
||||
cprMsgQueue_t gsm_msgq;
|
||||
cprThread_t gsm_thread;
|
||||
|
||||
cprMsgQueue_t misc_app_msgq;
|
||||
cprThread_t misc_app_thread;
|
||||
|
||||
#ifdef JINDO_DEBUG_SUPPORTED
|
||||
cprMsgQueue_t debug_msgq;
|
||||
cprThread_t debug_thread;
|
||||
#endif
|
||||
|
||||
#ifdef EXTERNAL_TICK_REQUIRED
|
||||
cprMsgQueue_t ticker_msgq;
|
||||
cprThread_t ticker_thread;
|
||||
#endif
|
||||
|
||||
/* Platform initialized flag */
|
||||
boolean platform_initialized = FALSE;
|
||||
|
||||
static int thread_init(void);
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
* External data references
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
* External function prototypes
|
||||
*--------------------------------------------------------------------------
|
||||
*/
|
||||
extern void gsm_set_initialized(void);
|
||||
extern void vcm_init(void);
|
||||
extern void dp_init(void *);
|
||||
extern cprBuffer_t SIPTaskGetBuffer(uint16_t size);
|
||||
|
||||
extern void sip_platform_task_loop(void *arg);
|
||||
#ifdef NO_SOCKET_POLLING
|
||||
extern void sip_platform_task_msgqwait(void *arg);
|
||||
#endif
|
||||
extern void GSMTask(void *);
|
||||
#ifndef VENDOR_BUILD
|
||||
extern void debug_task(void *);
|
||||
#endif
|
||||
extern void MiscAppTask(void *);
|
||||
extern void cpr_timer_tick(void);
|
||||
|
||||
extern void cprTimerSystemInit(void);
|
||||
extern int32_t ui_clear_mwi(int32_t argc, const char *argv[]);
|
||||
void gsm_shutdown(void);
|
||||
void dp_shutdown(void);
|
||||
void MiscAppTaskShutdown(void);
|
||||
void CCAppShutdown(void);
|
||||
cprBuffer_t gsm_get_buffer (uint16_t size);
|
||||
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
* Local scope function prototypes
|
||||
*--------------------------------------------------------------------------
|
||||
*/
|
||||
#ifdef EXTERNAL_TICK_REQUIRED
|
||||
int TickerTask(void *);
|
||||
#endif
|
||||
|
||||
void send_protocol_config_msg(void);
|
||||
|
||||
/**
|
||||
* ccMemInit()
|
||||
*/
|
||||
extern
|
||||
int ccMemInit(size_t size) {
|
||||
return CPR_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ccPreInit
|
||||
*
|
||||
* Initialization routine to call before any application level
|
||||
* code initializes.
|
||||
*
|
||||
* Parameters: None
|
||||
*
|
||||
* Return Value: CPR_SUCCESS or CPR_FAILURE
|
||||
*/
|
||||
|
||||
int
|
||||
ccPreInit ()
|
||||
{
|
||||
static boolean ccPreInit_called = FALSE;
|
||||
|
||||
if (ccPreInit_called == FALSE) {
|
||||
ccPreInit_called = TRUE;
|
||||
//Initializes the memory first
|
||||
ccMemInit(PRIVATE_SYS_MEM_SIZE);
|
||||
cprPreInit();
|
||||
}
|
||||
|
||||
return CPR_SUCCESS;
|
||||
}
|
||||
|
||||
int
|
||||
ccInit ()
|
||||
{
|
||||
|
||||
TNP_DEBUG(DEB_F_PREFIX"started init of SIP call control\n", DEB_F_PREFIX_ARGS(SIP_CC_INIT, "ccInit"));
|
||||
|
||||
platInit();
|
||||
|
||||
strlib_init();
|
||||
|
||||
/*
|
||||
* below should move to cprPreInit. keep it here until then
|
||||
*/
|
||||
#ifdef _WIN32
|
||||
cprTimerSystemInit();
|
||||
#endif
|
||||
|
||||
/* Initialize threads, queues etc. */
|
||||
(void) thread_init();
|
||||
|
||||
platform_initialized = TRUE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
thread_init ()
|
||||
{
|
||||
gStopTickTask = FALSE;
|
||||
/*
|
||||
* This will have already been called for CPR CNU code,
|
||||
* but may be called here for Windows emulation.
|
||||
*/
|
||||
(void) cprPreInit();
|
||||
|
||||
|
||||
PHNChangeState(STATE_FILE_CFG);
|
||||
|
||||
/* initialize message queues */
|
||||
sip_msgq = cprCreateMessageQueue("SIPQ", SIPQSZ);
|
||||
gsm_msgq = cprCreateMessageQueue("GSMQ", GSMQSZ);
|
||||
|
||||
if (FALSE == gHardCodeSDPMode) {
|
||||
misc_app_msgq = cprCreateMessageQueue("MISCAPPQ", DEFQSZ);
|
||||
}
|
||||
ccapp_msgq = cprCreateMessageQueue("CCAPPQ", DEFQSZ);
|
||||
#ifdef JINDO_DEBUG_SUPPORTED
|
||||
debug_msgq = cprCreateMessageQueue("DEBUGAPPQ", DEFQSZ);
|
||||
#endif
|
||||
#ifdef EXTERNAL_TICK_REQUIRED
|
||||
ticker_msgq = cprCreateMessageQueue("Ticker", DEFQSZ);
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Initialize the command parser and debug infrastructure
|
||||
*/
|
||||
debugInit();
|
||||
|
||||
/* create threads */
|
||||
ccapp_thread = cprCreateThread("CCAPP Task",
|
||||
(cprThreadStartRoutine) CCApp_task,
|
||||
GSMSTKSZ, CCPROVIDER_THREAD_RELATIVE_PRIORITY /* pri */, ccapp_msgq);
|
||||
if (ccapp_thread == NULL) {
|
||||
err_msg("failed to create CCAPP task \n");
|
||||
}
|
||||
|
||||
#ifdef JINDO_DEBUG_SUPPORTED
|
||||
#ifndef VENDOR_BUILD
|
||||
debug_thread = cprCreateThread("Debug Task",
|
||||
(cprThreadStartRoutine) debug_task, STKSZ,
|
||||
0 /*pri */ , debug_msgq);
|
||||
|
||||
if (debug_thread == NULL) {
|
||||
err_msg("failed to create debug task\n");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* SIP main thread */
|
||||
sip_thread = cprCreateThread("SIPStack task",
|
||||
(cprThreadStartRoutine) sip_platform_task_loop,
|
||||
STKSZ, SIP_THREAD_RELATIVE_PRIORITY /* pri */, sip_msgq);
|
||||
if (sip_thread == NULL) {
|
||||
err_msg("failed to create sip task \n");
|
||||
}
|
||||
|
||||
#ifdef NO_SOCKET_POLLING
|
||||
/* SIP message wait queue task */
|
||||
sip_msgqwait_thread = cprCreateThread("SIP MsgQueueWait task",
|
||||
(cprThreadStartRoutine)
|
||||
sip_platform_task_msgqwait,
|
||||
STKSZ, SIP_THREAD_RELATIVE_PRIORITY /* pri */, sip_msgq);
|
||||
if (sip_msgqwait_thread == NULL) {
|
||||
err_msg("failed to create sip message queue wait task\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
gsm_thread = cprCreateThread("GSM Task",
|
||||
(cprThreadStartRoutine) GSMTask,
|
||||
GSMSTKSZ, GSM_THREAD_RELATIVE_PRIORITY /* pri */, gsm_msgq);
|
||||
if (gsm_thread == NULL) {
|
||||
err_msg("failed to create gsm task \n");
|
||||
}
|
||||
|
||||
if (FALSE == gHardCodeSDPMode) {
|
||||
misc_app_thread = cprCreateThread("MiscApp Task",
|
||||
(cprThreadStartRoutine) MiscAppTask,
|
||||
STKSZ, 0 /* pri */, misc_app_msgq);
|
||||
if (misc_app_thread == NULL) {
|
||||
err_msg("failed to create MiscApp task \n");
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef EXTERNAL_TICK_REQUIRED
|
||||
ticker_thread = cprCreateThread("Ticker task",
|
||||
(cprThreadStartRoutine) TickerTask,
|
||||
STKSZ, 0, ticker_msgq);
|
||||
if (ticker_thread == NULL) {
|
||||
err_msg("failed to create ticker task \n");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Associate the threads with the message queues */
|
||||
(void) cprSetMessageQueueThread(sip_msgq, sip_thread);
|
||||
(void) cprSetMessageQueueThread(gsm_msgq, gsm_thread);
|
||||
|
||||
if (FALSE == gHardCodeSDPMode) {
|
||||
(void) cprSetMessageQueueThread(misc_app_msgq, misc_app_thread);
|
||||
}
|
||||
|
||||
(void) cprSetMessageQueueThread(ccapp_msgq, ccapp_thread);
|
||||
#ifdef JINDO_DEBUG_SUPPORTED
|
||||
(void) cprSetMessageQueueThread(debug_msgq, debug_thread);
|
||||
#endif
|
||||
#ifdef EXTERNAL_TICK_REQUIRED
|
||||
(void) cprSetMessageQueueThread(ticker_msgq, ticker_thread);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* initialize debugs of other modules.
|
||||
*
|
||||
* dp_init needs the gsm_msgq id. This
|
||||
* is set in a global variable by the
|
||||
* GSM task running. However due to timing
|
||||
* issues dp_init is sometimes run before
|
||||
* the GSM task has set this variable resulting
|
||||
* in a NULL msgqueue ptr being passed to CPR
|
||||
* which returns an error and does not create
|
||||
* the dialplan timer. Thus pass is the same
|
||||
* data to dp_init that is passed into the
|
||||
* cprCreateThread call for GSM above.
|
||||
*/
|
||||
config_init();
|
||||
vcmInit();
|
||||
dp_init(gsm_msgq);
|
||||
|
||||
if (sip_minimum_config_check() != 0) {
|
||||
PHNChangeState(STATE_UNPROVISIONED);
|
||||
} else {
|
||||
PHNChangeState(STATE_CONNECTED);
|
||||
}
|
||||
|
||||
(void) cprPostInit();
|
||||
|
||||
if ( vcmGetVideoCodecList(VCM_DSP_FULLDUPLEX) ) {
|
||||
cc_media_update_native_video_support(TRUE);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
#ifdef EXTERNAL_TICK_REQUIRED
|
||||
|
||||
uint16_t SecTimer = 50;
|
||||
|
||||
unsigned long timeofday_in_seconds = 0;
|
||||
|
||||
void
|
||||
MAIN0Timer (void)
|
||||
{
|
||||
if (SecTimer-- == 0) {
|
||||
SecTimer = 50;
|
||||
timeofday_in_seconds++;
|
||||
}
|
||||
//gtick +=2;
|
||||
cpr_timer_tick();
|
||||
}
|
||||
|
||||
int
|
||||
TickerTask (void *a)
|
||||
{
|
||||
TNP_DEBUG(DEB_F_PREFIX"Ticker Task initialized..\n", DEB_F_PREFIX_ARGS(SIP_CC_INIT, "TickerTask"));
|
||||
while (FALSE == gStopTickTask) {
|
||||
cprSleep(20);
|
||||
MAIN0Timer();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
send_protocol_config_msg (void)
|
||||
{
|
||||
const char *fname = "send_protocol_config_msg";
|
||||
char *msg;
|
||||
|
||||
TNP_DEBUG(DEB_F_PREFIX"send TCP_DONE message to sip thread..\n", DEB_F_PREFIX_ARGS(SIP_CC_INIT, fname));
|
||||
|
||||
msg = (char *) SIPTaskGetBuffer(4);
|
||||
if (msg == NULL) {
|
||||
TNP_DEBUG(DEB_F_PREFIX"failed to allocate message..\n", DEB_F_PREFIX_ARGS(SIP_CC_INIT, fname));
|
||||
return;
|
||||
}
|
||||
/* send a config done message to the SIP Task */
|
||||
if (SIPTaskSendMsg(TCP_PHN_CFG_TCP_DONE, msg, 0, NULL) == CPR_FAILURE) {
|
||||
err_msg("%s: notify SIP stack ready failed", fname);
|
||||
cpr_free(msg);
|
||||
}
|
||||
gsm_set_initialized();
|
||||
PHNChangeState(STATE_CONNECTED);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Function: send_task_unload_msg
|
||||
*
|
||||
* Description:
|
||||
* - send shutdown and thread destroy msg to sip, gsm, ccapp, misc
|
||||
* threads
|
||||
* Parameters: destination thread
|
||||
*
|
||||
* Returns: none
|
||||
*
|
||||
*/
|
||||
void
|
||||
send_task_unload_msg(cc_srcs_t dest_id)
|
||||
{
|
||||
const char *fname = "send_task_unload_msg";
|
||||
uint16_t len = 4;
|
||||
cprBuffer_t msg = gsm_get_buffer(len);
|
||||
int sdpmode = 0;
|
||||
|
||||
config_get_value(CFGID_SDPMODE, &sdpmode, sizeof(sdpmode));
|
||||
|
||||
if (msg == NULL) {
|
||||
err_msg("%s: failed to allocate msg cprBuffer_t\n", fname);
|
||||
return;
|
||||
}
|
||||
|
||||
DEF_DEBUG(DEB_F_PREFIX"send Unload message to %s task ..\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_INIT, fname),
|
||||
dest_id == CC_SRC_SIP ? "SIP" :
|
||||
dest_id == CC_SRC_GSM ? "GSM" :
|
||||
dest_id == CC_SRC_MISC_APP ? "Misc App" :
|
||||
dest_id == CC_SRC_CCAPP ? "CCApp" : "Unknown");
|
||||
|
||||
switch(dest_id) {
|
||||
case CC_SRC_SIP:
|
||||
{
|
||||
/* send this msg so phone can send unRegister msg */
|
||||
SIPTaskPostShutdown(SIP_EXTERNAL, CC_CAUSE_SHUTDOWN, "");
|
||||
/* allow unRegister msg to sent out and shutdown to complete */
|
||||
|
||||
if (!sdpmode) {
|
||||
cprSleep(2000);
|
||||
}
|
||||
/* send a unload message to the SIP Task to kill sip thread*/
|
||||
msg = SIPTaskGetBuffer(len);
|
||||
if (msg == NULL) {
|
||||
err_msg("%s:%d: failed to allocate sip msg buffer\n", fname);
|
||||
return;
|
||||
}
|
||||
|
||||
if (SIPTaskSendMsg(THREAD_UNLOAD, (cprBuffer_t)msg, len, NULL) == CPR_FAILURE)
|
||||
{
|
||||
cpr_free(msg);
|
||||
err_msg("%s: Unable to send THREAD_UNLOAD msg to sip thread", fname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CC_SRC_GSM:
|
||||
{
|
||||
msg = gsm_get_buffer(len);
|
||||
if (msg == NULL) {
|
||||
err_msg("%s: failed to allocate gsm msg cprBuffer_t\n", fname);
|
||||
return;
|
||||
}
|
||||
if (CPR_FAILURE == gsm_send_msg(THREAD_UNLOAD, msg, len)) {
|
||||
err_msg("%s: Unable to send THREAD_UNLOAD msg to gsm thread", fname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CC_SRC_MISC_APP:
|
||||
{
|
||||
msg = cpr_malloc(len);
|
||||
if (msg == NULL) {
|
||||
err_msg("%s: failed to allocate misc msg cprBuffer_t\n", fname);
|
||||
return;
|
||||
}
|
||||
if (CPR_FAILURE == MiscAppTaskSendMsg(THREAD_UNLOAD, msg, len)) {
|
||||
err_msg("%s: Unable to send THREAD_UNLOAD msg to Misc App thread", fname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CC_SRC_CCAPP:
|
||||
{
|
||||
msg = cpr_malloc(len);
|
||||
if (msg == NULL) {
|
||||
err_msg("%s: failed to allocate ccapp msg cprBuffer_t\n", fname);
|
||||
return;
|
||||
}
|
||||
if (ccappTaskPostMsg(CCAPP_THREAD_UNLOAD, msg, len, CCAPP_CCPROVIER) == CPR_FAILURE )
|
||||
{
|
||||
err_msg("%s: Unable to send THREAD_UNLOAD msg to CCapp thread", fname);
|
||||
}
|
||||
err_msg("%s: send UNLOAD msg to CCapp thread good", fname);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
err_msg("%s: Unknown destination task passed=%d.", fname, dest_id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: ccUnload
|
||||
*
|
||||
* Description:
|
||||
* - deinit portable runtime.
|
||||
* - Cleanup call control modules, GSM and SIp Stack
|
||||
*
|
||||
* Parameters: none
|
||||
*
|
||||
* Returns: none
|
||||
*
|
||||
*/
|
||||
void
|
||||
ccUnload (void)
|
||||
{
|
||||
static const char fname[] = "ccUnload";
|
||||
|
||||
DEF_DEBUG(DEB_F_PREFIX"ccUnload called..\n", DEB_F_PREFIX_ARGS(SIP_CC_INIT, fname));
|
||||
if (platform_initialized == FALSE)
|
||||
{
|
||||
TNP_DEBUG(DEB_F_PREFIX"system is not loaded, ignore unload\n", DEB_F_PREFIX_ARGS(SIP_CC_INIT, fname));
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* We are going to send an unload msg to each of the thread, which on
|
||||
* receiving the msg, will kill itself.
|
||||
*/
|
||||
send_task_unload_msg(CC_SRC_SIP);
|
||||
send_task_unload_msg(CC_SRC_GSM);
|
||||
|
||||
if (FALSE == gHardCodeSDPMode) {
|
||||
send_task_unload_msg(CC_SRC_MISC_APP);
|
||||
}
|
||||
|
||||
send_task_unload_msg(CC_SRC_CCAPP);
|
||||
|
||||
cprSleep(200);
|
||||
|
||||
gStopTickTask = TRUE;
|
||||
}
|
||||
|
87
libs/sipcc/core/common/logger.c
Executable file
87
libs/sipcc/core/common/logger.c
Executable file
@ -0,0 +1,87 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "cpr_types.h"
|
||||
#include "cpr_string.h"
|
||||
#include "cpr_stdio.h"
|
||||
#include "cpr_stdlib.h"
|
||||
#include "stdarg.h"
|
||||
#include "logger.h"
|
||||
#include "logmsg.h"
|
||||
#include "phone_debug.h"
|
||||
#include "text_strings.h"
|
||||
#include "uiapi.h"
|
||||
#include "platform_api.h"
|
||||
#include "prot_configmgr.h"
|
||||
|
||||
#define MAX_LOG_CACHE_ENTRIES 20
|
||||
|
||||
/*
|
||||
* Log a message.
|
||||
* Cause the message to be printed to the console port
|
||||
* as well, the log is stored in a local data area for
|
||||
* later viewing
|
||||
*/
|
||||
void
|
||||
log_msg (int phrase_index, ...)
|
||||
{
|
||||
char phrase_buf[LOG_MAX_LEN * 4];
|
||||
char status_msg[LOG_MAX_LEN * 4];
|
||||
va_list ap;
|
||||
|
||||
/*
|
||||
* Make sure that the phrase index is valid.
|
||||
*/
|
||||
if (phrase_index == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the translated phrase index from the Java code.
|
||||
*/
|
||||
if (platGetPhraseText(phrase_index, phrase_buf, (LOG_MAX_LEN * 4)) == CPR_FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* If extra data is required, sprintf this into the status message buffer
|
||||
*/
|
||||
va_start(ap, phrase_index);
|
||||
vsprintf(status_msg, phrase_buf, ap);
|
||||
va_end(ap);
|
||||
|
||||
err_msg("%%%s\n", status_msg);
|
||||
|
||||
/*
|
||||
* For now, do not send the Registration messages over to the Java Status
|
||||
* Logs. They come out too fast and will overwhelm the existing logging
|
||||
* mechanism. We will need to implement a new mechanism in order to put
|
||||
* these in the phone's status menu.
|
||||
*/
|
||||
switch (phrase_index) {
|
||||
case LOG_REG_MSG:
|
||||
case LOG_REG_RED_MSG:
|
||||
case LOG_REG_AUTH_MSG:
|
||||
case LOG_REG_AUTH_HDR_MSG:
|
||||
case LOG_REG_AUTH_SCH_MSG:
|
||||
case LOG_REG_CANCEL_MSG:
|
||||
case LOG_REG_AUTH:
|
||||
case LOG_REG_AUTH_ACK_TMR:
|
||||
case LOG_REG_AUTH_NO_CRED:
|
||||
case LOG_REG_AUTH_UNREG_TMR:
|
||||
case LOG_REG_RETRY:
|
||||
case LOG_REG_UNSUPPORTED:
|
||||
case LOG_REG_AUTH_SERVER_ERR:
|
||||
case LOG_REG_AUTH_GLOBAL_ERR:
|
||||
case LOG_REG_AUTH_UNKN_ERR:
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
ui_log_status_msg(status_msg);
|
||||
}
|
||||
|
||||
|
17
libs/sipcc/core/common/logger.h
Normal file
17
libs/sipcc/core/common/logger.h
Normal file
@ -0,0 +1,17 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _LOGGER_INCLUDED_H
|
||||
#define _LOGGER_INCLUDED_H
|
||||
|
||||
#define LOG_MAX_LEN 64
|
||||
|
||||
/*
|
||||
* short form helper macros
|
||||
*/
|
||||
void log_msg(int log, ...);
|
||||
void log_clear(int msg);
|
||||
char *get_device_name();
|
||||
|
||||
#endif /* _LOGGER_INCLUDED_H */
|
42
libs/sipcc/core/common/logmsg.h
Normal file
42
libs/sipcc/core/common/logmsg.h
Normal file
@ -0,0 +1,42 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _LOGMSG_INCLUDED_H
|
||||
#define _LOGMSG_INCLUDED_H
|
||||
|
||||
#include "logger.h"
|
||||
|
||||
/*
|
||||
* Config messages
|
||||
* The number denotes the string location in the Phone dictionary file
|
||||
*/
|
||||
#define LOG_CFG_PARSE_DIAL 1074 //"%d Error(s) Parsing: %s"
|
||||
|
||||
/*
|
||||
* SIP messages
|
||||
* The number denotes the string location in the Phone dictionary file
|
||||
*/
|
||||
#define LOG_REG_MSG 1058 //"REG send failure: REGISTER"
|
||||
#define LOG_REG_RED_MSG 1059 //"REG send failure: REGISTER Redirected"
|
||||
#define LOG_REG_AUTH_MSG 1060 //"REG send failure: REGISTER auth"
|
||||
#define LOG_REG_AUTH_HDR_MSG 1061 //"REG send failure: REGISTER auth hdr"
|
||||
#define LOG_REG_AUTH_SCH_MSG 1062 //"REG send failure: REGISTER auth scheme"
|
||||
#define LOG_REG_CANCEL_MSG 1063 //"REG send failure: CANCEL REGISTER"
|
||||
|
||||
#define LOG_REG_AUTH 1064 //"REG auth failed: %s"
|
||||
#define LOG_REG_AUTH_ACK_TMR 1065 //"REG auth failed: ack timer"
|
||||
#define LOG_REG_AUTH_NO_CRED 1066 //"REG auth failed: no more credentials"
|
||||
#define LOG_REG_AUTH_UNREG_TMR 1067 //"REG auth failed: unreg ack timer"
|
||||
#define LOG_REG_RETRY 1068 //"REG retries exceeded"
|
||||
#define LOG_REG_UNSUPPORTED 1069 //"REG msg unsupported: %s"
|
||||
|
||||
#define LOG_REG_AUTH_SERVER_ERR 1070 //"REG auth failed: in %d, server error"
|
||||
#define LOG_REG_AUTH_GLOBAL_ERR 1071 //"REG auth failed: in %d, global error"
|
||||
#define LOG_REG_AUTH_UNKN_ERR 1072 //"REG auth failed: in %d, ??? error"
|
||||
|
||||
#define LOG_REG_BACKUP 1073 //"REG Not Registered to Backup Proxy"
|
||||
|
||||
#define LOG_REG_EXPIRE 1076 //"REG Expires time too small"
|
||||
|
||||
#endif /* _LOGMSG_INCLUDED_H */
|
389
libs/sipcc/core/common/misc.c
Normal file
389
libs/sipcc/core/common/misc.c
Normal file
@ -0,0 +1,389 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "cpr.h"
|
||||
#include "phone_debug.h"
|
||||
#include "cc_debug.h"
|
||||
#include "phone.h"
|
||||
#include "cpr_socket.h"
|
||||
#include "prot_configmgr.h"
|
||||
#include "debug.h"
|
||||
#include "cpr_string.h"
|
||||
#include "cpr_stdlib.h"
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
* Local definitions
|
||||
*--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* NTP related local data */
|
||||
#define MAX_NTP_MONTH_STR_LEN 4
|
||||
#define MAX_NTP_MONTH_ARRAY_SIZE 12
|
||||
#define MAX_NTP_DATE_HDR_STR_LEN 128
|
||||
#define MAX_NTP_TOKEN_BUF_LEN 16
|
||||
|
||||
/* The number of arguments (argc) used in the show command */
|
||||
#define NUM_OF_SHOW_ARGUMENTS 2
|
||||
|
||||
static int last_month = 99;
|
||||
static char last_month_str[MAX_NTP_MONTH_STR_LEN] = "";
|
||||
static const char *month_ar[MAX_NTP_MONTH_ARRAY_SIZE] = {
|
||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
||||
};
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
* External function prototypes
|
||||
*--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
extern void platform_set_time(int32_t gmt_time);
|
||||
void SipNtpUpdateClockFromCCM(void);
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
* Local scope function prototypes
|
||||
*--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* This function finds month (0 to 11) from month name
|
||||
* listed above in month_ar[]. This is used to convert the
|
||||
* date header from CCM to derive time/date.
|
||||
*/
|
||||
static boolean
|
||||
set_month_from_str (char *month_str)
|
||||
{
|
||||
boolean ret_val = FALSE;
|
||||
const char * fname = "set_month_from_str";
|
||||
int i;
|
||||
|
||||
if (month_str) {
|
||||
if (strncmp(month_str, last_month_str, 3) != 0) {
|
||||
for (i = 0; i < 12; i++) {
|
||||
if (strncmp(month_str, month_ar[i], 3) == 0) {
|
||||
sstrncpy(last_month_str, month_str, sizeof(last_month_str));
|
||||
last_month = i;
|
||||
ret_val = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ret_val = TRUE;
|
||||
}
|
||||
} else {
|
||||
TNP_DEBUG(DEB_F_PREFIX "Input month_str is NULL!!!! \n", DEB_F_PREFIX_ARGS(PLAT_API, fname));
|
||||
}
|
||||
return (ret_val);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* MISC platform stubs
|
||||
* These stubs are mostly NOPs for TNP but they are referred from common code
|
||||
* and this avoids ifdefs in the code.
|
||||
*
|
||||
*/
|
||||
static uint16_t PHNState = STATE_CONNECTED;
|
||||
|
||||
/* ccsip_core.o */
|
||||
uint16_t
|
||||
PHNGetState (void)
|
||||
{
|
||||
return (PHNState);
|
||||
}
|
||||
|
||||
void
|
||||
PHNChangeState (uint16_t state)
|
||||
{
|
||||
PHNState = state;
|
||||
}
|
||||
|
||||
/* ccsip_platform.o */
|
||||
void
|
||||
phone_reset (DeviceResetType resetType)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Methods below should be moved to plat as they are exported as an external API.
|
||||
* For now keeping all miscellaneous methods here.
|
||||
*/
|
||||
extern void config_get_value (int id, void *buffer, int length);
|
||||
|
||||
/*logger.c */
|
||||
|
||||
/*
|
||||
* Clear an entry or multiple entries in the
|
||||
* log table. The passed in log message is used
|
||||
* for partial matching, in order to figure out
|
||||
* what logs need to be cleared.
|
||||
*
|
||||
* The TNP Status Message screen does not have any
|
||||
* facility to "clear" log messages.
|
||||
*/
|
||||
void
|
||||
log_clear (int msg)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Indicates if the (preferred) network interface has changed (e.g., dock/undock)
|
||||
*
|
||||
* @param none
|
||||
*
|
||||
*
|
||||
* @return true if the (preferred) network interface has changed since last query
|
||||
* @return false if the (preferred) network interface has not changed
|
||||
*/
|
||||
boolean plat_is_network_interface_changed (void)
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* give the platform IPV6 IP address.
|
||||
*
|
||||
* @param[in/out] ip_addr - pointer to the cpr_ip_addr_t. The
|
||||
* result IP address will be populated in this
|
||||
* structure.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
void
|
||||
platform_get_ipv6_address (cpr_ip_addr_t *ip_addr)
|
||||
{
|
||||
//config_get_value(CFGID_IP_ADDR_MODE, &ip_mode, sizeof(ip_mode));
|
||||
//Todo IPv6: Hack to get the IPV6 address
|
||||
//if (ip_mode == CPR_IP_MODE_IPV6 || ip_mode == CPR_IP_MODE_DUAL) {
|
||||
//}
|
||||
ip_addr->type = CPR_IP_ADDR_IPV6;
|
||||
ip_addr->u.ip6.addr.base8[15] = 0x65;
|
||||
ip_addr->u.ip6.addr.base8[14] = 0xfb;
|
||||
ip_addr->u.ip6.addr.base8[13] = 0xb1;
|
||||
ip_addr->u.ip6.addr.base8[12] = 0xfe;
|
||||
ip_addr->u.ip6.addr.base8[11] = 0xff;
|
||||
ip_addr->u.ip6.addr.base8[10] = 0x11;
|
||||
ip_addr->u.ip6.addr.base8[9] = 0x11;
|
||||
ip_addr->u.ip6.addr.base8[8] = 0x02;
|
||||
ip_addr->u.ip6.addr.base8[7] = 0x01;
|
||||
ip_addr->u.ip6.addr.base8[6] = 0x00;
|
||||
ip_addr->u.ip6.addr.base8[5] = 0x18;
|
||||
ip_addr->u.ip6.addr.base8[4] = 0x0c;
|
||||
ip_addr->u.ip6.addr.base8[3] = 0xb8;
|
||||
ip_addr->u.ip6.addr.base8[2] = 0x0d;
|
||||
ip_addr->u.ip6.addr.base8[1] = 0x01;
|
||||
ip_addr->u.ip6.addr.base8[0] = 0x20;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* give the mac address string
|
||||
*
|
||||
* @param addr - mac address string (OUTPUT)
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
void
|
||||
platform_get_wired_mac_address (unsigned char *addr)
|
||||
{
|
||||
config_get_value(CFGID_MY_MAC_ADDR, addr, 6);
|
||||
TNP_DEBUG(DEB_F_PREFIX"Wired MacAddr:from Get Val: %04x:%04x:%04x",
|
||||
DEB_F_PREFIX_ARGS(PLAT_API, "platform_get_wired_mac_address"),
|
||||
addr[0] * 256 + addr[1], addr[2] * 256 + addr[3],
|
||||
addr[4] * 256 + addr[5]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get active mac address if required
|
||||
*
|
||||
* @param addr - mac address string (OUTPUT)
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
void
|
||||
platform_get_active_mac_address (unsigned char *addr)
|
||||
{
|
||||
config_get_value(CFGID_MY_ACTIVE_MAC_ADDR, addr, 6);
|
||||
TNP_DEBUG(DEB_F_PREFIX"ActiveMacAddr:from Get Val: %04x:%04x:%04x",
|
||||
DEB_F_PREFIX_ARGS(PLAT_API, "platform_get_mac_address"),
|
||||
addr[0] * 256 + addr[1], addr[2] * 256 + addr[3],
|
||||
addr[4] * 256 + addr[5]);
|
||||
}
|
||||
|
||||
/**
|
||||
* give the platform IPV4 IP address.
|
||||
*
|
||||
* @param[in/out] ip_addr - pointer to the cpr_ip_addr_t. The
|
||||
* result IP address will be populated in this
|
||||
* structure.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
void
|
||||
platform_get_ipv4_address (cpr_ip_addr_t *ip_addr)
|
||||
{
|
||||
config_get_value(CFGID_MY_IP_ADDR, ip_addr, sizeof(cpr_ip_addr_t));
|
||||
ip_addr->type = CPR_IP_ADDR_IPV4;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
IPNameCk (char *name, char *addr_error)
|
||||
{
|
||||
char *namePtr = name;
|
||||
char string[4] = { 0, 0, 0, 0 };
|
||||
int x = 0;
|
||||
int i = 0;
|
||||
uint32_t temp, ip_addr = 0;
|
||||
char ip_addr_out[MAX_IPADDR_STR_LEN];
|
||||
unsigned long strtoul_result;
|
||||
char *strtoul_end;
|
||||
|
||||
/* Check if valid IPv6 address */
|
||||
if (cpr_inet_pton(AF_INET6, name, ip_addr_out)) {
|
||||
*addr_error = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
*addr_error = TRUE;
|
||||
while (*namePtr != 0) {
|
||||
if ((*namePtr >= 0x30) && (*namePtr <= 0x39)) {
|
||||
if (x > 2)
|
||||
return (0);
|
||||
string[x++] = *namePtr++;
|
||||
} else {
|
||||
if (*namePtr == 0x2e) {
|
||||
if (i > 3)
|
||||
return (0);
|
||||
namePtr++;
|
||||
x = 0;
|
||||
|
||||
errno = 0;
|
||||
strtoul_result = strtoul(string, &strtoul_end, 10);
|
||||
|
||||
if (errno || string == strtoul_end || strtoul_result > 255) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
temp = (uint32_t) strtoul_result;
|
||||
|
||||
ip_addr |= temp << (24 - (i * 8));
|
||||
string[0] = 0;
|
||||
string[1] = 0;
|
||||
string[2] = 0;
|
||||
i++;
|
||||
} else
|
||||
return (0); // not an IP address
|
||||
}
|
||||
}
|
||||
|
||||
if (i == 3) {
|
||||
errno = 0;
|
||||
strtoul_result = strtoul(string, &strtoul_end, 10);
|
||||
|
||||
if (errno || string == strtoul_end || strtoul_result > 255) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
temp = (uint32_t) strtoul_result;
|
||||
|
||||
ip_addr |= temp;
|
||||
*addr_error = FALSE;
|
||||
return (ntohl(ip_addr));
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Given a msg buffer, returns a pointer to the buffer's header
|
||||
*
|
||||
* The cprGetSysHeader function retrieves the system header buffer for the
|
||||
* passed in message buffer.
|
||||
*
|
||||
* @param[in] buffer pointer to the buffer whose sysHdr to return
|
||||
*
|
||||
* @return Abstract pointer to the msg buffer's system header
|
||||
* or #NULL if failure
|
||||
*/
|
||||
void *
|
||||
cprGetSysHeader (void *buffer)
|
||||
{
|
||||
phn_syshdr_t *syshdr;
|
||||
|
||||
/*
|
||||
* Stinks that an external structure is necessary,
|
||||
* but this is a side-effect of porting from IRX.
|
||||
*/
|
||||
syshdr = cpr_calloc(1, sizeof(phn_syshdr_t));
|
||||
if (syshdr) {
|
||||
syshdr->Data = buffer;
|
||||
}
|
||||
return (void *)syshdr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Called when the application is done with this system header
|
||||
*
|
||||
* The cprReleaseSysHeader function returns the system header buffer to the
|
||||
* system.
|
||||
* @param[in] syshdr pointer to the sysHdr to be released
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
void
|
||||
cprReleaseSysHeader (void *syshdr)
|
||||
{
|
||||
if (syshdr == NULL) {
|
||||
CPR_ERROR("cprReleaseSysHeader: Sys header pointer is NULL\n");
|
||||
return;
|
||||
}
|
||||
|
||||
cpr_free(syshdr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief An internal function to update the system header
|
||||
*
|
||||
* A CPR-only function. Given a sysHeader and data, this function fills
|
||||
* in the data. The purpose for this function is to help prevent CPR
|
||||
* code from having to know about the phn_syshdr_t layout.
|
||||
*
|
||||
* @param[in] buffer pointer to a syshdr from a successful call to
|
||||
* cprGetSysHeader
|
||||
* @param[in] cmd command to place in the syshdr buffer
|
||||
* @param[in] len length to place in the syshdr buffer
|
||||
* @param[in] timerMsg msg being sent to the calling thread
|
||||
*
|
||||
* @return none
|
||||
*
|
||||
* @pre (buffer != NULL)
|
||||
*/
|
||||
void
|
||||
fillInSysHeader (void *buffer, uint16_t cmd, uint16_t len, void *timerMsg)
|
||||
{
|
||||
phn_syshdr_t *syshdr;
|
||||
|
||||
syshdr = (phn_syshdr_t *) buffer;
|
||||
syshdr->Cmd = cmd;
|
||||
syshdr->Len = len;
|
||||
syshdr->Usr.UsrPtr = timerMsg;
|
||||
return;
|
||||
}
|
||||
|
89
libs/sipcc/core/common/plat.c
Normal file
89
libs/sipcc/core/common/plat.c
Normal file
@ -0,0 +1,89 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <string.h>
|
||||
#include "cpr.h"
|
||||
#include "phone_debug.h"
|
||||
#include "CCProvider.h"
|
||||
#include "ccsip_pmh.h"
|
||||
#include "sessionTypes.h"
|
||||
#include "ccapp_task.h"
|
||||
|
||||
// Why don't we modify strlib_malloc to handle NULL?
|
||||
#define STRLIB_CREATE(str) (str)?strlib_malloc((str), strlen((str))):strlib_empty()
|
||||
|
||||
void
|
||||
platform_apply_config (char * configVersionStamp,
|
||||
char * dialplanVersionStamp,
|
||||
char * fcpVersionStamp,
|
||||
char * cucmResult,
|
||||
char * loadId,
|
||||
char * inactiveLoadId,
|
||||
char * loadServer,
|
||||
char * logServer,
|
||||
boolean ppid);
|
||||
/**
|
||||
* This function calls the JNI function to sends the information received
|
||||
* in apply-config NOTIFY message to Java side.
|
||||
*
|
||||
* @param configVersionStamp - version stamp for config file
|
||||
* @param dialplanVersionStamp - version stamp for the dialplan file
|
||||
* @param fcpVersionStamp - version stamp for the softkey file (?)
|
||||
* @param cucmResult - CUCM result after applying config by CUCM
|
||||
* @param loadId - loadId to upgrade as requested by CUCM
|
||||
* @param inactiveLoadId - inactive loadId for inactive partition as requested by CUCM
|
||||
* @param loadServer - load server form where to pick loadId
|
||||
* @param logServer - log server for logging output of peer to peer upgrade.
|
||||
* @param ppid - specify whether peer to peer upgrade is enabled/disabled.
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
void
|
||||
platform_apply_config (char * configVersionStamp,
|
||||
char * dialplanVersionStamp,
|
||||
char * fcpVersionStamp,
|
||||
char * cucmResult,
|
||||
char * loadId,
|
||||
char * inactiveLoadId,
|
||||
char * loadServer,
|
||||
char * logServer,
|
||||
boolean ppid)
|
||||
{
|
||||
static const char fname[] = "platform_apply_config";
|
||||
session_mgmt_t msg;
|
||||
|
||||
fcpVersionStamp = (fcpVersionStamp != NULL) ? fcpVersionStamp : "";
|
||||
|
||||
/// Print the arguments
|
||||
CCAPP_DEBUG(DEB_F_PREFIX" configVersionStamp=%s \ndialplanVersionStamp=%s"
|
||||
"\nfcpVersionStamp=%s \ncucmResult=%s "
|
||||
"\nloadId=%s \ninactiveLoadId=%s \nloadServer=%s \nlogServer=%s "
|
||||
"\nppid=%s\n", DEB_F_PREFIX_ARGS(PLAT_API, fname),
|
||||
(configVersionStamp != NULL) ? configVersionStamp : "",
|
||||
(dialplanVersionStamp != NULL) ? dialplanVersionStamp:"",
|
||||
fcpVersionStamp,
|
||||
cucmResult != NULL ? cucmResult: "",
|
||||
(loadId != NULL) ? loadId : "",
|
||||
(inactiveLoadId != NULL) ? inactiveLoadId : "",
|
||||
(loadServer != NULL) ? loadServer : "",
|
||||
(logServer != NULL) ? logServer : "",
|
||||
ppid == TRUE? "True": "False");
|
||||
|
||||
|
||||
// following data is freed in function freeSessionMgmtData()
|
||||
msg.func_id = SESSION_MGMT_APPLY_CONFIG;
|
||||
msg.data.config.config_version_stamp = STRLIB_CREATE(configVersionStamp);
|
||||
msg.data.config.dialplan_version_stamp = STRLIB_CREATE(dialplanVersionStamp);
|
||||
msg.data.config.fcp_version_stamp = STRLIB_CREATE(fcpVersionStamp);
|
||||
msg.data.config.cucm_result = STRLIB_CREATE(cucmResult);
|
||||
msg.data.config.load_id = STRLIB_CREATE(loadId);
|
||||
msg.data.config.inactive_load_id = STRLIB_CREATE(inactiveLoadId);
|
||||
msg.data.config.load_server = STRLIB_CREATE(loadServer);
|
||||
msg.data.config.log_server = STRLIB_CREATE(logServer);
|
||||
msg.data.config.ppid = ppid;
|
||||
|
||||
if ( ccappTaskPostMsg(CCAPP_SESSION_MGMT, &msg, sizeof(session_mgmt_t), CCAPP_CCPROVIER) != CPR_SUCCESS ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"failed to send platform_apply_config msg\n", DEB_F_PREFIX_ARGS(PLAT_API, fname));
|
||||
}
|
||||
}
|
396
libs/sipcc/core/common/platform_api.c
Executable file
396
libs/sipcc/core/common/platform_api.c
Executable file
@ -0,0 +1,396 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include "cpr.h"
|
||||
#include "cpr_string.h"
|
||||
#include "phone_debug.h"
|
||||
#include "prot_configmgr.h"
|
||||
#include "phone.h"
|
||||
#include "CCProvider.h"
|
||||
#include "cpr_stdlib.h"
|
||||
#include "ccsip_pmh.h"
|
||||
#include "platform_api.h"
|
||||
#include <fcntl.h>
|
||||
#include "ccapp_task.h"
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
* Local definitions
|
||||
*--------------------------------------------------------------------------
|
||||
*/
|
||||
#define PLT_F_PREFIX "PLT : %s : " // requires 1 arg: fname
|
||||
// Why don't we modify strlib_malloc to handle NULL?
|
||||
#define STRLIB_CREATE(str) (str)?strlib_malloc((str), strlen((str))):strlib_empty()
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
* Global data
|
||||
*--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
* External function prototypes
|
||||
*--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void platform_sync_cfg_vers(char *cfg_ver, char *dp_ver, char *softkey_ver);
|
||||
void platform_reg_fallback_ind(int fallback_to);
|
||||
void platform_reg_failover_ind(int failover_to);
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
* Local scope function prototypes
|
||||
*--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* give the platform IP address mode. This is a temporary function
|
||||
* until config_get_value(CFGID_IP_ADDR_MODE, &ip_mode, sizeof(ip_mode))
|
||||
* is fully implemented (P2).
|
||||
*
|
||||
* @param none
|
||||
*
|
||||
* @return CPR_IP_MODE_IPV4,
|
||||
* CPR_IP_MODE_IPV6,
|
||||
* CPR_IP_MODE_DUAL
|
||||
*/
|
||||
cpr_ip_mode_e
|
||||
platform_get_ip_address_mode (void)
|
||||
{
|
||||
cpr_ip_mode_e ip_mode;
|
||||
|
||||
//config_get_value(CFGID_IP_ADDR_MODE, &ip_mode, sizeof(ip_mode));
|
||||
|
||||
/* fake mode to what ever mode under test here */
|
||||
ip_mode = CPR_IP_MODE_IPV4;
|
||||
|
||||
return (ip_mode);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send a reset or restart request to the adapter
|
||||
*
|
||||
* @param action - reset or restart
|
||||
* @return none
|
||||
*
|
||||
*/
|
||||
void
|
||||
platform_reset_req (DeviceResetType action)
|
||||
{
|
||||
static const char fname[] = "platform_reset_req";
|
||||
feature_update_t msg;
|
||||
|
||||
DEF_DEBUG(DEB_F_PREFIX"***********%s, requested***********\n",
|
||||
DEB_F_PREFIX_ARGS(PLAT_API, fname),
|
||||
(action==1)? "RESET":"RESTART");
|
||||
|
||||
msg.sessionType = SESSIONTYPE_CALLCONTROL;
|
||||
msg.featureID = DEVICE_SERVICE_CONTROL_REQ;
|
||||
msg.update.ccFeatUpd.data.reset_type = action;
|
||||
|
||||
if ( ccappTaskPostMsg(CCAPP_FEATURE_UPDATE, &msg, sizeof(feature_update_t), CCAPP_CCPROVIER) != CPR_SUCCESS ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"failed to send platform_reset_req(%d) msg \n", DEB_F_PREFIX_ARGS(PLAT_API, fname), action);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ask the platform to sync with versions got from call control
|
||||
* or outside entity. As part of the sync, platform downloads
|
||||
* the files if required.
|
||||
*
|
||||
* @param cfg_ver - version stamp for config file
|
||||
* @param dp_ver - version stamp for the dialplan file
|
||||
* @param softkey_ver - version stamp for the softkey file.
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
void
|
||||
platform_sync_cfg_vers (char *cfg_ver, char *dp_ver, char *softkey_ver)
|
||||
{
|
||||
static const char fname[] = "platform_sync_cfg_vers";
|
||||
char empty_string[] = "";
|
||||
feature_update_t msg;
|
||||
|
||||
if (cfg_ver == NULL) {
|
||||
cfg_ver = empty_string;
|
||||
}
|
||||
if (dp_ver == NULL) {
|
||||
dp_ver = empty_string;
|
||||
}
|
||||
if (softkey_ver == NULL) {
|
||||
softkey_ver = empty_string;
|
||||
}
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"cfg_ver=%s dp_ver=%s sk_ver=%s\n", DEB_F_PREFIX_ARGS(PLAT_API, fname),
|
||||
cfg_ver, dp_ver, softkey_ver);
|
||||
|
||||
msg.sessionType = SESSIONTYPE_CALLCONTROL;
|
||||
msg.featureID = DEVICE_SYNC_CONFIG_VERSION;
|
||||
msg.update.ccFeatUpd.data.cfg_ver_data.cfg_ver = strlib_malloc(cfg_ver, strlen(cfg_ver));
|
||||
msg.update.ccFeatUpd.data.cfg_ver_data.dp_ver = strlib_malloc(dp_ver, strlen(dp_ver));
|
||||
msg.update.ccFeatUpd.data.cfg_ver_data.softkey_ver = strlib_malloc(softkey_ver, strlen(softkey_ver));
|
||||
|
||||
if ( ccappTaskPostMsg(CCAPP_FEATURE_UPDATE, &msg, sizeof(feature_update_t), CCAPP_CCPROVIER) != CPR_SUCCESS ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"failed to send platform_sync_cfg_vers msg \n",
|
||||
DEB_F_PREFIX_ARGS(PLAT_API, fname));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Tell platform to adjust the time to the gmt_time received from outside
|
||||
* For sip the "outside" is from the "Date" header coming from a CCM or
|
||||
* any other Server
|
||||
*
|
||||
* @param gmt_time - GMT time in seconds
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
void
|
||||
platform_set_time (long gmt_time)
|
||||
{
|
||||
static const char fname[] = "platform_set_time";
|
||||
session_mgmt_t msg;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"setting time to=%ld", DEB_F_PREFIX_ARGS(PLAT_API, fname), gmt_time);
|
||||
|
||||
msg.func_id = SESSION_MGMT_SET_TIME;
|
||||
msg.data.time.gmt_time = gmt_time;
|
||||
|
||||
if ( ccappTaskPostMsg(CCAPP_SESSION_MGMT, &msg, sizeof(session_mgmt_t), CCAPP_CCPROVIER) != CPR_SUCCESS ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"failed to send platform_set_time msg\n", DEB_F_PREFIX_ARGS(PLAT_API, fname));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Indicate to the platform that reg manager wants to failover to a Call
|
||||
* control indicated in failover_to. A corresponding ccRegFailoverRsp()
|
||||
* will be issued by the platform once the failover indication is processed.
|
||||
*
|
||||
* @param failover_to - type of call control,
|
||||
* e.g. cip_sipcc_CcMgmtConst_CC_TYPE_CCM
|
||||
* @return none
|
||||
*/
|
||||
void
|
||||
platform_reg_failover_ind (int failover_to)
|
||||
{
|
||||
static const char fname[] = "platform_reg_failover_ind";
|
||||
feature_update_t msg;
|
||||
|
||||
DEF_DEBUG(DEB_F_PREFIX"***********Failover to %s=%d ***********\n",
|
||||
DEB_F_PREFIX_ARGS(PLAT_API, fname),
|
||||
failover_to == CC_TYPE_CCM ? "CC_TYPE_CCM" :
|
||||
"Other", failover_to);
|
||||
|
||||
msg.sessionType = SESSIONTYPE_CALLCONTROL;
|
||||
msg.featureID = CCAPP_FAILOVER_IND;
|
||||
msg.update.ccFeatUpd.data.line_info.info = failover_to;
|
||||
|
||||
if ( ccappTaskPostMsg(CCAPP_FAILOVER_IND, &msg, sizeof(feature_update_t), CCAPP_CCPROVIER) != CPR_SUCCESS ) {
|
||||
CCAPP_ERROR(PLT_F_PREFIX"failed to send platform_reg_failover_ind(%d) msg \n", fname, failover_to);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Indicate to the platform that reg manager intends to fallback to
|
||||
* primary CCM. Currently the fallback_to is always to CC_TYPE_CCM.
|
||||
*
|
||||
* @param fallback_to - type of call control,
|
||||
* e.g. cip_sipcc_CcMgmtConst_CC_TYPE_CCM
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
void
|
||||
platform_reg_fallback_ind (int fallback_to)
|
||||
{
|
||||
static const char fname[] = "platform_reg_fallback_ind";
|
||||
feature_update_t msg;
|
||||
|
||||
DEF_DEBUG(DEB_F_PREFIX"***********Fallback to %d CUCM.***********\n",
|
||||
DEB_F_PREFIX_ARGS(PLAT_API, fname),
|
||||
fallback_to);
|
||||
|
||||
msg.sessionType = SESSIONTYPE_CALLCONTROL;
|
||||
msg.featureID = CCAPP_FALLBACK_IND;
|
||||
msg.update.ccFeatUpd.data.line_info.info = fallback_to;
|
||||
|
||||
if ( ccappTaskPostMsg(CCAPP_FALLBACK_IND, &msg, sizeof(feature_update_t), CCAPP_CCPROVIER) != CPR_SUCCESS ) {
|
||||
CCAPP_ERROR(PLT_F_PREFIX"failed to send platform_reg_fallback_ind(%d) msg \n", fname, fallback_to);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Indicate to the platform that current fallback activity
|
||||
* is complete i.e. either success or encountered an error
|
||||
* and that the platform should put the User interaction back
|
||||
* in service.
|
||||
*
|
||||
* @param none
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
void
|
||||
platform_reg_fallback_cfm (void)
|
||||
{
|
||||
static const char fname[] = "platform_reg_fallback_cfm";
|
||||
|
||||
DEF_DEBUG(DEB_F_PREFIX"***********Fallback completed.***********\n",
|
||||
DEB_F_PREFIX_ARGS(PLAT_API, fname));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Indicate to the platform that current failover activity
|
||||
* is complete i.e. either success or encountered an error
|
||||
* and that the platform should put the User interaction back
|
||||
* in service.
|
||||
*
|
||||
* @param none
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
void
|
||||
platform_reg_failover_cfm (void)
|
||||
{
|
||||
static const char fname[] = "platform_reg_failover_cfm";
|
||||
|
||||
DEF_DEBUG(DEB_F_PREFIX"***********Failover completed.***********\n",
|
||||
DEB_F_PREFIX_ARGS(PLAT_API, fname));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Notify the platform that call control has shut down.
|
||||
*
|
||||
* @param none
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
void
|
||||
shutdownCCAck (void)
|
||||
{
|
||||
static const char fname[] = "shutdownCCAck";
|
||||
feature_update_t msg;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"\n", DEB_F_PREFIX_ARGS(PLAT_API, fname));
|
||||
|
||||
msg.sessionType = SESSIONTYPE_CALLCONTROL;
|
||||
msg.featureID = CCAPP_SHUTDOWN_ACK;
|
||||
|
||||
if ( ccappTaskPostMsg(CCAPP_SHUTDOWN_ACK, &msg, sizeof(feature_update_t), CCAPP_CCPROVIER) != CPR_SUCCESS ) {
|
||||
CCAPP_ERROR(PLT_F_PREFIX"failed to send shutdownCCAck(%d) msg \n", fname);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify the platform about the change in call control mode.
|
||||
*
|
||||
* @param mode - the call control mode.
|
||||
* cip_sipcc_CcMgmtConst_CC_TYPE_CCM
|
||||
* or cip_sipcc_CcMgmtConst_CC_TYPE_OTHER
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
void
|
||||
platform_cc_mode_notify (int mode)
|
||||
{
|
||||
static const char fname[] = "platform_cc_mode_notify";
|
||||
feature_update_t msg;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"mode =%d\n", DEB_F_PREFIX_ARGS(PLAT_API, fname), mode);
|
||||
|
||||
msg.sessionType = SESSIONTYPE_CALLCONTROL;
|
||||
msg.featureID = CCAPP_MODE_NOTIFY;
|
||||
msg.update.ccFeatUpd.data.line_info.info = mode;
|
||||
|
||||
if ( ccappTaskPostMsg(CCAPP_MODE_NOTIFY, &msg, sizeof(feature_update_t), CCAPP_CCPROVIER) != CPR_SUCCESS ) {
|
||||
CCAPP_ERROR(PLT_F_PREFIX"failed to send platform_cc_mode_notify(%d) msg \n", fname, mode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
platform_get_phrase_text (int ndx, char *outstr, uint32_t len)
|
||||
{
|
||||
static const char fname[] = "platform_get_phrase_text";
|
||||
session_mgmt_t msg;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX "index=%d\n", DEB_F_PREFIX_ARGS(PLAT_API, fname), ndx);
|
||||
|
||||
msg.func_id = SESSION_MGMT_GET_PHRASE_TEXT;
|
||||
msg.data.phrase_text.ndx = ndx;
|
||||
msg.data.phrase_text.outstr = outstr;
|
||||
msg.data.phrase_text.len = len;
|
||||
|
||||
ccappSyncSessionMgmt(&msg);
|
||||
|
||||
return msg.data.phrase_text.ret_val;
|
||||
}
|
||||
|
||||
|
||||
/*called from configapp.c. This routine will set the kpml
|
||||
value on the java side and trigger it down to c-side.
|
||||
Also, it will reinitialize the dialplan. */
|
||||
void
|
||||
update_kpmlconfig(int kpmlVal)
|
||||
{
|
||||
static const char fname[] = "update_kpmlconfig";
|
||||
session_mgmt_t msg;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX "kpml=%d\n", DEB_F_PREFIX_ARGS(PLAT_API, fname), kpmlVal);
|
||||
|
||||
msg.func_id = SESSION_MGMT_UPDATE_KPMLCONFIG;
|
||||
msg.data.kpmlconfig.kpml_val = kpmlVal;
|
||||
|
||||
if ( ccappTaskPostMsg(CCAPP_SESSION_MGMT, &msg, sizeof(session_mgmt_t), CCAPP_CCPROVIER) != CPR_SUCCESS ) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"failed to send update_kpmlconfig msg\n", DEB_F_PREFIX_ARGS(PLAT_API, fname));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
boolean
|
||||
check_speaker_headset_mode()
|
||||
{
|
||||
static const char fname[] = "check_speaker_headset_mode";
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX "checking SPEAKER and HEADSET active or not\n", DEB_F_PREFIX_ARGS(PLAT_API, fname));
|
||||
|
||||
return platGetSpeakerHeadsetMode();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Notify the platform to logout and reset.
|
||||
*
|
||||
* @param none
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
|
||||
void
|
||||
platform_logout_reset_req(void){
|
||||
static const char fname[] = "platform_logout_reset_req";
|
||||
feature_update_t msg;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"\n", DEB_F_PREFIX_ARGS(PLAT_API, fname));
|
||||
|
||||
msg.sessionType = SESSIONTYPE_CALLCONTROL;
|
||||
msg.featureID = CCAPP_LOGOUT_RESET;
|
||||
|
||||
if ( ccappTaskPostMsg(CCAPP_FALLBACK_IND, &msg, sizeof(feature_update_t), CCAPP_CCPROVIER) != CPR_SUCCESS ) {
|
||||
CCAPP_ERROR(PLT_F_PREFIX"failed to send Logout_Reset(%d) msg \n", fname);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
431
libs/sipcc/core/common/prot_cfgmgr_private.h
Executable file
431
libs/sipcc/core/common/prot_cfgmgr_private.h
Executable file
@ -0,0 +1,431 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _PROT_CFGMGR_PRIVATE_H_
|
||||
#define _PROT_CFGMGR_PRIVATE_H_
|
||||
|
||||
#include "cpr_types.h"
|
||||
#include "ccapi.h"
|
||||
#include "ccsip_protocol.h"
|
||||
//TEMPORARY REMOVAL #include "sntp.h"
|
||||
#include "configmgr.h"
|
||||
#include "dtmf.h"
|
||||
#include "phone_platform_constants.h"
|
||||
|
||||
#ifdef SAPP_SAPP_GSM
|
||||
#define DEFAULT_PROTOCOL "sip"
|
||||
#define SCCP_WELL_KNOWN_PORT_STR "2000"
|
||||
#endif
|
||||
|
||||
#define SIP_PLATFORM_CONFIG_DATE_TEMPLATE_24HOUR "M/D/Y"
|
||||
#define SIP_PLATFORM_CONFIG_DATE_TEMPLATE_12HOUR "M/D/YA"
|
||||
|
||||
#define DYNAMIC_DTMF_PAYLOAD_MIN 96
|
||||
#define DYNAMIC_DTMF_PAYLOAD_MAX 127
|
||||
|
||||
// Includes 3 CCMS
|
||||
#define MAX_CCMS 4
|
||||
|
||||
#define MAX_CODEC_ENTRIES 10
|
||||
// updated MAX_LOAD_FILE_NAME to be in sync with XmlDefaultConfigParmObject
|
||||
#define MAX_LOAD_FILE_NAME 65
|
||||
|
||||
/*********************************************************
|
||||
*
|
||||
* Config Block Definition
|
||||
* This structure holds all of the parsed configuration
|
||||
* information obtained from the TFTP config file
|
||||
*
|
||||
* To add new entries to the config table, please see
|
||||
* the instructions in configmgr.h and prot_configmgr.h
|
||||
*
|
||||
* note: IP addresses are internally stored in the
|
||||
* Telecaster "Byte Reversed" order.
|
||||
* Eg. 0xf8332ca1 = 161.44.51.248
|
||||
*
|
||||
********************************************************/
|
||||
typedef struct
|
||||
{
|
||||
int feature;
|
||||
int index;
|
||||
int maxnumcalls;
|
||||
int busy_trigger;
|
||||
char name[MAX_LINE_NAME_SIZE];
|
||||
char authname[AUTH_NAME_SIZE];
|
||||
char password[MAX_LINE_PASSWORD_SIZE];
|
||||
char displayname[MAX_LINE_NAME_SIZE]; // Actually we allow upto 32 UTF-8 chars which typically needs 32*3 octets.
|
||||
char contact[MAX_LINE_CONTACT_SIZE];
|
||||
int autoanswer;
|
||||
char autoanswer_mode[MAX_LINE_AUTO_ANS_MODE_SIZE];
|
||||
int call_waiting;
|
||||
int msg_waiting_lamp;
|
||||
int msg_waiting_amwi;
|
||||
int ring_setting_idle;
|
||||
int ring_setting_active;
|
||||
char proxy_address[MAX_IPADDR_STR_LEN];
|
||||
int proxy_port;
|
||||
char cfwdall[MAX_URL_LENGTH];
|
||||
char speeddial_number[MAX_LINE_NAME_SIZE];
|
||||
char retrieval_prefix[MAX_LINE_NAME_SIZE];
|
||||
char messages_number[MAX_LINE_NAME_SIZE];
|
||||
int fwd_caller_name_display;
|
||||
int fwd_caller_number_display;
|
||||
int fwd_redirected_number_display;
|
||||
int fwd_dialed_number_display;
|
||||
int feature_option_mask;
|
||||
} line_cfg_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char address[MAX_IPADDR_STR_LEN];
|
||||
char ipv6address[MAX_IPADDR_STR_LEN];
|
||||
int sip_port;
|
||||
int sec_level;
|
||||
int is_valid;
|
||||
} ccm_cfg_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
cpr_ip_addr_t my_ip_addr;
|
||||
uint8_t my_mac_addr[6];
|
||||
|
||||
line_cfg_t line[MAX_CONFIG_LINES];
|
||||
ccm_cfg_t ccm[MAX_CCMS];
|
||||
int proxy_register;
|
||||
int sip_retx; /* SIP retransmission count */
|
||||
int sip_invite_retx; /* SIP INVITE request retransmission count */
|
||||
int timer_t1; /* SIP T1 timer value */
|
||||
int timer_t2; /* SIP T2 timer value */
|
||||
int timer_invite_expires; /* SIP Expires timer value */
|
||||
int timer_register_expires;
|
||||
/*
|
||||
* preferred codec is kept as key_table_entry structure. The
|
||||
* name field of the key is a primary indication whether the
|
||||
* parameter is configured or not. This is because the
|
||||
* zero value is a designated value for G711 and the -1 is
|
||||
* for no codec. The -1 is not natural value of uninitialized
|
||||
* variable therefore keep the codec as name and value pair.
|
||||
* The missing of the name indiates there the parameter is not
|
||||
* configured.
|
||||
*/
|
||||
key_table_entry_t preferred_codec;
|
||||
int dtmf_db_level;
|
||||
DtmfOutOfBandTransport_t dtmf_outofband;
|
||||
int dtmf_avt_payload;
|
||||
int callerid_blocking;
|
||||
int dnd_call_alert;
|
||||
int dnd_reminder_timer;
|
||||
int blf_alert_tone_idle;
|
||||
int blf_alert_tone_busy;
|
||||
int auto_pickup_enabled;
|
||||
int call_hold_ringback;
|
||||
int stutter_msg_waiting;
|
||||
int call_stats;
|
||||
int auto_answer;
|
||||
int anonymous_call_block;
|
||||
int nat_enable;
|
||||
char nat_address[MAX_IPADDR_STR_LEN];
|
||||
int voip_control_port;
|
||||
unsigned int media_port_start;
|
||||
unsigned int media_port_end;
|
||||
char sync[MAX_SYNC_LEN];
|
||||
char proxy_backup[MAX_IPADDR_STR_LEN];
|
||||
char proxy_emergency[MAX_IPADDR_STR_LEN];
|
||||
int proxy_backup_port;
|
||||
int proxy_emergency_port;
|
||||
int nat_received_processing;
|
||||
|
||||
char proxy_outbound[MAX_IPADDR_STR_LEN];
|
||||
int proxy_outbound_port;
|
||||
char reg_user_info[MAX_REG_USER_INFO_LEN];
|
||||
int cnf_join_enable;
|
||||
int remote_party_id;
|
||||
int semi_xfer;
|
||||
char cfwd_uri[MAX_URL_LENGTH];
|
||||
int local_cfwd_enable;
|
||||
int timer_register_delta;
|
||||
int rfc_2543_hold;
|
||||
int sip_max_forwards;
|
||||
int conn_monitor_duration;
|
||||
char call_pickup_uri[MAX_URL_LENGTH];
|
||||
char call_pickup_list_uri[MAX_URL_LENGTH];
|
||||
char call_pickup_group_uri[MAX_URL_LENGTH];
|
||||
char meet_me_service_uri[MAX_URL_LENGTH];
|
||||
char call_forward_uri[MAX_URL_LENGTH];
|
||||
char abbreviated_dial_uri[MAX_URL_LENGTH];
|
||||
int call_log_blf_enabled;
|
||||
int remote_cc_enabled;
|
||||
int timer_keepalive_expires;
|
||||
int timer_subscribe_expires;
|
||||
int timer_subscribe_delta;
|
||||
int transport_layer_prot;
|
||||
int kpml;
|
||||
int enable_vad;
|
||||
int autoanswer_idle_alt;
|
||||
int autoanswer_timer;
|
||||
int autoanswer_override;
|
||||
int offhook_to_first_digit;
|
||||
int call_waiting_period;
|
||||
int ring_setting_busy_pol;
|
||||
int dscp_for_call_control;
|
||||
int speaker_enabled;
|
||||
int xfr_onhook_enabled;
|
||||
int retain_forward_information;
|
||||
int rollover;
|
||||
int join_across_lines;
|
||||
int emcc_mode;
|
||||
int visiting_em_port;
|
||||
char visiting_em_ip[MAX_IPADDR_STR_LEN];
|
||||
int ip_addr_mode;
|
||||
char load_file[MAX_LOAD_FILE_NAME];
|
||||
int inter_digit_timer;
|
||||
int dscp_audio;
|
||||
int dscp_video;
|
||||
char deviceName[MAX_REG_USER_INFO_LEN];
|
||||
uint8_t my_active_mac_addr[6];
|
||||
char userAgent[MAX_REG_USER_INFO_LEN];
|
||||
char modelNumber[MAX_REG_USER_INFO_LEN];
|
||||
int srst_is_secure;
|
||||
char join_dxfer_policy[MAX_JOIN_DXFER_POLICY_SIZE];
|
||||
char external_number_mask[MAX_EXTERNAL_NUMBER_MASK_SIZE];
|
||||
char media_ip_addr[MAX_IPADDR_STR_LEN];
|
||||
int p2psip;
|
||||
int sdpmode;
|
||||
char version[4];
|
||||
int rtcpmux;
|
||||
int rtpsavpf;
|
||||
int maxavbitrate;
|
||||
int maxcodedaudiobw;
|
||||
int usedtx;
|
||||
int stereo;
|
||||
int useinbandfec;
|
||||
int cbr;
|
||||
int maxptime;
|
||||
int sctp_port;
|
||||
int num_data_streams;
|
||||
} prot_cfg_t;
|
||||
|
||||
static prot_cfg_t prot_cfg_block;
|
||||
|
||||
|
||||
/*********************************************************
|
||||
* return (1);
|
||||
* Config Table Keytable Structures
|
||||
*
|
||||
* Some config table entries can only contain special return (1);
|
||||
* values. Those entries must specify a key table
|
||||
* that contains valid values for the entry.
|
||||
*
|
||||
*********************************************************/
|
||||
/*
|
||||
* codec_table table is used for parsing configured preferred
|
||||
* codec, J-side caches string and it is converted to the enumerated
|
||||
* value during reset/restart. The "none" value is currently used
|
||||
* by CUCM' TFTP when there is no preferred codec configured and
|
||||
* therefore the "none" is included in the table.
|
||||
*/
|
||||
static const key_table_entry_t codec_table[] = {
|
||||
{"g711ulaw", RTP_PCMU},
|
||||
{"g711alaw", RTP_PCMA},
|
||||
{"g729a", RTP_G729},
|
||||
{"L16", RTP_L16},
|
||||
#ifdef CISCOWB_SUPPORTED
|
||||
{"CiscoWb", RTP_CISCOWB},
|
||||
#endif
|
||||
{"g722", RTP_G722},
|
||||
{"iLBC", RTP_ILBC},
|
||||
{"iSAC", RTP_ISAC},
|
||||
{"opus", RTP_OPUS},
|
||||
{"none", RTP_NONE},
|
||||
{0, RTP_NONE}
|
||||
};
|
||||
|
||||
static const key_table_entry_t dtmf_outofband_table[] = {
|
||||
{"none", DTMF_OUTOFBAND_NONE},
|
||||
{"avt", DTMF_OUTOFBAND_AVT},
|
||||
{"avt_always", DTMF_OUTOFBAND_AVT_ALWAYS},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
static const key_table_entry_t user_info_table[] = {
|
||||
{"none", 0,},
|
||||
{"phone", 1,},
|
||||
{"ip", 2,},
|
||||
{0, 0,}
|
||||
};
|
||||
|
||||
/*********************************************************
|
||||
*!!!!!!!!!!!!!!!!!!!!!WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
*
|
||||
* SIP Protocol Config table Variable Name and Type Definitions
|
||||
*
|
||||
* This table defines all the possible variables that can
|
||||
* be set in the TFTP config file (if used).
|
||||
* var: Is the name as it is defined in the ascii
|
||||
* configuration file.
|
||||
* addr: Is the address of where the parsed variable
|
||||
* is stored into memory
|
||||
* len: Is the length of the item in kazoo memory.
|
||||
* (Important for things like strings)
|
||||
* parser: Is a function pointer to a routine that is
|
||||
* used to parse (convert) this particular
|
||||
* variable from ascii form to internal form.
|
||||
* print: Is a function pointer to a routine that is
|
||||
* used to print (convert) this particular
|
||||
* variable from internal form to ascii form.
|
||||
* keytable: Defines the table of values that this entry
|
||||
* can have.
|
||||
*
|
||||
*!!!!!!!!!!!!!!!!!!!!!WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
* Before changing any these, please read the following:
|
||||
*
|
||||
* This table MUST be kept in sync with the configuration
|
||||
* ID enums located in the prot_configmgr.h
|
||||
* file. There is a one-to-one correspondence between those
|
||||
* enums and this table.
|
||||
*
|
||||
* To add or remove config properties, please refer to the
|
||||
* file prot_configmgr.h.
|
||||
*
|
||||
*!!!!!!!!!!!!!!!!!!!!!WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
*********************************************************/
|
||||
/*********************************************************
|
||||
*
|
||||
* Platform-Specific Configuration Section
|
||||
* (Common across all IP Phone protocols.)
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
/* name {addr & len} parser print */
|
||||
/* ------------------------ ----------------- ------ ------ */
|
||||
var_t prot_cfg_table[CFGID_PROTOCOL_MAX+1] = {
|
||||
/* 0 */{"startMediaPort",CFGVAR(media_port_start), PA_INT, PR_INT, 0},
|
||||
{"endMediaPort", CFGVAR(media_port_end), PA_INT, PR_INT, 0},
|
||||
{"callerIdBlocking", CFGVAR(callerid_blocking), PA_INT, PR_INT, 0},
|
||||
{"anonymousCallBlock", CFGVAR(anonymous_call_block), PA_INT, PR_INT, 0},
|
||||
{"dndCallAlert", CFGVAR(dnd_call_alert), PA_INT, PR_INT, 0},
|
||||
{"dndReminderTimer", CFGVAR(dnd_reminder_timer), PA_INT, PR_INT, 0},
|
||||
{"preferredCode", CFGVAR(preferred_codec), PA_KEYE, PR_KEYE, codec_table},
|
||||
{"dtmfOutofBand",CFGVAR(dtmf_outofband), PA_KEY, PR_KEY, dtmf_outofband_table},
|
||||
{"dtmfAvtPayload", CFGVAR(dtmf_avt_payload), PA_INT, PR_INT, 0},
|
||||
{"dtmfDbLevel", CFGVAR(dtmf_db_level), PA_INT, PR_INT, 0},
|
||||
{"sipRetx", CFGVAR(sip_retx), PA_INT, PR_INT, 0},
|
||||
/*11*/ {"sipInviteRetx", CFGVAR(sip_invite_retx), PA_INT, PR_INT, 0},
|
||||
{"timerT1", CFGVAR(timer_t1), PA_INT, PR_INT, 0},
|
||||
{"timerT2", CFGVAR(timer_t2), PA_INT, PR_INT, 0},
|
||||
{"timerInviteExpires", CFGVAR(timer_invite_expires), PA_INT, PR_INT, 0},
|
||||
{"timerRegisterExpires", CFGVAR(timer_register_expires), PA_INT, PR_INT, 0},
|
||||
{"registerWithProxy", CFGVAR(proxy_register), PA_INT, PR_INT, 0},
|
||||
{"backupProxy", CFGVAR(proxy_backup), PA_STR, PR_STR, 0},
|
||||
{"backupProxyPort", CFGVAR(proxy_backup_port), PA_INT, PR_INT, 0},
|
||||
{"emergencyProxy", CFGVAR(proxy_emergency), PA_STR, PR_STR, 0},
|
||||
{"emergencyProxyPort", CFGVAR(proxy_emergency_port), PA_INT, PR_INT, 0},
|
||||
{"outboundProxy", CFGVAR(proxy_outbound), PA_STR, PR_STR, 0},
|
||||
{"outboundProxyPort", CFGVAR(proxy_outbound_port), PA_INT, PR_INT, 0},
|
||||
{"natReceivedProcessing", CFGVAR(nat_received_processing),PA_INT, PR_INT, 0},
|
||||
{"userInfo", CFGVAR(reg_user_info), PA_KEY, PR_KEY, user_info_table},
|
||||
{"cnfJoinEnable", CFGVAR(cnf_join_enable), PA_INT, PR_INT, 0},
|
||||
{"remotePartyID", CFGVAR(remote_party_id), PA_INT, PR_INT, 0},
|
||||
{"semiAttendedTransfer", CFGVAR(semi_xfer), PA_INT, PR_INT, 0},
|
||||
{"callHoldRingback", CFGVAR(call_hold_ringback), PA_INT, PR_INT, 0},
|
||||
{"stutterMsgWaiting", CFGVAR(stutter_msg_waiting), PA_INT, PR_INT, 0},
|
||||
{"callForwardUri", CFGVAR(cfwd_uri), PA_STR, PR_STR, 0},
|
||||
/*31*/ {"callStats", CFGVAR(call_stats), PA_INT, PR_INT, 0},
|
||||
{"autoAnswer", CFGVAR(auto_answer), PA_INT, PR_INT, 0},
|
||||
{"localCfwdEnable", CFGVAR(local_cfwd_enable), PA_INT, PR_INT, 0},
|
||||
{"timerRegisterDelta", CFGVAR(timer_register_delta), PA_INT, PR_INT, 0},
|
||||
{"MaxRedirects", CFGVAR(sip_max_forwards), PA_INT, PR_INT, 0},
|
||||
{"rfc2543Hold", CFGVAR(rfc_2543_hold), PA_INT, PR_INT, 0},
|
||||
{"ccm1_address", CFGVAR(ccm[0].address), PA_STR, PR_STR, 0},
|
||||
{"ccm2_address", CFGVAR(ccm[1].address), PA_STR, PR_STR, 0},
|
||||
{"ccm3_address", CFGVAR(ccm[2].address), PA_STR, PR_STR, 0},
|
||||
{"ccm1_ipv6address", CFGVAR(ccm[0].ipv6address), PA_STR, PR_STR, 0},
|
||||
{"ccm2_ipv6address", CFGVAR(ccm[1].ipv6address), PA_STR, PR_STR, 0},
|
||||
{"ccm3_ipv6address", CFGVAR(ccm[2].ipv6address), PA_STR, PR_STR, 0},
|
||||
{"ccm1_sipPort", CFGVAR(ccm[0].sip_port), PA_INT, PR_INT, 0},
|
||||
{"ccm2_sipPort", CFGVAR(ccm[1].sip_port), PA_INT, PR_INT, 0},
|
||||
{"ccm3_sipPort", CFGVAR(ccm[2].sip_port), PA_INT, PR_INT, 0},
|
||||
{"ccm1_securityLevel", CFGVAR(ccm[0].sec_level), PA_INT, PR_INT, 0},
|
||||
{"ccm2_securityLevel", CFGVAR(ccm[1].sec_level), PA_INT, PR_INT, 0},
|
||||
{"ccm3_securityLevel", CFGVAR(ccm[2].sec_level), PA_INT, PR_INT, 0},
|
||||
{"ccm1_isValid", CFGVAR(ccm[0].is_valid), PA_INT, PR_INT, 0},
|
||||
/*50*/ {"ccm2_isValid", CFGVAR(ccm[1].is_valid), PA_INT, PR_INT, 0},
|
||||
{"ccm3_isValid", CFGVAR(ccm[2].is_valid), PA_INT, PR_INT, 0},
|
||||
{"ccmTftp_ipAddr", CFGVAR(ccm[3].address), PA_STR, PR_STR, 0},
|
||||
{"ccmTftp_port", CFGVAR(ccm[3].sip_port), PA_INT, PR_INT, 0},
|
||||
{"ccmTftp_isValid", CFGVAR(ccm[3].is_valid), PA_INT, PR_INT, 0},
|
||||
{"ccmTftp_securityLevel", CFGVAR(ccm[3].sec_level), PA_INT, PR_INT, 0},
|
||||
{"ccmSrstIpAddr", CFGVAR(ccm[4].address), PA_STR, PR_STR, 0},
|
||||
{"ccmSrst_sipPort", CFGVAR(ccm[4].sip_port), PA_INT, PR_INT, 0},
|
||||
{"ccmSrst_isValid", CFGVAR(ccm[4].is_valid), PA_INT, PR_INT, 0},
|
||||
{"ccmSrst_securityLevel", CFGVAR(ccm[4].sec_level), PA_INT, PR_INT, 0},
|
||||
{"connectionMonitorDuration", CFGVAR(conn_monitor_duration), PA_INT, PR_INT, 0},
|
||||
{"callPickupURI", CFGVAR(call_pickup_uri), PA_STR, PR_STR, 0},
|
||||
{"callPickupListURI", CFGVAR(call_pickup_list_uri), PA_STR, PR_STR, 0},
|
||||
{"callPickupGroupURI", CFGVAR(call_pickup_group_uri), PA_STR, PR_STR, 0},
|
||||
{"meetMeServiceURI", CFGVAR(meet_me_service_uri), PA_STR, PR_STR, 0},
|
||||
{"callForwardURI", CFGVAR(call_forward_uri), PA_STR, PR_STR, 0},
|
||||
{"abbreviatedDialURI", CFGVAR(abbreviated_dial_uri), PA_STR, PR_STR, 0},
|
||||
{"callLogBlfEnabled", CFGVAR(call_log_blf_enabled), PA_INT, PR_INT, 0},
|
||||
{"remoteCcEnabled", CFGVAR(remote_cc_enabled), PA_INT, PR_INT, 0},
|
||||
{"retainForwardInformation", CFGVAR(retain_forward_information), PA_INT, PR_INT, 0},
|
||||
/*70*/ {"timerKeepaliveExpires", CFGVAR(timer_keepalive_expires),PA_INT, PR_INT, 0},
|
||||
{"timerSubscribeExpires", CFGVAR(timer_subscribe_expires),PA_INT, PR_INT, 0},
|
||||
{"timerSubscribeDelta", CFGVAR(timer_subscribe_delta), PA_INT, PR_INT, 0},
|
||||
{"transportLayerProtocol", CFGVAR(transport_layer_prot), PA_INT, PR_INT, 0},
|
||||
{"kpml", CFGVAR(kpml), PA_INT, PR_INT, 0},
|
||||
{"natEnable", CFGVAR(nat_enable), PA_INT, PR_INT, 0},
|
||||
{"natAddress", CFGVAR(nat_address), PA_STR, PR_STR, 0},
|
||||
{"voipControlPort", CFGVAR(voip_control_port), PA_INT, PR_INT, 0},
|
||||
{"myIpAddr", CFGVAR(my_ip_addr), PA_IP, PR_IP, 0},
|
||||
{"myMacAddr", CFGVAR(my_mac_addr), PA_STR, PR_MAC, 0},
|
||||
{"enableVad", CFGVAR(enable_vad), PA_INT, PR_INT, 0},
|
||||
{"autoAnswerAltBehavior", CFGVAR(autoanswer_idle_alt), PA_INT, PR_INT, 0},
|
||||
{"autoAnswerTimer", CFGVAR(autoanswer_timer), PA_INT, PR_INT, 0},
|
||||
{"autoAnswerOverride", CFGVAR(autoanswer_override), PA_INT, PR_INT, 0},
|
||||
{"offhookToFirstDigitTimer", CFGVAR(offhook_to_first_digit), PA_INT, PR_INT, 0},
|
||||
{"silentPeriodBetweenCallWaitingBursts", CFGVAR(call_waiting_period), PA_INT, PR_INT, 0},
|
||||
{"ringSettingBusyStationPolicy", CFGVAR(ring_setting_busy_pol), PA_INT, PR_INT, 0},
|
||||
{"DscpForCm2Dvce", CFGVAR(dscp_for_call_control), PA_INT, PR_INT, 0},
|
||||
{"speakerEnabled", CFGVAR(speaker_enabled), PA_INT, PR_INT, 0},
|
||||
{"transferOnhookEnable", CFGVAR(xfr_onhook_enabled), PA_INT, PR_INT, 0},
|
||||
/*90*/ {"rollover", CFGVAR(rollover), PA_INT, PR_INT, 0},
|
||||
{"loadFileName", CFGVAR(load_file), PA_STR, PR_STR, 0},
|
||||
{"blfAlertToneIdle", CFGVAR(blf_alert_tone_idle),PA_INT, PR_INT, 0},
|
||||
{"blfAlertToneBusy", CFGVAR(blf_alert_tone_busy),PA_INT, PR_INT, 0},
|
||||
{"autoPickupEnable", CFGVAR(auto_pickup_enabled),PA_INT, PR_INT, 0},
|
||||
{"joinAcrossLines", CFGVAR(join_across_lines), PA_INT, PR_INT, 0},
|
||||
/*96*/ {"myActiveMacAddr", CFGVAR(my_active_mac_addr), PA_STR, PR_MAC, 0},
|
||||
/*97*/ {"DscpAudio", CFGVAR(dscp_audio), PA_INT, PR_INT, 0},
|
||||
{"deviceName", CFGVAR(deviceName), PA_STR, PR_STR, 0},
|
||||
{"userAgent", CFGVAR(userAgent), PA_STR, PR_STR, 0},
|
||||
{"modelNumber", CFGVAR(modelNumber), PA_STR, PR_STR, 0},
|
||||
{"DscpVideo", CFGVAR(dscp_video), PA_INT, PR_INT, 0},
|
||||
{"IPAddrMode", CFGVAR(ip_addr_mode), PA_INT, PR_INT, 0},
|
||||
{"interDigitTimer", CFGVAR(inter_digit_timer), PA_INT, PR_INT, 0},
|
||||
{"emccMode", CFGVAR(emcc_mode), PA_INT, PR_INT, 0},
|
||||
{"visitingEMPort", CFGVAR(visiting_em_port), PA_INT, PR_INT, 0},
|
||||
{"visitingEMIpAddress", CFGVAR(visiting_em_ip), PA_STR, PR_STR, 0},
|
||||
{"isSRSTSecure", CFGVAR(srst_is_secure), PA_INT, PR_INT, 0},
|
||||
/*108*/ {"joinDxferPolicy", CFGVAR(join_dxfer_policy), PA_STR, PR_STR, 0},
|
||||
{"externalNumberMask", CFGVAR(external_number_mask), PA_STR, PR_STR, 0},
|
||||
{"mediaIpAddr", CFGVAR(media_ip_addr), PA_STR, PR_STR, 0},
|
||||
{"p2psip", CFGVAR(p2psip), PA_INT, PR_INT, 0},
|
||||
{"version", CFGVAR(version), PA_STR, PR_STR, 0},
|
||||
{"sdpmode", CFGVAR(sdpmode), PA_INT, PR_INT, 0},
|
||||
{"rtcpmux", CFGVAR(rtcpmux), PA_INT, PR_INT, 0},
|
||||
{"rtpsavpf", CFGVAR(rtpsavpf), PA_INT, PR_INT, 0},
|
||||
{"maxavbitrate", CFGVAR(maxavbitrate), PA_INT, PR_INT, 0},
|
||||
{"maxcodedaudiobw", CFGVAR(maxcodedaudiobw), PA_INT, PR_INT, 0},
|
||||
{"usedtx", CFGVAR(usedtx), PA_INT, PR_INT, 0},
|
||||
{"stereo", CFGVAR(stereo), PA_INT, PR_INT, 0},
|
||||
{"useinbandfec", CFGVAR(useinbandfec), PA_INT, PR_INT, 0},
|
||||
{"cbr", CFGVAR(cbr), PA_INT, PR_INT, 0},
|
||||
{"maxptime", CFGVAR(maxptime), PA_INT, PR_INT, 0},
|
||||
{"sctp_port", CFGVAR(sctp_port), PA_INT, PR_INT, 0},
|
||||
{"num_data_streams", CFGVAR(num_data_streams), PA_INT, PR_INT, 0},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
#endif /* _PROT_CFGMGR_PRIVATE_H_ */
|
890
libs/sipcc/core/common/prot_configmgr.c
Executable file
890
libs/sipcc/core/common/prot_configmgr.c
Executable file
@ -0,0 +1,890 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "cpr_types.h"
|
||||
#include "cpr_stdio.h"
|
||||
#include "cpr_string.h"
|
||||
#include "cpr_in.h"
|
||||
#include "util_string.h"
|
||||
#include "task.h"
|
||||
#include "upgrade.h"
|
||||
#include "ccsip_task.h"
|
||||
#include "config.h"
|
||||
#include "ccsip_core.h"
|
||||
#include "prot_configmgr.h"
|
||||
#include "prot_cfgmgr_private.h"
|
||||
#include "sip_common_transport.h"
|
||||
#include "phone_debug.h"
|
||||
#include "regmgrapi.h"
|
||||
#include "rtp_defs.h"
|
||||
#include "vcm.h"
|
||||
#include "plat_api.h"
|
||||
|
||||
#define MAX_TOS_VALUE 5
|
||||
#define MIN_VOIP_PORT_RANGE 1024
|
||||
#define MAX_VOIP_PORT_RANGE 65535
|
||||
#define MAX_AUTO_ANSWER_7960 63
|
||||
#define MIN_KEEPALIVE_EXPIRES 120
|
||||
#define MAX_KEEPALIVE_EXPIRES 7200
|
||||
|
||||
extern void platform_get_ipv4_address(cpr_ip_addr_t *ip_addr);
|
||||
extern void platform_get_ipv6_address(cpr_ip_addr_t *ip_addr);
|
||||
extern boolean Is794x;
|
||||
|
||||
static cpr_ip_addr_t redirected_nat_ipaddr = {0,{0}};
|
||||
static void config_set_current_codec_table(int codec_mask,
|
||||
rtp_ptype *codec_table);
|
||||
|
||||
/*********************************************************
|
||||
*
|
||||
* Network Configuration Settings
|
||||
* Look at making these generic and moving them to the
|
||||
* network library...
|
||||
*
|
||||
*********************************************************/
|
||||
|
||||
static void initCfgTblEntry(int index, const char * name, void *addr, int length,
|
||||
parse_func_t parse, print_func_t print,
|
||||
const key_table_entry_t *key)
|
||||
{
|
||||
var_t *table;
|
||||
table = &prot_cfg_table[index];
|
||||
|
||||
table->name = name;
|
||||
table->addr = addr;
|
||||
table->length = length;
|
||||
table->parse_func = parse;
|
||||
table->print_func = print;
|
||||
table->key_table = key;
|
||||
|
||||
}
|
||||
|
||||
/* Function: protCfgTblInit()
|
||||
*
|
||||
* Description: Initializes line specific params in prot_cfg_table
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* Returns:
|
||||
*/
|
||||
void protCfgTblInit()
|
||||
{
|
||||
int i;
|
||||
memset(&prot_cfg_block, 0, sizeof(prot_cfg_block));
|
||||
for (i=0; i< MAX_CONFIG_LINES; i++) {
|
||||
initCfgTblEntry(CFGID_LINE_INDEX+i, "Index", CFGVAR(line[i].index), PA_INT, PR_INT, 0);
|
||||
initCfgTblEntry(CFGID_LINE_FEATURE+i, "Feat", CFGVAR(line[i].feature), PA_INT, PR_INT, 0);
|
||||
initCfgTblEntry(CFGID_LINE_MAXNUMCALLS+i, "MNC", CFGVAR(line[i].maxnumcalls), PA_INT, PR_INT, 0);
|
||||
initCfgTblEntry(CFGID_LINE_BUSY_TRIGGER+i, "BT", CFGVAR(line[i].busy_trigger), PA_INT, PR_INT, 0);
|
||||
initCfgTblEntry(CFGID_PROXY_ADDRESS+i, "ProxyAddr", CFGVAR(line[i].proxy_address), PA_STR, PR_STR, 0);
|
||||
initCfgTblEntry(CFGID_PROXY_PORT+i, "ProxyPort", CFGVAR(line[i].proxy_port), PA_INT, PR_INT, 0);
|
||||
initCfgTblEntry(CFGID_LINE_CALL_WAITING+i, "CWait", CFGVAR(line[i].call_waiting), PA_INT, PR_INT, 0);
|
||||
initCfgTblEntry(CFGID_LINE_AUTOANSWER_ENABLED+i, "AAns", CFGVAR(line[i].autoanswer), PA_INT, PR_INT, 0);
|
||||
initCfgTblEntry(CFGID_LINE_AUTOANSWER_MODE+i, "AAnsMode", CFGVAR(line[i].autoanswer_mode), PA_STR, PR_STR, 0);
|
||||
initCfgTblEntry(CFGID_LINE_MSG_WAITING_LAMP+i, "MWILamp", CFGVAR(line[i].msg_waiting_lamp), PA_INT, PR_INT, 0);
|
||||
initCfgTblEntry(CFGID_LINE_MESSAGE_WAITING_AMWI+i, "AMWI", CFGVAR(line[i].msg_waiting_amwi), PA_INT, PR_INT, 0);
|
||||
initCfgTblEntry(CFGID_LINE_RING_SETTING_IDLE+i, "RingIdle", CFGVAR(line[i].ring_setting_idle), PA_INT, PR_INT, 0);
|
||||
initCfgTblEntry(CFGID_LINE_RING_SETTING_ACTIVE+i, "RingActive", CFGVAR(line[i].ring_setting_active), PA_INT, PR_INT, 0);
|
||||
initCfgTblEntry(CFGID_LINE_NAME+i, "Name", CFGVAR(line[i].name), PA_STR, PR_STR, 0);
|
||||
initCfgTblEntry(CFGID_LINE_AUTHNAME+i, "AuthName", CFGVAR(line[i].authname), PA_STR, PR_STR, 0);
|
||||
initCfgTblEntry(CFGID_LINE_PASSWORD+i, "Passwd", CFGVAR(line[i].password), PA_STR, PR_STR, 0);
|
||||
initCfgTblEntry(CFGID_LINE_DISPLAYNAME+i, "DisplayName", CFGVAR(line[i].displayname), PA_STR, PR_STR, 0);
|
||||
initCfgTblEntry(CFGID_LINE_CONTACT+i, "Contact", CFGVAR(line[i].contact), PA_STR, PR_STR, 0);
|
||||
initCfgTblEntry(CFGID_LINE_CFWDALL+i, "CfwdAll", CFGVAR(line[i].cfwdall), PA_STR, PR_STR, 0);
|
||||
initCfgTblEntry(CFGID_LINE_SPEEDDIAL_NUMBER+i, "speedDialNumber", CFGVAR(line[i].speeddial_number), PA_STR, PR_STR, 0);
|
||||
initCfgTblEntry(CFGID_LINE_RETRIEVAL_PREFIX+i, "retrievalPrefix", CFGVAR(line[i].retrieval_prefix), PA_STR, PR_STR, 0);
|
||||
initCfgTblEntry(CFGID_LINE_MESSAGES_NUMBER+i, "messagesNumber", CFGVAR(line[i].messages_number), PA_STR, PR_STR, 0);
|
||||
initCfgTblEntry(CFGID_LINE_FWD_CALLER_NAME_DIPLAY+i, "callerName", CFGVAR(line[i].fwd_caller_name_display), PA_INT, PR_INT, 0);
|
||||
initCfgTblEntry(CFGID_LINE_FWD_CALLER_NUMBER_DIPLAY+i, "callerName", CFGVAR(line[i].fwd_caller_number_display), PA_INT, PR_INT, 0);
|
||||
initCfgTblEntry(CFGID_LINE_FWD_REDIRECTED_NUMBER_DIPLAY+i, "redirectedNumber", CFGVAR(line[i].fwd_redirected_number_display), PA_INT, PR_INT, 0);
|
||||
initCfgTblEntry(CFGID_LINE_FWD_DIALED_NUMBER_DIPLAY+i, "dialedNumber", CFGVAR(line[i].fwd_dialed_number_display), PA_INT, PR_INT, 0);
|
||||
initCfgTblEntry(CFGID_LINE_FEATURE_OPTION_MASK+i, "featureOptionMask", CFGVAR(line[i].feature_option_mask), PA_INT, PR_INT, 0);
|
||||
}
|
||||
|
||||
initCfgTblEntry(CFGID_PROTOCOL_MAX, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* sip_config_get_net_device_ipaddr()
|
||||
*
|
||||
* Get the device IP address.
|
||||
* Note: the IP Address is returned in the non-Telecaster
|
||||
* SIP format, which is not byte reversed.
|
||||
* Eg. 0xac2c33f8 = 161.44.51.248
|
||||
*/
|
||||
void
|
||||
sip_config_get_net_device_ipaddr (cpr_ip_addr_t *ip_addr)
|
||||
{
|
||||
cpr_ip_addr_t ip_addr1 = {0,{0}};
|
||||
|
||||
platform_get_ipv4_address(&ip_addr1);
|
||||
util_ntohl(ip_addr, &ip_addr1);
|
||||
}
|
||||
|
||||
/*
|
||||
* sip_config_get_net_device_ipaddr()
|
||||
*
|
||||
* Get the device IP address.
|
||||
* Note: the IP Address is returned in the non-Telecaster
|
||||
* SIP format, which is not byte reversed.
|
||||
*
|
||||
*/
|
||||
void
|
||||
sip_config_get_net_ipv6_device_ipaddr (cpr_ip_addr_t *ip_addr)
|
||||
{
|
||||
cpr_ip_addr_t ip_addr1 = {0,{0}};
|
||||
|
||||
platform_get_ipv6_address(&ip_addr1);
|
||||
util_ntohl(ip_addr, &ip_addr1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* sip_config_get_nat_ipaddr()
|
||||
*
|
||||
* Get the nat IP address.
|
||||
* Note: the IP Address is returned in the non-Telecaster
|
||||
* SIP format, which is not byte reversed.
|
||||
* Eg. 0xac2c33f8 = 161.44.51.248
|
||||
*/
|
||||
void
|
||||
sip_config_get_nat_ipaddr (cpr_ip_addr_t *ip_addr)
|
||||
{
|
||||
cpr_ip_addr_t IPAddress;
|
||||
char address[MAX_IPADDR_STR_LEN];
|
||||
int dnsErrorCode = 1;
|
||||
|
||||
if (redirected_nat_ipaddr.type == CPR_IP_ADDR_INVALID) {
|
||||
config_get_string(CFGID_NAT_ADDRESS, address, sizeof(address));
|
||||
if ((cpr_strcasecmp(address, UNPROVISIONED) != 0) && (address[0] != 0)) {
|
||||
dnsErrorCode = dnsGetHostByName(address, &IPAddress, 100, 1);
|
||||
}
|
||||
|
||||
if (dnsErrorCode == 0) {
|
||||
util_ntohl(ip_addr, &IPAddress);
|
||||
return ;
|
||||
} else {
|
||||
/*
|
||||
* If the NAT address is not provisioned or
|
||||
* unavailable, return the local address instead.
|
||||
*/
|
||||
sip_config_get_net_device_ipaddr(ip_addr);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
*ip_addr = redirected_nat_ipaddr;
|
||||
return ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* sip_config_set_nat_ipaddr()
|
||||
*
|
||||
* Set the device NAT IP address.
|
||||
* Note: the IP Address is returned in the non-Telecaster
|
||||
* SIP format, which is not byte reversed.
|
||||
* Eg. 0xac2c33f8 = 161.44.51.248
|
||||
*/
|
||||
void
|
||||
sip_config_set_nat_ipaddr (cpr_ip_addr_t *ip_address)
|
||||
{
|
||||
redirected_nat_ipaddr = *ip_address;
|
||||
}
|
||||
|
||||
/*********************************************************
|
||||
*
|
||||
* SIP Configuration Settings
|
||||
* These should probably be turned into generic config
|
||||
* table "gets/sets" or should be moved to a SIP platform
|
||||
* file. Maybe ccsip_platform_ui.c since that's where we
|
||||
* have the other SIP Platform code. In the long run, we
|
||||
* should rename ccsip_platform_ui.c to ccsip_platform.c
|
||||
*
|
||||
*********************************************************/
|
||||
|
||||
/*
|
||||
* sip_config_get_line_from_button()
|
||||
* Some cases CCM sends down line number instead of button number
|
||||
* that has to be mapped to correct button number. This function is
|
||||
* called to get actual line number for a given button number
|
||||
*
|
||||
* Returns: actual line number from given button number
|
||||
*
|
||||
*/
|
||||
line_t
|
||||
sip_config_get_line_from_button (line_t button)
|
||||
{
|
||||
line_t max_lines_allowed;
|
||||
uint32_t line = 0;
|
||||
line_t button_no = 0;
|
||||
|
||||
if (Is794x) {
|
||||
max_lines_allowed = MAX_REG_LINES_794X;
|
||||
} else {
|
||||
max_lines_allowed = MAX_REG_LINES;
|
||||
}
|
||||
|
||||
if ((button < 1) || (button > max_lines_allowed)) {
|
||||
return (button);
|
||||
}
|
||||
|
||||
config_get_line_value(CFGID_LINE_INDEX, &line,
|
||||
sizeof(line), button);
|
||||
|
||||
/* Look for the line number through the configuration
|
||||
* <line button="4" lineIndex="3>. If the inddex value is not
|
||||
* found then use old way of searching for button. The dolby
|
||||
* release of CCM adds index to configuration but older
|
||||
* ccm does not support that.
|
||||
*/
|
||||
|
||||
if (line > 0) {
|
||||
|
||||
return((line_t)line);
|
||||
}
|
||||
|
||||
/* Try old way of calculating the line number
|
||||
*/
|
||||
|
||||
line = 0;
|
||||
button_no = 0;
|
||||
|
||||
for (button_no = 1; button_no <= button; button_no++) {
|
||||
|
||||
if (sip_config_check_line(button_no) == FALSE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
line++;
|
||||
}
|
||||
|
||||
return ((line_t)line);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* sip_config_get_button_from_line()
|
||||
*
|
||||
* Some cases CCM sends down line number instead of button number
|
||||
* that has to be mapped to correct button number.
|
||||
*
|
||||
* Parameters: line - the line instance
|
||||
*
|
||||
* Returns: line - actual button number
|
||||
*
|
||||
*/
|
||||
line_t
|
||||
sip_config_get_button_from_line (line_t line)
|
||||
{
|
||||
line_t max_lines_allowed;
|
||||
line_t button = 0;
|
||||
uint32_t line_no = 0;
|
||||
|
||||
if (Is794x) {
|
||||
max_lines_allowed = MAX_REG_LINES_794X;
|
||||
} else {
|
||||
max_lines_allowed = MAX_REG_LINES;
|
||||
}
|
||||
|
||||
if ((line < 1) || (line > max_lines_allowed)) {
|
||||
return (line);
|
||||
}
|
||||
|
||||
/* Look for the button number through the configuration
|
||||
* <line button="4" lineIndex="3>. If the inddex value is not
|
||||
* found then use old way of searching for button. The dolby
|
||||
* release of CCM adds index to configuration but older
|
||||
* ccm does not support that.
|
||||
*/
|
||||
|
||||
for (button = 1; button <= max_lines_allowed; button++) {
|
||||
|
||||
config_get_line_value(CFGID_LINE_INDEX, &line_no, sizeof(line_no), button);
|
||||
|
||||
if ((line_t)line_no == line) {
|
||||
return(button);
|
||||
}
|
||||
}
|
||||
|
||||
button = 0;
|
||||
line_no = 0;
|
||||
|
||||
/* Nothing has found so far, try old way of calculating the
|
||||
* button number
|
||||
*/
|
||||
do {
|
||||
|
||||
if (sip_config_check_line(button) == FALSE) {
|
||||
button++;
|
||||
continue;
|
||||
}
|
||||
|
||||
button++;
|
||||
line_no++;
|
||||
|
||||
} while (((line_t)line_no < line) &&
|
||||
button <= max_lines_allowed);
|
||||
|
||||
|
||||
/* Above loop not able to find the correct button number
|
||||
* so return value 0
|
||||
*/
|
||||
if (button > max_lines_allowed) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
return (button - 1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* sip_config_check_line()
|
||||
*
|
||||
* Check to see if the indicated line is configured as a DN line
|
||||
*
|
||||
* Parameters: line - the line instance
|
||||
*
|
||||
* Returns: TRUE if the indicated line is Valid
|
||||
* FALSE if the indicated line is Invalid
|
||||
*
|
||||
*/
|
||||
boolean
|
||||
sip_config_check_line (line_t line)
|
||||
{
|
||||
const char fname[] = "sip_config_check_line";
|
||||
char temp[MAX_LINE_NAME_SIZE];
|
||||
uint32_t line_feature;
|
||||
line_t max_lines_allowed;
|
||||
|
||||
if (Is794x) {
|
||||
max_lines_allowed = MAX_REG_LINES_794X;
|
||||
} else {
|
||||
max_lines_allowed = MAX_REG_LINES;
|
||||
}
|
||||
|
||||
if ((line < 1) || (line > max_lines_allowed)) {
|
||||
if (line != 0) {
|
||||
PLAT_ERROR(PLAT_COMMON_F_PREFIX"Invalid Line: %d\n", fname, line);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
config_get_line_string(CFGID_LINE_NAME, temp, line, sizeof(temp));
|
||||
if (temp[0] == '\0') {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
config_get_line_value(CFGID_LINE_FEATURE, &line_feature,
|
||||
sizeof(line_feature), line);
|
||||
|
||||
if (line_feature != cfgLineFeatureDN) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
/*
|
||||
* sip_config_local_line_get()
|
||||
*
|
||||
* Get the Line setting.
|
||||
* Note: The UI has serious problems if there are gaps in the
|
||||
* line names. Therefore, lines must be sequential. In
|
||||
* other words, if lines 1, 2, and 4 have names, this routine
|
||||
* will return that two lines are active. Once Line three is
|
||||
* found to be unprovisioned, line 4 will be ignored.
|
||||
*/
|
||||
line_t
|
||||
sip_config_local_line_get (void)
|
||||
{
|
||||
if (Is794x) {
|
||||
return (MAX_REG_LINES_794X);
|
||||
}
|
||||
return (MAX_REG_LINES);
|
||||
}
|
||||
/*
|
||||
* sip_config_get_keepalive_expires()
|
||||
*
|
||||
* Returns the keepalive expires configured.
|
||||
* The minimum allowed value is returned if
|
||||
* configured value is less than the minimum
|
||||
* allowed value.If the configured value is
|
||||
* greater than the maximum allowed then the
|
||||
* maximum allowed value is returned.
|
||||
*
|
||||
*/
|
||||
int
|
||||
sip_config_get_keepalive_expires()
|
||||
{
|
||||
int keepalive_interval = 0;
|
||||
|
||||
config_get_value(CFGID_TIMER_KEEPALIVE_EXPIRES, &keepalive_interval,
|
||||
sizeof(keepalive_interval));
|
||||
|
||||
if (keepalive_interval < MIN_KEEPALIVE_EXPIRES) {
|
||||
keepalive_interval = MIN_KEEPALIVE_EXPIRES;
|
||||
TNP_DEBUG(DEB_F_PREFIX"Keepalive interval less than minimum acceptable.Resetting it to %d\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_KA, "sip_config_get_keepalive_expires"),
|
||||
keepalive_interval);
|
||||
} else if (keepalive_interval > MAX_KEEPALIVE_EXPIRES) {
|
||||
keepalive_interval = MAX_KEEPALIVE_EXPIRES;
|
||||
TNP_DEBUG(DEB_F_PREFIX"Keepalive interval more than maximum acceptable.Resetting it to %d\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_KA, "sip_config_get_keepalive_expires"),
|
||||
keepalive_interval);
|
||||
}
|
||||
|
||||
return keepalive_interval;
|
||||
}
|
||||
/*
|
||||
* sip_config_get_display_name()
|
||||
*
|
||||
* Get the display name
|
||||
*/
|
||||
void
|
||||
sip_config_get_display_name (line_t line, char *buffer, int buffer_len)
|
||||
{
|
||||
|
||||
config_get_line_string(CFGID_LINE_DISPLAYNAME, buffer, line, buffer_len);
|
||||
|
||||
if ((strcmp(buffer, UNPROVISIONED) == 0) || (buffer[0] == '\0')) {
|
||||
config_get_line_string(CFGID_LINE_NAME, buffer, line, buffer_len);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the configured value of preferred codec. The codec may
|
||||
* or may not be available by the platform.
|
||||
*
|
||||
* @param[in] none.
|
||||
*
|
||||
* @return rtp_ptype of the codec.
|
||||
*/
|
||||
rtp_ptype
|
||||
sip_config_preferred_codec (void)
|
||||
{
|
||||
key_table_entry_t cfg_preferred_codec;
|
||||
|
||||
config_get_value(CFGID_PREFERRED_CODEC, &cfg_preferred_codec,
|
||||
sizeof(cfg_preferred_codec));
|
||||
if ((cfg_preferred_codec.name != NULL) &&
|
||||
(cfg_preferred_codec.name[0] != '\0')) {
|
||||
/* The configuration has preferred codec configured */
|
||||
return (cfg_preferred_codec.value);
|
||||
}
|
||||
/* No preferred codec configured */
|
||||
return (RTP_NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* sip_config_local_supported_codecs_get()
|
||||
* Get the locally supported codec list. The returned list
|
||||
* of codecs will be in the ordered of preference. If there is
|
||||
* preferred condec configured and it is available, the
|
||||
* preferred codec will be put on the first entry of the
|
||||
* returned list.
|
||||
*
|
||||
* @param[in,out] aSupportedCodecs - pointer to arrary fo the
|
||||
* rtp_ptype to store the result of
|
||||
* currenlty available codecs.
|
||||
* @param[in] supportedCodecsLen - indicates the number of entry
|
||||
* of the aSupportedCodecs.
|
||||
*
|
||||
* @return number of current codecs available.
|
||||
*
|
||||
* @pre (aSupportedCodecs != NULL)
|
||||
* @pre (supportedCodecsLen != 0)
|
||||
*/
|
||||
uint16_t
|
||||
sip_config_local_supported_codecs_get (rtp_ptype aSupportedCodecs[],
|
||||
uint16_t supportedCodecsLen)
|
||||
{
|
||||
rtp_ptype current_codec_table[MAX_CODEC_ENTRIES+1];
|
||||
rtp_ptype *codec;
|
||||
rtp_ptype pref_codec;
|
||||
uint16_t count = 0;
|
||||
int codec_mask;
|
||||
boolean preferred_codec_available = FALSE;
|
||||
|
||||
codec_mask = vcmGetAudioCodecList(VCM_DSP_FULLDUPLEX);
|
||||
|
||||
if (!codec_mask) {
|
||||
codec_mask = VCM_CODEC_RESOURCE_G711 | VCM_CODEC_RESOURCE_OPUS;
|
||||
}
|
||||
|
||||
/*
|
||||
* convert the current available codec into the enumerated
|
||||
* preferred list.
|
||||
*/
|
||||
current_codec_table[0] = RTP_NONE;
|
||||
current_codec_table[MAX_CODEC_ENTRIES] = RTP_NONE;
|
||||
config_set_current_codec_table(codec_mask, ¤t_codec_table[0]);
|
||||
|
||||
/*
|
||||
* Get the configured preferred codec. If one is configured,
|
||||
* check it to see if currently it can be supported by the
|
||||
* platform. If it is configured and is availble to support,
|
||||
* put the preferred codec in the first one of the list.
|
||||
*/
|
||||
pref_codec = sip_config_preferred_codec();
|
||||
if (pref_codec != RTP_NONE) {
|
||||
/*
|
||||
* There is a configured preferred codec, check to see if
|
||||
* the codec is currently avaible or not.
|
||||
*/
|
||||
codec = ¤t_codec_table[0];
|
||||
while (*codec != RTP_NONE) {
|
||||
if (pref_codec == *codec) {
|
||||
preferred_codec_available = TRUE;
|
||||
break;
|
||||
}
|
||||
codec++;
|
||||
}
|
||||
}
|
||||
|
||||
if (preferred_codec_available) {
|
||||
/*
|
||||
* The preferred codec is configured and the platform
|
||||
* currently can support the preferred codec, put it in
|
||||
* the first entry.
|
||||
*/
|
||||
aSupportedCodecs[count] = pref_codec;
|
||||
count++;
|
||||
} else {
|
||||
/*
|
||||
* Must init or comparison will be made to uninitialized memory.
|
||||
* Do not increment count here since we are not adding RTP_NONE
|
||||
* as a supported codec. We are only initializing memory to a
|
||||
* known value.
|
||||
*/
|
||||
aSupportedCodecs[count] = RTP_NONE;
|
||||
}
|
||||
|
||||
codec = ¤t_codec_table[0];
|
||||
while (*codec != RTP_NONE) {
|
||||
if (count < supportedCodecsLen) {
|
||||
if (*codec != aSupportedCodecs[0]) {
|
||||
aSupportedCodecs[count] = *codec;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
codec++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/*
|
||||
* sip_config_local_supported_codecs_get()
|
||||
*
|
||||
* Get the locally supported codec list.
|
||||
*/
|
||||
uint16_t
|
||||
sip_config_video_supported_codecs_get (rtp_ptype aSupportedCodecs[],
|
||||
uint16_t supportedCodecsLen, boolean isOffer)
|
||||
{
|
||||
uint16_t count = 0;
|
||||
int codec_mask;
|
||||
cc_uint32_t major_ver, minor_ver;
|
||||
|
||||
if ( isOffer ) {
|
||||
codec_mask = vcmGetVideoCodecList(VCM_DSP_FULLDUPLEX);
|
||||
} else {
|
||||
/* we are trying to match the answer then we
|
||||
already have the rx stream open */
|
||||
//codec_mask = vcmGetVideoCodecList(DSP_ENCODEONLY);
|
||||
codec_mask = vcmGetVideoCodecList(VCM_DSP_IGNORE);
|
||||
}
|
||||
if ( codec_mask & VCM_CODEC_RESOURCE_VP8) {
|
||||
aSupportedCodecs[count] = RTP_VP8;
|
||||
count++;
|
||||
}
|
||||
if ( codec_mask & VCM_CODEC_RESOURCE_H264) {
|
||||
/*
|
||||
* include payload type for packetization mode 1 only if ucm sis version
|
||||
* is equal to or greater than 5.1.0 (AngelFire).
|
||||
*/
|
||||
platGetSISProtocolVer(&major_ver, &minor_ver, NULL, NULL);
|
||||
if ((major_ver > SIS_PROTOCOL_MAJOR_VERSION_ANGELFIRE) ||
|
||||
(major_ver == SIS_PROTOCOL_MAJOR_VERSION_ANGELFIRE &&
|
||||
minor_ver >= SIS_PROTOCOL_MINOR_VERSION_ANGELFIRE)) {
|
||||
if (vcmGetVideoMaxSupportedPacketizationMode() == 1) {
|
||||
aSupportedCodecs[count] = RTP_H264_P1;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
aSupportedCodecs[count] = RTP_H264_P0;
|
||||
count++;
|
||||
}
|
||||
if ( codec_mask & VCM_CODEC_RESOURCE_H263) {
|
||||
aSupportedCodecs[count] = RTP_H263;
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* The function fills in the given codec array based on the
|
||||
* platform bit mask of codecs. Note, that the enumerated list
|
||||
* produced is also in the preferred order.
|
||||
*
|
||||
* @param[in] codec_mask - platform bit mask corresponding to the
|
||||
* codecs.
|
||||
* @param[in/out] codecs - pointer to array of for storing the
|
||||
* output of the enumerated codec based on
|
||||
* bit set in the codec_mask.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @pre (codec_table != NULL)
|
||||
* @pre storge of codec_table must be last enough to holds
|
||||
* supported codec in the bit mask.
|
||||
*/
|
||||
static void
|
||||
config_set_current_codec_table (int codec_mask, rtp_ptype *codecs)
|
||||
{
|
||||
int idx = 0;
|
||||
|
||||
if (codec_mask & VCM_CODEC_RESOURCE_OPUS) {
|
||||
codecs[idx] = RTP_OPUS;
|
||||
idx++;
|
||||
}
|
||||
|
||||
if (codec_mask & VCM_CODEC_RESOURCE_G711) {
|
||||
codecs[idx] = RTP_PCMU;
|
||||
idx++;
|
||||
codecs[idx] = RTP_PCMA;
|
||||
idx++;
|
||||
}
|
||||
|
||||
if (codec_mask & VCM_CODEC_RESOURCE_G729A) {
|
||||
codecs[idx] = RTP_G729;
|
||||
idx++;
|
||||
}
|
||||
|
||||
if (codec_mask & VCM_CODEC_RESOURCE_LINEAR) {
|
||||
codecs[idx] = RTP_L16;
|
||||
idx++;
|
||||
}
|
||||
|
||||
if (codec_mask & VCM_CODEC_RESOURCE_G722) {
|
||||
codecs[idx] = RTP_G722;
|
||||
idx++;
|
||||
}
|
||||
|
||||
if (codec_mask & VCM_CODEC_RESOURCE_iLBC) {
|
||||
codecs[idx] = RTP_ILBC;
|
||||
idx++;
|
||||
}
|
||||
|
||||
if (codec_mask & VCM_CODEC_RESOURCE_iSAC) {
|
||||
codecs[idx] = RTP_ISAC;
|
||||
idx++;
|
||||
}
|
||||
|
||||
codecs[idx] = RTP_NONE;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* sip_config_local_dtmf_dblevels_get()
|
||||
*
|
||||
* Get the DTMF DB levels
|
||||
*/
|
||||
uint32_t
|
||||
sip_config_local_dtmf_dblevels_get (void)
|
||||
{
|
||||
int value;
|
||||
|
||||
config_get_value(CFGID_DTMF_DB_LEVEL, &value, sizeof(value));
|
||||
switch (value) {
|
||||
case 0:
|
||||
return 0; // Mute
|
||||
case 1:
|
||||
return 2900; // 6 dB down
|
||||
case 2:
|
||||
return 4096; // 3 dB down
|
||||
case 3:
|
||||
return 5786; // Nominal amplitude
|
||||
// (-8.83 dBm0 to network, -11.83 dBm0 local)
|
||||
case 4:
|
||||
return 8173; // 3 dB up
|
||||
case 5:
|
||||
return 11544; // 6 dB up
|
||||
default:
|
||||
return 5786; // Nominal amplitude
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* sip_config_get_line_by_called_number
|
||||
*
|
||||
* Return the line by the given called_number
|
||||
*/
|
||||
line_t sip_config_get_line_by_called_number (line_t start_line, const char *called_number)
|
||||
{
|
||||
int i;
|
||||
line_t max_lines;
|
||||
line_t line = 0;
|
||||
char line_name[MAX_LINE_NAME_SIZE];
|
||||
char contact[MAX_LINE_CONTACT_SIZE];
|
||||
char *name;
|
||||
|
||||
max_lines = sip_config_local_line_get();
|
||||
|
||||
/*
|
||||
* Check the called number for the E.164 "+"
|
||||
* and ignore it if present.
|
||||
*/
|
||||
if (called_number[0] == '+') {
|
||||
called_number++;
|
||||
}
|
||||
|
||||
for (i = start_line; i <= max_lines; i++) {
|
||||
if (sip_config_check_line((line_t)i)) {
|
||||
config_get_line_string(CFGID_LINE_NAME, line_name, i,
|
||||
sizeof(line_name));
|
||||
/*
|
||||
* Check the configured line name for the E.164 "+"
|
||||
* and ignore it if present.
|
||||
*/
|
||||
name = &line_name[0];
|
||||
if (line_name[0] == '+') {
|
||||
name++;
|
||||
}
|
||||
|
||||
if (cpr_strcasecmp(called_number, name) == 0) {
|
||||
line = (line_t)i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If line not found - check with contact list
|
||||
if (line == 0) {
|
||||
for (i = start_line; i <= max_lines; i++) {
|
||||
if (sip_config_check_line((line_t)i)) {
|
||||
config_get_line_string(CFGID_LINE_CONTACT, contact, i,
|
||||
sizeof(contact));
|
||||
if (cpr_strcasecmp(called_number, contact) == 0) {
|
||||
line = (line_t)i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (line);
|
||||
}
|
||||
|
||||
/*********************************************************
|
||||
*
|
||||
* SIP Config API
|
||||
* The routines below with the "prot" prefix are called
|
||||
* by the config system. The calls that start with "sip"
|
||||
* are helper functions for the SIP implementation of the
|
||||
* "prot" API.
|
||||
*
|
||||
*********************************************************/
|
||||
|
||||
/*
|
||||
* sip_minimum_config_check()
|
||||
*
|
||||
* Return indication if the SIP minimum configuration
|
||||
* requirements have been met.
|
||||
* Returns 0 if minimum config is met
|
||||
* Returns non-zero if minimum config has not been met
|
||||
* (eg. missing at least 1 required parameter)
|
||||
*/
|
||||
int
|
||||
sip_minimum_config_check (void)
|
||||
{
|
||||
char str_val[MAX_IPADDR_STR_LEN];
|
||||
char line_name[MAX_LINE_NAME_SIZE];
|
||||
int value;
|
||||
|
||||
/*
|
||||
* Make sure that line 1 is configured
|
||||
*/
|
||||
config_get_line_string(CFGID_LINE_NAME, line_name, 1, sizeof(line_name));
|
||||
if ((strcmp(line_name, UNPROVISIONED) == 0) || (line_name[0] == '\0')) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
config_get_line_string(CFGID_PROXY_ADDRESS, str_val, 1, MAX_IPADDR_STR_LEN);
|
||||
if ((strcmp(str_val, UNPROVISIONED) == 0) || (str_val[0] == '\0')) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
config_get_line_value(CFGID_PROXY_PORT, &value, sizeof(value), 1);
|
||||
if (value == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* prot_config_change_notify()
|
||||
* Let the SIP stack know that a config change has occurred.
|
||||
*
|
||||
*/
|
||||
int
|
||||
prot_config_change_notify (int notify_type)
|
||||
{
|
||||
if (SIPTaskProcessConfigChangeNotify(notify_type) < 0) {
|
||||
//CPR TODO: need reference for
|
||||
CCSIP_DEBUG_ERROR(PLAT_COMMON_F_PREFIX"SIPTaskProcessConfigChangeNotify() "
|
||||
"returned error.\n", "prot_config_change_notify");
|
||||
}
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* prot_config_check_line_name()
|
||||
* Makes sure that there are no spaces in the SIP Line Names
|
||||
*
|
||||
* Returns: TRUE if the Name is Valid
|
||||
* FALSE if the Name is Invalid
|
||||
*
|
||||
*/
|
||||
boolean
|
||||
prot_config_check_line_name (char *line_name)
|
||||
{
|
||||
while ((*line_name != ' ') && (*line_name != NUL)) {
|
||||
line_name++;
|
||||
}
|
||||
|
||||
if (*line_name == ' ') {
|
||||
return (FALSE);
|
||||
}
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* prot_sanity_check_config_settings()
|
||||
*
|
||||
, Louis* Checks the sanity of the protocol config block values
|
||||
* and sets them to defaults if they are incorrect.
|
||||
*/
|
||||
int
|
||||
prot_sanity_check_config_settings (void)
|
||||
{
|
||||
int retval = 0;
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* prot_shutdown()
|
||||
*
|
||||
* Shut down the protocol stack.
|
||||
*/
|
||||
|
||||
void
|
||||
prot_shutdown (void)
|
||||
{
|
||||
sip_shutdown();
|
||||
}
|
298
libs/sipcc/core/common/prot_configmgr.h
Executable file
298
libs/sipcc/core/common/prot_configmgr.h
Executable file
@ -0,0 +1,298 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _PROT_CONFIGMGR_H_
|
||||
#define _PROT_CONFIGMGR_H_
|
||||
|
||||
#include "cpr_types.h"
|
||||
#include "phone_types.h"
|
||||
#include "rtp_defs.h"
|
||||
#include "ccsip_platform.h"
|
||||
#include "configmgr.h"
|
||||
#include "cfgfile_utils.h"
|
||||
#include "phone_platform_constants.h"
|
||||
#include "cc_config.h"
|
||||
#include "cc_constants.h"
|
||||
#include "ccsdp.h"
|
||||
|
||||
#define UNPROVISIONED "UNPROVISIONED"
|
||||
|
||||
/*********************************************************
|
||||
*
|
||||
* The following parameters set Config system settings
|
||||
* for SIP
|
||||
*
|
||||
*********************************************************/
|
||||
#define HWTYPE "SIP"
|
||||
#define MAX_LINE_NAME_SIZE 128
|
||||
#define AUTH_NAME_SIZE 129
|
||||
#define MAX_LINE_PASSWORD_SIZE 32
|
||||
#define MAX_LINE_DISPLAY_SIZE 32
|
||||
#define MAX_LINE_CONTACT_SIZE 128
|
||||
#define MAX_LINE_AUTO_ANS_MODE_SIZE 32
|
||||
#define MAX_REG_USER_INFO_LEN 32
|
||||
#define MAX_JOIN_DXFER_POLICY_SIZE 40
|
||||
#define MAX_EXTERNAL_NUMBER_MASK_SIZE 40
|
||||
|
||||
/*********************************************************
|
||||
*!!!!!!!!!!!!!!!!!!!!!!WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
*
|
||||
* TNP SIP Phone Configuration IDs
|
||||
*
|
||||
*!!!!!!!!!!!!!!!!!!!!!!WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
* The following macro definitions are defined in cc_config.h.
|
||||
* Change should be made in the cc_config.h and add reference here.
|
||||
*
|
||||
* <------ Original notes ------>
|
||||
* Before changing this code, please read the following:
|
||||
*
|
||||
* The Configuration system for the TNP phones is simply a cache
|
||||
* that exists for the GSM/SIP DLL to use. The property values are
|
||||
* sent from Java across the JNI to the cache. This prevents
|
||||
* the SIP and GSM code from having to suffer through a JNI call
|
||||
* every time they wish to retrieve a configuration parameter.
|
||||
*
|
||||
* These ID's need to match the definitions in JplatConfigConstants.java
|
||||
*
|
||||
* To add a new value to the table,
|
||||
* In general, you will have to:
|
||||
*
|
||||
* 1) Create an index for the new CFG param below
|
||||
* 2) Update prot_cfg_table either in prot_cfgmgr_private.h
|
||||
* or in prot_configmgr.c (for line specific params)
|
||||
* 3) Update JPlatConfigConstants.h with the new ID
|
||||
* 4) Create a property on JAVA side and update it from XML config
|
||||
* 5) Update show_cfg_cmd if adding a new line param
|
||||
*
|
||||
*!!!!!!!!!!!!!!!!!!!!!!WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
*********************************************************/
|
||||
|
||||
/* Keep non line specific params here */
|
||||
|
||||
#define CFGID_MEDIA_PORT_RANGE_START CFGID_MEDIA_PORT_RANGE_START_INT
|
||||
#define CFGID_MEDIA_PORT_RANGE_END CFGID_MEDIA_PORT_RANGE_END_INT
|
||||
#define CFGID_CALLERID_BLOCKING CFGID_CALLERID_BLOCKING_BOOL
|
||||
#define CFGID_ANONYMOUS_CALL_BLOCK CFGID_ANONYMOUS_CALL_BLOCK_BOOL
|
||||
#define CFGID_DND_CALL_ALERT CFGID_DND_CALL_ALERT_BYTE
|
||||
#define CFGID_DND_REMINDER_TIMER CFGID_DND_REMINDER_TIMER_INT
|
||||
#define CFGID_PREFERRED_CODEC CFGID_PREFERRED_CODEC_STRING
|
||||
#define CFGID_DTMF_OUTOFBAND CFGID_DTMF_OUTOFBAND_STRING
|
||||
#define CFGID_DTMF_AVT_PAYLOAD CFGID_DTMF_AVT_PAYLOAD_INT
|
||||
#define CFGID_DTMF_DB_LEVEL CFGID_DTMF_DB_LEVEL_INT
|
||||
|
||||
#define CFGID_SIP_RETX CFGID_SIP_RETX_INT
|
||||
#define CFGID_SIP_INVITE_RETX CFGID_SIP_INVITE_RETX_INT
|
||||
#define CFGID_TIMER_T1 CFGID_TIMER_T1_INT
|
||||
#define CFGID_TIMER_T2 CFGID_TIMER_T2_INT
|
||||
#define CFGID_TIMER_INVITE_EXPIRES CFGID_TIMER_INVITE_EXPIRES_INT
|
||||
#define CFGID_TIMER_REGISTER_EXPIRES CFGID_TIMER_REGISTER_EXPIRES_INT
|
||||
|
||||
#define CFGID_PROXY_REGISTER CFGID_PROXY_REGISTER_BOOL
|
||||
#define CFGID_PROXY_BACKUP CFGID_PROXY_BACKUP_STRING
|
||||
#define CFGID_PROXY_BACKUP_PORT CFGID_PROXY_BACKUP_PORT_INT
|
||||
#define CFGID_PROXY_EMERGENCY CFGID_PROXY_EMERGENCY_STRING
|
||||
#define CFGID_PROXY_EMERGENCY_PORT CFGID_PROXY_EMERGENCY_PORT_INT
|
||||
#define CFGID_OUTBOUND_PROXY CFGID_OUTBOUND_PROXY_STRING
|
||||
#define CFGID_OUTBOUND_PROXY_PORT CFGID_OUTBOUND_PROXY_PORT_INT
|
||||
|
||||
#define CFGID_NAT_RECEIVED_PROCESSING CFGID_NAT_RECEIVED_PROCESSING_BOOL
|
||||
#define CFGID_REG_USER_INFO CFGID_REG_USER_INFO_STRING
|
||||
#define CFGID_CNF_JOIN_ENABLE CFGID_CNF_JOIN_ENABLE_BOOL
|
||||
#define CFGID_REMOTE_PARTY_ID CFGID_REMOTE_PARTY_ID_BOOL
|
||||
#define CFGID_SEMI_XFER CFGID_SEMI_XFER_BOOL
|
||||
#define CFGID_CALL_HOLD_RINGBACK CFGID_CALL_HOLD_RINGBACK_BOOL
|
||||
#define CFGID_STUTTER_MSG_WAITING CFGID_STUTTER_MSG_WAITING_BOOL
|
||||
/**
|
||||
* The CFGID_CFWD_URL was consolidated for RT and CIUS and should be for TNP as well.
|
||||
*/
|
||||
#define CFGID_CFWD_URL CFGID_CFWD_URL_STRING
|
||||
|
||||
#define CFGID_CALL_STATS CFGID_CALL_STATS_BOOL
|
||||
#define CFGID_LOCAL_CFWD_ENABLE CFGID_LOCAL_CFWD_ENABLE_BOOL
|
||||
#define CFGID_TIMER_REGISTER_DELTA CFGID_TIMER_REGISTER_DELTA_INT
|
||||
#define CFGID_SIP_MAX_FORWARDS CFGID_SIP_MAX_FORWARDS_INT
|
||||
#define CFGID_2543_HOLD CFGID_2543_HOLD_BOOL
|
||||
|
||||
#define CFGID_CCM1_ADDRESS CFGID_CCM1_ADDRESS_STRING
|
||||
#define CFGID_CCM2_ADDRESS CFGID_CCM2_ADDRESS_STRING
|
||||
#define CFGID_CCM3_ADDRESS CFGID_CCM3_ADDRESS_STRING
|
||||
|
||||
// Note: IPv6 Not currently supported on Cius
|
||||
#define CFGID_CCM1_IPV6_ADDRESS CFGID_CCM1_IPV6_ADDRESS_STRING
|
||||
#define CFGID_CCM2_IPV6_ADDRESS CFGID_CCM2_IPV6_ADDRESS_STRING
|
||||
#define CFGID_CCM3_IPV6_ADDRESS CFGID_CCM3_IPV6_ADDRESS_STRING
|
||||
|
||||
#define CFGID_CCM1_SIP_PORT CFGID_CCM1_SIP_PORT_INT
|
||||
#define CFGID_CCM2_SIP_PORT CFGID_CCM2_SIP_PORT_INT
|
||||
#define CFGID_CCM3_SIP_PORT CFGID_CCM3_SIP_PORT_INT
|
||||
|
||||
#define CFGID_CCM1_SEC_LEVEL CFGID_CCM1_SEC_LEVEL_INT
|
||||
#define CFGID_CCM2_SEC_LEVEL CFGID_CCM2_SEC_LEVEL_INT
|
||||
#define CFGID_CCM3_SEC_LEVEL CFGID_CCM3_SEC_LEVEL_INT
|
||||
|
||||
#define CFGID_CCM1_IS_VALID CFGID_CCM1_IS_VALID_BOOL
|
||||
#define CFGID_CCM2_IS_VALID CFGID_CCM2_IS_VALID_BOOL
|
||||
#define CFGID_CCM3_IS_VALID CFGID_CCM3_IS_VALID_BOOL
|
||||
|
||||
#define CFGID_CCM_TFTP_IP_ADDR CFGID_CCM_TFTP_IP_ADDR_STRING
|
||||
#define CFGID_CCM_TFTP_PORT CFGID_CCM_TFTP_PORT_INT
|
||||
#define CFGID_CCM_TFTP_IS_VALID CFGID_CCM_TFTP_IS_VALID_BOOL
|
||||
#define CFGID_CCM_TFTP_SEC_LEVEL CFGID_CCM_TFTP_SEC_LEVEL_INT
|
||||
|
||||
#define CFGID_CONN_MONITOR_DURATION CFGID_CONN_MONITOR_DURATION_INT
|
||||
#define CFGID_CALL_PICKUP_URI CFGID_CALL_PICKUP_URI_STRING
|
||||
#define CFGID_CALL_PICKUP_LIST_URI CFGID_CALL_PICKUP_LIST_URI_STRING
|
||||
#define CFGID_CALL_PICKUP_GROUP_URI CFGID_CALL_PICKUP_GROUP_URI_STRING
|
||||
#define CFGID_MEET_ME_SERVICE_URI CFGID_MEET_ME_SERVICE_URI_STRING
|
||||
#define CFGID_CALL_FORWARD_URI CFGID_CALL_FORWARD_URI_STRING
|
||||
#define CFGID_ABBREVIATED_DIAL_URI CFGID_ABBREVIATED_DIAL_URI_STRING
|
||||
#define CFGID_CALL_LOG_BLF_ENABLED CFGID_CALL_LOG_BLF_ENABLED_BOOL
|
||||
#define CFGID_REMOTE_CC_ENABLED CFGID_REMOTE_CC_ENABLED_BOOL
|
||||
#define CFGID_RETAIN_FORWARD_INFORMATION CFGID_RETAIN_FORWARD_INFORMATION_BOOL
|
||||
|
||||
#define CFGID_TIMER_KEEPALIVE_EXPIRES CFGID_TIMER_KEEPALIVE_EXPIRES_INT
|
||||
#define CFGID_TIMER_SUBSCRIBE_EXPIRES CFGID_TIMER_SUBSCRIBE_EXPIRES_INT
|
||||
#define CFGID_TIMER_SUBSCRIBE_DELTA CFGID_TIMER_SUBSCRIBE_DELTA_INT
|
||||
#define CFGID_TRANSPORT_LAYER_PROT CFGID_TRANSPORT_LAYER_PROT_INT
|
||||
#define CFGID_KPML_ENABLED CFGID_KPML_ENABLED_INT
|
||||
|
||||
#define CFGID_NAT_ENABLE CFGID_NAT_ENABLE_BOOL
|
||||
#define CFGID_NAT_ADDRESS CFGID_NAT_ADDRESS_STRING
|
||||
#define CFGID_VOIP_CONTROL_PORT CFGID_VOIP_CONTROL_PORT_INT
|
||||
#define CFGID_MY_IP_ADDR CFGID_MY_IP_ADDR_STRING
|
||||
#define CFGID_MY_MAC_ADDR CFGID_MY_MAC_ADDR_STRING
|
||||
#define CFGID_ENABLE_VAD CFGID_ENABLE_VAD_BOOL
|
||||
|
||||
#define CFGID_AUTOANSWER_IDLE_ALTERNATE CFGID_AUTOANSWER_IDLE_ALTERNATE_BOOL
|
||||
#define CFGID_AUTOANSWER_TIMER CFGID_AUTOANSWER_TIMER_INT
|
||||
#define CFGID_AUTOANSWER_OVERRIDE CFGID_AUTOANSWER_OVERRIDE_BOOL
|
||||
|
||||
#define CFGID_OFFHOOK_TO_FIRST_DIGIT_TIMER CFGID_OFFHOOK_TO_FIRST_DIGIT_TIMER_INT
|
||||
#define CFGID_CALL_WAITING_SILENT_PERIOD CFGID_CALL_WAITING_SILENT_PERIOD_INT
|
||||
#define CFGID_RING_SETTING_BUSY_POLICY CFGID_RING_SETTING_BUSY_POLICY_INT
|
||||
#define CFGID_DSCP_FOR_CALL_CONTROL CFGID_DSCP_FOR_CALL_CONTROL_INT
|
||||
#define CFGID_SPEAKER_ENABLED CFGID_SPEAKER_ENABLED_BOOL
|
||||
#define CFGID_XFR_ONHOOK_ENABLED CFGID_XFR_ONHOOK_ENABLED_BOOL
|
||||
#define CFGID_ROLLOVER CFGID_ROLLOVER_INT
|
||||
#define CFGID_LOAD_FILE CFGID_LOAD_FILE_STRING
|
||||
|
||||
#define CFGID_BLF_ALERT_TONE_IDLE CFGID_BLF_ALERT_TONE_IDLE_INT
|
||||
#define CFGID_BLF_ALERT_TONE_BUSY CFGID_BLF_ALERT_TONE_BUSY_INT
|
||||
#define CFGID_AUTO_PICKUP_ENABLED CFGID_AUTO_PICKUP_ENABLED_BOOL
|
||||
|
||||
#define CFGID_JOIN_ACROSS_LINES CFGID_JOIN_ACROSS_LINES_INT
|
||||
|
||||
#define CFGID_MY_ACTIVE_MAC_ADDR CFGID_MY_ACTIVE_MAC_ADDR_STRING
|
||||
#define CFGID_DSCP_AUDIO CFGID_DSCP_AUDIO_INT
|
||||
#define CFGID_DEVICE_NAME CFGID_DEVICE_NAME_STRING
|
||||
#define CFGID_USER_AGENT CFGID_USER_AGENT_STRING
|
||||
#define CFGID_MODEL_NUMBER CFGID_MODEL_NUMBER_STRING
|
||||
#define CFGID_DSCP_VIDEO CFGID_DSCP_VIDEO_INT
|
||||
|
||||
#define CFGID_IP_ADDR_MODE CFGID_IP_ADDR_MODE_INT
|
||||
#define CFGID_INTER_DIGIT_TIMER CFGID_INTER_DIGIT_TIMER_INT
|
||||
|
||||
// Note - EMCC not currently supported on CIUS
|
||||
#define CFGID_EMCC_MODE CFGID_EMCC_MODE_BOOL
|
||||
#define CFGID_VISITING_EM_PORT CFGID_VISITING_EM_PORT_INT
|
||||
#define CFGID_VISITING_EM_IP CFGID_VISITING_EM_IP_STRING
|
||||
|
||||
#define CFGID_CCM_EXTERNAL_NUMBER_MASK CFGID_CCM_EXTERNAL_NUMBER_MASK_STRING
|
||||
#define CFGID_MEDIA_IP_ADDR CFGID_MEDIA_IP_ADDR_STRING
|
||||
|
||||
/* All non Line specific params should be added above */
|
||||
/* All Line specific params should be added below */
|
||||
|
||||
#define CFGID_LINE_FEATURE CFGID_LINE_FEATURE_INT
|
||||
#define CFGID_LINE_INDEX CFGID_LINE_INDEX_INT
|
||||
#define CFGID_LINE_MAXNUMCALLS CFGID_LINE_MAXNUMCALLS_INT
|
||||
#define CFGID_LINE_NAME CFGID_LINE_NAME_STRING
|
||||
#define CFGID_LINE_AUTHNAME CFGID_LINE_AUTHNAME_STRING
|
||||
#define CFGID_LINE_PASSWORD CFGID_LINE_PASSWORD_STRING
|
||||
#define CFGID_LINE_DISPLAYNAME CFGID_LINE_DISPLAYNAME_STRING
|
||||
#define CFGID_LINE_CONTACT CFGID_LINE_CONTACT_STRING
|
||||
#define CFGID_PROXY_ADDRESS CFGID_PROXY_ADDRESS_STRING
|
||||
#define CFGID_PROXY_PORT CFGID_PROXY_PORT_INT
|
||||
#define CFGID_LINE_AUTOANSWER_ENABLED CFGID_LINE_AUTOANSWER_ENABLED_BYTE
|
||||
#define CFGID_LINE_AUTOANSWER_MODE CFGID_LINE_AUTOANSWER_MODE_STRING
|
||||
#define CFGID_LINE_CALL_WAITING CFGID_LINE_CALL_WAITING_BYTE
|
||||
#define CFGID_LINE_MSG_WAITING_LAMP CFGID_LINE_MSG_WAITING_LAMP_BYTE
|
||||
#define CFGID_LINE_MESSAGE_WAITING_AMWI CFGID_LINE_MESSAGE_WAITING_AMWI_BYTE
|
||||
#define CFGID_LINE_RING_SETTING_IDLE CFGID_LINE_RING_SETTING_IDLE_BYTE
|
||||
#define CFGID_LINE_RING_SETTING_ACTIVE CFGID_LINE_RING_SETTING_ACTIVE_BYTE
|
||||
#define CFGID_LINE_BUSY_TRIGGER CFGID_LINE_BUSY_TRIGGER_INT
|
||||
#define CFGID_LINE_CFWDALL CFGID_LINE_CFWDALL_STRING
|
||||
|
||||
#define CFGID_LINE_SPEEDDIAL_NUMBER CFGID_LINE_SPEEDDIAL_NUMBER_STRING
|
||||
#define CFGID_LINE_RETRIEVAL_PREFIX CFGID_LINE_RETRIEVAL_PREFIX_STRING
|
||||
#define CFGID_LINE_MESSAGES_NUMBER CFGID_LINE_MESSAGES_NUMBER_STRING
|
||||
#define CFGID_LINE_FWD_CALLER_NAME_DIPLAY CFGID_LINE_FWD_CALLER_NAME_DIPLAY_BOOL
|
||||
#define CFGID_LINE_FWD_CALLER_NUMBER_DIPLAY CFGID_LINE_FWD_CALLER_NUMBER_DIPLAY_BOOL
|
||||
#define CFGID_LINE_FWD_REDIRECTED_NUMBER_DIPLAY CFGID_LINE_FWD_REDIRECTED_NUMBER_DIPLAY_BOOL
|
||||
#define CFGID_LINE_FWD_DIALED_NUMBER_DIPLAY CFGID_LINE_FWD_DIALED_NUMBER_DIPLAY_BOOL
|
||||
#define CFGID_LINE_FEATURE_OPTION_MASK CFGID_LINE_FEATURE_OPTION_MASK_INT
|
||||
#define CFGID_P2PSIP CFGID_P2PSIP_BOOL
|
||||
#define CFGID_VERSION CFGID_VERSION_STRING
|
||||
#define CFGID_SDPMODE CFGID_SDPMODE_BOOL
|
||||
#define CFGID_RTCPMUX CFGID_RTCPMUX_BOOL
|
||||
#define CFGID_RTPSAVPF CFGID_RTPSAVPF_BOOL
|
||||
#define CFGID_MAXAVBITRATE CFGID_MAXAVBITRATE_BOOL
|
||||
#define CFGID_MAXCODEDAUDIOBW CFGID_MAXCODEDAUDIOBW_BOOL
|
||||
#define CFGID_USEDTX CFGID_USEDTX_BOOL
|
||||
#define CFGID_STEREO CFGID_STEREO_BOOL
|
||||
#define CFGID_USEINBANDFEC CFGID_USEINBANDFEC_BOOL
|
||||
#define CFGID_CBR CFGID_CBR_BOOL
|
||||
#define CFGID_MAXPTIME CFGID_MAXPTIME_BOOL
|
||||
#define CFGID_SCTP_PORT CFGID_SCTP_PORT_INT
|
||||
#define CFGID_NUM_DATA_STREAMS CFGID_NUM_DATA_STREAMS_INT
|
||||
|
||||
/*********************************************************
|
||||
*
|
||||
* Value Definitions
|
||||
*
|
||||
*********************************************************/
|
||||
// Line feature
|
||||
typedef enum {
|
||||
cfgLineFeatureNone = CC_LINE_FEATURE_NONE,
|
||||
cfgLineFeatureRedial = CC_LINE_FEATURE_REDIAL,
|
||||
cfgLineFeatureSpeedDial = CC_LINE_FEATURE_SPEEDDIAL,
|
||||
cfgLineFeatureDN = CC_LINE_FEATURE_DN,
|
||||
cfgLineFeatureService = CC_LINE_FEATURE_SERVICE,
|
||||
cfgLineFeatureSpeedDialBLF = CC_LINE_FEATURE_SPEEDDIALBLF,
|
||||
cfgLineFeatureMaliciousCallID = CC_LINE_FEATURE_MALICIOUSCALLID,
|
||||
cfgLineFeatureAllCalls = CC_LINE_FEATURE_ALLCALLS,
|
||||
cfgLineFeatureAnswerOldest = CC_LINE_FEATURE_ANSWEROLDEST,
|
||||
cfgLineFeatureServices = CC_LINE_FEATURE_SERVICES,
|
||||
cfgLineFeatureBLF = CC_LINE_FEATURE_BLF
|
||||
} cfgLineFeatureType_e;
|
||||
|
||||
/*********************************************************
|
||||
*
|
||||
* Function Prototypes
|
||||
*
|
||||
*********************************************************/
|
||||
void protocol_cfg_init(void);
|
||||
void sip_config_get_net_device_ipaddr(cpr_ip_addr_t *ip_addr);
|
||||
void sip_config_get_net_ipv6_device_ipaddr(cpr_ip_addr_t *ip_addr);
|
||||
void sip_config_get_nat_ipaddr(cpr_ip_addr_t *ip_addr);
|
||||
void sip_config_set_nat_ipaddr(cpr_ip_addr_t *ip_address);
|
||||
uint16_t sip_config_local_supported_codecs_get(rtp_ptype aSupportedCodecs[],
|
||||
uint16_t supportedCodecsLen);
|
||||
uint16_t sip_config_video_supported_codecs_get(rtp_ptype aSupportedCodecs[],
|
||||
uint16_t supportedCodecsLen, boolean isOffer);
|
||||
|
||||
boolean prot_config_check_line_name(char *line_name);
|
||||
//const key_table_entry_t * sip_config_local_codec_entry_find(const rtp_ptype codec);
|
||||
line_t sip_config_get_button_from_line(line_t line);
|
||||
line_t sip_config_get_line_from_button(line_t button);
|
||||
boolean sip_config_check_line(line_t line);
|
||||
line_t sip_config_local_line_get(void);
|
||||
void sip_config_get_display_name(line_t line, char *buffer, int buffer_len);
|
||||
line_t sip_config_get_line_by_called_number(line_t start_line, const char *called_number);
|
||||
int sip_minimum_config_check(void);
|
||||
void config_set_codec_table(int codec_mask);
|
||||
int sip_config_get_keepalive_expires();
|
||||
rtp_ptype sip_config_preferred_codec(void);
|
||||
|
||||
#endif /* PROT_CONFIGMGR_H_ */
|
300
libs/sipcc/core/common/resource_manager.c
Normal file
300
libs/sipcc/core/common/resource_manager.c
Normal file
@ -0,0 +1,300 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "cpr_types.h"
|
||||
#include "cpr_stdlib.h"
|
||||
#include "resource_manager.h"
|
||||
#include "phone_debug.h"
|
||||
|
||||
#define RM_NUM_ELEMENTS_PER_MAP 32
|
||||
#define rm_get_table_index(a) (a / RM_NUM_ELEMENTS_PER_MAP)
|
||||
#define rm_get_map_offset(a) (a % RM_NUM_ELEMENTS_PER_MAP)
|
||||
|
||||
/*
|
||||
* rm_clear_all_elements
|
||||
*
|
||||
* Description:
|
||||
* This function clears all members of the specified resource manager
|
||||
*
|
||||
* Parameters:
|
||||
* rm_p - pointer to the resource manager to be cleared
|
||||
*
|
||||
* Returns:
|
||||
* None
|
||||
*/
|
||||
void
|
||||
rm_clear_all_elements (resource_manager_t *rm_p)
|
||||
{
|
||||
static const char fname[] = "rm_clear_all_elements";
|
||||
uint16_t i;
|
||||
|
||||
if (!rm_p) {
|
||||
PLAT_ERROR(PLAT_COMMON_F_PREFIX"null resource manager received.\n", fname);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < rm_p->max_index; i++) {
|
||||
rm_p->table[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* rm_clear_element
|
||||
*
|
||||
* Description:
|
||||
* This function clears a single element from the specified resource manager
|
||||
*
|
||||
* Parameters:
|
||||
* rm_p - pointer to the resource manager to be cleared
|
||||
* element - element id of element to be cleared
|
||||
*
|
||||
* Returns:
|
||||
* None
|
||||
*/
|
||||
void
|
||||
rm_clear_element (resource_manager_t * rm_p, int16_t element)
|
||||
{
|
||||
static const char fname[] = "rm_clear_elements";
|
||||
|
||||
if (!rm_p) {
|
||||
PLAT_ERROR(PLAT_COMMON_F_PREFIX"null resource manager received.\n", fname);
|
||||
return;
|
||||
}
|
||||
|
||||
if (element < 0 || element >= rm_p->max_element) {
|
||||
PLAT_ERROR(PLAT_COMMON_F_PREFIX"element value %d invalid. Max value is %d.\n",
|
||||
fname, element, rm_p->max_element - 1);
|
||||
return;
|
||||
}
|
||||
|
||||
rm_p->table[rm_get_table_index(element)] &=
|
||||
(~(1 << rm_get_map_offset(element)));
|
||||
}
|
||||
|
||||
/*
|
||||
* rm_set_element
|
||||
*
|
||||
* Description:
|
||||
* This function sets the bit representing the specified element
|
||||
* in the specified resource manager.
|
||||
*
|
||||
* Parameters:
|
||||
* rm_p - pointer to the resource manager
|
||||
* element - element id of element to be set
|
||||
*
|
||||
* Returns:
|
||||
* None
|
||||
*/
|
||||
void
|
||||
rm_set_element (resource_manager_t *rm_p, int16_t element)
|
||||
{
|
||||
static const char fname[] = "rm_set_element";
|
||||
|
||||
if (!rm_p) {
|
||||
PLAT_ERROR(PLAT_COMMON_F_PREFIX"null resource manager received.\n", fname);
|
||||
return;
|
||||
}
|
||||
|
||||
if (element < 0 || element >= rm_p->max_element) {
|
||||
PLAT_ERROR(PLAT_COMMON_F_PREFIX"element value %d invalid. Max value %d.\n",
|
||||
fname, element, rm_p->max_element - 1);
|
||||
return;
|
||||
}
|
||||
|
||||
rm_p->table[rm_get_table_index(element)] |=
|
||||
(1 << rm_get_map_offset(element));
|
||||
}
|
||||
|
||||
/*
|
||||
* rm_is_element_set
|
||||
*
|
||||
* Description:
|
||||
* This function checks if the specified element in the specified
|
||||
* resource manager is set.
|
||||
*
|
||||
* Parameters:
|
||||
* rm_p - pointer to the resource manager.
|
||||
* element - element id of element to be checked.
|
||||
*
|
||||
* Returns:
|
||||
* TRUE if element is set, else FALSE
|
||||
*/
|
||||
boolean
|
||||
rm_is_element_set (resource_manager_t *rm_p, int16_t element)
|
||||
{
|
||||
static const char fname[] = "rm_is_element_set";
|
||||
|
||||
if (!rm_p) {
|
||||
PLAT_ERROR(PLAT_COMMON_F_PREFIX"null resource manager received.\n", fname);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (element < 0 || element >= rm_p->max_element) {
|
||||
PLAT_ERROR(PLAT_COMMON_F_PREFIX"element value %d invalid. Max value %d.\n",
|
||||
fname, element, rm_p->max_element - 1);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (rm_p->table[rm_get_table_index(element)] &
|
||||
(1 << rm_get_map_offset(element))) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* rm_get_free_element
|
||||
*
|
||||
* Description:
|
||||
* This function walks through the members of the resource manager and
|
||||
* attempts to locate a free element. If a free element is found, the
|
||||
* element's associated bit is set in the resource manager and the
|
||||
* element id is returned.
|
||||
*
|
||||
* Parameters:
|
||||
* rm_p - pointer to the resource manager.
|
||||
*
|
||||
* Returns:
|
||||
* If an element is available, a element id (from zero to max element)
|
||||
* If no element is available, -1 is returned.
|
||||
*/
|
||||
int16_t
|
||||
rm_get_free_element (resource_manager_t *rm_p)
|
||||
{
|
||||
static const char fname[] = "rm_get_free_element";
|
||||
int16_t element = -1;
|
||||
uint16_t i, j;
|
||||
uint32_t max_map = 0;
|
||||
|
||||
max_map = ~max_map;
|
||||
|
||||
if (!rm_p) {
|
||||
PLAT_ERROR(PLAT_COMMON_F_PREFIX"null resource manager received.\n", fname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < rm_p->max_index && element == -1; i++) {
|
||||
if (rm_p->table[i] != max_map) {
|
||||
for (j = 0; j < RM_NUM_ELEMENTS_PER_MAP && element == -1; j++) {
|
||||
if (!(rm_p->table[i] & (1 << j))) {
|
||||
element = i * RM_NUM_ELEMENTS_PER_MAP + j;
|
||||
if (element < rm_p->max_element) {
|
||||
rm_set_element(rm_p, element);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (element >= rm_p->max_element) {
|
||||
element = -1;
|
||||
}
|
||||
return (element);
|
||||
}
|
||||
|
||||
/*
|
||||
* rm_show
|
||||
*
|
||||
* Description:
|
||||
* Utility function used to dump the contents of the resource manager.
|
||||
*
|
||||
* Parameters:
|
||||
* rm_p - pointer to the resource manager.
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*/
|
||||
void
|
||||
rm_show (resource_manager_t *rm_p)
|
||||
{
|
||||
static const char fname[] = "rm_show";
|
||||
int16_t element = 0;
|
||||
uint16_t i, j;
|
||||
|
||||
if (!rm_p) {
|
||||
PLAT_ERROR(PLAT_COMMON_F_PREFIX"null resource manager received.\n", fname);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < rm_p->max_index; i++) {
|
||||
for (j = 0; j < RM_NUM_ELEMENTS_PER_MAP; j++) {
|
||||
if (rm_p->table[i] & (1 << j)) {
|
||||
element = (i * RM_NUM_ELEMENTS_PER_MAP) + j;
|
||||
TNP_DEBUG(DEB_F_PREFIX"rm map: %d\n", DEB_F_PREFIX_ARGS(RM, fname), element);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* rm_create
|
||||
*
|
||||
* Description:
|
||||
* Allocates and initializes a new resource manager
|
||||
*
|
||||
* Parameters:
|
||||
* max_element - Maximum number of elements the resource manager
|
||||
* is required to track
|
||||
*
|
||||
* Returns:
|
||||
* If successful, pointer to the newly allocated resource manager
|
||||
* If not successful, NULL
|
||||
*/
|
||||
resource_manager_t *
|
||||
rm_create (int16_t max_element)
|
||||
{
|
||||
static const char fname[] = "rm_create";
|
||||
resource_manager_t *rm_p;
|
||||
|
||||
if (max_element < 0) {
|
||||
PLAT_ERROR(PLAT_COMMON_F_PREFIX"invalid max element %d received.\n", fname,
|
||||
max_element);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rm_p = (resource_manager_t *) cpr_malloc(sizeof(resource_manager_t));
|
||||
if (!rm_p) {
|
||||
PLAT_ERROR(PLAT_COMMON_F_PREFIX"unable to allocate resource manager.\n", fname);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rm_p->max_element = max_element;
|
||||
rm_p->max_index = max_element / RM_NUM_ELEMENTS_PER_MAP + 1;
|
||||
|
||||
rm_p->table = (uint32_t *)
|
||||
cpr_malloc(rm_p->max_index * RM_NUM_ELEMENTS_PER_MAP);
|
||||
if (!rm_p->table) {
|
||||
free(rm_p);
|
||||
return NULL;
|
||||
}
|
||||
rm_clear_all_elements(rm_p);
|
||||
return rm_p;
|
||||
}
|
||||
|
||||
/*
|
||||
* rm_free
|
||||
*
|
||||
* Description:
|
||||
* This function frees the memory allocated for the specified resource manager.
|
||||
*
|
||||
* Parameters:
|
||||
* rm_p - pointer to the resource manager.
|
||||
*
|
||||
* Returns:
|
||||
* none
|
||||
*/
|
||||
void
|
||||
rm_destroy (resource_manager_t *rm_p)
|
||||
{
|
||||
static const char fname[] = "rm_destroy";
|
||||
|
||||
if (!rm_p) {
|
||||
PLAT_ERROR(PLAT_COMMON_F_PREFIX"null resource manager received.\n", fname);
|
||||
return;
|
||||
}
|
||||
|
||||
cpr_free(rm_p->table);
|
||||
cpr_free(rm_p);
|
||||
}
|
23
libs/sipcc/core/common/resource_manager.h
Normal file
23
libs/sipcc/core/common/resource_manager.h
Normal file
@ -0,0 +1,23 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _RM_MGR_H__
|
||||
#define _RM_MGR_H_
|
||||
|
||||
typedef struct resource_manager {
|
||||
int16_t max_element;
|
||||
int16_t max_index;
|
||||
uint32_t *table;
|
||||
} resource_manager_t;
|
||||
|
||||
void rm_clear_all_elements(resource_manager_t *rm);
|
||||
void rm_clear_element(resource_manager_t *rm, int16_t element);
|
||||
void rm_set_element(resource_manager_t *rm, int16_t element);
|
||||
boolean rm_is_element_set(resource_manager_t *rm, int16_t element);
|
||||
int16_t rm_get_free_element(resource_manager_t *rm);
|
||||
void rm_show(resource_manager_t *rm);
|
||||
resource_manager_t *rm_create(int16_t max_element);
|
||||
void rm_destroy(resource_manager_t *rm);
|
||||
|
||||
#endif
|
100
libs/sipcc/core/common/sip_socket_api.c
Executable file
100
libs/sipcc/core/common/sip_socket_api.c
Executable file
@ -0,0 +1,100 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "cpr.h"
|
||||
#include "cpr_socket.h"
|
||||
#include "errno.h"
|
||||
#include "plat_api.h"
|
||||
|
||||
/**
|
||||
* sipSocketSend
|
||||
*
|
||||
* @brief The sipSocketSend() function is a wrapper used by the sipstack to send
|
||||
* data over a socket. This function decides to use the secure versus unsecure
|
||||
* connection based on the "secure" flag.
|
||||
*
|
||||
* @note - The implementation of both secure/non-secure is the same in RT/TNP
|
||||
* products. It is different for the other vendors and hence we need this
|
||||
* flexibility.
|
||||
*
|
||||
* @param[in] soc Specifies the socket created with cprSocket() to send
|
||||
* @param[in] buf A pointer to the buffer of the message to send.
|
||||
* @param[in] len Specifies the length in bytes of the message pointed to by the buffer argument.
|
||||
* @param[in] flags - The options used for the send.
|
||||
*
|
||||
*
|
||||
*/
|
||||
ssize_t
|
||||
sipSocketSend (cpr_socket_t soc,
|
||||
CONST void *buf,
|
||||
size_t len,
|
||||
int32_t flags,
|
||||
boolean secure)
|
||||
{
|
||||
// if (secure) {
|
||||
// return platSecSocSend (soc, buf, len);
|
||||
// } else {
|
||||
return cprSend(soc, buf, len, flags);
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* sipSocketRecv
|
||||
*
|
||||
* @brief The sipSocketRecv() function is a wrapper used by the sipstack to send
|
||||
* data over a socket. This function decides to use the secure versus unsecure
|
||||
* connection based on the "secure" flag.
|
||||
*
|
||||
* @note - The implementation of both secure/non-secure is the same in RT/TNP
|
||||
* products. It is different for the other vendors and hence we need this
|
||||
* flexibility.
|
||||
*
|
||||
* @param[in] soc Specifies the socket created with cprSocket() to send
|
||||
* @param[in] buf A pointer to the buffer of the message to send.
|
||||
* @param[in] len Specifies the length in bytes of the message pointed to by the buffer argument.
|
||||
* @param[in] flags - The options used for the recv.
|
||||
*/
|
||||
ssize_t
|
||||
sipSocketRecv (cpr_socket_t soc,
|
||||
void * RESTRICT buf,
|
||||
size_t len,
|
||||
int32_t flags,
|
||||
boolean secure)
|
||||
{
|
||||
// if (secure) {
|
||||
// return platSecSocRecv (soc, buf, len);
|
||||
// } else {
|
||||
return cprRecv(soc, buf, len, flags);
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* sipSocketClose
|
||||
*
|
||||
* @brief The sipSocketClose() function is a wrapper used by the sipstack to
|
||||
* close a socket. This function decides to use the secure versus unsecure
|
||||
* connection based on the "secure" flag.
|
||||
*
|
||||
* @note - The implementation of both secure/non-secure is the same in RT/TNP
|
||||
* products. It is different for the other vendors and hence we need this
|
||||
* flexibility.
|
||||
*
|
||||
* @param[in] soc - The socket that needs to be destroyed
|
||||
*
|
||||
* @return CPR_SUCCESS on success otherwise, CPR_FAILURE. cpr_errno needs to be set in this case.
|
||||
*
|
||||
* @note The possible error values this function should return are
|
||||
* @li [CPR_EBADF] socket is not a valid socket descriptor.
|
||||
*/
|
||||
cpr_status_e
|
||||
sipSocketClose (cpr_socket_t soc,
|
||||
boolean secure)
|
||||
{
|
||||
// if (secure) {
|
||||
// return platSecSocClose (soc);
|
||||
// } else {
|
||||
return cprCloseSocket(soc);
|
||||
// }
|
||||
}
|
||||
|
342
libs/sipcc/core/common/subscription_handler.c
Executable file
342
libs/sipcc/core/common/subscription_handler.c
Executable file
@ -0,0 +1,342 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "cpr_types.h"
|
||||
#include "cc_types.h"
|
||||
#include "phone_platform_constants.h"
|
||||
#include "cc_constants.h"
|
||||
#include "phone_debug.h"
|
||||
#include "prot_configmgr.h"
|
||||
#include "cc_blf.h"
|
||||
#include "ccapi_snapshot.h"
|
||||
|
||||
#define SPEEDDIAL_START_BUTTON_NUMBER 2
|
||||
|
||||
static unsigned char transactionIds[MAX_REG_LINES];
|
||||
static boolean displayBLFState = TRUE;
|
||||
static cc_blf_state_t blfStates[MAX_REG_LINES];
|
||||
static boolean isBLFHandlerRunning = FALSE;
|
||||
static boolean isAvailable = FALSE;
|
||||
|
||||
#ifndef INT_MAX
|
||||
#define INT_MAX 2147483647
|
||||
#endif
|
||||
|
||||
static void ccBLFHandlerInitialized();
|
||||
|
||||
/*
|
||||
* Function: sub_hndlr_isAlertingBLFState
|
||||
*
|
||||
* Description: returns if the BLF state is "alerting"
|
||||
*
|
||||
* Parameters:
|
||||
* inst - line button number.
|
||||
*
|
||||
* Returns: TRUE/FALSE
|
||||
*/
|
||||
boolean sub_hndlr_isAlertingBLFState(int inst)
|
||||
{
|
||||
static const char fname[] = "sub_hndlr_isAlertingBLFState";
|
||||
|
||||
if ((displayBLFState == TRUE) && (blfStates[inst - 1] == CC_SIP_BLF_ALERTING)) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"inst=%d, isAlerting=TRUE\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname),
|
||||
inst);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"inst=%d, isAlerting=FALSE\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname),
|
||||
inst);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: sub_hndlr_isInUseBLFState
|
||||
*
|
||||
* Description: returns if the BLF state is "in use"
|
||||
*
|
||||
* Parameters:
|
||||
* inst - line button number.
|
||||
*
|
||||
* Returns: TRUE/FALSE
|
||||
*/
|
||||
boolean sub_hndlr_isInUseBLFState(int inst)
|
||||
{
|
||||
static const char fname[] = "sub_hndlr_isInUseBLFState";
|
||||
|
||||
if ((displayBLFState == TRUE) && (blfStates[inst - 1] == CC_SIP_BLF_INUSE)) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"inst=%d, isInUse=TRUE\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname),
|
||||
inst);
|
||||
return TRUE;
|
||||
}
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"inst=%d, isInUse=FALSE\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname),
|
||||
inst);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: sub_hndlr_isAvailable
|
||||
*
|
||||
* Description: returns if the subscription handler is available.
|
||||
*
|
||||
* Parameters: none.
|
||||
*
|
||||
* Returns: TRUE/FALSE
|
||||
*/
|
||||
boolean sub_hndlr_isAvailable()
|
||||
{
|
||||
static const char fname[] = "sub_hndlr_isAvailable";
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"isAvailable=%d\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname),
|
||||
isAvailable);
|
||||
return isAvailable;
|
||||
}
|
||||
|
||||
static unsigned short get_new_trans_id()
|
||||
{
|
||||
static unsigned short curr_trans_id = 0;
|
||||
|
||||
if (++curr_trans_id == 0) {
|
||||
curr_trans_id = 1;
|
||||
}
|
||||
|
||||
return curr_trans_id;
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: sub_hndlr_start
|
||||
*
|
||||
* Description: does blf subscriptions upon registration.
|
||||
*
|
||||
* Parameters: none.
|
||||
*
|
||||
* Returns: void
|
||||
*/
|
||||
void sub_hndlr_start()
|
||||
{
|
||||
static const char fname[] = "sub_hndlr_start";
|
||||
int i;
|
||||
cc_uint32_t lineFeature = 0;
|
||||
cc_uint32_t featureOptionMask = 0;
|
||||
char speedDialNumber[MAX_LINE_NAME_SIZE] = {0};
|
||||
char primaryLine[MAX_LINE_NAME_SIZE] = {0};
|
||||
int transId;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"entering\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
/* let the system know that subscription handler is available. */
|
||||
isAvailable = TRUE;
|
||||
|
||||
/* get primary DN */
|
||||
config_get_line_string(CFGID_LINE_NAME, primaryLine, 1, sizeof(primaryLine));
|
||||
|
||||
/*
|
||||
* for speeddial/BLF buttons, make presence subscriptions.
|
||||
*/
|
||||
for (i = SPEEDDIAL_START_BUTTON_NUMBER; i <= MAX_REG_LINES; i++) {
|
||||
// first line must always be a calling line.
|
||||
config_get_line_value(CFGID_LINE_FEATURE, &lineFeature, sizeof(lineFeature), i);
|
||||
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"inst=%d, lineFeature=%d\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname),
|
||||
i, lineFeature);
|
||||
switch (lineFeature) {
|
||||
case cfgLineFeatureSpeedDialBLF:
|
||||
config_get_line_string(CFGID_LINE_SPEEDDIAL_NUMBER, speedDialNumber, i, sizeof(speedDialNumber));
|
||||
if (speedDialNumber[0] == 0) {
|
||||
break;
|
||||
}
|
||||
config_get_line_value(CFGID_LINE_FEATURE, &featureOptionMask, sizeof(featureOptionMask), i);
|
||||
|
||||
transId = get_new_trans_id();
|
||||
transactionIds[i - 1] = transId;
|
||||
CC_BLF_subscribe(transId,
|
||||
INT_MAX,
|
||||
primaryLine,
|
||||
speedDialNumber,
|
||||
i,
|
||||
featureOptionMask );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//Initializes native BLF handler
|
||||
ccBLFHandlerInitialized();
|
||||
}
|
||||
}
|
||||
|
||||
static void ccBLFHandlerInitialized()
|
||||
{
|
||||
if (!isBLFHandlerRunning) {
|
||||
CC_BLF_init();
|
||||
isBLFHandlerRunning = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: sub_hndlr_stop
|
||||
*
|
||||
* Description: terminates blf subscriptions upon unregistration.
|
||||
*
|
||||
* Parameters: none.
|
||||
*
|
||||
* Returns: void
|
||||
*/
|
||||
void sub_hndlr_stop()
|
||||
{
|
||||
static const char fname[] = "sub_hndlr_stop";
|
||||
int i;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"entering\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
isAvailable = FALSE;
|
||||
isBLFHandlerRunning = FALSE;
|
||||
|
||||
// should clean up blf susbcription list.
|
||||
for (i = SPEEDDIAL_START_BUTTON_NUMBER; i <= MAX_REG_LINES; i++) {
|
||||
//first, reset the transaction ids
|
||||
transactionIds[i - 1] = 0;
|
||||
//reset blf states.
|
||||
blfStates[i - 1] = CC_SIP_BLF_UNKNOWN;
|
||||
}
|
||||
CC_BLF_unsubscribe_All();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Function: hideBLFButtonsDisplay
|
||||
*
|
||||
* Description: hides BLF states
|
||||
*
|
||||
* Parameters: none.
|
||||
*
|
||||
* Returns: void
|
||||
*/
|
||||
static void hideBLFButtonsDisplay()
|
||||
{
|
||||
static const char fname[] = "hideBLFButtonsDisplay";
|
||||
int i;
|
||||
cc_uint32_t lineFeature = 0;
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"entering\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
displayBLFState = FALSE;
|
||||
for (i = SPEEDDIAL_START_BUTTON_NUMBER; i <= MAX_REG_LINES; i++) {
|
||||
// first line must always be a calling line.
|
||||
config_get_line_value(CFGID_LINE_FEATURE, &lineFeature, sizeof(lineFeature), i);
|
||||
|
||||
switch (lineFeature) {
|
||||
case cfgLineFeatureSpeedDialBLF:
|
||||
ccsnap_gen_blfFeatureEvent(CC_SIP_BLF_UNKNOWN, i);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: unhideBLFButtonsDisplay
|
||||
*
|
||||
* Description: unhides BLF states.
|
||||
*
|
||||
* Parameters: none.
|
||||
*
|
||||
* Returns: void
|
||||
*/
|
||||
static void unhideBLFButtonsDisplay()
|
||||
{
|
||||
static const char fname[] = "unhideBLFButtonsDisplay";
|
||||
int i;
|
||||
cc_uint32_t lineFeature = 0;
|
||||
char speedDialNumber[MAX_LINE_NAME_SIZE] = {0};
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"entering\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
|
||||
displayBLFState = TRUE;
|
||||
|
||||
for (i = SPEEDDIAL_START_BUTTON_NUMBER; i <= MAX_REG_LINES; i++) {
|
||||
// first line must always be a calling line.
|
||||
config_get_line_value(CFGID_LINE_FEATURE, &lineFeature, sizeof(lineFeature), i);
|
||||
config_get_line_string(CFGID_LINE_SPEEDDIAL_NUMBER, speedDialNumber, i, sizeof(speedDialNumber));
|
||||
|
||||
switch (lineFeature) {
|
||||
case cfgLineFeatureSpeedDialBLF:
|
||||
ccsnap_gen_blfFeatureEvent(blfStates[i - 1], i);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: sub_hndlr_controlBLFButtons
|
||||
*
|
||||
* Description: hides/unhides BLF states.
|
||||
*
|
||||
* Parameters: none.
|
||||
*
|
||||
* Returns: void
|
||||
*/
|
||||
void sub_hndlr_controlBLFButtons(boolean state)
|
||||
{
|
||||
static const char fname[] = "sub_hndlr_controlBLFButtons";
|
||||
|
||||
if (state == TRUE) {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"going to hide\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
hideBLFButtonsDisplay();
|
||||
} else {
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"going to unhide\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
|
||||
unhideBLFButtonsDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: sub_hndlr_NotifyBLFStatus
|
||||
*
|
||||
* Description: notifies the app of BLF state.
|
||||
*
|
||||
* Parameters:
|
||||
* requestId - requestId of the subscription
|
||||
* status - BLF status
|
||||
* appId - button number of the BLF feature key.
|
||||
*
|
||||
* Returns: void
|
||||
*/
|
||||
void sub_hndlr_NotifyBLFStatus(int requestId, cc_blf_state_t status, int appId)
|
||||
{
|
||||
static const char fname[] = "sub_hndlr_NotifyBLFStatus";
|
||||
cc_uint32_t lineFeature = 0;
|
||||
char speedDialNumber[MAX_LINE_NAME_SIZE] = {0};
|
||||
|
||||
|
||||
CCAPP_DEBUG(DEB_F_PREFIX"requestId=%d, status=%d, appId=%d\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname),
|
||||
requestId, status, appId);
|
||||
if (appId == 0) {
|
||||
// call list BLF.
|
||||
} else {
|
||||
config_get_line_value(CFGID_LINE_FEATURE, &lineFeature, sizeof(lineFeature), appId);
|
||||
config_get_line_string(CFGID_LINE_SPEEDDIAL_NUMBER, speedDialNumber, appId, sizeof(speedDialNumber));
|
||||
|
||||
blfStates[appId - 1] = status;
|
||||
if (displayBLFState == FALSE) {
|
||||
return; // ignore the notify
|
||||
}
|
||||
if (lineFeature == cfgLineFeatureSpeedDialBLF) {
|
||||
ccsnap_gen_blfFeatureEvent(status, appId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
23
libs/sipcc/core/common/subscription_handler.h
Executable file
23
libs/sipcc/core/common/subscription_handler.h
Executable file
@ -0,0 +1,23 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef __SUB_HANDLER_H__
|
||||
#define __SUB_HANDLER_H__
|
||||
|
||||
boolean sub_hndlr_isAlertingBLFState(int inst);
|
||||
|
||||
boolean sub_hndlr_isInUseBLFState(int inst);
|
||||
|
||||
boolean sub_hndlr_isAvailable();
|
||||
|
||||
void sub_hndlr_start();
|
||||
|
||||
void sub_hndlr_stop();
|
||||
|
||||
void sub_hndlr_controlBLFButtons(boolean state);
|
||||
|
||||
void sub_hndlr_NotifyBLFStatus(int requestId, int status, int appId);
|
||||
|
||||
#endif
|
||||
|
361
libs/sipcc/core/common/text_strings.c
Executable file
361
libs/sipcc/core/common/text_strings.c
Executable file
@ -0,0 +1,361 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <cpr_string.h>
|
||||
#include "text_strings.h"
|
||||
|
||||
|
||||
#define dcl_str(x,p) char str_##x[] = p
|
||||
#define use_str(x) str_##x
|
||||
|
||||
|
||||
/*
|
||||
* Debug strings. No localization needed. Keep it separate.
|
||||
*/
|
||||
|
||||
dcl_str(DEBUG_START, "SIPCC-START:\0");
|
||||
dcl_str(DEBUG_SEPARATOR_BAR, "===============\n");
|
||||
dcl_str(DEBUG_CONSOLE_PASSWORD, "CONSOLE-PWD:cisco");
|
||||
dcl_str(DEBUG_CONSOLE_KEYWORD_CONSOLE_STALL, "CONSOLE-STALL");
|
||||
dcl_str(DEBUG_CONSOLE_KEYWORD_MEMORYMAP, "CONSOLE-MEMORYMAP");
|
||||
dcl_str(DEBUG_CONSOLE_KEYWORD_MALLOCTABLE, "CONSOLE-MALLOCTABLE");
|
||||
dcl_str(DEBUG_CONSOLE_KEYWORD_MEMORYDUMP, "CONSOLE-DUMP");
|
||||
dcl_str(DEBUG_CONSOLE_KEYWORD_DNS, "CONSOLE-DNS");
|
||||
dcl_str(DEBUG_CONSOLE_KEYWORD_DSPSTATE, "CONSOLE-DSPSTATE");
|
||||
dcl_str(DEBUG_CONSOLE_USAGE_MEMORYDUMP, "CONSOLE-MEMORYDUMP: addr bytes [cnt blk [1/0 char output]]\n");
|
||||
dcl_str(DEBUG_CONSOLE_BREAK, "CONSOLE-BREAK\r\n");
|
||||
|
||||
dcl_str(DEBUG_FUNCTION_ENTRY, "SIPCC-FUNC_ENTRY: LINE %d/%d: %-35s: %s <- %s\n");
|
||||
dcl_str(DEBUG_FUNCTION_ENTRY2, "SIPCC-FUNC_ENTRY: LINE %d/%d: %-35s: %s <- %s(%d)\n");
|
||||
dcl_str(DEBUG_SIP_ENTRY, "SIPCC-ENTRY: LINE %d/%d: %-35s: %s\n");
|
||||
dcl_str(DEBUG_SIP_URL_ERROR, "SIPCC-%s: Error: URL is not SIP.\n");
|
||||
dcl_str(DEBUG_LINE_NUMBER_INVALID, "SIPCC-LINE_NUM: %s: Error: Line number (%d) is invalid\n");
|
||||
dcl_str(DEBUG_SIP_SPI_SEND_ERROR, "SIPCC-SPI_SEND_ERR: %s: Error: sipSPISendErrorResponse(%d) failed.\n");
|
||||
dcl_str(DEBUG_SIP_SDP_CREATE_BUF_ERROR, "SIPCC-SDP_BUF: %s: Error: sipsdp_src_dest_create() returned null\n");
|
||||
dcl_str(DEBUG_SIP_PARSE_SDP_ERROR, "SIPCC-SDP_PARSE: %s: Error: sdp_parse()\n");
|
||||
dcl_str(DEBUG_SIP_FEATURE_UNSUPPORTED, "SIPCC-FEATURE: LINE %d/%d: %-35s: This feature is unsupported in the current state.\n");
|
||||
dcl_str(DEBUG_SIP_DEST_SDP, "SIPCC-SDP_DEST: LINE %d/%d: %-35s: Process SDP: Dest=<%s>:<%d>\n");
|
||||
dcl_str(DEBUG_SIP_MSG_SENDING_REQUEST, "SIPCC-MSG_SEND_REQ: %s: Sending %s...\n");
|
||||
dcl_str(DEBUG_SIP_MSG_SENDING_RESPONSE, "SIPCC-MSG_SEND_RESP: %s: Sending response %d...\n");
|
||||
dcl_str(DEBUG_SIP_MSG_RECV, "SIPCC-MSG_RECV: %s: Received SIP message %s.\n");
|
||||
dcl_str(DEBUG_SIP_STATE_UNCHANGED, "SIPCC-SIP_STATE: LINE %d/%d: %-35s: State unchanged -> %s\n");
|
||||
dcl_str(DEBUG_SIP_FUNCTIONCALL_FAILED, "SIPCC-FUNC_CALL: LINE %d/%d: %-35s: Error: %s returned error.\n");
|
||||
dcl_str(DEBUG_SIP_BUILDFLAG_ERROR, "SIPCC-BUILD_FLAG: %s: Error: Build flag is not successful. Will not send message.\n");
|
||||
dcl_str(DEBUG_GENERAL_FUNCTIONCALL_FAILED, "SIPCC-FUNC_CALL: %s: Error: %s returned error.\n");
|
||||
dcl_str(DEBUG_GENERAL_SYSTEMCALL_FAILED, "SIPCC-SYS_CALL: %s: Error: %s failed: errno = %d\n");
|
||||
dcl_str(DEBUG_GENERAL_FUNCTIONCALL_BADARGUMENT, "SIPCC-FUNC_CALL: %s: Error: invalid argument: %s\n");
|
||||
dcl_str(DEBUG_FUNCTIONNAME_SIPPMH_PARSE_FROM, "SIPCC-FUNC_NAME: sippmh_parse_from_or_to(FROM)");
|
||||
dcl_str(DEBUG_FUNCTIONNAME_SIPPMH_PARSE_TO, "SIPCC-FUNC_NAME: sippmh_parse_from_or_to(TO)");
|
||||
dcl_str(DEBUG_FUNCTIONNAME_SIP_SM_REQUEST_CHECK_AND_STORE, "SIPCC-SM_REQ: sip_sm_request_check_and_store()");
|
||||
dcl_str(DEBUG_SNTP_LI_ERROR, "SIPCC-SNTP: Leap indicator == 3\n");
|
||||
dcl_str(DEBUG_SNTP_MODE_ERROR, "SIPCC-SNTP: Mode is not server (4/5) in response\n");
|
||||
dcl_str(DEBUG_SNTP_STRATUM_ERROR, "SIPCC-SNTP: Invalid stratum > 15\n");
|
||||
dcl_str(DEBUG_SNTP_TIMESTAMP_ERROR, "SIPCC-SNTP: Server did not echo our transmit timestamp\n");
|
||||
dcl_str(DEBUG_SNTP_TIMESTAMP1, "SIPCC-SNTP: %-15s: 0x%08x %08x, ");
|
||||
dcl_str(DEBUG_SNTP_TIMESTAMP2, "SIPCC-SNTP: (%+03d:%02d) %s");
|
||||
dcl_str(DEBUG_SNTP_TIME_UPDATE, "SIPCC-SNTP: Updating date and time to:\n%s %lu %02lu:%02lu:%02lu "
|
||||
"%04lu, %s, week %lu and day %lu. "
|
||||
"Daylight saving is: %d\n\n");
|
||||
dcl_str(DEBUG_SNTP_TS_HEADER, "SIPCC-SNTP: Settings:\nMode : %lu\nTimezone "
|
||||
": %d\nServer Addr : %s\nTimeStruct : TZ/Offset: %d/%lu,"
|
||||
" AutoAdjust: %d\nMo Day DoW WoM Time\n");
|
||||
dcl_str(DEBUG_SNTP_TS_PRINT, "SIPCC-SNTP: %3lu %3lu %3lu %3lu %4lu\n");
|
||||
dcl_str(DEBUG_SNTP_SOCKET_REOPEN, "SIPCC-SNTP: Re-opening listening port due to IP change\n");
|
||||
dcl_str(DEBUG_SNTP_DISABLED, "SIPCC-SNTP: Unicast w/server addr 0.0.0.0, SNTP disabled\n");
|
||||
dcl_str(DEBUG_SNTP_REQUEST, "SIPCC-SNTP: Sending NTP request packet [%s]\n");
|
||||
dcl_str(DEBUG_SNTP_RESPONSE, "SIPCC-SNTP: Receiving NTP response packet\n");
|
||||
dcl_str(DEBUG_SNTP_RETRANSMIT, "SIPCC-SNTP: Waiting %d msec to retransmit\n");
|
||||
dcl_str(DEBUG_SNTP_UNICAST_MODE, "SIPCC-SNTP: Unicast mode [%s]\n");
|
||||
dcl_str(DEBUG_SNTP_MULTICAST_MODE, "SIPCC-SNTP: Multicast/Directed broadcast mode [%s]\n");
|
||||
dcl_str(DEBUG_SNTP_ANYCAST_MODE, "SIPCC-SNTP: Anycast mode [%s]\n");
|
||||
dcl_str(DEBUG_SNTP_VALIDATION, "SIPCC-SNTP: Dropping unauthorized SNTP response: %s\n");
|
||||
dcl_str(DEBUG_SNTP_VALIDATION_PACKET, "SIPCC-SNTP: Semantic check failed for NTP packet\n");
|
||||
dcl_str(DEBUG_SNTP_WRONG_SERVER, "SIPCC-SNTP: Unauthorized server");
|
||||
dcl_str(DEBUG_SNTP_NO_REQUEST, "SIPCC-SNTP: No request sent");
|
||||
dcl_str(DEBUG_SNTP_ANYCAST_RESET, "SIPCC-SNTP: Reset to Unicast to server: %s\n");
|
||||
dcl_str(DEBUG_SOCKET_UDP_RTP, "SIPCC-SOC_TASK: UDP_RTP event received.\n");
|
||||
dcl_str(DEBUG_MAC_PRINT, "SIPCC-MAC_PRINT: %04x:%04x:%04x");
|
||||
dcl_str(DEBUG_IP_PRINT, "SIPCC-IP_PRINT: %u.%u.%u.%u");
|
||||
dcl_str(DEBUG_SYSBUF_UNAVAILABLE, "SIPCC-SYS_BUF: %s: Error: IRXLstGet() failed\n");
|
||||
dcl_str(DEBUG_MSG_BUFFER_TOO_BIG, "SIPCC-MSG_BUF: %s: Error: Args Check: message buffer length (%d) too big.\n");
|
||||
dcl_str(DEBUG_UNKNOWN_TIMER_BLOCK, "SIPCC-TIMER: %s: Error: Unknown timer block\n");
|
||||
dcl_str(DEBUG_CREDENTIALS_BAG_CORRUPTED, "SIPCC-CRED: %-35s: Error: credentials bags corrupted");
|
||||
dcl_str(DEBUG_INPUT_NULL, "SIPCC-INPUT: %s: Error: Input is null\n");
|
||||
dcl_str(DEBUG_INPUT_EMPTY, "SIPCC-INPUT: %s: Error: Input is empty\n");
|
||||
dcl_str(DEBUG_STRING_DUP_FAILED, "SIPCC-STR_DUP: %s: Unable to duplicate string.\n");
|
||||
dcl_str(DEBUG_PARSER_STRING_TOO_LARGE, "SIPCC-PARSE: Parse error: string too big (%d,%d)\n");
|
||||
dcl_str(DEBUG_PARSER_NULL_KEY_TABLE, "SIPCC-PARSE: Parse error: NULL key table passed into parser\n");
|
||||
dcl_str(DEBUG_PARSER_UNKNOWN_KEY, "SIPCC-PARSE: Parse error: Unknown key name: %s\n");
|
||||
dcl_str(DEBUG_PARSER_UNKNOWN_KEY_ENUM, "SIPCC-PARSE: Print error: Unknown key enum: %d\n");
|
||||
dcl_str(DEBUG_PARSER_INVALID_START_VAR, "SIPCC-PARSE: Parse error: Invalid start variable ch=0x%02x(%c)\n");
|
||||
dcl_str(DEBUG_PARSER_INVALID_VAR_CHAR, "SIPCC-PARSE: Parse error: Invalid variable ch=0x%02x(%c)\n");
|
||||
dcl_str(DEBUG_PARSER_MISSING_COLON, "SIPCC-PARSE: Parse error: Missing colon separator\n");
|
||||
dcl_str(DEBUG_PARSER_NO_VALUE, "SIPCC-PARSE: Parse error: no value for variable\n");
|
||||
dcl_str(DEBUG_PARSER_EARLY_EOL, "SIPCC-PARSE: Parse error: early EOL for value\n");
|
||||
dcl_str(DEBUG_PARSER_INVALID_VAR_NAME, "SIPCC-PARSE: Parse error: parse_var_name failed: %d\n");
|
||||
dcl_str(DEBUG_PARSER_INVALID_VAR_VALUE, "SIPCC-PARSE: Parse error: var: %s parse_var_value failed: %d\n");
|
||||
dcl_str(DEBUG_PARSER_UNKNOWN_VAR, "SIPCC-PARSE: Parse error: var: %s not found in table\n");
|
||||
dcl_str(DEBUG_PARSER_NAME_VALUE, "SIPCC-PARSE: Name: [%s] Value: [%s]\n");
|
||||
dcl_str(DEBUG_PARSER_UNKNOWN_NAME_VALUE, "SIPCC-PARSE: Parse error: Name: [%s] Value: [%s] rc:%d\n");
|
||||
dcl_str(DEBUG_PARSER_UNKNOWN_ERROR, "SIPCC-PARSE: Default error: Name: [%s] Value: [%s] rc:%d\n");
|
||||
dcl_str(DEBUG_PARSER_NUM_ERRORS, "SIPCC-PARSE: Parse error: %d Errors found\n");
|
||||
dcl_str(DEBUG_PARSER_SET_DEFAULT, "SIPCC-PARSE: Parser Info: Setting var: %s to default value: %s\n\n");
|
||||
dcl_str(DEBUG_SDP_ERROR_BODY_FIELD, "SIPCC-SDP: \n%s: Error in one of the SDP body fields \n");
|
||||
dcl_str(DEBUG_UDP_OPEN_FAIL, "SIPCC-UDP: %s: UdpOpen(R IP=%d, R Port=%d, L Port=%d) failed\n");
|
||||
dcl_str(DEBUG_UDP_PAYLOAD_TOO_LARGE, "SIPCC-UDP: %s: Error: payload size=<%d> > allowed size=<%d>\n");
|
||||
dcl_str(DEBUG_RTP_TRANSPORT, "SIPCC-RTP: %s: transport= %d\n");
|
||||
dcl_str(DEBUG_RTP_INVALID_VOIP_TYPE, "SIPCC-RTP: %s: Error: Unexpected voipCodec_t type: <%d>\n");
|
||||
dcl_str(DEBUG_RTP_INVALID_RTP_TYPE, "SIPCC-RTP: %s: Error: Unexpected rtp_ptype in SDP body: <%d>\n");
|
||||
dcl_str(DEBUG_MEMORY_ALLOC, "SIPCC-MEM: Malloc Addr:0x%lx, Size:%d\n");
|
||||
dcl_str(DEBUG_MEMORY_FREE, "SIPCC-MEM: Free Addr:0x%lx, Size:%d\n");
|
||||
dcl_str(DEBUG_MEMORY_MALLOC_ERROR, "SIPCC-MEM: 0x%lx:Malloc error for size %d\n");
|
||||
dcl_str(DEBUG_MEMORY_REALLOC_ERROR, "SIPCC-MEM: %s: Error: malloc_tagged() returned null.\n");
|
||||
dcl_str(DEBUG_MEMORY_OUT_OF_MEM, "SIPCC-MEM: %s: Error: malloc failed\n");
|
||||
dcl_str(DEBUG_MEMORY_ENTRY, "SIPCC-MEM: >> Used: %1d size: %6d addr:0x%08x\n");
|
||||
dcl_str(DEBUG_MEMORY_SUMMARY, "===== MEMORY MAP START =====\n"
|
||||
"free blocks : %6d, free block space:%6d, largest free block: %6d\n"
|
||||
"used blocks : %6d, used block space:%6d, largest used block: %6d\n"
|
||||
"wasted block: %6d, str_lib space :%6d\n"
|
||||
"used space excluding str_lib space :%6d\n \n"
|
||||
"===== MEMORY MAP END =====\n");
|
||||
dcl_str(DEBUG_MEMORY_ADDRESS_HEADER, "SIPCC-MEM: 0x%08x: ");
|
||||
dcl_str(DEBUG_MEMORY_DUMP, "SIPCC-MEM: DUMP: 0x%08x - 0x%08x\n");
|
||||
dcl_str(DEBUG_DNS_GETHOSTBYNAME, "SIPCC-DNS: gethostbyname('%s',%08x,%d,%d)\n");
|
||||
dcl_str(DEBUG_PMH_INCORRECT_SYNTAX, "SIPCC-PMH: INCORRECT SYNTAX");
|
||||
dcl_str(DEBUG_PMH_INVALID_FIELD_VALUE, "SIPCC-PMH: INVALID FIELD VALUE");
|
||||
dcl_str(DEBUG_PMH_INVALID_SCHEME, "SIPCC-PMH: INVALID SCHEME");
|
||||
dcl_str(DEBUG_PMH_UNKNOWN_SCHEME, "SIPCC-PMH: UNKNOWN SCHEME");
|
||||
dcl_str(DEBUG_PMH_NOT_ENOUGH_PARAMETERS, "SIPCC-PMH: NOT ENOUGH PARAMETERS");
|
||||
dcl_str(DEBUG_REG_DISABLED, "SIPCC-REG: LINE %d/%d: %-35s: registration disabled\n");
|
||||
dcl_str(DEBUG_REG_PROXY_EXPIRES, "SIPCC-REG: LINE %d/%d: %-35s: Using proxy expires value\n");
|
||||
dcl_str(DEBUG_REG_SIP_DATE, "SIPCC-REG: LINE %d/%d: %-35s: SIP-date= %s\n");
|
||||
dcl_str(DEBUG_REG_SIP_RESP_CODE, "SIPCC-REG: LINE %d/%d: %-35s: Error: SIP response code\n");
|
||||
dcl_str(DEBUG_REG_SIP_RESP_FAILURE, "SIPCC-REG: LINE %d/%d: %-35s: SIP failure %d resp\n");
|
||||
dcl_str(DEBUG_REG_INVALID_LINE, "SIPCC-REG: %-35s: Line %d: Invalid line\n");
|
||||
dcl_str(CC_NO_MSG_BUFFER, "SIPCC-MSG_BUF: %s : no msg buffer available\n");
|
||||
dcl_str(CC_SEND_FAILURE, "SIPCC-MSG_SEND: %s : unable to send msg\n");
|
||||
dcl_str(GSM_UNDEFINED, "SIPCC-GSM: UNDEFINED");
|
||||
dcl_str(GSM_DBG_PTR, "SIPCC-GSM_DBG_PTR: %s %-4d: %-35s: %s= %p\n");
|
||||
dcl_str(GSM_FUNC_ENTER, "SIPCC-GSM_FUNC_ENT: %s %-4d: %-35s\n");
|
||||
dcl_str(GSM_DBG1, "SIPCC-GSM: %s %-4d: %-35s: %s\n");
|
||||
dcl_str(FSM_DBG_SM_DEFAULT_EVENT, "SIPCC-FSM: default - ignoring.\n");
|
||||
dcl_str(FSM_DBG_SM_FTR_ENTRY, "SIPCC-FSM: feature= %s, src= %s\n");
|
||||
dcl_str(FSM_DBG_FAC_ERR, "SIPCC-FSM_FAC_ERR: %-4d: %-35s:\n %s, rc= %s\n");
|
||||
dcl_str(FSM_DBG_FAC_FOUND, "SIPCC-FSM: %-4d: %-35s: facility found(%d)\n");
|
||||
dcl_str(FSM_DBG_IGNORE_FTR, "SIPCC-FSM: %s %-4d: %8d: ignoring feature= %s\n");
|
||||
dcl_str(FSM_DBG_IGNORE_SRC, "SIPCC-FSM: %s %-4d: %8d: ignoring src= %s\n");
|
||||
dcl_str(FSM_DBG_CHANGE_STATE, "SIPCC-FSM: %s %-4d: %8d: %s -> %s\n");
|
||||
dcl_str(FSM_DBG_SDP_BUILD_ERR, "SIPCC-FSM: Unable to build SDP. \n");
|
||||
dcl_str(FSMDEF_DBG_PTR, "SIPCC-FSM: DEF %-4d/%d: %-35s: dcb= %p\n");
|
||||
dcl_str(FSMDEF_DBG1, "SIPCC-FSM: DEF %-4d/%d: %-35s: %s\n");
|
||||
dcl_str(FSMDEF_DBG2, "SIPCC-FSM: DEF %-4d/%d: %-35s: %s %d\n");
|
||||
dcl_str(FSMDEF_DBG_SDP, "SIPCC-FSM: DEF %-4d/%d: %-35s: addr= %s, port= %d,\n media_type(s)=");
|
||||
dcl_str(FSMDEF_DBG_CLR_SPOOF_APPLD, "SIPCC-FSM: DEF %-4d/%d: %-35s: clearing spoof_ringout_applied.\n");
|
||||
dcl_str(FSMDEF_DBG_CLR_SPOOF_RQSTD, "SIPCC-FSM: DEF %-4d/%d: %-35s: clearing spoof_ringout_requested.\n");
|
||||
dcl_str(FSMDEF_DBG_INVALID_DCB, "SIPCC-FSM: DEF 0 : %-35s: invalid dcb\n");
|
||||
dcl_str(FSMDEF_DBG_FTR_REQ_ACT, "SIPCC-FSM: DEF %-4d/%d: feature requested %s but %s is active.\n");
|
||||
dcl_str(FSMDEF_DBG_TMR_CREATE_FAILED, "SIPCC-FSM: DEF %-4d/%d: %-35s: %s:\n cprCreateTimer failed.\n");
|
||||
dcl_str(FSMDEF_DBG_TMR_START_FAILED, "SIPCC-FSM: DEF %-4d/%d: %-35s: %s:\n cprStartTimer failed, errno= %d.\n");
|
||||
dcl_str(FSMDEF_DBG_TMR_CANCEL_FAILED, "SIPCC-FSM: DEF %-4d/%d: %-35s: %s:\n cprCancelTimer failed, errno= %d.\n");
|
||||
dcl_str(FSMXFR_DBG_XFR_INITIATED, "SIPCC-FSM: XFR %-4d/%d/%d: %8d: xfer initiated\n");
|
||||
dcl_str(FSMXFR_DBG_PTR, "SIPCC-FSM: XFR %-4d/%d/%d: %-35s: xcb= %p\n");
|
||||
dcl_str(FSMCNF_DBG_CNF_INITIATED, "SIPCC-FSM: CNF %-4d/%d/%d: %8d: conf initiated\n");
|
||||
dcl_str(FSMCNF_DBG_PTR, "SIPCC-FSM: CNF %-4d/%d/%d: %-35s: ncb= %p\n");
|
||||
dcl_str(FSMB2BCNF_DBG_CNF_INITIATED, "SIPCC-FSM: B2BCNF %-4d/%d/%d: %8d: b2bconf initiated\n");
|
||||
dcl_str(FSMB2BCNF_DBG_PTR, "SIPCC-FSM: B2BCNF %-4d/%d/%d: %-35s: ncb= %p\n");
|
||||
dcl_str(FSMSHR_DBG_BARGE_INITIATED, "SIPCC-FSM: SHR %-4d/%d/%d: %8d: Barge initiated\n");
|
||||
dcl_str(LSM_DBG_ENTRY, "SIPCC-LSM: %-4d/%d: %-35s\n");
|
||||
dcl_str(LSM_DBG_INT1, "SIPCC-LSM: %-4d/%d: %-35s: %s= %d\n");
|
||||
dcl_str(LSM_DBG_CC_ERROR, "SIPCC-LSM: %-4d/%d: %-35s: (%d:%p) failure\n");
|
||||
dcl_str(VCM_DEBUG_ENTRY, "SIPCC-VCM: %-4d: %-35s\n");
|
||||
dcl_str(SM_PROCESS_EVENT_ERROR, "SIPCC-SM: %s: Error: sip_sm_process_event() returned error processing %d\n");
|
||||
dcl_str(REG_SM_PROCESS_EVENT_ERROR, "SIPCC-SM: %s: Error: sip_reg_sm_process_event() returned error processing %d\n");
|
||||
dcl_str(DEBUG_END, "SIPCC-END: \0");
|
||||
|
||||
/*
|
||||
* Debug string table NOT subject to localization
|
||||
*/
|
||||
debug_string_table_entry debug_string_table [] = {
|
||||
{0}, // DEBUG_START
|
||||
{use_str(DEBUG_SEPARATOR_BAR)}, // DEBUG_SEPARATOR_BAR
|
||||
{use_str(DEBUG_CONSOLE_PASSWORD)}, // DEBUG_CONSOLE_PASSWORD
|
||||
{use_str(DEBUG_CONSOLE_KEYWORD_CONSOLE_STALL)}, // DEBUG_CONSOLE_KEYWORD_CONSOLE_STALL
|
||||
{use_str(DEBUG_CONSOLE_KEYWORD_MEMORYMAP)}, // DEBUG_CONSOLE_KEYWORD_MEMORYMAP
|
||||
{use_str(DEBUG_CONSOLE_KEYWORD_MALLOCTABLE)}, // DEBUG_CONSOLE_KEYWORD_MALLOCTABLE
|
||||
{use_str(DEBUG_CONSOLE_KEYWORD_MEMORYDUMP)}, // DEBUG_CONSOLE_KEYWORD_MEMORYDUMP
|
||||
{use_str(DEBUG_CONSOLE_KEYWORD_DNS)}, // DEBUG_CONSOLE_KEYWORD_DNS
|
||||
{use_str(DEBUG_CONSOLE_KEYWORD_DSPSTATE)}, // DEBUG_CONSOLE_KEYWORD_DSPSTATE
|
||||
{use_str(DEBUG_CONSOLE_USAGE_MEMORYDUMP)}, // DEBUG_CONSOLE_USAGE_MEMORYDUMP
|
||||
{use_str(DEBUG_CONSOLE_BREAK)}, // DEBUG_CONSOLE_BREAK
|
||||
{use_str(DEBUG_FUNCTION_ENTRY)}, // DEBUG_FUNCTION_ENTRY
|
||||
{use_str(DEBUG_FUNCTION_ENTRY2)}, // DEBUG_FUNCTION_ENTRY2
|
||||
{use_str(DEBUG_SIP_ENTRY)}, // DEBUG_SIP_ENTRY
|
||||
{use_str(DEBUG_SIP_URL_ERROR)}, // DEBUG_SIP_URL_ERROR
|
||||
{use_str(DEBUG_LINE_NUMBER_INVALID)}, // DEBUG_LINE_NUMBER_INVALID
|
||||
{use_str(DEBUG_SIP_SPI_SEND_ERROR)}, // DEBUG_SIP_SPI_SEND_ERROR
|
||||
{use_str(DEBUG_SIP_SDP_CREATE_BUF_ERROR)}, // DEBUG_SIP_SDP_CREATE_BUF_ERROR
|
||||
{use_str(DEBUG_SIP_PARSE_SDP_ERROR)}, // DEBUG_SIP_PARSE_SDP_ERROR
|
||||
{use_str(DEBUG_SIP_FEATURE_UNSUPPORTED)}, // DEBUG_SIP_FEATURE_UNSUPPORTED
|
||||
{use_str(DEBUG_SIP_DEST_SDP)}, // DEBUG_SIP_DEST_SDP
|
||||
{use_str(DEBUG_SIP_MSG_SENDING_REQUEST)}, // DEBUG_SIP_MSG_SENDING_REQUEST
|
||||
{use_str(DEBUG_SIP_MSG_SENDING_RESPONSE)}, // DEBUG_SIP_MSG_SENDING_RESPONSE
|
||||
{use_str(DEBUG_SIP_MSG_RECV)}, // DEBUG_SIP_MSG_RECV
|
||||
{use_str(DEBUG_SIP_STATE_UNCHANGED)}, // DEBUG_SIP_STATE_UNCHANGED
|
||||
{use_str(DEBUG_SIP_FUNCTIONCALL_FAILED)}, // DEBUG_SIP_FUNCTIONCALL_FAILED
|
||||
{use_str(DEBUG_SIP_BUILDFLAG_ERROR)}, // DEBUG_SIP_BUILDFLAG_ERROR
|
||||
{use_str(DEBUG_GENERAL_FUNCTIONCALL_FAILED)}, // DEBUG_GENERAL_FUNCTIONCALL_FAILED
|
||||
{use_str(DEBUG_GENERAL_SYSTEMCALL_FAILED)}, // DEBUG_GENERAL_SYSTEMCALL_FAILED
|
||||
{use_str(DEBUG_GENERAL_FUNCTIONCALL_BADARGUMENT)}, // DEBUG_GENERAL_FUNCTIONCALL_BADARGUMENT
|
||||
{use_str(DEBUG_FUNCTIONNAME_SIPPMH_PARSE_FROM)},// DEBUG_FUNCTIONNAME_SIP_PARSE_FROM
|
||||
{use_str(DEBUG_FUNCTIONNAME_SIPPMH_PARSE_TO)}, // DEBUG_FUNCTIONNAME_SIP_PARSE_TO
|
||||
{use_str(DEBUG_FUNCTIONNAME_SIP_SM_REQUEST_CHECK_AND_STORE)}, // DEBUG_FUNCTIONNAME_SIP_SM_REQUEST_CHECK_AND_STORE
|
||||
{use_str(DEBUG_SNTP_LI_ERROR)}, // DEBUG_SNTP_LI_ERROR
|
||||
{use_str(DEBUG_SNTP_MODE_ERROR)}, // DEBUG_SNTP_MODE_ERROR
|
||||
{use_str(DEBUG_SNTP_STRATUM_ERROR)}, // DEBUG_SNTP_STRATUM_ERROR
|
||||
{use_str(DEBUG_SNTP_TIMESTAMP_ERROR)}, // DEBUG_SNTP_TIMESTAMP_ERROR
|
||||
{use_str(DEBUG_SNTP_TIMESTAMP1)}, // DEBUG_SNTP_TIMESTAMP1
|
||||
{use_str(DEBUG_SNTP_TIMESTAMP2)}, // DEBUG_SNTP_TIMESTAMP2
|
||||
{use_str(DEBUG_SNTP_TIME_UPDATE)}, // DEBUG_SNTP_TIME_UPDATE
|
||||
{use_str(DEBUG_SNTP_TS_HEADER)}, // DEBUG_SNTP_TS_HEADER
|
||||
{use_str(DEBUG_SNTP_TS_PRINT)}, // DEBUG_SNTP_TS_PRINT
|
||||
{use_str(DEBUG_SNTP_SOCKET_REOPEN)}, // DEBUG_SNTP_SOCKET_REOPEN
|
||||
{use_str(DEBUG_SNTP_DISABLED)}, // DEBUG_SNTP_DISABLED
|
||||
{use_str(DEBUG_SNTP_REQUEST)}, // DEBUG_SNTP_REQUEST
|
||||
{use_str(DEBUG_SNTP_RESPONSE)}, // DEBUG_SNTP_RESPONSE
|
||||
{use_str(DEBUG_SNTP_RETRANSMIT)}, // DEBUG_SNTP_RETRANSMIT
|
||||
{use_str(DEBUG_SNTP_UNICAST_MODE)}, // DEBUG_SNTP_UNICAST_MODE
|
||||
{use_str(DEBUG_SNTP_MULTICAST_MODE)}, // DEBUG_SNTP_MULTICAST_MODE
|
||||
{use_str(DEBUG_SNTP_ANYCAST_MODE)}, // DEBUG_SNTP_ANYCAST_MODE
|
||||
{use_str(DEBUG_SNTP_VALIDATION)}, // DEBUG_SNTP_VALIDATION
|
||||
{use_str(DEBUG_SNTP_VALIDATION_PACKET)}, // DEBUG_SNTP_VALIDATION_PACKET
|
||||
{use_str(DEBUG_SNTP_WRONG_SERVER)}, // DEBUG_SNTP_WRONG_SERVER
|
||||
{use_str(DEBUG_SNTP_NO_REQUEST)}, // DEBUG_SNTP_NO_REQUEST
|
||||
{use_str(DEBUG_SNTP_ANYCAST_RESET)}, // DEBUG_SNTP_ANYCAST_RESET
|
||||
{use_str(DEBUG_SOCKET_UDP_RTP)}, // DEBUG_SOCKET_UDP_RTP
|
||||
{use_str(DEBUG_MAC_PRINT)}, // DEBUG_MAC_PRINT
|
||||
{use_str(DEBUG_IP_PRINT)}, // DEBUG_IP_PRINT
|
||||
{use_str(DEBUG_SYSBUF_UNAVAILABLE)}, // DEBUG_SYSBUF_UNAVAILABLE
|
||||
{use_str(DEBUG_MSG_BUFFER_TOO_BIG)}, // DEBUG_MSG_BUFFER_TOO_BIG
|
||||
{use_str(DEBUG_UNKNOWN_TIMER_BLOCK)}, // DEBUG_UNKNOWN_TIMER_BLOCK
|
||||
{use_str(DEBUG_CREDENTIALS_BAG_CORRUPTED)}, // DEBUG_CREDENTIALS_BAG_CORRUPTED
|
||||
{use_str(DEBUG_INPUT_NULL)}, // DEBUG_INPUT_NULL
|
||||
{use_str(DEBUG_INPUT_EMPTY)}, // DEBUG_INPUT_EMPTY
|
||||
{use_str(DEBUG_STRING_DUP_FAILED)}, // DEBUG_STRING_DUP_FAILED
|
||||
{use_str(DEBUG_PARSER_STRING_TOO_LARGE)}, // DEBUG_PARSER_STRING_TOO_LARGE
|
||||
{use_str(DEBUG_PARSER_NULL_KEY_TABLE)}, // DEBUG_PARSER_NULL_KEY_TABLE
|
||||
{use_str(DEBUG_PARSER_UNKNOWN_KEY)}, // DEBUG_PARSER_UNKNOWN_KEY
|
||||
{use_str(DEBUG_PARSER_UNKNOWN_KEY_ENUM)}, // DEBUG_PARSER_UNKNOWN_KEY_ENUM
|
||||
{use_str(DEBUG_PARSER_INVALID_START_VAR)}, // DEBUG_PARSER_INVALID_START_VAR
|
||||
{use_str(DEBUG_PARSER_INVALID_VAR_CHAR)}, // DEBUG_PARSER_INVALID_VAR_CHAR
|
||||
{use_str(DEBUG_PARSER_MISSING_COLON)}, // DEBUG_PARSER_MISSING_COLON
|
||||
{use_str(DEBUG_PARSER_NO_VALUE)}, // DEBUG_PARSER_NO_VALUE
|
||||
{use_str(DEBUG_PARSER_EARLY_EOL)}, // DEBUG_PARSER_EARLY_EOL
|
||||
{use_str(DEBUG_PARSER_INVALID_VAR_NAME)}, // DEBUG_PARSER_INVALID_VAR_NAME
|
||||
{use_str(DEBUG_PARSER_INVALID_VAR_VALUE)}, // DEBUG_PARSER_INVALID_VAR_VALUE
|
||||
{use_str(DEBUG_PARSER_UNKNOWN_VAR)}, // DEBUG_PARSER_UNKNOWN_VAR
|
||||
{use_str(DEBUG_PARSER_NAME_VALUE)}, // DEBUG_PARSER_NAME_VALUE
|
||||
{use_str(DEBUG_PARSER_UNKNOWN_NAME_VALUE)}, // DEBUG_PARSER_UNKNOWN_NAME_VALUE
|
||||
{use_str(DEBUG_PARSER_UNKNOWN_ERROR)}, // DEBUG_PARSER_UNKNOWN_ERROR
|
||||
{use_str(DEBUG_PARSER_NUM_ERRORS)}, // DEBUG_PARSER_NUM_ERRORS
|
||||
{use_str(DEBUG_PARSER_SET_DEFAULT)}, // DEBUG_PARSER_SET_DEFAULT
|
||||
{use_str(DEBUG_SDP_ERROR_BODY_FIELD)}, // DEBUG_SDP_ERROR_BODY_FIELD
|
||||
{use_str(DEBUG_UDP_OPEN_FAIL)}, // DEBUG_UDP_OPEN_FAIL
|
||||
{use_str(DEBUG_UDP_PAYLOAD_TOO_LARGE)}, // DEBUG_UDP_PAYLOAD_TOO_LARGE
|
||||
{use_str(DEBUG_RTP_TRANSPORT)}, // DEBUG_RTP_TRANSPORT
|
||||
{use_str(DEBUG_RTP_INVALID_VOIP_TYPE)}, // DEBUG_RTP_INVALID_VOIP_TYPE
|
||||
{use_str(DEBUG_RTP_INVALID_RTP_TYPE)}, // DEBUG_RTP_INVALID_RTP_TYPE
|
||||
{use_str(DEBUG_MEMORY_ALLOC)}, // DEBUG_MEMORY_ALLOC
|
||||
{use_str(DEBUG_MEMORY_FREE)}, // DEBUG_MEMORY_FREE
|
||||
{use_str(DEBUG_MEMORY_MALLOC_ERROR)}, // DEBUG_MEMORY_MALLOC_ERROR
|
||||
{use_str(DEBUG_MEMORY_REALLOC_ERROR)}, // DEBUG_MEMORY_REALLOC_ERROR
|
||||
{use_str(DEBUG_MEMORY_OUT_OF_MEM)}, // DEBUG_MEMORY_OUT_OF_MEM
|
||||
{use_str(DEBUG_MEMORY_ENTRY)}, // DEBUG_MEMORY_ENTRY
|
||||
{use_str(DEBUG_MEMORY_SUMMARY)}, // DEBUG_MEMORY_SUMMARY
|
||||
{use_str(DEBUG_MEMORY_ADDRESS_HEADER)}, // DEBUG_MEMORY_ADDRESS_HEADER
|
||||
{use_str(DEBUG_MEMORY_DUMP)}, // DEBUG_MEMORY_DUMP
|
||||
{use_str(DEBUG_DNS_GETHOSTBYNAME)}, // DEBUG_DNS_GETHOSTBYNAME
|
||||
{use_str(DEBUG_PMH_INCORRECT_SYNTAX)}, // DEBUG_PMH_INCORRECT_SYNTAX
|
||||
{use_str(DEBUG_PMH_INVALID_FIELD_VALUE)}, // DEBUG_PMH_INVALID_FIELD_VALUE
|
||||
{use_str(DEBUG_PMH_INVALID_SCHEME)}, // DEBUG_PMH_INVALID_SCHEME
|
||||
{use_str(DEBUG_PMH_UNKNOWN_SCHEME)}, // DEBUG_PMH_UNKNOWN_SCHEME
|
||||
{use_str(DEBUG_PMH_NOT_ENOUGH_PARAMETERS)}, // DEBUG_PMH_NOT_ENOUGH_PARAMETERS
|
||||
{use_str(DEBUG_REG_DISABLED)}, // DEBUG_REG_DISABLED
|
||||
{use_str(DEBUG_REG_PROXY_EXPIRES)}, // DEBUG_REG_PROXY_EXPIRES
|
||||
{use_str(DEBUG_REG_SIP_DATE)}, // DEBUG_REG_SIP_DATE
|
||||
{use_str(DEBUG_REG_SIP_RESP_CODE)}, // DEBUG_REG_SIP_RESP_CODE
|
||||
{use_str(DEBUG_REG_SIP_RESP_FAILURE)}, // DEBUG_REG_SIP_RESP_FAILURE
|
||||
{use_str(DEBUG_REG_INVALID_LINE)}, // DEBUG_REG_INVALID_LINE
|
||||
{use_str(CC_NO_MSG_BUFFER)}, // CC_NO_MSG_BUFFER^M
|
||||
{use_str(CC_SEND_FAILURE)}, // CC_SEND_FAILURE^M
|
||||
{use_str(GSM_UNDEFINED)}, // GSM_UNDEFINED
|
||||
{use_str(GSM_DBG_PTR)}, // GSM_DBG_PTR
|
||||
{use_str(GSM_FUNC_ENTER)}, // GSM_FUNC_ENTER
|
||||
{use_str(GSM_DBG1)}, // GSM_DBG1
|
||||
{use_str(FSM_DBG_SM_DEFAULT_EVENT)}, // FSM_DBG_SM_DEFAULT_EVENT
|
||||
{use_str(FSM_DBG_SM_FTR_ENTRY)}, // FSM_DBG_SM_FTR_ENTRY
|
||||
{use_str(FSM_DBG_FAC_ERR)}, // FSM_DBG_FAC_ERR
|
||||
{use_str(FSM_DBG_FAC_FOUND)}, // FSM_DBG_FAC_FOUND
|
||||
{use_str(FSM_DBG_IGNORE_FTR)}, // FSM_DBG_IGNORE_FTR
|
||||
{use_str(FSM_DBG_IGNORE_SRC)}, // FSM_DBG_IGNORE_SRC
|
||||
{use_str(FSM_DBG_CHANGE_STATE)}, // FSM_DBG_CHANGE_STATE
|
||||
{use_str(FSM_DBG_SDP_BUILD_ERR)}, // FSM_DBG_SDP_BUILD_ERR
|
||||
{use_str(FSMDEF_DBG_PTR)}, // FSMDEF_DBG_PTR
|
||||
{use_str(FSMDEF_DBG1)}, // FSMDEF_DBG1
|
||||
{use_str(FSMDEF_DBG2)}, // FSMDEF_DBG2
|
||||
{use_str(FSMDEF_DBG_SDP)}, // FSMDEF_DBG_SDP
|
||||
{use_str(FSMDEF_DBG_CLR_SPOOF_APPLD)}, // FSMDEF_DBG_CLEAR_SPOOF
|
||||
{use_str(FSMDEF_DBG_CLR_SPOOF_RQSTD)}, // FSMDEF_DBG_CLEAR_SPOOF
|
||||
{use_str(FSMDEF_DBG_INVALID_DCB)}, // FSMDEF_DBG_INVALID_DCB
|
||||
{use_str(FSMDEF_DBG_FTR_REQ_ACT)}, // FSMDEF_DBG_FTR_REQ_ACT
|
||||
{use_str(FSMDEF_DBG_TMR_CREATE_FAILED)}, // FSMDEF_DBG_TMR_CREATE_FAILED
|
||||
{use_str(FSMDEF_DBG_TMR_START_FAILED)}, // FSMDEF_DBG_TMR_START_FAILED
|
||||
{use_str(FSMDEF_DBG_TMR_CANCEL_FAILED)}, // FSMDEF_DBG_TMR_CANCEL_FAILED
|
||||
{use_str(FSMXFR_DBG_XFR_INITIATED)}, // FSMXFR_DBG_XFR_INITIATED
|
||||
{use_str(FSMXFR_DBG_PTR)}, // FSMXFR_DBG_PTR
|
||||
{use_str(FSMCNF_DBG_CNF_INITIATED)}, // FSMCNF_DBG_CNF_INITIATED
|
||||
{use_str(FSMCNF_DBG_PTR)}, // FSMCNF_DBG_PTR
|
||||
{use_str(FSMB2BCNF_DBG_CNF_INITIATED)}, // FSMB2BCNF_DBG_CNF_INITIATED
|
||||
{use_str(FSMB2BCNF_DBG_PTR)}, // FSMB2BCNF_DBG_PTR
|
||||
{use_str(FSMSHR_DBG_BARGE_INITIATED)}, // FSMSHR_DBG_BARGE_INITIATED
|
||||
{use_str(LSM_DBG_ENTRY)}, // LSM_DBG_ENTRY
|
||||
{use_str(LSM_DBG_INT1)}, // LSM_DBG_INT1
|
||||
{use_str(LSM_DBG_CC_ERROR)}, // LSM_DBG_CC_ERROR
|
||||
{use_str(VCM_DEBUG_ENTRY)}, // VCM_DEBUG_ENTRY
|
||||
{use_str(SM_PROCESS_EVENT_ERROR)}, // SM_PROCESS_EVENT_ERROR
|
||||
{use_str(REG_SM_PROCESS_EVENT_ERROR)}, // REG_SM_PROCESS_EVENT_ERROR
|
||||
{0},
|
||||
};
|
||||
|
||||
|
||||
|
||||
//************************************************************************
|
||||
|
||||
/*
|
||||
* Phrase string table subject to localization
|
||||
*/
|
||||
tnp_phrase_index_str_table_entry tnp_phrase_index_str_table [] = {
|
||||
{"\0"}, // LOCALE_START
|
||||
{"\x80\x13"}, // IDLE_PROMPT sccp 119
|
||||
{"Anonymous"}, // ANONYMOUS - used for messaging; keep English
|
||||
{"\x80\x1e"}, // CALL_PROCEEDING_IN
|
||||
{"\x80\x1e"}, // CALL_PROCEEDING_OUT
|
||||
{"\x80\x16"}, // CALL_ALERTING sccp 122
|
||||
{"\x80\x1b"}, // CALL_ALERTING_SECONDARY sccp 127
|
||||
{"\x80\x16"}, // CALL_ALERTING_LOCAL
|
||||
{"\x80\x18"}, // CALL_CONNECTED sccp 124
|
||||
{"\x80\x03"}, // CALL_INITIATE_HOLD sccp 103 or phone 786?
|
||||
{"\x80\x20"}, // PROMPT_DIAL sccp 132
|
||||
{"\x80\x19"}, // LINE_BUSY sccp 125
|
||||
{"\x80\x1b"}, // CALL_WAITING
|
||||
{"\x80\x52"}, // TRANSFER_FAILED sccp 182
|
||||
{"\x80\x26"}, // Cannot complete the b2b conf
|
||||
{"\x80\x34"}, // UI_CONFERENCE
|
||||
{"\x80\x38"}, // UI_UNKNOWN
|
||||
{"\x80\x1f"}, // REMOTE_IN_USE
|
||||
{"\x80\x55"}, // NUM_NOT_CONFIGURED
|
||||
{"\x80\x17"}, // UI_FROM
|
||||
{"\x80\x29"}, // INVALID_CONF_PARTICIPANT
|
||||
{"\x80\x36"}, // UI_PRIVATE
|
||||
{"\0"} // LOCALE_END
|
||||
};
|
302
libs/sipcc/core/common/text_strings.h
Executable file
302
libs/sipcc/core/common/text_strings.h
Executable file
@ -0,0 +1,302 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef TEXT_STRINGS_H
|
||||
#define TEXT_STRINGS_H
|
||||
|
||||
#include "cpr_types.h"
|
||||
#include "phone_types.h"
|
||||
#include "string_lib.h"
|
||||
|
||||
|
||||
#define DEF_NOTIFY_PRI 20
|
||||
#define HR_NOTIFY_PRI 1
|
||||
|
||||
/*
|
||||
* Define hard coded Anonymous string to be used in From header
|
||||
* when call id blocking is enabled. This is also used to
|
||||
* compare to when anonymous call block is enabled. We can
|
||||
* can not use the localized version of Anonymous for these
|
||||
* actions.
|
||||
*/
|
||||
#define SIP_HEADER_ANONYMOUS_STR "Anonymous"
|
||||
|
||||
/*
|
||||
* Define special strings that are not localized to be used for
|
||||
* comparing special display names whether the names are special
|
||||
* and not to display the number associated with the name.
|
||||
*/
|
||||
#define CONFERENCE_STR "conference"
|
||||
#define CONFERENCE_STR_LEN (sizeof(CONFERENCE_STR)-1)
|
||||
#define CONFERENCE_LOCALE_CODE 964
|
||||
/*
|
||||
* Constants for dictionary index
|
||||
*/
|
||||
|
||||
// Hardcoding phrases that need to be dropped on floor for RT to 1
|
||||
|
||||
#define STR_INDEX_GRP_CALL_PICKUP 47
|
||||
#define STR_INDEX_LST_CALL_PICKUP 49
|
||||
#define STR_INDEX_FEAT_UNAVAIL 148
|
||||
#define STR_INDEX_CNFR_FAIL_NOCODEC 1054
|
||||
#define STR_INDEX_REORDER 1055
|
||||
#define STR_INDEX_ANONYMOUS_SPACE 1056
|
||||
#define STR_INDEX_NO_FREE_LINES 1057
|
||||
#define STR_INDEX_REGISTRATION_REJECTED 1058
|
||||
#define STR_INDEX_REGISTERING 1
|
||||
#define STR_INDEX_WHISPER 1
|
||||
#define STR_INDEX_PROXY_UNAVAIL 1
|
||||
#define STR_INDEX_CALL_REDIRECTED 1
|
||||
#define STR_INDEX_TRANSFERRING 1
|
||||
#define STR_INDEX_SESSION_PROGRESS 1
|
||||
#define STR_INDEX_CALLING 1
|
||||
#define STR_INDEX_USE_LINE_OR_JOIN_TO_COMPLETE 1
|
||||
#define STR_INDEX_CONF_LOCAL_MIXED 1
|
||||
#define STR_INDEX_NO_CALL_FOR_PICKUP 195
|
||||
|
||||
#define STR_INDEX_CALL_FORWARD 105
|
||||
#define STR_INDEX_CALL_PICKUP 117
|
||||
#define STR_INDEX_NO_LINE_FOR_PICKUP 198
|
||||
|
||||
|
||||
#define STR_INDEX_ERROR_PASS_LIMIT 149
|
||||
#define STR_INDEX_TRANS_COMPLETE 918
|
||||
#define STR_INDEX_END_CALL 877
|
||||
#define STR_INDEX_NO_BAND_WIDTH 1158
|
||||
|
||||
#define STR_INDEX_RESP_TIMEOUT 1160
|
||||
|
||||
#define CALL_BUBBLE_STR_MAX_LEN 32
|
||||
|
||||
#define STATUS_LINE_MAX_LEN 128
|
||||
|
||||
/*
|
||||
* Escape codes definitions
|
||||
*/
|
||||
#define OLD_CUCM_DICTIONARY_ESCAPE_TAG '\x80'
|
||||
#define NEW_CUCM_DICTIONARY_ESCAPE_TAG '\x1E'
|
||||
#define CALL_CONTROL_PHRASE_OFFSET '\x64' // offset 100
|
||||
#define MAX_LOCALE_PHRASE_LEN 256
|
||||
#define MAX_LOCALE_STRING_LEN 1024
|
||||
|
||||
/*
|
||||
* Escaped index string codes for Call Mgr dictionary phrases
|
||||
*/
|
||||
#define INDEX_STR_KEY_NOT_ACTIVE (char *) "\x80\x2D"
|
||||
#define INDEX_STR_BARGE (char *) "\x80\x43"
|
||||
#define INDEX_STR_PRIVATE (char *) "\x80\x36"
|
||||
#define INDEX_STR_HOLD_REVERSION (char *) "\x1E\x23"
|
||||
#define INDEX_STR_MONITORING (char *) "\x1E\x27"
|
||||
#define INDEX_STR_COACHING (char *) "\x1E\x46"
|
||||
|
||||
|
||||
/*
|
||||
* Index value for phrase strings subject to localization
|
||||
*/
|
||||
enum PHRASE_STRINGS_ENUM {
|
||||
LOCALE_START,
|
||||
IDLE_PROMPT,
|
||||
ANONYMOUS, /* fsmdef.o */
|
||||
CALL_PROCEEDING_IN,
|
||||
CALL_PROCEEDING_OUT,
|
||||
CALL_ALERTING,
|
||||
CALL_ALERTING_SECONDARY,
|
||||
CALL_ALERTING_LOCAL,
|
||||
CALL_CONNECTED,
|
||||
CALL_INITIATE_HOLD,
|
||||
PROMPT_DIAL,
|
||||
LINE_BUSY,
|
||||
CALL_WAITING,
|
||||
TRANSFER_FAILED,
|
||||
CONF_CANNOT_COMPLETE,
|
||||
UI_CONFERENCE,
|
||||
UI_UNKNOWN,
|
||||
REMOTE_IN_USE,
|
||||
NUM_NOT_CONFIGURED,
|
||||
UI_FROM,
|
||||
INVALID_CONF_PARTICIPANT,
|
||||
UI_PRIVATE,
|
||||
LOCALE_END
|
||||
};
|
||||
|
||||
/*
|
||||
* Index value for Debug strings NOT subject to localization
|
||||
*/
|
||||
enum DEBUG_STRINGS_ENUM {
|
||||
DEBUG_START,
|
||||
DEBUG_SEPARATOR_BAR,
|
||||
DEBUG_CONSOLE_PASSWORD,
|
||||
DEBUG_CONSOLE_KEYWORD_CONSOLE_STALL,
|
||||
DEBUG_CONSOLE_KEYWORD_MEMORYMAP,
|
||||
DEBUG_CONSOLE_KEYWORD_MALLOCTABLE,
|
||||
DEBUG_CONSOLE_KEYWORD_MEMORYDUMP,
|
||||
DEBUG_CONSOLE_KEYWORD_DNS,
|
||||
DEBUG_CONSOLE_KEYWORD_DSPSTATE,
|
||||
DEBUG_CONSOLE_USAGE_MEMORYDUMP,
|
||||
DEBUG_CONSOLE_BREAK,
|
||||
|
||||
DEBUG_FUNCTION_ENTRY,
|
||||
DEBUG_FUNCTION_ENTRY2,
|
||||
DEBUG_SIP_ENTRY,
|
||||
DEBUG_SIP_URL_ERROR,
|
||||
DEBUG_LINE_NUMBER_INVALID,
|
||||
DEBUG_SIP_SPI_SEND_ERROR,
|
||||
DEBUG_SIP_SDP_CREATE_BUF_ERROR,
|
||||
DEBUG_SIP_PARSE_SDP_ERROR,
|
||||
DEBUG_SIP_FEATURE_UNSUPPORTED,
|
||||
DEBUG_SIP_DEST_SDP,
|
||||
DEBUG_SIP_MSG_SENDING_REQUEST,
|
||||
DEBUG_SIP_MSG_SENDING_RESPONSE,
|
||||
DEBUG_SIP_MSG_RECV,
|
||||
DEBUG_SIP_STATE_UNCHANGED,
|
||||
DEBUG_SIP_FUNCTIONCALL_FAILED,
|
||||
DEBUG_SIP_BUILDFLAG_ERROR,
|
||||
DEBUG_GENERAL_FUNCTIONCALL_FAILED,
|
||||
DEBUG_GENERAL_SYSTEMCALL_FAILED,
|
||||
DEBUG_GENERAL_FUNCTIONCALL_BADARGUMENT,
|
||||
DEBUG_FUNCTIONNAME_SIPPMH_PARSE_FROM,
|
||||
DEBUG_FUNCTIONNAME_SIPPMH_PARSE_TO,
|
||||
DEBUG_FUNCTIONNAME_SIP_SM_REQUEST_CHECK_AND_STORE,
|
||||
|
||||
DEBUG_SNTP_LI_ERROR,
|
||||
DEBUG_SNTP_MODE_ERROR,
|
||||
DEBUG_SNTP_STRATUM_ERROR,
|
||||
DEBUG_SNTP_TIMESTAMP_ERROR,
|
||||
DEBUG_SNTP_TIMESTAMP1,
|
||||
DEBUG_SNTP_TIMESTAMP2,
|
||||
DEBUG_SNTP_TIME_UPDATE,
|
||||
DEBUG_SNTP_TS_HEADER,
|
||||
DEBUG_SNTP_TS_PRINT,
|
||||
DEBUG_SNTP_SOCKET_REOPEN,
|
||||
DEBUG_SNTP_DISABLED,
|
||||
DEBUG_SNTP_REQUEST,
|
||||
DEBUG_SNTP_RESPONSE,
|
||||
DEBUG_SNTP_RETRANSMIT,
|
||||
DEBUG_SNTP_UNICAST_MODE,
|
||||
DEBUG_SNTP_MULTICAST_MODE,
|
||||
DEBUG_SNTP_ANYCAST_MODE,
|
||||
DEBUG_SNTP_VALIDATION,
|
||||
DEBUG_SNTP_VALIDATION_PACKET,
|
||||
DEBUG_SNTP_WRONG_SERVER,
|
||||
DEBUG_SNTP_NO_REQUEST,
|
||||
DEBUG_SNTP_ANYCAST_RESET,
|
||||
DEBUG_SOCKET_UDP_RTP,
|
||||
DEBUG_MAC_PRINT,
|
||||
DEBUG_IP_PRINT,
|
||||
DEBUG_SYSBUF_UNAVAILABLE,
|
||||
DEBUG_MSG_BUFFER_TOO_BIG,
|
||||
DEBUG_UNKNOWN_TIMER_BLOCK,
|
||||
DEBUG_CREDENTIALS_BAG_CORRUPTED,
|
||||
DEBUG_INPUT_EMPTY,
|
||||
DEBUG_INPUT_NULL,
|
||||
DEBUG_STRING_DUP_FAILED,
|
||||
DEBUG_PARSER_STRING_TOO_LARGE,
|
||||
DEBUG_PARSER_NULL_KEY_TABLE,
|
||||
DEBUG_PARSER_UNKNOWN_KEY,
|
||||
DEBUG_PARSER_UNKNOWN_KEY_ENUM,
|
||||
DEBUG_PARSER_INVALID_START_VAR,
|
||||
DEBUG_PARSER_INVALID_VAR_CHAR,
|
||||
DEBUG_PARSER_MISSING_COLON,
|
||||
DEBUG_PARSER_NO_VALUE,
|
||||
DEBUG_PARSER_EARLY_EOL,
|
||||
DEBUG_PARSER_INVALID_VAR_NAME,
|
||||
DEBUG_PARSER_INVALID_VAR_VALUE,
|
||||
DEBUG_PARSER_UNKNOWN_VAR,
|
||||
DEBUG_PARSER_NAME_VALUE,
|
||||
DEBUG_PARSER_UNKNOWN_NAME_VALUE,
|
||||
DEBUG_PARSER_UNKNOWN_ERROR,
|
||||
DEBUG_PARSER_NUM_ERRORS,
|
||||
DEBUG_PARSER_SET_DEFAULT,
|
||||
DEBUG_SDP_ERROR_BODY_FIELD,
|
||||
DEBUG_UDP_OPEN_FAIL,
|
||||
DEBUG_UDP_PAYLOAD_TOO_LARGE,
|
||||
DEBUG_TCP_PAYLOAD_TOO_LARGE = DEBUG_UDP_PAYLOAD_TOO_LARGE,
|
||||
DEBUG_RTP_TRANSPORT,
|
||||
DEBUG_RTP_INVALID_VOIP_TYPE,
|
||||
DEBUG_RTP_INVALID_RTP_TYPE,
|
||||
DEBUG_MEMORY_ALLOC,
|
||||
DEBUG_MEMORY_FREE,
|
||||
DEBUG_MEMORY_MALLOC_ERROR,
|
||||
DEBUG_MEMORY_REALLOC_ERROR,
|
||||
DEBUG_MEMORY_OUT_OF_MEM,
|
||||
DEBUG_MEMORY_ENTRY,
|
||||
DEBUG_MEMORY_SUMMARY,
|
||||
DEBUG_MEMORY_ADDRESS_HEADER,
|
||||
DEBUG_MEMORY_DUMP,
|
||||
DEBUG_DNS_GETHOSTBYNAME,
|
||||
DEBUG_PMH_INCORRECT_SYNTAX,
|
||||
DEBUG_PMH_INVALID_FIELD_VALUE,
|
||||
DEBUG_PMH_INVALID_SCHEME,
|
||||
DEBUG_PMH_UNKNOWN_SCHEME,
|
||||
DEBUG_PMH_NOT_ENOUGH_PARAMETERS,
|
||||
DEBUG_REG_DISABLED,
|
||||
DEBUG_REG_PROXY_EXPIRES,
|
||||
DEBUG_REG_SIP_DATE,
|
||||
DEBUG_REG_SIP_RESP_CODE,
|
||||
DEBUG_REG_SIP_RESP_FAILURE,
|
||||
DEBUG_REG_INVALID_LINE,
|
||||
CC_NO_MSG_BUFFER,
|
||||
CC_SEND_FAILURE,
|
||||
GSM_UNDEFINED,
|
||||
GSM_DBG_PTR,
|
||||
GSM_FUNC_ENTER,
|
||||
GSM_DBG1,
|
||||
FSM_DBG_SM_DEFAULT_EVENT,
|
||||
FSM_DBG_SM_FTR_ENTRY,
|
||||
FSM_DBG_FAC_ERR,
|
||||
FSM_DBG_FAC_FOUND,
|
||||
FSM_DBG_IGNORE_FTR,
|
||||
FSM_DBG_IGNORE_SRC,
|
||||
FSM_DBG_CHANGE_STATE,
|
||||
FSM_DBG_SDP_BUILD_ERR,
|
||||
FSMDEF_DBG_PTR,
|
||||
FSMDEF_DBG1,
|
||||
FSMDEF_DBG2,
|
||||
FSMDEF_DBG_SDP,
|
||||
FSMDEF_DBG_CLR_SPOOF_APPLD,
|
||||
FSMDEF_DBG_CLR_SPOOF_RQSTD,
|
||||
FSMDEF_DBG_INVALID_DCB,
|
||||
FSMDEF_DBG_FTR_REQ_ACT,
|
||||
FSMDEF_DBG_TMR_CREATE_FAILED,
|
||||
FSMDEF_DBG_TMR_START_FAILED,
|
||||
FSMDEF_DBG_TMR_CANCEL_FAILED,
|
||||
FSMXFR_DBG_XFR_INITIATED,
|
||||
FSMXFR_DBG_PTR,
|
||||
FSMCNF_DBG_CNF_INITIATED,
|
||||
FSMCNF_DBG_PTR,
|
||||
FSMB2BCNF_DBG_CNF_INITIATED,
|
||||
FSMB2BCNF_DBG_PTR,
|
||||
FSMSHR_DBG_BARGE_INITIATED,
|
||||
LSM_DBG_ENTRY,
|
||||
LSM_DBG_INT1,
|
||||
LSM_DBG_CC_ERROR,
|
||||
VCM_DEBUG_ENTRY,
|
||||
SM_PROCESS_EVENT_ERROR,
|
||||
REG_SM_PROCESS_EVENT_ERROR,
|
||||
DEBUG_END
|
||||
};
|
||||
|
||||
|
||||
typedef struct {
|
||||
const char *text;
|
||||
} debug_string_table_entry;
|
||||
|
||||
extern debug_string_table_entry debug_string_table[];
|
||||
|
||||
#define get_debug_string(index) ((char*)debug_string_table[(index)].text)
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
const char *index_str;
|
||||
} tnp_phrase_index_str_table_entry;
|
||||
|
||||
|
||||
extern tnp_phrase_index_str_table_entry tnp_phrase_index_str_table[];
|
||||
|
||||
#define platform_get_phrase_index_str(index) ((char*)tnp_phrase_index_str_table[(index)].index_str)
|
||||
#define get_info_string(index) "NotImplemented"
|
||||
|
||||
|
||||
#endif
|
1666
libs/sipcc/core/common/ui.c
Executable file
1666
libs/sipcc/core/common/ui.c
Executable file
File diff suppressed because it is too large
Load Diff
1749
libs/sipcc/core/gsm/ccapi.c
Executable file
1749
libs/sipcc/core/gsm/ccapi.c
Executable file
File diff suppressed because it is too large
Load Diff
60
libs/sipcc/core/gsm/ccapi_strings.c
Normal file
60
libs/sipcc/core/gsm/ccapi_strings.c
Normal file
@ -0,0 +1,60 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "cpr_types.h"
|
||||
#define __CC_FEATURE_STRINGS__ // this is required to include feature strings.
|
||||
#define __CC_MESSAGES_STRINGS__ // this is required to include message strings.
|
||||
#define __CC_CAUSE_STRINGS__ // this is required to include cause strings.
|
||||
#include "text_strings.h"
|
||||
#include "ccapi.h"
|
||||
|
||||
/**
|
||||
* This function will be invoked by debug print functions.
|
||||
*
|
||||
* @param id - feature id
|
||||
*
|
||||
* @return feature name string.
|
||||
*/
|
||||
const char *cc_feature_name (cc_features_t id)
|
||||
{
|
||||
if ((id <= CC_FEATURE_MIN) || (id >= CC_FEATURE_MAX)) {
|
||||
return get_debug_string(GSM_UNDEFINED);
|
||||
}
|
||||
|
||||
return cc_feature_names[id - CC_FEATURE_NONE];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function will be invoked by debug print functions.
|
||||
*
|
||||
* @param id - cc msg id
|
||||
*
|
||||
* @return cc msg name string.
|
||||
*/
|
||||
const char *cc_msg_name (cc_msgs_t id)
|
||||
{
|
||||
if ((id <= CC_MSG_MIN) || (id >= CC_MSG_MAX)) {
|
||||
return get_debug_string(GSM_UNDEFINED);
|
||||
}
|
||||
|
||||
return cc_msg_names[id];
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will be invoked by debug print functions.
|
||||
*
|
||||
* @param id - cc cause id
|
||||
*
|
||||
* @return cc cause name string.
|
||||
*/
|
||||
const char *cc_cause_name (cc_causes_t id)
|
||||
{
|
||||
if ((id <= CC_CAUSE_MIN) || (id >= CC_CAUSE_MAX)) {
|
||||
return get_debug_string(GSM_UNDEFINED);
|
||||
}
|
||||
|
||||
return cc_cause_names[id - CC_CAUSE_OK];
|
||||
}
|
||||
|
723
libs/sipcc/core/gsm/dcsm.c
Executable file
723
libs/sipcc/core/gsm/dcsm.c
Executable file
@ -0,0 +1,723 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "cpr_types.h"
|
||||
#include "cpr_stdlib.h"
|
||||
#include "cpr_stdio.h"
|
||||
#include "cpr_string.h"
|
||||
#include "cpr_errno.h"
|
||||
#include "phone.h"
|
||||
#include "phntask.h"
|
||||
#include "lsm.h"
|
||||
#include "ccapi.h"
|
||||
#include "phone_debug.h"
|
||||
#include "fim.h"
|
||||
#include "sdp.h"
|
||||
#include "debug.h"
|
||||
#include "gsm_sdp.h"
|
||||
#include "uiapi.h"
|
||||
#include "gsm.h"
|
||||
#include "prot_configmgr.h"
|
||||
#include "singly_link_list.h"
|
||||
|
||||
typedef enum dcsm_state {
|
||||
DCSM_S_MIN = -1,
|
||||
DCSM_S_READY,
|
||||
DCSM_S_WAITING,
|
||||
DCSM_S_MAX
|
||||
} dcsm_state_e;
|
||||
|
||||
#define DCSM_MAX_CALL_IDS (LSM_MAX_CALLS)
|
||||
|
||||
static struct dcsm_icb_t {
|
||||
callid_t call_ids[DCSM_MAX_CALL_IDS];
|
||||
line_t line;
|
||||
int gsm_state;
|
||||
sll_handle_t s_msg_list;
|
||||
|
||||
dcsm_state_e state;
|
||||
} dcsm_cb;
|
||||
|
||||
static const char *dcsm_state_names[] = {
|
||||
"DCSM_READY",
|
||||
"DCSM_WAITING"
|
||||
};
|
||||
|
||||
extern cc_int32_t g_dcsmDebug;
|
||||
|
||||
static sm_rcs_t dcsm_wait_ev_feature_handling(void *event, int event_id);
|
||||
static sm_rcs_t dcsm_wait_ev_offhook_handling(void *event, int event_id);
|
||||
static sm_rcs_t dcsm_wait_ev_dialstring_handling(void *event, int event_id);
|
||||
|
||||
typedef sm_rcs_t (*pdcsm_sm_evt_handler)(void *event, int event_id);
|
||||
|
||||
typedef struct _dcsm_table_t {
|
||||
int min_state;
|
||||
int max_state;
|
||||
int min_event;
|
||||
int max_event;
|
||||
pdcsm_sm_evt_handler *table;
|
||||
} dcsm_table_t;
|
||||
|
||||
|
||||
static pdcsm_sm_evt_handler dcsm_function_table[DCSM_S_MAX][CC_MSG_MAX] =
|
||||
{
|
||||
/* DCSM_S_READY ------------------------------------------------------------ */
|
||||
{
|
||||
/* DCSM_E_SETUP */ NULL,
|
||||
/* DCSM_E_SETUP_ACK */ NULL,
|
||||
/* DCSM_E_PROCEEDING */ NULL,
|
||||
/* DCSM_E_ALERTING */ NULL,
|
||||
/* DCSM_E_CONNECTED */ NULL,
|
||||
/* DCSM_E_CONNECTED_ACK */ NULL,
|
||||
/* DCSM_E_RELEASE */ NULL,
|
||||
/* DCSM_E_RELEASE_COMPLETE */ NULL,
|
||||
/* DCSM_E_FEATURE */ NULL,
|
||||
/* DCSM_E_FEATURE_ACK */ NULL,
|
||||
/* DCSM_E_OFFHOOK */ NULL,
|
||||
/* DCSM_E_ONHOOK */ NULL,
|
||||
/* DCSM_E_LINE */ NULL,
|
||||
/* DCSM_E_DIGIT_BEGIN */ NULL,
|
||||
/* DCSM_E_DIGIT_END */ NULL,
|
||||
/* DCSM_E_DIALSTRING */ NULL,
|
||||
/* DCSM_E_MWI */ NULL,
|
||||
/* DCSM_E_SESSION_AUDIT */ NULL
|
||||
},
|
||||
|
||||
/* DCSM_S_WAITING----------------------------------------------------- */
|
||||
{
|
||||
/* DCSM_E_SETUP */ NULL,
|
||||
/* DCSM_E_SETUP_ACK */ NULL,
|
||||
/* DCSM_E_PROCEEDING */ NULL,
|
||||
/* DCSM_E_ALERTING */ NULL,
|
||||
/* DCSM_E_CONNECTED */ NULL,
|
||||
/* DCSM_E_CONNECTED_ACK */ NULL,
|
||||
/* DCSM_E_RELEASE */ NULL,
|
||||
/* DCSM_E_RELEASE_COMPLETE */ NULL,
|
||||
/* DCSM_E_FEATURE */ dcsm_wait_ev_feature_handling,
|
||||
/* DCSM_E_FEATURE_ACK */ NULL,
|
||||
/* DCSM_E_OFFHOOK */ dcsm_wait_ev_offhook_handling,
|
||||
/* DCSM_E_ONHOOK */ NULL,
|
||||
/* DCSM_E_LINE */ NULL,
|
||||
/* DCSM_E_DIGIT_BEGIN */ NULL,
|
||||
/* DCSM_E_DIGIT_END */ NULL,
|
||||
/* DCSM_E_DIALSTRING */ dcsm_wait_ev_dialstring_handling,
|
||||
/* DCSM_E_MWI */ NULL,
|
||||
/* DCSM_E_SESSION_AUDIT */ NULL
|
||||
},
|
||||
};
|
||||
|
||||
static dcsm_table_t dcsm_sm_table;
|
||||
static dcsm_table_t *pdcsm_sm_table = &dcsm_sm_table;
|
||||
|
||||
/*
|
||||
* Adds event to the dcsm queue.
|
||||
*
|
||||
* @param event - Call control event to add
|
||||
*
|
||||
* @return TRUE if the event is added.
|
||||
|
||||
*
|
||||
*/
|
||||
static boolean
|
||||
dcsm_add_event_to_queue (void *event)
|
||||
{
|
||||
(void) sll_append(dcsm_cb.s_msg_list, event);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get a event from the queue.
|
||||
*
|
||||
* @param none
|
||||
*
|
||||
* @return pointer to the event.
|
||||
|
||||
*
|
||||
*/
|
||||
static void *
|
||||
dcsm_get_first_event_from_queue (void)
|
||||
{
|
||||
void *msg_ptr = NULL;
|
||||
|
||||
msg_ptr = sll_next(dcsm_cb.s_msg_list, NULL);
|
||||
|
||||
sll_remove(dcsm_cb.s_msg_list, msg_ptr);
|
||||
|
||||
return(msg_ptr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get dcsm state name.
|
||||
*
|
||||
* @param int - state id
|
||||
*
|
||||
* @return ponter to the state name either
|
||||
* DCSM_READY or DCSM_WAITING.
|
||||
*
|
||||
*/
|
||||
const char *dcsm_get_state_name (int state)
|
||||
{
|
||||
if ((state <= DCSM_S_MIN) ||
|
||||
(state >= DCSM_S_MAX)) {
|
||||
return (get_debug_string(GSM_UNDEFINED));
|
||||
}
|
||||
|
||||
return dcsm_state_names[state];
|
||||
}
|
||||
|
||||
/**
|
||||
* Feed the event to FIM state machine a direct function call
|
||||
* to process message retrieved from the queue.
|
||||
*
|
||||
* @param void * - pointer to the message to be processed
|
||||
*
|
||||
* @return none.
|
||||
*/
|
||||
static void dcsm_process_event_to_gsm (void *msg_ptr)
|
||||
{
|
||||
if (fim_process_event(msg_ptr, FALSE) == TRUE) {
|
||||
|
||||
fim_free_event(msg_ptr);
|
||||
|
||||
/* Release buffer too */
|
||||
cpr_free(msg_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Process ready state events.
|
||||
*
|
||||
* @param none
|
||||
*
|
||||
* @return none.
|
||||
*/
|
||||
|
||||
static void dcsm_do_ready_state_job (void)
|
||||
{
|
||||
static const char fname[] = "dcsm_do_ready_state_job";
|
||||
void *msg_ptr;
|
||||
int event_id;
|
||||
cc_feature_t *feat_msg = NULL;
|
||||
callid_t call_id = CC_NO_CALL_ID;
|
||||
|
||||
if (dcsm_cb.state != DCSM_S_READY) {
|
||||
DEF_DEBUG(DEB_F_PREFIX": not in ready state.\n",
|
||||
DEB_F_PREFIX_ARGS("DCSM", fname));
|
||||
return;
|
||||
}
|
||||
|
||||
msg_ptr = dcsm_get_first_event_from_queue();
|
||||
|
||||
/* Check if there is any msg available */
|
||||
if (msg_ptr != NULL) {
|
||||
event_id = (int)(((cc_setup_t *)msg_ptr)->msg_id);
|
||||
if (event_id == CC_MSG_FEATURE) {
|
||||
feat_msg = (cc_feature_t *) msg_ptr;
|
||||
if (feat_msg != NULL) {
|
||||
call_id = feat_msg->call_id;
|
||||
}
|
||||
}
|
||||
|
||||
DEF_DEBUG(DEB_F_PREFIX"%d: event (%s%s)\n",
|
||||
DEB_F_PREFIX_ARGS("DCSM", fname), call_id,
|
||||
cc_msg_name((cc_msgs_t)(event_id)),
|
||||
feat_msg ? cc_feature_name(feat_msg->feature_id):" ");
|
||||
dcsm_process_event_to_gsm(msg_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function process events based on the state of DCSM.
|
||||
*
|
||||
* @param none
|
||||
*
|
||||
* @return none.
|
||||
*/
|
||||
void dcsm_process_jobs (void)
|
||||
{
|
||||
dcsm_do_ready_state_job();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds call_id to the list of call_id's which made DCSM to move
|
||||
* to waiting state.
|
||||
*
|
||||
* @param callid_t - call id that has to be added to the list
|
||||
*
|
||||
* @return none.
|
||||
*/
|
||||
static void dcsm_add_call_id_to_list (callid_t call_id)
|
||||
{
|
||||
static const char fname[] = "dcsm_add_call_id_to_list";
|
||||
int i, loc = -1;
|
||||
|
||||
for (i=0; i< DCSM_MAX_CALL_IDS; i++) {
|
||||
if (dcsm_cb.call_ids[i] == CC_NO_CALL_ID) {
|
||||
loc = i;
|
||||
} else if (dcsm_cb.call_ids[i] == call_id) {
|
||||
//Call_id already present so do not try to add again
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (loc == -1) {
|
||||
|
||||
/* Should never happen as there is a space to store call_id
|
||||
* for each calls
|
||||
*/
|
||||
DCSM_ERROR(DCSM_F_PREFIX"DCSM No space to store call_id.\n",
|
||||
DEB_F_PREFIX_ARGS("DCSM", fname));
|
||||
return;
|
||||
}
|
||||
|
||||
dcsm_cb.call_ids[loc] = call_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove call_id from the list and see if the call_ids list is null.
|
||||
*
|
||||
* @param callid_t - call id that to be removed from the list.
|
||||
*
|
||||
* @return TRUE - if the call_ids list is empty.
|
||||
* FALSE - call_ids list is not empty.
|
||||
*/
|
||||
static boolean dcsm_remove_check_for_empty_list (callid_t call_id)
|
||||
{
|
||||
int i;
|
||||
boolean call_id_present = FALSE;
|
||||
|
||||
for (i=0; i< DCSM_MAX_CALL_IDS; i++) {
|
||||
if (dcsm_cb.call_ids[i] == call_id) {
|
||||
dcsm_cb.call_ids[i] = CC_NO_CALL_ID;
|
||||
|
||||
/* Found out that other call_id exist by setting
|
||||
* call_id_preset, so return true, don't have to
|
||||
* continue
|
||||
*/
|
||||
if (call_id_present == TRUE) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
} else if (dcsm_cb.call_ids[i] != CC_NO_CALL_ID) {
|
||||
call_id_present = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (call_id_present == TRUE) {
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The function responsible for setting gsm state machine.
|
||||
*
|
||||
* @param callid_t - call id of the call
|
||||
* state - current GSM state
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
void
|
||||
dcsm_update_gsm_state (fsm_fcb_t *fcb, callid_t call_id, int state)
|
||||
{
|
||||
int last_state;
|
||||
static const char fname[] = "dcsm_update_gsm_state";
|
||||
fsmdef_dcb_t *dcb;
|
||||
|
||||
if (fcb->fsm_type != FSM_TYPE_DEF) {
|
||||
DEF_DEBUG(DEB_F_PREFIX"%d: Not handling for %s\n",
|
||||
DEB_F_PREFIX_ARGS("DCSM", fname), call_id,
|
||||
fsm_type_name(fcb->fsm_type));
|
||||
return;
|
||||
}
|
||||
|
||||
last_state = dcsm_cb.state;
|
||||
|
||||
switch (state) {
|
||||
case FSMDEF_S_RELEASING:
|
||||
dcb = fsmdef_get_dcb_by_call_id(call_id);
|
||||
if (dcb && dcb->send_release == FALSE) {
|
||||
/* This call is already released from SIP persepctive. so no need to wait */
|
||||
break;
|
||||
}
|
||||
case FSMDEF_S_CONNECTING:
|
||||
case FSMDEF_S_HOLD_PENDING:
|
||||
case FSMDEF_S_RESUME_PENDING:
|
||||
dcsm_add_call_id_to_list(call_id);
|
||||
|
||||
dcsm_cb.state = DCSM_S_WAITING;
|
||||
break;
|
||||
case FSMDEF_S_MIN:
|
||||
case FSMDEF_S_IDLE:
|
||||
case FSMDEF_S_COLLECT_INFO:
|
||||
case FSMDEF_S_CALL_SENT:
|
||||
case FSMDEF_S_OUTGOING_PROCEEDING:
|
||||
case FSMDEF_S_KPML_COLLECT_INFO:
|
||||
case FSMDEF_S_OUTGOING_ALERTING:
|
||||
case FSMDEF_S_INCOMING_ALERTING:
|
||||
case FSMDEF_S_JOINING:
|
||||
case FSMDEF_S_CONNECTED:
|
||||
case FSMDEF_S_CONNECTED_MEDIA_PEND:
|
||||
case FSMDEF_S_HOLDING:
|
||||
case FSMDEF_S_PRESERVED:
|
||||
case FSMDEF_S_MAX:
|
||||
/* If there are no other call_id then move it to
|
||||
* ready state else, it will remain in waiting
|
||||
* state
|
||||
*/
|
||||
if (dcsm_remove_check_for_empty_list(call_id) == TRUE) {
|
||||
dcsm_cb.state = DCSM_S_READY;
|
||||
/* Check if there are any pending events in the queue
|
||||
* if so send a DCSM_EV_READY to the GSM so dcsm will
|
||||
* get a chance to execute.
|
||||
*/
|
||||
if (sll_count(dcsm_cb.s_msg_list) > 0 ) {
|
||||
if (gsm_send_msg(DCSM_EV_READY, NULL, 0) == CPR_FAILURE) {
|
||||
DCSM_ERROR(DCSM_F_PREFIX"send DCSM_EV_READY ERROR.\n",
|
||||
DEB_F_PREFIX_ARGS(DCSM, fname));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
DEF_DEBUG(DEB_F_PREFIX"%d : %s --> %s\n",
|
||||
DEB_F_PREFIX_ARGS("DCSM", fname), call_id,
|
||||
dcsm_get_state_name(last_state),
|
||||
dcsm_get_state_name(dcsm_cb.state));
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Feature passed through when state machine is in waiting state
|
||||
*
|
||||
* @param sm_event_t
|
||||
*
|
||||
* @return sm_rcs_t
|
||||
*
|
||||
* @pre (none)
|
||||
*/
|
||||
static sm_rcs_t
|
||||
dcsm_wait_ev_offhook_handling (void *event, int event_id)
|
||||
{
|
||||
static const char fname[] = "dcsm_wait_ev_offhook_handling";
|
||||
|
||||
DEF_DEBUG(DEB_F_PREFIX": offhook\n",
|
||||
DEB_F_PREFIX_ARGS("DCSM", fname));
|
||||
|
||||
dcsm_add_event_to_queue(event);
|
||||
return (SM_RC_END);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Feature passed through when state machine is in waiting state
|
||||
*
|
||||
* @param sm_event_t
|
||||
*
|
||||
* @return sm_rcs_t
|
||||
*
|
||||
* @pre (none)
|
||||
*/
|
||||
static sm_rcs_t
|
||||
dcsm_wait_ev_feature_handling (void *event, int event_id)
|
||||
{
|
||||
static const char fname[] = "dcsm_wait_ev_feature_handling";
|
||||
cc_feature_t *feat_msg = (cc_feature_t *) event;
|
||||
sm_rcs_t rc = SM_RC_END;
|
||||
cc_features_t ftr_id = CC_FEATURE_UNDEFINED;
|
||||
callid_t call_id = CC_NO_CALL_ID;
|
||||
|
||||
if (feat_msg != NULL) {
|
||||
ftr_id = feat_msg->feature_id;
|
||||
call_id = feat_msg->call_id;
|
||||
}
|
||||
|
||||
DEF_DEBUG(DEB_F_PREFIX"%d: id= %s%s\n",
|
||||
DEB_F_PREFIX_ARGS("DCSM", fname), call_id,
|
||||
cc_msg_name((cc_msgs_t)(event_id)),
|
||||
feat_msg ? cc_feature_name(feat_msg->feature_id):" ");
|
||||
|
||||
switch (ftr_id) {
|
||||
case CC_FEATURE_ANSWER:
|
||||
case CC_FEATURE_NEW_CALL:
|
||||
case CC_FEATURE_REDIAL:
|
||||
case CC_FEATURE_RESUME:
|
||||
case CC_FEATURE_JOIN:
|
||||
dcsm_add_event_to_queue(event);
|
||||
DEF_DEBUG(DEB_F_PREFIX"%d: Event queued\n",
|
||||
DEB_F_PREFIX_ARGS("DCSM", fname), call_id);
|
||||
rc = SM_RC_END;
|
||||
break;
|
||||
default:
|
||||
DEF_DEBUG(DEB_F_PREFIX"%d: Feature msg not handled\n",
|
||||
DEB_F_PREFIX_ARGS("DCSM", fname), call_id);
|
||||
|
||||
rc = SM_RC_CONT;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return (rc);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Feature passed through when state machine is in waiting state
|
||||
*
|
||||
* @param sm_event_t
|
||||
*
|
||||
* @return sm_rcs_t
|
||||
*
|
||||
* @pre (none)
|
||||
*/
|
||||
static sm_rcs_t
|
||||
dcsm_wait_ev_dialstring_handling (void *event, int event_id)
|
||||
{
|
||||
static const char fname[] = "dcsm_wait_ev_dialstring_handling";
|
||||
|
||||
DEF_DEBUG(DEB_F_PREFIX": dialstring\n",
|
||||
DEB_F_PREFIX_ARGS("DCSM", fname));
|
||||
|
||||
dcsm_add_event_to_queue(event);
|
||||
return (SM_RC_END);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Feature passed through when state machine is in waiting state
|
||||
*
|
||||
* @param sm_event_t
|
||||
*
|
||||
* @return sm_rcs_t
|
||||
*
|
||||
* @pre (none)
|
||||
*/
|
||||
sm_rcs_t
|
||||
dcsm_process_event (void *event, int event_id)
|
||||
{
|
||||
static const char fname[] = "dcsm_process_event";
|
||||
callid_t call_id;
|
||||
int state_id;
|
||||
sm_rcs_t rc = SM_RC_CONT;
|
||||
fsm_fcb_t *fcb = (fsm_fcb_t *) event;
|
||||
cc_feature_t *feat_msg = NULL;
|
||||
pdcsm_sm_evt_handler hdlr; /* cached handler in order to compute its addr once */
|
||||
|
||||
call_id = fcb->call_id;
|
||||
|
||||
if (event_id == CC_MSG_FEATURE) {
|
||||
feat_msg = (cc_feature_t *) event;
|
||||
|
||||
if (feat_msg != NULL){
|
||||
call_id = feat_msg->call_id;
|
||||
}
|
||||
}
|
||||
|
||||
DEF_DEBUG(DEB_F_PREFIX"DCSM %-4d:(%s:%s%s)\n",
|
||||
DEB_F_PREFIX_ARGS("DCSM", fname), call_id,
|
||||
dcsm_get_state_name(dcsm_cb.state),
|
||||
cc_msg_name((cc_msgs_t)(event_id)),
|
||||
feat_msg ? cc_feature_name(feat_msg->feature_id):" ");
|
||||
|
||||
state_id = dcsm_cb.state; // Get current state;
|
||||
|
||||
/*
|
||||
* validate the state and event
|
||||
* and that there is a valid function for this state-event pair.
|
||||
*/
|
||||
if ((state_id > pdcsm_sm_table->min_state) &&
|
||||
(state_id < pdcsm_sm_table->max_state) &&
|
||||
(event_id > pdcsm_sm_table->min_event) &&
|
||||
(event_id < pdcsm_sm_table->max_event)) {
|
||||
|
||||
if ((hdlr = pdcsm_sm_table->table[pdcsm_sm_table->max_event * state_id +
|
||||
event_id]) != NULL) {
|
||||
DEF_DEBUG(DEB_F_PREFIX"%-4d: dcsm entry: (%s)\n",
|
||||
DEB_F_PREFIX_ARGS("DCSM", fname), call_id,
|
||||
cc_msg_name((cc_msgs_t)(event_id)));
|
||||
|
||||
rc = hdlr(event, event_id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return (rc);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Function responsible for searching the list.
|
||||
*
|
||||
* @param cac_data_t *key_p - pointer to the key.
|
||||
* @param cac_data_t *cac_data - cac data.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
static sll_match_e
|
||||
dcsm_match_event (void *key_p, void *msg_data)
|
||||
{
|
||||
return SLL_MATCH_FOUND;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Show function for DCSM
|
||||
*
|
||||
* @param argc - number of parameter passed
|
||||
* argv - argument passed
|
||||
*
|
||||
* @return 0 - if function successful
|
||||
*/
|
||||
cc_int32_t
|
||||
dcsm_show_cmd (cc_int32_t argc, const char *argv[])
|
||||
{
|
||||
void *msg_ptr;
|
||||
int i;
|
||||
cc_setup_t *msg;
|
||||
cc_msgs_t msg_id;
|
||||
line_t line;
|
||||
callid_t call_id;
|
||||
cc_feature_t *feat_msg = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* check if need help
|
||||
*/
|
||||
if ((argc == 2) && (argv[1][0] == '?')) {
|
||||
debugif_printf("show dcsm\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
if (dcsm_cb.s_msg_list == NULL) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
debugif_printf("\n-------------------------- DCSM Data --------------------------");
|
||||
debugif_printf("\nDCSM State = %s",dcsm_get_state_name(dcsm_cb.state));
|
||||
debugif_printf("\nDCSM waiting calls \n");
|
||||
|
||||
for (i=0; i< DCSM_MAX_CALL_IDS; i++) {
|
||||
if (dcsm_cb.call_ids[i] != CC_NO_CALL_ID) {
|
||||
debugif_printf("%d ", dcsm_cb.call_ids[i]);
|
||||
}
|
||||
}
|
||||
debugif_printf("\n");
|
||||
|
||||
debugif_printf("\nDCSM waiting events \n");
|
||||
i = 0;
|
||||
msg_ptr = sll_next(dcsm_cb.s_msg_list, NULL);
|
||||
while (msg_ptr) {
|
||||
msg_ptr = sll_next(dcsm_cb.s_msg_list, msg_ptr);
|
||||
|
||||
if (msg_ptr) {
|
||||
msg = (cc_setup_t *) msg_ptr;
|
||||
msg_id = msg->msg_id;
|
||||
call_id = msg->call_id;
|
||||
line = msg->line;
|
||||
if ((int)msg_id == CC_MSG_FEATURE) {
|
||||
feat_msg = (cc_feature_t *) msg_ptr;
|
||||
}
|
||||
|
||||
debugif_printf("Event %d (%d/%d): (%s%s)\n",
|
||||
i++, line, call_id, cc_msg_name(msg_id),
|
||||
feat_msg ? cc_feature_name(feat_msg->feature_id):" ");
|
||||
}
|
||||
}
|
||||
debugif_printf("\n-------------------------- DCSM Data Done-----------------------");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Initialize dcsm state machine.
|
||||
*
|
||||
* @param none
|
||||
*
|
||||
* @return none
|
||||
*
|
||||
* @pre none
|
||||
*/
|
||||
void
|
||||
dcsm_init (void)
|
||||
{
|
||||
static const char fname[] = "dcsm_init";
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Initialize the state/event table.
|
||||
*/
|
||||
dcsm_sm_table.min_state = DCSM_S_MIN;
|
||||
dcsm_sm_table.max_state = DCSM_S_MAX;
|
||||
dcsm_sm_table.min_event = CC_MSG_MIN;
|
||||
dcsm_sm_table.max_event = CC_MSG_MAX;
|
||||
dcsm_sm_table.table = (&(dcsm_function_table[0][0]));
|
||||
|
||||
dcsm_cb.state = DCSM_S_READY;
|
||||
|
||||
for (i=0; i< DCSM_MAX_CALL_IDS; i++) {
|
||||
dcsm_cb.call_ids[i] = CC_NO_CALL_ID;
|
||||
}
|
||||
|
||||
/* allocate and initialize cac list */
|
||||
dcsm_cb.s_msg_list = sll_create((sll_match_e(*)(void *, void *))
|
||||
dcsm_match_event);
|
||||
|
||||
if (dcsm_cb.s_msg_list == NULL) {
|
||||
DCSM_ERROR(DCSM_F_PREFIX"DCSM CB creation failed.\n",
|
||||
DEB_F_PREFIX_ARGS("DCSM", fname));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Shut down routine for dcsm state machine.
|
||||
*
|
||||
* @param none
|
||||
*
|
||||
* @return none
|
||||
*
|
||||
* @pre none
|
||||
*/
|
||||
void
|
||||
dcsm_shutdown (void)
|
||||
{
|
||||
void *msg_ptr;
|
||||
|
||||
if (dcsm_cb.s_msg_list == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
msg_ptr = sll_next(dcsm_cb.s_msg_list, NULL);
|
||||
while (msg_ptr) {
|
||||
msg_ptr = sll_next(dcsm_cb.s_msg_list, msg_ptr);
|
||||
|
||||
if (msg_ptr) {
|
||||
fim_free_event(msg_ptr);
|
||||
|
||||
/* Release buffer too */
|
||||
cpr_free(msg_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
sll_destroy(dcsm_cb.s_msg_list);
|
||||
dcsm_cb.s_msg_list = NULL;
|
||||
}
|
||||
|
761
libs/sipcc/core/gsm/fim.c
Executable file
761
libs/sipcc/core/gsm/fim.c
Executable file
@ -0,0 +1,761 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "cpr_types.h"
|
||||
#include "cpr_stdlib.h"
|
||||
#include "cpr_stdio.h"
|
||||
#include "phone.h"
|
||||
#include "fim.h"
|
||||
#include "lsm.h"
|
||||
#include "fsm.h"
|
||||
#include "sm.h"
|
||||
#include "ccapi.h"
|
||||
#include "debug.h"
|
||||
#include "phone_debug.h"
|
||||
#include "util_string.h"
|
||||
#include "sdp.h"
|
||||
#include "gsm_sdp.h"
|
||||
#include "ccsip_sdp.h"
|
||||
#include "platform_api.h"
|
||||
|
||||
extern void set_next_sess_video_pref(int pref);
|
||||
extern sm_rcs_t dcsm_process_event(void *event, int event_id);
|
||||
|
||||
#define FIM_MAX_CHNS (LSM_MAX_CALLS)
|
||||
#define FIM_MAX_SCBS (FSM_TYPE_MAX)
|
||||
#define FIM_MAX_ICBS (FSM_TYPE_MAX * FIM_MAX_CHNS)
|
||||
|
||||
static fim_scb_t *fim_scbs;
|
||||
static fim_icb_t *fim_icbs;
|
||||
|
||||
|
||||
static void
|
||||
fim_mwi (cc_mwi_t *msg)
|
||||
{
|
||||
cc_action_data_t data;
|
||||
|
||||
data.mwi.on = msg->msgSummary.on;
|
||||
data.mwi.type = msg->msgSummary.type;
|
||||
data.mwi.newCount = msg->msgSummary.newCount;
|
||||
data.mwi.oldCount = msg->msgSummary.oldCount;
|
||||
data.mwi.hpNewCount = msg->msgSummary.hpNewCount;
|
||||
data.mwi.hpOldCount = msg->msgSummary.hpOldCount;
|
||||
|
||||
(void)cc_call_action(msg->call_id, msg->line, CC_ACTION_MWI, &data);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
fim_init_call_chns (void)
|
||||
{
|
||||
int chn;
|
||||
fsm_types_t type;
|
||||
fim_icb_t *icb = NULL;
|
||||
static const char fname[] = "fim_init_call_chns";
|
||||
|
||||
fim_scbs = (fim_scb_t *) cpr_calloc(FIM_MAX_SCBS, sizeof(fim_scb_t));
|
||||
if (fim_scbs == NULL) {
|
||||
GSM_DEBUG_ERROR(GSM_F_PREFIX"Failed to allocate FIM SCBs.\n", fname);
|
||||
return;
|
||||
}
|
||||
|
||||
fim_icbs = (fim_icb_t *) cpr_calloc(FIM_MAX_ICBS, sizeof(fim_icb_t));
|
||||
if (fim_icbs == NULL) {
|
||||
GSM_DEBUG_ERROR(GSM_F_PREFIX"Failed to allocate FIM ICBs.\n", fname);
|
||||
cpr_free(fim_scbs);
|
||||
fim_scbs = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize the icbs (fim control blocks).
|
||||
*/
|
||||
icb = fim_icbs;
|
||||
for (chn = 0; chn < FIM_MAX_CHNS; chn++) {
|
||||
for (type = FSM_TYPE_HEAD; type < FSM_TYPE_MAX; type++, icb++) {
|
||||
icb->call_id = CC_NO_CALL_ID;
|
||||
icb->scb = &(fim_scbs[type]);
|
||||
icb->cb = NULL;
|
||||
|
||||
/*
|
||||
* Set the next_chn pointers if this is the head of the chain,
|
||||
* Set non-head icbs and the last head to NULL.
|
||||
*/
|
||||
if ((type == FSM_TYPE_HEAD) && (chn < (FIM_MAX_CHNS - 1))) {
|
||||
icb->next_chn = icb + FSM_TYPE_MAX;
|
||||
} else {
|
||||
icb->next_chn = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the next_icb pointers if this icb is not the last
|
||||
* one on the chain.
|
||||
*/
|
||||
if (type < (FSM_TYPE_MAX - 1)) {
|
||||
icb->next_icb = icb + 1;
|
||||
} else {
|
||||
icb->next_icb = NULL;
|
||||
}
|
||||
} /* for (jscb = FSM_TYPE_HEAD; i < FSM_TYPE_MAX; i++) { */
|
||||
} /* for (ichn = 0; ichn < FIM_MAX_CHNS; ichn++) { */
|
||||
|
||||
/*
|
||||
* Initialize the scbs (state machine control blocks).
|
||||
*/
|
||||
icb = fim_icbs;
|
||||
for (type = FSM_TYPE_HEAD; type < FSM_TYPE_MAX; type++, icb++) {
|
||||
icb->scb->type = type;
|
||||
fsm_init_scb(icb, CC_NO_CALL_ID);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
fim_free_call_chn (fim_icb_t *call_chn, line_t line, boolean update_call_cnt)
|
||||
{
|
||||
static const char fname[] = "fim_free_call_chn";
|
||||
fim_icb_t *icb = call_chn;
|
||||
|
||||
FIM_DEBUG(get_debug_string(GSM_DBG_PTR), "FIM", call_chn->call_id, fname,
|
||||
"call_chn", call_chn);
|
||||
|
||||
/*
|
||||
* Go through the chain and free each icb.
|
||||
*/
|
||||
for (icb = call_chn; icb != NULL; icb = icb->next_icb) {
|
||||
if (icb->scb->free_cb != NULL) {
|
||||
icb->scb->free_cb(icb, icb->call_id);
|
||||
}
|
||||
icb->call_id = CC_NO_CALL_ID;
|
||||
icb->cb = NULL;
|
||||
}
|
||||
if (update_call_cnt == TRUE) {
|
||||
lsm_decrement_call_chn_cnt(line);
|
||||
}
|
||||
else {
|
||||
FIM_DEBUG(get_debug_string(GSM_DBG_PTR), "lsm not decremented", call_chn->call_id, fname,
|
||||
"call_chn", call_chn);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static fim_icb_t *
|
||||
fim_get_call_chn_by_call_id (callid_t call_id)
|
||||
{
|
||||
static const char fname[] = "fim_get_call_chn_by_call_id";
|
||||
fim_icb_t *call_chn = NULL;
|
||||
fim_icb_t *icb = NULL;
|
||||
|
||||
for (icb = fim_icbs; icb != NULL; icb = icb->next_chn) {
|
||||
if (icb->call_id == call_id) {
|
||||
call_chn = icb;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
FIM_DEBUG(get_debug_string(GSM_DBG_PTR), "FIM", call_id, fname, "chn",
|
||||
call_chn);
|
||||
|
||||
return call_chn;
|
||||
}
|
||||
|
||||
static fim_icb_t *
|
||||
fim_get_new_call_chn (callid_t call_id)
|
||||
{
|
||||
static const char fname[] = "fim_get_new_call_chn";
|
||||
fim_icb_t *call_chn = NULL;
|
||||
fim_icb_t *icb = NULL;
|
||||
|
||||
/*
|
||||
* Verify that this call_id is not already used.
|
||||
*/
|
||||
call_chn = fim_get_call_chn_by_call_id(call_id);
|
||||
if (call_chn != NULL) {
|
||||
FIM_DEBUG(get_debug_string(GSM_DBG1), "FIM", call_id, fname,
|
||||
"call_id in use");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Construct a new call chain.
|
||||
*/
|
||||
call_chn = fim_get_call_chn_by_call_id(CC_NO_CALL_ID);
|
||||
if (call_chn == NULL) {
|
||||
/*
|
||||
* No more free call_chns are available.
|
||||
*/
|
||||
FIM_DEBUG(get_debug_string(GSM_DBG1), "FIM", call_id, fname,
|
||||
"no free call_chns");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
call_chn->call_id = call_id;
|
||||
call_chn->ui_locked = FALSE;
|
||||
|
||||
/*
|
||||
* Set the control blocks for the icbs.
|
||||
*/
|
||||
for (icb = call_chn; icb != NULL; icb = icb->next_icb) {
|
||||
FIM_DEBUG(get_debug_string(GSM_DBG1), "FIM", call_id, fname,
|
||||
fsm_type_name(icb->scb->type));
|
||||
|
||||
if (icb->scb->get_cb) {
|
||||
icb->scb->get_cb(icb, call_id);
|
||||
icb->call_id = call_id;
|
||||
icb->ui_locked = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
FIM_DEBUG(get_debug_string(GSM_DBG_PTR), "FIM", call_chn->call_id, fname,
|
||||
"call_chn", call_chn);
|
||||
|
||||
return call_chn;
|
||||
}
|
||||
|
||||
void
|
||||
fim_free_event (void *data)
|
||||
{
|
||||
cc_msg_t *msg = (cc_msg_t *) data;
|
||||
|
||||
/* Free CCAPI msg. data that are not consumed */
|
||||
cc_free_msg_data(msg);
|
||||
}
|
||||
|
||||
static void
|
||||
fim_process_options_msg (void *data)
|
||||
{
|
||||
static const char fname[] = "fim_process_options_msg";
|
||||
cc_sdp_t *local_sdp_p = NULL;
|
||||
cc_causes_t cause = CC_CAUSE_MIN;
|
||||
cc_msgbody_info_t msg_body;
|
||||
cc_options_sdp_req_t *options_msg = (cc_options_sdp_req_t *) data;
|
||||
|
||||
gsmsdp_create_options_sdp(&local_sdp_p);
|
||||
|
||||
cause = gsmsdp_encode_sdp(local_sdp_p, &msg_body);
|
||||
if (cause != CC_CAUSE_OK) {
|
||||
FIM_DEBUG(get_debug_string(GSM_DBG1), "FIM", options_msg->call_id,
|
||||
fname, "Unable to build SDP\n");
|
||||
} else {
|
||||
cc_int_options_sdp_ack(CC_SRC_GSM, CC_SRC_SIP,
|
||||
options_msg->call_id,
|
||||
options_msg->line,
|
||||
options_msg->pMessage, &msg_body);
|
||||
}
|
||||
sipsdp_src_dest_free(CCSIP_SRC_SDP_BIT, &local_sdp_p);
|
||||
}
|
||||
|
||||
void
|
||||
fim_lock_ui (callid_t call_id)
|
||||
{
|
||||
fim_icb_t *call_chn = fim_get_call_chn_by_call_id(call_id);
|
||||
|
||||
if (call_chn == NULL) {
|
||||
FIM_DEBUG(DEB_F_PREFIX"unknown call id\n", DEB_F_PREFIX_ARGS(FIM, "fim_lock_ui"));
|
||||
return;
|
||||
}
|
||||
call_chn->ui_locked = TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
fim_unlock_ui (callid_t call_id)
|
||||
{
|
||||
fim_icb_t *call_chn = fim_get_call_chn_by_call_id(call_id);
|
||||
|
||||
if (call_chn == NULL) {
|
||||
FIM_DEBUG(DEB_F_PREFIX"unknown call id\n", DEB_F_PREFIX_ARGS(FIM, "fim_unlock_ui"));
|
||||
return;
|
||||
}
|
||||
call_chn->ui_locked = FALSE;
|
||||
}
|
||||
|
||||
static boolean
|
||||
fsm_event_filtered_by_ui_lock (int event_id, cc_features_t feature_id)
|
||||
{
|
||||
/*
|
||||
* If UI has been locked by GSM due to pending states, we want
|
||||
* to filter the events that come in from the UI. We will still
|
||||
* allow all GSM and SIP stack originated events through to the
|
||||
* GSM sm.
|
||||
*/
|
||||
if (event_id == CC_MSG_ONHOOK) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((event_id == CC_MSG_FEATURE) &&
|
||||
(feature_id == CC_FEATURE_END_CALL ||
|
||||
feature_id == CC_FEATURE_REQ_PEND_TIMER_EXP ||
|
||||
feature_id == CC_FEATURE_RESUME ||
|
||||
feature_id == CC_FEATURE_HOLD)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Check if the feature event is generic feature
|
||||
*
|
||||
* @param cc_features_t feature_id
|
||||
*
|
||||
* @return TRUE if the feature is generic or else FALSE
|
||||
*
|
||||
* @pre None
|
||||
*/
|
||||
boolean fim_is_app_generic_features (cc_features_t feat_id)
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Check if the message is the feature event that may requires a new
|
||||
* call chain.
|
||||
*
|
||||
* @param msg - pointer to cc_setup_t.
|
||||
*
|
||||
* @return TRUE if the feature that may requires a new call chain.
|
||||
*
|
||||
* @pre (msg != NULL)
|
||||
*/
|
||||
static boolean
|
||||
fim_check_feature_event (cc_setup_t *msg)
|
||||
{
|
||||
|
||||
if ((((cc_feature_t *)msg)->feature_id == CC_FEATURE_SELECT) ||
|
||||
(((cc_feature_t *)msg)->feature_id == CC_FEATURE_DIRTRXFR) ||
|
||||
(((cc_feature_t *)msg)->feature_id == CC_FEATURE_B2BCONF) ||
|
||||
(((cc_feature_t *)msg)->feature_id == CC_FEATURE_CFWD_ALL)) {
|
||||
return (TRUE);
|
||||
}
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* fim_feature_need_outgoing_call_context
|
||||
*
|
||||
* Description:
|
||||
* This function determines whther a new feature invokation needs
|
||||
* an early outgoing call context created in the FIM main module or not.
|
||||
*
|
||||
* Parameters:
|
||||
msg - pointer to the cc_setup_t.
|
||||
*
|
||||
* Returns:
|
||||
* TRUE - the feature requires outgoing call context to be created.
|
||||
* FALSE - the feature does not requries outgoing call context to
|
||||
* be created during initial FIM displacthing.
|
||||
*/
|
||||
static boolean
|
||||
fim_feature_need_outgoing_call_context (cc_setup_t *msg)
|
||||
{
|
||||
if (((cc_feature_t *)msg)->feature_id == CC_FEATURE_NOTIFY) {
|
||||
/*
|
||||
* these features do not need outgoing context to be created early
|
||||
*/
|
||||
return (FALSE);
|
||||
}
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Process events received for GSM
|
||||
*
|
||||
* @param void event data
|
||||
* cac_passed indicate if the event passed cac request.
|
||||
* Usually set to true once the cac response is
|
||||
* received so that it won't do another request.
|
||||
*
|
||||
* @return true if message memory has to be released by caller
|
||||
* false if the message memory is not to be released by
|
||||
* caller.
|
||||
*
|
||||
* @pre (data not_eq NULL)
|
||||
* @pre (CC_MSG_MIN < msg->msg_id <CC_MSG_MAX)
|
||||
*/
|
||||
boolean
|
||||
fim_process_event (void *data, boolean cac_passed)
|
||||
{
|
||||
static const char fname[] = "fim_process_event";
|
||||
cc_setup_t *msg = (cc_setup_t *) data;
|
||||
cc_msgs_t msg_id = msg->msg_id;
|
||||
callid_t call_id = msg->call_id;
|
||||
line_t line = msg->line;
|
||||
int event_id = msg_id;
|
||||
sm_event_t event;
|
||||
fim_icb_t *call_chn = NULL;
|
||||
fim_icb_t *icb = NULL;
|
||||
boolean done = FALSE;
|
||||
sm_rcs_t rc = SM_RC_ERROR;
|
||||
fim_cb_hdr_t *cb_hdr = NULL;
|
||||
fsm_fcb_t *fcb = NULL;
|
||||
cc_feature_t *feat_msg = (cc_feature_t *) data;
|
||||
cc_feature_data_t * feat_data = &(feat_msg->data);
|
||||
boolean update_call_cnt = TRUE;
|
||||
uint32_t no_of_session = 1;
|
||||
callid_t bw_call_id;
|
||||
|
||||
FIM_DEBUG(DEB_L_C_F_PREFIX"Msg name = %s\n", DEB_L_C_F_PREFIX_ARGS(FIM, line, call_id, fname),
|
||||
cc_msg_name(msg_id));
|
||||
|
||||
/*
|
||||
* Validate the incoming event.
|
||||
*/
|
||||
if ((event_id <= CC_MSG_MIN) || (event_id >= CC_MSG_MAX)) {
|
||||
cc_call_state(call_id, line, CC_STATE_UNKNOWN, NULL);
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
/* Make sure to process the device events
|
||||
*/
|
||||
|
||||
if (dcsm_process_event(data, event_id) == SM_RC_END) {
|
||||
/* Keep the message in the dcsm state handler */
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Grab non-call control events and hand them off to other functions that
|
||||
* are not implemented by the fsms.
|
||||
*/
|
||||
if (msg_id == CC_MSG_MWI) {
|
||||
fim_mwi((cc_mwi_t *) msg);
|
||||
}
|
||||
|
||||
if (event_id == CC_MSG_OPTIONS) {
|
||||
fim_process_options_msg(data);
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
if (platWlanISActive() && cac_passed == FALSE) {
|
||||
/* The WLAN will request for bandwidth only for the events received from
|
||||
* UI or other external entity. For internal events there is allocated bandwidth
|
||||
* and do not need to request again.
|
||||
*/
|
||||
|
||||
if ((msg->src_id != CC_SRC_GSM) &&
|
||||
((event_id == CC_MSG_SETUP) ||
|
||||
(event_id == CC_MSG_OFFHOOK) ||
|
||||
(event_id == CC_MSG_DIALSTRING) ||
|
||||
(event_id == CC_MSG_LINE) ||
|
||||
((event_id == CC_MSG_FEATURE) &&
|
||||
((((cc_feature_t *) msg)->feature_id == CC_FEATURE_NEW_CALL))))) {
|
||||
|
||||
bw_call_id = call_id;
|
||||
|
||||
if ((event_id == CC_MSG_SETUP) &&
|
||||
((((cc_setup_t *)msg)->call_info.type == CC_FEAT_MONITOR))) {
|
||||
no_of_session = 2;
|
||||
bw_call_id = msg->call_info.data.join.join_call_id;
|
||||
}
|
||||
|
||||
if (fsm_cac_call_bandwidth_req (bw_call_id, no_of_session, msg) != CC_CAUSE_OK) {
|
||||
return(TRUE);
|
||||
}
|
||||
/* Do not release the msg once it returns from the call
|
||||
*/
|
||||
return(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
if ((event_id == CC_MSG_FEATURE) && ((call_id == CC_NO_CALL_ID) ||
|
||||
fim_is_app_generic_features(((cc_feature_t *) msg)->feature_id))) {
|
||||
if (((cc_feature_t *)msg)->feature_id == CC_FEATURE_BLF_ALERT_TONE) {
|
||||
(void)cc_call_action(0, 0, CC_ACTION_PLAY_BLF_ALERTING_TONE, NULL);
|
||||
} else if (((cc_feature_t *)msg)->feature_id == CC_FEATURE_UPD_MEDIA_CAP) {
|
||||
fsmdef_update_media_cap_feature_event(feat_msg);
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Throw away any messages with call_id < 1 (which means they are invalid).
|
||||
*
|
||||
* The GSM will send messages back to itself with a call_id < 1 because
|
||||
* it uses the NULL_DCB. The fsmxfr will use a NULL_DCB that has invalid
|
||||
* data in it, but the DCB points to a valid DCB. This way, the fsmxfr does
|
||||
* not have to keep checking for the NULL.
|
||||
*/
|
||||
if (call_id < 1) {
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get the call chain associated with this call_id.
|
||||
*/
|
||||
call_chn = fim_get_call_chn_by_call_id(call_id);
|
||||
|
||||
if (call_chn == NULL) {
|
||||
/*
|
||||
* No call chain, so get a new call chain,
|
||||
* but only if the event is a call establishment event.
|
||||
*/
|
||||
if ((event_id == CC_MSG_SETUP) ||
|
||||
(event_id == CC_MSG_OFFHOOK) ||
|
||||
(event_id == CC_MSG_DIALSTRING) ||
|
||||
(event_id == CC_MSG_LINE) ||
|
||||
(event_id == CC_MSG_CREATEOFFER) ||
|
||||
(event_id == CC_MSG_CREATEANSWER) ||
|
||||
(event_id == CC_MSG_SETLOCALDESC) ||
|
||||
(event_id == CC_MSG_SETREMOTEDESC) ||
|
||||
(event_id == CC_MSG_SETPEERCONNECTION) ||
|
||||
(event_id == CC_MSG_ADDSTREAM) ||
|
||||
(event_id == CC_MSG_REMOVESTREAM) ||
|
||||
(event_id == CC_MSG_ADDCANDIDATE) ||
|
||||
((event_id == CC_MSG_FEATURE) &&
|
||||
((((cc_feature_t *) msg)->feature_id == CC_FEATURE_NEW_CALL)))) {
|
||||
call_chn = fim_get_new_call_chn(call_id);
|
||||
|
||||
/*
|
||||
* Make sure we got a new call chain.
|
||||
*/
|
||||
if (call_chn == NULL) {
|
||||
FIM_DEBUG(get_debug_string(GSM_DBG1), "FIM", call_id, fname,
|
||||
"no call_chn");
|
||||
|
||||
fsm_display_no_free_lines();
|
||||
|
||||
cc_call_state(call_id, line, CC_STATE_UNKNOWN, NULL);
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
} else if ((event_id == CC_MSG_FEATURE) &&
|
||||
(fim_check_feature_event(msg))) {
|
||||
|
||||
call_chn = fim_get_new_call_chn(call_id);
|
||||
|
||||
/*
|
||||
* Make sure we got a new call chain.
|
||||
*/
|
||||
if (call_chn == NULL) {
|
||||
FIM_DEBUG(get_debug_string(GSM_DBG1), "FIM", call_id, fname,
|
||||
"no call_chn");
|
||||
|
||||
fsm_display_no_free_lines();
|
||||
|
||||
cc_call_state(call_id, line, CC_STATE_UNKNOWN, NULL);
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
if (fim_feature_need_outgoing_call_context(msg)) {
|
||||
/* Get new outgoing call context using DEF state m/c fsm */
|
||||
if (fsm_get_new_outgoing_call_context(call_id, line,
|
||||
fsm_get_fcb_by_call_id_and_type(call_id, FSM_TYPE_DEF),
|
||||
FALSE) != CC_CAUSE_OK) {
|
||||
cc_call_state(call_id, line, CC_STATE_UNKNOWN, NULL);
|
||||
return(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
FIM_DEBUG(get_debug_string(GSM_DBG1), "FIM", call_id, fname,
|
||||
"not a call establishment event\n");
|
||||
if( feat_msg->feature_id == CC_FEATURE_UPD_SESSION_MEDIA_CAP) {
|
||||
FIM_DEBUG(DEB_L_C_F_PREFIX"set_next_sess_video_pref = %d\n",
|
||||
DEB_L_C_F_PREFIX_ARGS(FIM, line, call_id, fname),
|
||||
feat_data->caps.support_direction);
|
||||
set_next_sess_video_pref(feat_data->caps.support_direction);
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
if (event_id != CC_MSG_SETUP) {
|
||||
/*
|
||||
* Increment the call chain cnt for this line
|
||||
* For incoming calls, we don't know the line number
|
||||
* when SETUP msg is received, so it's an exception, it'll be
|
||||
* added in fsmdef_idle_setup
|
||||
*/
|
||||
lsm_increment_call_chn_cnt(line);
|
||||
}
|
||||
} /* if (call_chn == NULL) */
|
||||
|
||||
|
||||
/*
|
||||
* Pass the event to the call chain unless UI lock has been enabled.
|
||||
*/
|
||||
if (call_chn->ui_locked && ((cc_feature_t *) msg)->src_id == CC_SRC_UI) {
|
||||
if (fsm_event_filtered_by_ui_lock(event_id,
|
||||
((cc_feature_t *)msg)->feature_id)) {
|
||||
FIM_DEBUG(DEB_L_C_F_PREFIX" %s filtered by UI lock\n",
|
||||
DEB_L_C_F_PREFIX_ARGS(FIM, line, call_id, fname),
|
||||
cc_feature_name(((cc_feature_t *)msg)->feature_id));
|
||||
return(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip the head.
|
||||
*/
|
||||
icb = call_chn->next_icb;
|
||||
MOZ_ASSERT(icb);
|
||||
while (icb && !done) {
|
||||
/*
|
||||
* Set the required event data so the entity can process the event.
|
||||
*/
|
||||
cb_hdr = (fim_cb_hdr_t *) (icb->cb);
|
||||
|
||||
MOZ_ASSERT(cb_hdr);
|
||||
if (!cb_hdr) {
|
||||
done = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
event.data = cb_hdr;
|
||||
event.state = cb_hdr->state;
|
||||
event.event = event_id;
|
||||
event.msg = data;
|
||||
|
||||
fcb = (fsm_fcb_t *) icb->cb;
|
||||
|
||||
/*
|
||||
* For example, if we receive INVITE and CANCEL messages back to back,
|
||||
* we may be decrementing the call count of wrong line because SIP stack did
|
||||
* not get the correct value for line yet.
|
||||
* so set the line value to correct value from DCB.
|
||||
* For RIU calls, there will be no DCB. However, line value cames from SIP stack
|
||||
* correctly.
|
||||
*/
|
||||
|
||||
if ((fcb->fsm_type == FSM_TYPE_DEF) && (event_id == CC_MSG_RELEASE)) {
|
||||
if (fcb->dcb != NULL) {
|
||||
line = fcb->dcb->line;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This update_call_cnt is only used when RC_CLEANUP is returned.
|
||||
*/
|
||||
update_call_cnt = TRUE; // by default, always update call count
|
||||
if (fcb->dcb != NULL) {
|
||||
update_call_cnt = (fcb->dcb->call_not_counted_in_mnc_bt) ? FALSE: TRUE;
|
||||
}
|
||||
|
||||
FIM_DEBUG(DEB_L_C_F_PREFIX" %s(%s:%s)\n",
|
||||
DEB_L_C_F_PREFIX_ARGS(FIM, line, call_id, fname), fsm_type_name(icb->scb->type),
|
||||
fsm_state_name(fcb->fsm_type, event.state),
|
||||
cc_msg_name((cc_msgs_t) (event.event)));
|
||||
|
||||
rc = sm_process_event(icb->scb->sm, &event);
|
||||
|
||||
|
||||
switch (rc) {
|
||||
case SM_RC_CONT:
|
||||
case SM_RC_DEF_CONT:
|
||||
icb = icb->next_icb;
|
||||
break;
|
||||
|
||||
case SM_RC_END:
|
||||
done = TRUE;
|
||||
break;
|
||||
|
||||
case SM_RC_ERROR:
|
||||
FIM_DEBUG(DEB_L_C_F_PREFIX" fsm sm error(%d:%d)\n",
|
||||
DEB_L_C_F_PREFIX_ARGS(FIM, line, call_id, fname), event.state, event.event);
|
||||
done = TRUE;
|
||||
cc_call_state(call_id, line, CC_STATE_UNKNOWN, NULL);
|
||||
break;
|
||||
|
||||
case SM_RC_CLEANUP:
|
||||
done = TRUE;
|
||||
cc_call_state(call_id, line, CC_STATE_UNKNOWN, NULL);
|
||||
break;
|
||||
|
||||
default:
|
||||
done = TRUE;
|
||||
cc_call_state(call_id, line, CC_STATE_UNKNOWN, NULL);
|
||||
break;
|
||||
} /* switch (rc) */
|
||||
|
||||
if ((rc == SM_RC_END) && (fcb->fsm_type == FSM_TYPE_DEF) &&
|
||||
(event_id == CC_MSG_FEATURE))
|
||||
{
|
||||
if ( ((cc_feature_t *) msg)->feature_id == CC_FEATURE_CFWD_ALL){
|
||||
lsm_decrement_call_chn_cnt(line);
|
||||
}
|
||||
}
|
||||
|
||||
if (icb == NULL) {
|
||||
done = TRUE;
|
||||
FIM_DEBUG("icb is null and get here!");
|
||||
}
|
||||
|
||||
} /* while (done != TRUE) { */
|
||||
|
||||
if (rc == SM_RC_CLEANUP) {
|
||||
fim_free_call_chn(call_chn, line, update_call_cnt);
|
||||
|
||||
}
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
cc_int32_t
|
||||
fim_show_cmd (cc_int32_t argc, const char *argv[])
|
||||
{
|
||||
fim_icb_t *icb = NULL;
|
||||
fim_scb_t *scb = NULL;
|
||||
int i = 0;
|
||||
|
||||
/*
|
||||
* Check if need help.
|
||||
*/
|
||||
if ((argc == 2) && (argv[1][0] == '?')) {
|
||||
debugif_printf("show fim\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Print the icbs.
|
||||
*/
|
||||
debugif_printf("\n---------------------------------- FIM icbs -----------------------------------");
|
||||
debugif_printf("\ni call_id type icb next_chn next_icb cb scb");
|
||||
debugif_printf("\n-------------------------------------------------------------------------------\n");
|
||||
|
||||
FSM_FOR_ALL_CBS(icb, fim_icbs, FIM_MAX_ICBS) {
|
||||
debugif_printf("%-3d %-7d %-6s 0x%8p 0x%8p 0x%8p 0x%8p 0x%8p\n",
|
||||
i++, icb->call_id, fsm_type_name(icb->scb->type),
|
||||
icb, icb->next_chn, icb->next_icb, icb->cb, icb->scb);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print the scbs.
|
||||
*/
|
||||
i = 0;
|
||||
debugif_printf
|
||||
("\n------------------------ FIM scbs ------------------------");
|
||||
debugif_printf("\ni type scb sm get_cb free_cb");
|
||||
debugif_printf
|
||||
("\n----------------------------------------------------------\n");
|
||||
|
||||
FSM_FOR_ALL_CBS(scb, fim_scbs, FIM_MAX_SCBS) {
|
||||
debugif_printf("%-2d %-6s 0x%8p 0x%8p 0x%8p 0x%8p\n",
|
||||
i++, fsm_type_name(scb->type), scb,
|
||||
scb->sm, scb->get_cb, scb->free_cb);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
fim_init (void)
|
||||
{
|
||||
|
||||
fim_init_call_chns();
|
||||
}
|
||||
|
||||
void
|
||||
fim_shutdown (void)
|
||||
{
|
||||
cpr_free(fim_scbs);
|
||||
cpr_free(fim_icbs);
|
||||
fim_scbs = NULL;
|
||||
fim_icbs = NULL;
|
||||
}
|
1383
libs/sipcc/core/gsm/fsm.c
Executable file
1383
libs/sipcc/core/gsm/fsm.c
Executable file
File diff suppressed because it is too large
Load Diff
1284
libs/sipcc/core/gsm/fsmb2bcnf.c
Executable file
1284
libs/sipcc/core/gsm/fsmb2bcnf.c
Executable file
File diff suppressed because it is too large
Load Diff
707
libs/sipcc/core/gsm/fsmcac.c
Executable file
707
libs/sipcc/core/gsm/fsmcac.c
Executable file
@ -0,0 +1,707 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "cpr_types.h"
|
||||
#include "cpr_stdlib.h"
|
||||
#include "cpr_stdio.h"
|
||||
#include "phntask.h"
|
||||
#include "fsm.h"
|
||||
#include "fim.h"
|
||||
#include "lsm.h"
|
||||
#include "sm.h"
|
||||
#include "gsm.h"
|
||||
#include "ccapi.h"
|
||||
#include "phone_debug.h"
|
||||
#include "debug.h"
|
||||
#include "text_strings.h"
|
||||
#include "sip_interface_regmgr.h"
|
||||
#include "resource_manager.h"
|
||||
#include "singly_link_list.h"
|
||||
#include "platform_api.h"
|
||||
|
||||
#define CAC_FAILURE_TIMEOUT 5
|
||||
cc_int32_t g_cacDebug = 0;
|
||||
|
||||
/* CAC key */
|
||||
typedef struct {
|
||||
callid_t call_id;
|
||||
} cac_key_t;
|
||||
|
||||
|
||||
typedef enum {
|
||||
FSM_CAC_IDLE = 0,
|
||||
FSM_CAC_REQ_PENDING = 1,
|
||||
FSM_CAC_REQ_RESP = 2
|
||||
} fsm_cac_state_e;
|
||||
|
||||
/* CAC structure to hold the data
|
||||
*/
|
||||
typedef struct cac_data_t {
|
||||
void *msg_ptr;
|
||||
callid_t call_id;
|
||||
void *cac_fail_timer;
|
||||
fsm_cac_state_e cac_state;
|
||||
uint32_t sessions;
|
||||
} cac_data_t;
|
||||
|
||||
static sll_handle_t s_cac_list = NULL;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Function responsible for searching the list waiting for
|
||||
* bandwidth allocation.
|
||||
*
|
||||
* @param cac_data_t *key_p - pointer to the key.
|
||||
* @param cac_data_t *cac_data - cac data.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
static sll_match_e
|
||||
fsm_cac_match_call_id (cac_data_t *key_p, cac_data_t *cac_data)
|
||||
{
|
||||
if (cac_data->call_id == key_p->call_id) {
|
||||
|
||||
return SLL_MATCH_FOUND;
|
||||
}
|
||||
|
||||
return SLL_MATCH_NOT_FOUND;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Function responsible to create new data information
|
||||
* for cac.
|
||||
*
|
||||
* @param none.
|
||||
*
|
||||
* @return cac_data_t *
|
||||
*
|
||||
*/
|
||||
static cac_data_t *
|
||||
fsm_get_new_cac_data (void)
|
||||
{
|
||||
static const char *fname="fsm_get_new_cac_data";
|
||||
cac_data_t *cac_mem;
|
||||
|
||||
cac_mem = (cac_data_t *) cpr_malloc(sizeof(cac_data_t));
|
||||
|
||||
if (cac_mem == NULL) {
|
||||
CAC_ERROR(CAC_F_PREFIX"No memory for CAC data.\n",
|
||||
DEB_F_PREFIX_ARGS("CAC", fname));
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
memset(cac_mem, 0, sizeof(cac_data_t));
|
||||
return (cac_mem);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Release all cac related data. This includes timer, cac_data
|
||||
* and message buffers
|
||||
*
|
||||
* @param cac_data cac data structure
|
||||
*
|
||||
* @return none.
|
||||
*
|
||||
* @pre (cac_data not_eq NULL)
|
||||
*/
|
||||
|
||||
static void
|
||||
fsm_clear_cac_data (cac_data_t *cac_data)
|
||||
{
|
||||
|
||||
if (cac_data->cac_fail_timer) {
|
||||
(void) cprCancelTimer(cac_data->cac_fail_timer);
|
||||
|
||||
(void) cprDestroyTimer(cac_data->cac_fail_timer);
|
||||
}
|
||||
|
||||
(void) sll_remove(s_cac_list, cac_data);
|
||||
|
||||
fim_free_event(cac_data->msg_ptr);
|
||||
|
||||
/* Release buffer too */
|
||||
cpr_free(cac_data->msg_ptr);
|
||||
|
||||
cpr_free(cac_data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Notifies the SIP stack and UI that CAC has failed.
|
||||
*
|
||||
* @param cac_data cac data structure
|
||||
*
|
||||
* @return none.
|
||||
*
|
||||
* @pre (cac_data not_eq NULL)
|
||||
*/
|
||||
|
||||
static void fsm_cac_notify_failure (cac_data_t *cac_data)
|
||||
{
|
||||
const char fname[] = "fsm_cac_notify_failure";
|
||||
cc_setup_t *msg = (cc_setup_t *) cac_data->msg_ptr;
|
||||
cc_msgs_t msg_id = msg->msg_id;
|
||||
callid_t call_id = msg->call_id;
|
||||
line_t line = msg->line;
|
||||
int event_id = msg_id;
|
||||
cc_srcs_t src_id = msg->src_id;
|
||||
|
||||
/* Notify UI about the failure */
|
||||
lsm_ui_display_notify_str_index(STR_INDEX_NO_BAND_WIDTH);
|
||||
|
||||
/* Send response from network side regarding the failure */
|
||||
if (event_id == CC_MSG_SETUP &&
|
||||
src_id == CC_SRC_SIP) {
|
||||
DEF_DEBUG(DEB_F_PREFIX"Send CAC failure to SIP %d.\n",
|
||||
DEB_F_PREFIX_ARGS("CAC", fname), cac_data->call_id);
|
||||
cc_int_release(CC_SRC_GSM, CC_SRC_SIP, call_id, line,
|
||||
CC_CAUSE_CONGESTION, NULL, NULL);
|
||||
} else {
|
||||
/* If the cac failed, GSM is not spinning yet, so just send the
|
||||
* information to UI in this case. Other case, where GSM receives event
|
||||
* will send the information from GSM.
|
||||
* If the UI is not cleaned up, session infomation is not cleared.
|
||||
*/
|
||||
ui_call_state(evOnHook, line, call_id, CC_CAUSE_CONGESTION);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Initialize the cac timer. This timer is responsible for cleanup if the
|
||||
* cac response is not received from lower layer.
|
||||
*
|
||||
* @param cac_data cac data structure
|
||||
* timeout specify the time out in sec
|
||||
*
|
||||
* @return true if the timer is created scuccessfully.
|
||||
* false if the timer is not created.
|
||||
*
|
||||
* @pre (cac_data not_eq NULL)
|
||||
*/
|
||||
|
||||
static boolean
|
||||
fsm_init_cac_failure_timer(cac_data_t *cac_data, uint32_t timeout)
|
||||
{
|
||||
const char fname[] = "fsm_init_cac_failure_timer";
|
||||
|
||||
CAC_DEBUG(DEB_F_PREFIX"cac_data call_id=%x\n",
|
||||
DEB_F_PREFIX_ARGS("CAC", fname),
|
||||
cac_data->call_id);
|
||||
|
||||
cac_data->cac_fail_timer =
|
||||
cprCreateTimer("CAC failure timer", GSM_CAC_FAILURE_TIMER, TIMER_EXPIRATION,
|
||||
gsm_msg_queue);
|
||||
|
||||
if (cac_data->cac_fail_timer == NULL) {
|
||||
CAC_ERROR(CAC_F_PREFIX"CAC Timer allocation failed.\n",
|
||||
DEB_F_PREFIX_ARGS("CAC", fname));
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
(void) cprStartTimer(cac_data->cac_fail_timer, timeout * 1000,
|
||||
(void *)(long)cac_data->call_id);
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Serches through cac link list and returns cac_data
|
||||
* based on call_id. This search is a singly link list search.
|
||||
*
|
||||
* @param call_id call_id of the call
|
||||
*
|
||||
* @return cac_data if found in the list
|
||||
* NULL if there is no cac_data
|
||||
*
|
||||
* @pre (call_id not_eq CC_NO_CALL_ID)
|
||||
*/
|
||||
|
||||
static cac_data_t *
|
||||
fsm_cac_get_data_by_call_id (callid_t call_id)
|
||||
{
|
||||
const char fname[] = "fsm_cac_get_data_by_call_id";
|
||||
cac_data_t *cac_data;
|
||||
|
||||
cac_data = (cac_data_t *) sll_next(s_cac_list, NULL);
|
||||
|
||||
while (cac_data != NULL) {
|
||||
|
||||
if (cac_data->call_id == call_id) {
|
||||
CAC_DEBUG(DEB_F_PREFIX"cac_data found call_id=%x\n",
|
||||
DEB_F_PREFIX_ARGS("CAC", fname),
|
||||
cac_data->call_id);
|
||||
return(cac_data);
|
||||
}
|
||||
|
||||
cac_data = (cac_data_t *) sll_next(s_cac_list, cac_data);
|
||||
|
||||
}
|
||||
|
||||
CAC_DEBUG(DEB_F_PREFIX"cac_data NOT found.\n",
|
||||
DEB_F_PREFIX_ARGS("CAC", fname));
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Initialize cac module by enabling debugs and creating a cac list.
|
||||
*
|
||||
* @param void
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @pre (NULL)
|
||||
*/
|
||||
void fsm_cac_init (void)
|
||||
{
|
||||
const char fname[] = "fsm_cac_init";
|
||||
|
||||
|
||||
/* allocate and initialize cac list */
|
||||
s_cac_list = sll_create((sll_match_e(*)(void *, void *))
|
||||
fsm_cac_match_call_id);
|
||||
|
||||
if (s_cac_list == NULL) {
|
||||
CAC_ERROR(CAC_F_PREFIX"CAC list creation failed.\n",
|
||||
DEB_F_PREFIX_ARGS("CAC", fname));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* clears all the entries in the cac list
|
||||
*
|
||||
* @param void
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @pre (NULL)
|
||||
*/
|
||||
void fsm_cac_clear_list (void)
|
||||
{
|
||||
const char fname[] = "fsm_cac_clear_list";
|
||||
cac_data_t *cac_data;
|
||||
cac_data_t *prev_cac_data;
|
||||
|
||||
DEF_DEBUG(DEB_F_PREFIX"Clear all pending CAC dat.\n",
|
||||
DEB_F_PREFIX_ARGS("CAC", fname));
|
||||
|
||||
cac_data = (cac_data_t *) sll_next(s_cac_list, NULL);
|
||||
|
||||
while (cac_data != NULL) {
|
||||
|
||||
prev_cac_data = cac_data;
|
||||
cac_data = (cac_data_t *) sll_next(s_cac_list, cac_data);
|
||||
|
||||
fsm_cac_notify_failure(prev_cac_data);
|
||||
fsm_clear_cac_data(prev_cac_data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Shutdown cac module, clears all the pending cac requests
|
||||
*
|
||||
* @param void
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @pre (NULL)
|
||||
*/
|
||||
void fsm_cac_shutdown (void)
|
||||
{
|
||||
|
||||
fsm_cac_clear_list();
|
||||
|
||||
sll_destroy(s_cac_list);
|
||||
|
||||
s_cac_list = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Check if there are pending CAC requests
|
||||
*
|
||||
* @param none
|
||||
*
|
||||
* @return cac_data returns first pending request.
|
||||
*
|
||||
* @pre (NULL)
|
||||
*/
|
||||
static cac_data_t *
|
||||
fsm_cac_check_if_pending_req (void)
|
||||
{
|
||||
cac_data_t *cac_data;
|
||||
|
||||
cac_data = (cac_data_t *) sll_next(s_cac_list, NULL);
|
||||
|
||||
while (cac_data != NULL) {
|
||||
|
||||
if (cac_data->cac_state == FSM_CAC_REQ_PENDING ||
|
||||
cac_data->cac_state == FSM_CAC_IDLE) {
|
||||
|
||||
return(cac_data);
|
||||
}
|
||||
|
||||
cac_data = (cac_data_t *) sll_next(s_cac_list, cac_data);
|
||||
|
||||
}
|
||||
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Check if there are pending CAC requests
|
||||
*
|
||||
* @param none
|
||||
*
|
||||
* @return cac_data returns first pending request.
|
||||
*
|
||||
* @pre (NULL)
|
||||
*/
|
||||
static cc_causes_t
|
||||
fsm_cac_process_bw_allocation (cac_data_t *cac_data)
|
||||
{
|
||||
const char fname[] = "fsm_cac_process_bw_allocation";
|
||||
|
||||
if (lsm_allocate_call_bandwidth(cac_data->call_id, cac_data->sessions) ==
|
||||
CC_CAUSE_CONGESTION) {
|
||||
|
||||
DEF_DEBUG(DEB_F_PREFIX"CAC Allocation failed.\n",
|
||||
DEB_F_PREFIX_ARGS("CAC", fname));
|
||||
|
||||
fsm_cac_notify_failure(cac_data);
|
||||
|
||||
fsm_clear_cac_data(cac_data);
|
||||
|
||||
return(CC_CAUSE_CONGESTION);
|
||||
}
|
||||
|
||||
cac_data->cac_state = FSM_CAC_REQ_PENDING;
|
||||
|
||||
return(CC_CAUSE_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Check if there are pending CAC requests
|
||||
*
|
||||
* @param call_id request a cac for this call_id
|
||||
* sessions number of sessions in the request
|
||||
* msg ccapi msg, that is held to process
|
||||
* till cac response is received.
|
||||
*
|
||||
* @return CC_CAUSE_BW_OK if the bandwidth is received.
|
||||
* CC_CAUSE_Ok Call returned successfully, not sure about BW yet
|
||||
* CC_CAUSE_ERROR: Call returned with failure.
|
||||
*
|
||||
* @pre (NULL)
|
||||
*/
|
||||
cc_causes_t
|
||||
fsm_cac_call_bandwidth_req (callid_t call_id, uint32_t sessions,
|
||||
void *msg)
|
||||
{
|
||||
const char fname[] = "fsm_cac_call_bandwidth_req";
|
||||
cac_data_t *cac_data, *cac_pend_data;
|
||||
|
||||
/* If wlan not connected return OK */
|
||||
cac_data = fsm_get_new_cac_data();
|
||||
|
||||
if (cac_data == NULL) {
|
||||
|
||||
return(CC_CAUSE_CONGESTION);
|
||||
}
|
||||
|
||||
cac_data->msg_ptr = msg;
|
||||
cac_data->call_id = call_id;
|
||||
cac_data->cac_state = FSM_CAC_IDLE;
|
||||
cac_data->sessions = sessions;
|
||||
|
||||
fsm_init_cac_failure_timer(cac_data, CAC_FAILURE_TIMEOUT);
|
||||
|
||||
/* Make sure there is no pending requests before submitting
|
||||
* another one
|
||||
*/
|
||||
if ((cac_pend_data = fsm_cac_check_if_pending_req()) == NULL) {
|
||||
|
||||
/*
|
||||
* Make sure sufficient bandwidth available to make a outgoing call. This
|
||||
* should be done before allocating other resources.
|
||||
*/
|
||||
DEF_DEBUG(DEB_F_PREFIX"CAC request for %d sessions %d.\n",
|
||||
DEB_F_PREFIX_ARGS("CAC", fname), call_id, sessions);
|
||||
|
||||
if (fsm_cac_process_bw_allocation(cac_data) == CC_CAUSE_CONGESTION) {
|
||||
|
||||
return(CC_CAUSE_CONGESTION);
|
||||
}
|
||||
|
||||
cac_data->cac_state = FSM_CAC_REQ_PENDING;
|
||||
|
||||
} else if (cac_pend_data->cac_state == FSM_CAC_IDLE) {
|
||||
|
||||
if (fsm_cac_process_bw_allocation(cac_pend_data) ==
|
||||
CC_CAUSE_CONGESTION) {
|
||||
|
||||
/* Clear all remaining data */
|
||||
fsm_cac_clear_list();
|
||||
|
||||
return(CC_CAUSE_CONGESTION);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
(void) sll_append(s_cac_list, cac_data);
|
||||
|
||||
return(CC_CAUSE_OK);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* This is called by gsm to cleanup the cac data. If there are any
|
||||
* pending CAC requests and far end cancels the call, the pending
|
||||
* request has to be canceled.
|
||||
*
|
||||
* @param call_id - call_id of the request
|
||||
*
|
||||
* @return none.
|
||||
*
|
||||
* @pre (NULL)
|
||||
*/
|
||||
void fsm_cac_call_release_cleanup (callid_t call_id)
|
||||
{
|
||||
cac_data_t *cac_data;
|
||||
|
||||
cac_data = fsm_cac_get_data_by_call_id(call_id);
|
||||
|
||||
if (cac_data) {
|
||||
|
||||
sll_remove(s_cac_list, cac_data);
|
||||
|
||||
fsm_clear_cac_data(cac_data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Called when the bandwidth response with available bw is received. This
|
||||
* also process held ccapi messages through fim event chain
|
||||
*
|
||||
* @param none
|
||||
*
|
||||
* @return CC_CAUSE_NO_RESOURCE No bandwidth
|
||||
* CC_CAUSE_OK if ok
|
||||
*
|
||||
*
|
||||
* @pre (NULL)
|
||||
*/
|
||||
|
||||
cc_causes_t
|
||||
fsm_cac_process_bw_avail_resp (void)
|
||||
{
|
||||
const char fname[] = "fsm_cac_process_bw_avail_resp";
|
||||
cac_data_t *cac_data = NULL;
|
||||
cac_data_t *next_cac_data = NULL;
|
||||
|
||||
|
||||
cac_data = (cac_data_t *) sll_next(s_cac_list, NULL);
|
||||
|
||||
if (cac_data != NULL) {
|
||||
|
||||
switch (cac_data->cac_state) {
|
||||
default:
|
||||
case FSM_CAC_IDLE:
|
||||
DEF_DEBUG(DEB_F_PREFIX"No Pending CAC request.\n",
|
||||
DEB_F_PREFIX_ARGS("CAC", fname));
|
||||
/*
|
||||
* Make sure sufficient bandwidth available to make a outgoing call. This
|
||||
* should be done before allocating other resources.
|
||||
*/
|
||||
if (fsm_cac_process_bw_allocation(cac_data) == CC_CAUSE_CONGESTION) {
|
||||
|
||||
sll_remove(s_cac_list, cac_data);
|
||||
|
||||
return(CC_CAUSE_NO_RESOURCE);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case FSM_CAC_REQ_PENDING:
|
||||
|
||||
next_cac_data = (cac_data_t *) sll_next(s_cac_list, cac_data);
|
||||
sll_remove(s_cac_list, cac_data);
|
||||
|
||||
/* Request for the next bandwidth */
|
||||
DEF_DEBUG(DEB_F_PREFIX"Process pending responses %d.\n",
|
||||
DEB_F_PREFIX_ARGS("CAC", fname), cac_data->call_id);
|
||||
|
||||
/* Let GSM process completed request */
|
||||
fim_process_event(cac_data->msg_ptr, TRUE);
|
||||
|
||||
fsm_clear_cac_data(cac_data);
|
||||
|
||||
if (next_cac_data != NULL) {
|
||||
/*
|
||||
* Make sure sufficient bandwidth available to make a outgoing call. This
|
||||
* should be done before allocating other resources.
|
||||
*/
|
||||
DEF_DEBUG(DEB_F_PREFIX"Requesting next allocation %d.\n",
|
||||
DEB_F_PREFIX_ARGS("CAC", fname), next_cac_data->call_id);
|
||||
|
||||
if (fsm_cac_process_bw_allocation(next_cac_data) ==
|
||||
CC_CAUSE_CONGESTION) {
|
||||
|
||||
/* If the next data was in idle state and the request fialed
|
||||
* then clean up the remaining list
|
||||
*/
|
||||
if (next_cac_data->cac_state == FSM_CAC_IDLE) {
|
||||
/* Clear all remaining data */
|
||||
fsm_cac_clear_list();
|
||||
} else {
|
||||
|
||||
sll_remove(s_cac_list, next_cac_data);
|
||||
}
|
||||
|
||||
return(CC_CAUSE_NO_RESOURCE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return(CC_CAUSE_NO_RESOURCE);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Called when the bandwidth response with failed bw is received. This
|
||||
* also process held ccapi messages through fim event chain
|
||||
*
|
||||
* @param none
|
||||
*
|
||||
* @return CC_CAUSE_NO_RESOURCE No bandwidth
|
||||
* CC_CAUSE_OK if ok
|
||||
*
|
||||
*
|
||||
* @pre (NULL)
|
||||
*/
|
||||
cc_causes_t
|
||||
fsm_cac_process_bw_failed_resp (void)
|
||||
{
|
||||
const char fname[] = "fsm_cac_process_bw_avail_resp";
|
||||
cac_data_t *cac_data = NULL;
|
||||
cac_data_t *next_cac_data = NULL;
|
||||
|
||||
|
||||
cac_data = (cac_data_t *) sll_next(s_cac_list, NULL);
|
||||
|
||||
if (cac_data != NULL) {
|
||||
|
||||
switch (cac_data->cac_state) {
|
||||
default:
|
||||
case FSM_CAC_IDLE:
|
||||
DEF_DEBUG(DEB_F_PREFIX"No Pending request.\n",
|
||||
DEB_F_PREFIX_ARGS("CAC", fname));
|
||||
/*
|
||||
* Make sure sufficient bandwidth available to make a outgoing call. This
|
||||
* should be done before allocating other resources.
|
||||
*/
|
||||
if (fsm_cac_process_bw_allocation(cac_data) == CC_CAUSE_CONGESTION) {
|
||||
|
||||
sll_remove(s_cac_list, cac_data);
|
||||
|
||||
return(CC_CAUSE_NO_RESOURCE);
|
||||
}
|
||||
|
||||
break;
|
||||
case FSM_CAC_REQ_PENDING:
|
||||
|
||||
next_cac_data = (cac_data_t *) sll_next(s_cac_list, cac_data);
|
||||
|
||||
sll_remove(s_cac_list, cac_data);
|
||||
|
||||
/* Request for the next bandwidth */
|
||||
DEF_DEBUG(DEB_F_PREFIX"Process pending responses even after failure.\n",
|
||||
DEB_F_PREFIX_ARGS("CAC", fname));
|
||||
|
||||
/* Let GSM process completed request */
|
||||
fsm_cac_notify_failure(cac_data);
|
||||
|
||||
fsm_clear_cac_data(cac_data);
|
||||
|
||||
if (next_cac_data != NULL) {
|
||||
|
||||
/*
|
||||
* Make sure sufficient bandwidth available to make a outgoing call. This
|
||||
* should be done before allocating other resources.
|
||||
*/
|
||||
if (fsm_cac_process_bw_allocation(next_cac_data) == CC_CAUSE_CONGESTION) {
|
||||
|
||||
/* If the next data was in idle state and the request fialed
|
||||
* then clean up the remaining list
|
||||
*/
|
||||
if (next_cac_data->cac_state == FSM_CAC_IDLE) {
|
||||
/* Clear all remaining data */
|
||||
fsm_cac_clear_list();
|
||||
} else {
|
||||
|
||||
sll_remove(s_cac_list, next_cac_data);
|
||||
}
|
||||
|
||||
return(CC_CAUSE_NO_RESOURCE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return(CC_CAUSE_NO_RESOURCE);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Process time-out event. This cause cac data to send failure notifications.
|
||||
*
|
||||
* @param void *tmr_data - timer data
|
||||
*
|
||||
* @return none
|
||||
*
|
||||
*
|
||||
* @pre (NULL)
|
||||
*/
|
||||
void
|
||||
fsm_cac_process_bw_fail_timer (void *tmr_data)
|
||||
{
|
||||
const char fname[] = "fsm_cac_process_bw_fail_timer";
|
||||
|
||||
DEF_DEBUG(DEB_F_PREFIX"CAC request timedout %d.\n",
|
||||
DEB_F_PREFIX_ARGS("CAC", fname), (callid_t)(long)tmr_data);
|
||||
|
||||
/* Time-out causes same set of processing as bw failure
|
||||
*/
|
||||
fsm_cac_process_bw_failed_resp();
|
||||
|
||||
}
|
||||
|
1749
libs/sipcc/core/gsm/fsmcnf.c
Executable file
1749
libs/sipcc/core/gsm/fsmcnf.c
Executable file
File diff suppressed because it is too large
Load Diff
8667
libs/sipcc/core/gsm/fsmdef.c
Executable file
8667
libs/sipcc/core/gsm/fsmdef.c
Executable file
File diff suppressed because it is too large
Load Diff
3041
libs/sipcc/core/gsm/fsmxfr.c
Executable file
3041
libs/sipcc/core/gsm/fsmxfr.c
Executable file
File diff suppressed because it is too large
Load Diff
608
libs/sipcc/core/gsm/gsm.c
Executable file
608
libs/sipcc/core/gsm/gsm.c
Executable file
@ -0,0 +1,608 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "cpr_types.h"
|
||||
#include "cpr_memory.h"
|
||||
#include "cpr_stdio.h"
|
||||
#include "cpr_stdlib.h"
|
||||
#include "cpr_ipc.h"
|
||||
#include "cpr_errno.h"
|
||||
#include "cpr_time.h"
|
||||
#include "cpr_rand.h"
|
||||
#include "cpr_timers.h"
|
||||
#include "cpr_threads.h"
|
||||
#include "phone.h"
|
||||
#include "phntask.h"
|
||||
#include "gsm.h"
|
||||
#include "lsm.h"
|
||||
#include "vcm.h"
|
||||
#include "fsm.h"
|
||||
#include "phone_debug.h"
|
||||
#include "debug.h"
|
||||
#include "fim.h"
|
||||
#include "gsm_sdp.h"
|
||||
#include "ccsip_subsmanager.h"
|
||||
#include "dialplanint.h"
|
||||
#include "kpmlmap.h"
|
||||
#include "subapi.h"
|
||||
#include "platform_api.h"
|
||||
|
||||
static void sub_process_feature_msg(uint32_t cmd, void *msg);
|
||||
static void sub_process_feature_notify(ccsip_sub_not_data_t *msg, callid_t call_id,
|
||||
callid_t other_call_id);
|
||||
static void sub_process_b2bcnf_msg(uint32_t cmd, void *msg);
|
||||
void fsmb2bcnf_get_sub_call_id_from_ccb(fsmcnf_ccb_t *ccb, callid_t *cnf_call_id,
|
||||
callid_t *cns_call_id);
|
||||
cprMsgQueue_t gsm_msg_queue;
|
||||
void destroy_gsm_thread(void);
|
||||
void dp_shutdown();
|
||||
extern void dcsm_process_jobs(void);
|
||||
extern void dcsm_init(void);
|
||||
extern void dcsm_shutdown(void);
|
||||
|
||||
/* Flag to see whether we can start processing events */
|
||||
|
||||
static boolean gsm_initialized = FALSE;
|
||||
extern cprThread_t gsm_thread;
|
||||
static media_timer_callback_fp* media_timer_callback = NULL;
|
||||
|
||||
/**
|
||||
* Add media falsh one time timer call back. It's for ROUNDTABLE only.
|
||||
*/
|
||||
void
|
||||
gsm_set_media_callback(media_timer_callback_fp* callback) {
|
||||
media_timer_callback = callback;
|
||||
}
|
||||
|
||||
void
|
||||
gsm_set_initialized (void)
|
||||
{
|
||||
gsm_initialized = TRUE;
|
||||
}
|
||||
|
||||
boolean
|
||||
gsm_get_initialize_state (void)
|
||||
{
|
||||
return gsm_initialized;
|
||||
}
|
||||
|
||||
cprBuffer_t
|
||||
gsm_get_buffer (uint16_t size)
|
||||
{
|
||||
return cpr_malloc(size);
|
||||
}
|
||||
|
||||
|
||||
cpr_status_e
|
||||
gsm_send_msg (uint32_t cmd, cprBuffer_t buf, uint16_t len)
|
||||
{
|
||||
phn_syshdr_t *syshdr;
|
||||
|
||||
syshdr = (phn_syshdr_t *) cprGetSysHeader(buf);
|
||||
if (!syshdr) {
|
||||
return CPR_FAILURE;
|
||||
}
|
||||
syshdr->Cmd = cmd;
|
||||
syshdr->Len = len;
|
||||
|
||||
if (cprSendMessage(gsm_msg_queue, buf, (void **) &syshdr) == CPR_FAILURE) {
|
||||
cprReleaseSysHeader(syshdr);
|
||||
return CPR_FAILURE;
|
||||
}
|
||||
return CPR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
boolean
|
||||
gsm_process_msg (uint32_t cmd, void *msg)
|
||||
{
|
||||
static const char fname[] = "gsm_process_msg";
|
||||
boolean release_msg = TRUE;
|
||||
cc_msgs_t msg_id = ((cc_setup_t *)msg)->msg_id;
|
||||
int event_id = msg_id;
|
||||
|
||||
GSM_DEBUG(DEB_F_PREFIX"cmd= 0x%x\n", DEB_F_PREFIX_ARGS(GSM, fname), cmd);
|
||||
|
||||
switch (cmd) {
|
||||
case GSM_GSM:
|
||||
case GSM_SIP:
|
||||
if (gsm_initialized) {
|
||||
|
||||
if (event_id == CC_MSG_FEATURE &&
|
||||
(((cc_feature_t *) msg)->feature_id == CC_FEATURE_CAC_RESP_PASS)) {
|
||||
|
||||
fsm_cac_process_bw_avail_resp ();
|
||||
|
||||
/* Release all memory for CC_FEATURE_CAC_..message */
|
||||
release_msg = TRUE;
|
||||
|
||||
GSM_DEBUG(DEB_F_PREFIX"CAC Message Processed: 0x%x\n", DEB_F_PREFIX_ARGS(GSM, fname), cmd);
|
||||
} else if (event_id == CC_MSG_FEATURE &&
|
||||
(((cc_feature_t *) msg)->feature_id == CC_FEATURE_CAC_RESP_FAIL)) {
|
||||
|
||||
fsm_cac_process_bw_failed_resp ();
|
||||
|
||||
/* Release all memory for CC_FEATURE_CAC_..message */
|
||||
release_msg = TRUE;
|
||||
|
||||
GSM_DEBUG(DEB_F_PREFIX"CAC Message Processed: 0x%x\n", DEB_F_PREFIX_ARGS(GSM, fname), cmd);
|
||||
} else {
|
||||
|
||||
release_msg = fim_process_event(msg, FALSE);
|
||||
GSM_DEBUG(DEB_F_PREFIX"Message Processed: 0x%x\n", DEB_F_PREFIX_ARGS(GSM, fname), cmd);
|
||||
}
|
||||
}
|
||||
if (release_msg == TRUE) {
|
||||
fim_free_event(msg);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
GSM_DEBUG(DEB_F_PREFIX"Unknown Cmd received: 0x%x\n", DEB_F_PREFIX_ARGS(GSM, fname), cmd);
|
||||
break;
|
||||
}
|
||||
|
||||
return(release_msg);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gsm_process_timer_expiration (void *msg)
|
||||
{
|
||||
static const char fname[] = "gsm_process_timer_expiration";
|
||||
cprCallBackTimerMsg_t *timerMsg;
|
||||
void *timeout_msg = NULL;
|
||||
|
||||
timerMsg = (cprCallBackTimerMsg_t *) msg;
|
||||
TMR_DEBUG(DEB_F_PREFIX"Timer %s expired\n", DEB_F_PREFIX_ARGS(GSM, fname), timerMsg->expiredTimerName);
|
||||
|
||||
switch (timerMsg->expiredTimerId) {
|
||||
|
||||
case GSM_MULTIPART_TONES_TIMER:
|
||||
case GSM_CONTINUOUS_TONES_TIMER:
|
||||
lsm_tmr_tones_callback(timerMsg->usrData);
|
||||
break;
|
||||
|
||||
case GSM_ERROR_ONHOOK_TIMER:
|
||||
fsmdef_error_onhook_timeout(timerMsg->usrData);
|
||||
break;
|
||||
|
||||
case GSM_AUTOANSWER_TIMER:
|
||||
fsmdef_auto_answer_timeout(timerMsg->usrData);
|
||||
break;
|
||||
|
||||
case GSM_REVERSION_TIMER:
|
||||
fsmdef_reversion_timeout((callid_t)(long)timerMsg->usrData);
|
||||
break;
|
||||
|
||||
case GSM_CAC_FAILURE_TIMER:
|
||||
fsm_cac_process_bw_fail_timer(timerMsg->usrData);
|
||||
break;
|
||||
|
||||
case GSM_DIAL_TIMEOUT_TIMER:
|
||||
dp_dial_timeout(timerMsg->usrData);
|
||||
break;
|
||||
|
||||
case GSM_KPML_INTER_DIGIT_TIMER:
|
||||
kpml_inter_digit_timer_callback(timerMsg->usrData);
|
||||
break;
|
||||
case GSM_KPML_CRITICAL_DIGIT_TIMER:
|
||||
case GSM_KPML_EXTRA_DIGIT_TIMER:
|
||||
break;
|
||||
|
||||
case GSM_KPML_SUBSCRIPTION_TIMER:
|
||||
kpml_subscription_timer_callback(timerMsg->usrData);
|
||||
break;
|
||||
|
||||
case GSM_REQ_PENDING_TIMER:
|
||||
timeout_msg = fsmdef_feature_timer_timeout(
|
||||
CC_FEATURE_REQ_PEND_TIMER_EXP,
|
||||
timerMsg->usrData);
|
||||
break;
|
||||
|
||||
case GSM_RINGBACK_DELAY_TIMER:
|
||||
timeout_msg = fsmdef_feature_timer_timeout(
|
||||
CC_FEATURE_RINGBACK_DELAY_TIMER_EXP,
|
||||
timerMsg->usrData);
|
||||
break;
|
||||
case GSM_FLASH_ONCE_TIMER:
|
||||
if (media_timer_callback != NULL) {
|
||||
(* ((media_timer_callback_fp)(media_timer_callback)))();
|
||||
}
|
||||
break;
|
||||
case GSM_TONE_DURATION_TIMER:
|
||||
lsm_tone_duration_tmr_callback(timerMsg->usrData);
|
||||
break;
|
||||
default:
|
||||
GSM_ERR_MSG(GSM_F_PREFIX"unknown timer %d\n", fname,
|
||||
timerMsg->expiredTimerName);
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* If there is a timer message to be processed by state machine,
|
||||
* hands it to GSM state machine here.
|
||||
*/
|
||||
if (timeout_msg != NULL) {
|
||||
/* Let state machine handle glare timer expiration */
|
||||
gsm_process_msg(GSM_GSM, timeout_msg);
|
||||
cpr_free(timeout_msg);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gsm_init (void)
|
||||
{
|
||||
/* Placeholder for any initialization tasks */
|
||||
}
|
||||
|
||||
void
|
||||
gsm_shutdown (void)
|
||||
{
|
||||
gsm_initialized = FALSE;
|
||||
|
||||
lsm_shutdown();
|
||||
fsm_shutdown();
|
||||
fim_shutdown();
|
||||
dcsm_shutdown();
|
||||
}
|
||||
|
||||
void
|
||||
gsm_reset (void)
|
||||
{
|
||||
dp_reset();
|
||||
lsm_reset();
|
||||
fsmutil_free_all_shown_calls_ci_map();
|
||||
}
|
||||
|
||||
void
|
||||
GSMTask (void *arg)
|
||||
{
|
||||
static const char fname[] = "GSMTask";
|
||||
void *msg;
|
||||
phn_syshdr_t *syshdr;
|
||||
boolean release_msg = TRUE;
|
||||
|
||||
/*
|
||||
* Get the GSM message queue handle
|
||||
* A hack until the tasks in irx are
|
||||
* CPRized.
|
||||
*/
|
||||
gsm_msg_queue = (cprMsgQueue_t) arg;
|
||||
if (!gsm_msg_queue) {
|
||||
GSM_ERR_MSG(GSM_F_PREFIX"invalid input, exiting\n", fname);
|
||||
return;
|
||||
}
|
||||
|
||||
if (platThreadInit("GSMTask") != 0) {
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* Adjust relative priority of GSM thread.
|
||||
*/
|
||||
(void) cprAdjustRelativeThreadPriority(GSM_THREAD_RELATIVE_PRIORITY);
|
||||
|
||||
/*
|
||||
* Initialize all the GSM modules
|
||||
*/
|
||||
lsm_init();
|
||||
fsm_init();
|
||||
fim_init();
|
||||
gsm_init();
|
||||
dcsm_init();
|
||||
|
||||
cc_init();
|
||||
|
||||
fsmutil_init_shown_calls_ci_map();
|
||||
/*
|
||||
* On Win32 platform, the random seed is stored per thread; therefore,
|
||||
* each thread needs to seed the random number. It is recommended by
|
||||
* MS to do the following to ensure randomness across application
|
||||
* restarts.
|
||||
*/
|
||||
cpr_srand((unsigned int)time(NULL));
|
||||
|
||||
/*
|
||||
* Cache random numbers for SRTP keys
|
||||
*/
|
||||
gsmsdp_cache_crypto_keys();
|
||||
|
||||
while (1) {
|
||||
|
||||
release_msg = TRUE;
|
||||
|
||||
msg = cprGetMessage(gsm_msg_queue, TRUE, (void **) &syshdr);
|
||||
if (msg) {
|
||||
switch (syshdr->Cmd) {
|
||||
case TIMER_EXPIRATION:
|
||||
gsm_process_timer_expiration(msg);
|
||||
break;
|
||||
|
||||
case GSM_SIP:
|
||||
case GSM_GSM:
|
||||
release_msg = gsm_process_msg(syshdr->Cmd, msg);
|
||||
break;
|
||||
|
||||
case DP_MSG_INIT_DIALING:
|
||||
case DP_MSG_DIGIT_STR:
|
||||
case DP_MSG_STORE_DIGIT:
|
||||
case DP_MSG_DIGIT:
|
||||
case DP_MSG_DIAL_IMMEDIATE:
|
||||
case DP_MSG_REDIAL:
|
||||
case DP_MSG_ONHOOK:
|
||||
case DP_MSG_OFFHOOK:
|
||||
case DP_MSG_UPDATE:
|
||||
case DP_MSG_DIGIT_TIMER:
|
||||
case DP_MSG_CANCEL_OFFHOOK_TIMER:
|
||||
dp_process_msg(syshdr->Cmd, msg);
|
||||
break;
|
||||
|
||||
case SUB_MSG_B2BCNF_SUBSCRIBE_RESP:
|
||||
case SUB_MSG_B2BCNF_NOTIFY:
|
||||
case SUB_MSG_B2BCNF_TERMINATE:
|
||||
sub_process_b2bcnf_msg(syshdr->Cmd, msg);
|
||||
break;
|
||||
|
||||
case SUB_MSG_FEATURE_SUBSCRIBE_RESP:
|
||||
case SUB_MSG_FEATURE_NOTIFY:
|
||||
case SUB_MSG_FEATURE_TERMINATE:
|
||||
sub_process_feature_msg(syshdr->Cmd, msg);
|
||||
break;
|
||||
|
||||
case SUB_MSG_KPML_SUBSCRIBE:
|
||||
case SUB_MSG_KPML_TERMINATE:
|
||||
case SUB_MSG_KPML_NOTIFY_ACK:
|
||||
case SUB_MSG_KPML_SUBSCRIBE_TIMER:
|
||||
case SUB_MSG_KPML_DIGIT_TIMER:
|
||||
kpml_process_msg(syshdr->Cmd, msg);
|
||||
break;
|
||||
|
||||
case REG_MGR_STATE_CHANGE:
|
||||
gsm_reset();
|
||||
break;
|
||||
case THREAD_UNLOAD:
|
||||
destroy_gsm_thread();
|
||||
break;
|
||||
|
||||
default:
|
||||
GSM_ERR_MSG(GSM_F_PREFIX"Unknown message\n", fname);
|
||||
break;
|
||||
}
|
||||
|
||||
cprReleaseSysHeader(syshdr);
|
||||
if (release_msg == TRUE) {
|
||||
cpr_free(msg);
|
||||
}
|
||||
|
||||
/* Check if there are pending messages for dcsm
|
||||
* if it in the right state perform its operation
|
||||
*/
|
||||
dcsm_process_jobs();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will process SUBSCRIBED feature NOTIFY messages.
|
||||
*
|
||||
* @param[in] msg - pointer to ccsip_sub_not_data_t
|
||||
*
|
||||
* @return none
|
||||
*
|
||||
* @pre (msg != NULL)
|
||||
*/
|
||||
static void sub_process_b2bcnf_sub_resp (ccsip_sub_not_data_t *msg)
|
||||
{
|
||||
static const char fname[] = "sub_process_b2bcnf_sub_resp";
|
||||
|
||||
callid_t call_id = CC_NO_CALL_ID;
|
||||
callid_t other_call_id = CC_NO_CALL_ID;
|
||||
cc_causes_t cause;
|
||||
|
||||
fsmb2bcnf_get_sub_call_id_from_ccb ((fsmcnf_ccb_t *)(msg->request_id),
|
||||
&call_id, &other_call_id);
|
||||
|
||||
if (msg->u.subs_result_data.status_code == 200 ||
|
||||
msg->u.subs_result_data.status_code == 202 ) {
|
||||
|
||||
cause = CC_CAUSE_OK;
|
||||
|
||||
GSM_DEBUG(DEB_F_PREFIX"B2BCNF subs response = OK\n",
|
||||
DEB_F_PREFIX_ARGS(GSM,fname));
|
||||
|
||||
} else {
|
||||
|
||||
GSM_DEBUG(DEB_F_PREFIX"B2BCNF subs response = ERROR\n",
|
||||
DEB_F_PREFIX_ARGS(GSM,fname));
|
||||
|
||||
cause = CC_CAUSE_ERROR;
|
||||
}
|
||||
|
||||
cc_feature_ack(CC_SRC_GSM, call_id, msg->line_id, CC_FEATURE_B2BCONF, NULL, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will process b2bcnf feature NOTIFY messages.
|
||||
*
|
||||
* @param[in] cmd - command
|
||||
* @param[in] msg - pointer to ccsip_sub_not_data_t
|
||||
*
|
||||
* @return none
|
||||
*
|
||||
* @pre (msg != NULL)
|
||||
*/
|
||||
static void sub_process_b2bcnf_msg (uint32_t cmd, void *msg)
|
||||
{
|
||||
static const char fname[] = "sub_process_b2bcnf_msg";
|
||||
cc_feature_data_t data;
|
||||
callid_t call_id, other_call_id = CC_NO_CALL_ID;
|
||||
|
||||
fsmb2bcnf_get_sub_call_id_from_ccb((fsmcnf_ccb_t *)((ccsip_sub_not_data_t *)msg)->request_id,
|
||||
&call_id, &other_call_id);
|
||||
switch (cmd) {
|
||||
case SUB_MSG_B2BCNF_SUBSCRIBE_RESP:
|
||||
GSM_DEBUG(DEB_F_PREFIX"B2BCNF subs response\n",
|
||||
DEB_F_PREFIX_ARGS(GSM,fname));
|
||||
sub_process_b2bcnf_sub_resp((ccsip_sub_not_data_t *)msg);
|
||||
break;
|
||||
|
||||
case SUB_MSG_B2BCNF_NOTIFY:
|
||||
GSM_DEBUG(DEB_F_PREFIX"B2BCNF subs notify\n",
|
||||
DEB_F_PREFIX_ARGS(GSM,fname));
|
||||
sub_process_feature_notify((ccsip_sub_not_data_t *)msg, call_id, other_call_id);
|
||||
break;
|
||||
case SUB_MSG_B2BCNF_TERMINATE:
|
||||
/*
|
||||
* This is posted by SIP stack if it is shutting down or rolling over.
|
||||
* if so, notify b2bcnf to cleanup state machine.
|
||||
*/
|
||||
GSM_DEBUG(DEB_F_PREFIX"B2BCNF subs terminate\n",
|
||||
DEB_F_PREFIX_ARGS(GSM,fname));
|
||||
|
||||
data.notify.subscription = CC_SUBSCRIPTIONS_REMOTECC;
|
||||
data.notify.method = CC_RCC_METHOD_REFER;
|
||||
data.notify.data.rcc.feature = CC_FEATURE_B2BCONF;
|
||||
|
||||
data.notify.cause = CC_CAUSE_ERROR;
|
||||
|
||||
cc_feature(CC_SRC_GSM, call_id, 0, CC_FEATURE_NOTIFY, &data);
|
||||
|
||||
break;
|
||||
default:
|
||||
GSM_DEBUG(DEB_F_PREFIX"B2BCNF subs unknown event\n",
|
||||
DEB_F_PREFIX_ARGS(GSM,fname));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will process SUBSCRIBED feature NOTIFY messages.
|
||||
*
|
||||
* @param[in] cmd - command
|
||||
* @param[in] msg - pointer to ccsip_sub_not_data_t
|
||||
*
|
||||
* @return none
|
||||
*
|
||||
* @pre (msg != NULL)
|
||||
*/
|
||||
static void sub_process_feature_msg (uint32_t cmd, void *msg)
|
||||
{
|
||||
callid_t call_id;
|
||||
cc_feature_ack_t temp_msg;
|
||||
|
||||
switch (cmd) {
|
||||
case SUB_MSG_FEATURE_SUBSCRIBE_RESP:
|
||||
/*
|
||||
* if the response in non-2xx final, we should reset the active feature.
|
||||
*/
|
||||
call_id = (callid_t)(((ccsip_sub_not_data_t *)msg)->request_id);
|
||||
if (((ccsip_sub_not_data_t *)msg)->u.subs_result_data.status_code > 299) {
|
||||
memset(&temp_msg, 0, sizeof(temp_msg));
|
||||
temp_msg.msg_id = CC_MSG_FEATURE_ACK;
|
||||
temp_msg.src_id = CC_SRC_GSM;
|
||||
temp_msg.call_id = call_id;
|
||||
fim_process_event((void *)&temp_msg, FALSE);
|
||||
}
|
||||
break;
|
||||
case SUB_MSG_FEATURE_NOTIFY:
|
||||
call_id = (callid_t)(((ccsip_sub_not_data_t *)msg)->request_id);
|
||||
sub_process_feature_notify((ccsip_sub_not_data_t *)msg, call_id,
|
||||
CC_NO_CALL_ID);
|
||||
break;
|
||||
case SUB_MSG_FEATURE_TERMINATE:
|
||||
/*
|
||||
* This is posted by SIP stack if it is shutting down or rolling over.
|
||||
* if so, sip stack already cleaned up the subscription. so do nothing.
|
||||
*/
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will process SUBSCRIBED feature NOTIFY messages.
|
||||
*
|
||||
* @param[in] msg - pointer to ccsip_sub_not_data_t
|
||||
*
|
||||
* @return none
|
||||
*
|
||||
* @pre (msg != NULL)
|
||||
*/
|
||||
static void sub_process_feature_notify (ccsip_sub_not_data_t *msg, callid_t call_id,
|
||||
callid_t other_call_id)
|
||||
{
|
||||
static const char fname[] = "sub_process_feature_notify";
|
||||
ccsip_event_data_t *ev_data;
|
||||
cc_feature_ack_t temp_msg;
|
||||
|
||||
|
||||
/*
|
||||
* send response to NOTIFY.
|
||||
*/
|
||||
(void)sub_int_notify_ack(msg->sub_id, SIP_STATUS_SUCCESS, msg->u.notify_ind_data.cseq);
|
||||
|
||||
/*
|
||||
* if the subscription state is terminated, clean up the subscription.
|
||||
*/
|
||||
if (msg->u.notify_ind_data.subscription_state == SUBSCRIPTION_STATE_TERMINATED) {
|
||||
/*
|
||||
* post SIPSPI_EV_CC_SUBSCRIPTION_TERMINATED.
|
||||
* do not force SUB/NOT mgr to cleanup SCB immediately, because we may have to handle digest
|
||||
* challenges to terminating SUBSCRIBE sent.
|
||||
*/
|
||||
(void)sub_int_subscribe_term(msg->sub_id, FALSE, msg->request_id, CC_SUBSCRIPTIONS_REMOTECC);
|
||||
|
||||
}
|
||||
ev_data = msg->u.notify_ind_data.eventData;
|
||||
msg->u.notify_ind_data.eventData = NULL;
|
||||
if (ev_data == NULL) {
|
||||
GSM_ERR_MSG(DEB_F_PREFIX"No body in the NOTIFY message\n",
|
||||
DEB_F_PREFIX_ARGS(GSM, fname));
|
||||
/*
|
||||
* if (no content & subscription state is TERMINATED
|
||||
* then reset active_feature to NONE.
|
||||
*/
|
||||
if (msg->u.notify_ind_data.subscription_state == SUBSCRIPTION_STATE_TERMINATED) {
|
||||
memset(&temp_msg, 0, sizeof(temp_msg));
|
||||
temp_msg.msg_id = CC_MSG_FEATURE_ACK;
|
||||
temp_msg.src_id = CC_SRC_GSM;
|
||||
temp_msg.call_id = call_id;
|
||||
fim_process_event((void *)&temp_msg, FALSE);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// other types of event data is not supported as of now.
|
||||
free_event_data(ev_data);
|
||||
}
|
||||
|
||||
/*
|
||||
* return TRUE if GSM is considered idle,
|
||||
* currently this means lsm is idle
|
||||
* FALSE otherwise.
|
||||
*/
|
||||
boolean
|
||||
gsm_is_idle (void)
|
||||
{
|
||||
if (lsm_is_phone_idle()) {
|
||||
return (TRUE);
|
||||
}
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: destroy_gsm_thread
|
||||
* Description: shutdown gsm and kill gsm thread
|
||||
* Parameters: none
|
||||
* Returns: none
|
||||
*/
|
||||
void destroy_gsm_thread()
|
||||
{
|
||||
static const char fname[] = "destroy_gsm_thread";
|
||||
DEF_DEBUG(DEB_F_PREFIX"Unloading GSM and destroying GSM thread\n",
|
||||
DEB_F_PREFIX_ARGS(SIP_CC_INIT, fname));
|
||||
gsm_shutdown();
|
||||
dp_shutdown();
|
||||
kpml_shutdown();
|
||||
(void) cprDestroyThread(gsm_thread);
|
||||
}
|
6610
libs/sipcc/core/gsm/gsm_sdp.c
Normal file
6610
libs/sipcc/core/gsm/gsm_sdp.c
Normal file
File diff suppressed because it is too large
Load Diff
1914
libs/sipcc/core/gsm/gsm_sdp_crypto.c
Normal file
1914
libs/sipcc/core/gsm/gsm_sdp_crypto.c
Normal file
File diff suppressed because it is too large
Load Diff
66
libs/sipcc/core/gsm/h/fim.h
Executable file
66
libs/sipcc/core/gsm/h/fim.h
Executable file
@ -0,0 +1,66 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _FIM_H_
|
||||
#define _FIM_H_
|
||||
|
||||
#include "sm.h"
|
||||
#include "fsm.h"
|
||||
|
||||
/*
|
||||
* This is an overlay structure.
|
||||
* Every entity cb must have these two fields at the start of the cb
|
||||
*/
|
||||
typedef struct fim_cb_hdr_ {
|
||||
callid_t call_id;
|
||||
int state;
|
||||
} fim_cb_hdr_t;
|
||||
|
||||
#ifndef fim_icb_t__
|
||||
#define fim_icb_t__
|
||||
struct fim_icb_t_;
|
||||
typedef struct fim_icb_t_ fim_icb_t;
|
||||
#endif
|
||||
|
||||
typedef void (*fim_func_t)(fim_icb_t *elem, callid_t call_id);
|
||||
|
||||
typedef struct fim_scb_t_ {
|
||||
fsm_types_t type;
|
||||
sm_table_t *sm;
|
||||
fim_func_t get_cb;
|
||||
fim_func_t free_cb;
|
||||
} fim_scb_t;
|
||||
|
||||
struct fim_icb_t_ {
|
||||
struct fim_icb_t_ *next_chn;
|
||||
struct fim_icb_t_ *next_icb;
|
||||
callid_t call_id;
|
||||
boolean ui_locked;
|
||||
void *cb;
|
||||
fim_scb_t *scb;
|
||||
};
|
||||
|
||||
|
||||
const char *fim_event_name(int event);
|
||||
boolean fim_process_event(void *data, boolean cac_passed);
|
||||
void fim_free_event(void *data);
|
||||
void fim_init(void);
|
||||
void fim_shutdown(void);
|
||||
void fsmcnf_free_cb(fim_icb_t *icb, callid_t call_id);
|
||||
void fsmxfr_free_cb(fim_icb_t *icb, callid_t call_id);
|
||||
void fsmdef_free_cb(fim_icb_t *icb, callid_t call_id);
|
||||
void fsmb2bcnf_free_cb(fim_icb_t *icb, callid_t call_id);
|
||||
|
||||
void fim_lock_ui(callid_t call_id);
|
||||
void fim_unlock_ui(callid_t call_id);
|
||||
|
||||
cc_causes_t
|
||||
fsm_cac_process_bw_avail_resp(void);
|
||||
cc_causes_t
|
||||
fsm_cac_process_bw_failed_resp(void);
|
||||
cc_causes_t
|
||||
fsm_cac_call_bandwidth_req(callid_t call_id, uint32_t sessions,
|
||||
void *msg);
|
||||
|
||||
#endif /* _FIM_H_ */
|
768
libs/sipcc/core/gsm/h/fsm.h
Executable file
768
libs/sipcc/core/gsm/h/fsm.h
Executable file
@ -0,0 +1,768 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _FSM_H_
|
||||
#define _FSM_H_
|
||||
|
||||
#include "cpr_types.h"
|
||||
#include "sm.h"
|
||||
#include "ccapi.h"
|
||||
#include "vcm.h"
|
||||
#include "ccsip_core.h"
|
||||
#include "sll_lite.h"
|
||||
#include "sessionConstants.h"
|
||||
#include "ccsdp.h"
|
||||
|
||||
/* TODO: BLASBERG
|
||||
* fsm.h only needs the following from ccsip_core.h
|
||||
* should put basic sip types into a separate hdr file
|
||||
typedef enum {
|
||||
ALERTING_NONE,
|
||||
ALERTING_OLD,
|
||||
ALERTING_TONE,
|
||||
ALERTING_RING
|
||||
} alertingType;
|
||||
*/
|
||||
|
||||
|
||||
#define FSMCNF_MAX_CCBS (LSM_MAX_LINES)
|
||||
#define FSMXFR_MAX_XCBS (LSM_MAX_LINES)
|
||||
#define FSM_NO_ID (0)
|
||||
#define FSMDEF_NO_DCB (NULL)
|
||||
#define FSMDEF_ERR_ONHOOK_TMR_SECS (20)
|
||||
|
||||
#define FSMDEF_MAX_DIGEST_ALG_LEN 10
|
||||
#define FSMDEF_MAX_DIGEST_LEN 32 * 3
|
||||
|
||||
// Should match define for SIP stack MAX_SIP_URL_LENGTH
|
||||
#define FSMDEF_MAX_CALLER_ID_LEN (256)
|
||||
|
||||
#ifndef fim_icb_t__
|
||||
#define fim_icb_t__
|
||||
struct fim_icb_t_;
|
||||
typedef struct fim_icb_t_ fim_icb_t;
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
PRIMARY,
|
||||
MONITOR,
|
||||
LOCAL_CONF,
|
||||
WHISPER_COACHING
|
||||
} fsm_session_t;
|
||||
|
||||
typedef enum {
|
||||
DIAL_MODE_NUMERIC,
|
||||
DIAL_MODE_URL
|
||||
} dialMode_t;
|
||||
|
||||
typedef enum {
|
||||
FSMDEF_CALL_TYPE_MIN = -1,
|
||||
FSMDEF_CALL_TYPE_NONE = CC_CALL_TYPE_NONE,
|
||||
FSMDEF_CALL_TYPE_INCOMING = CC_CALL_TYPE_INCOMING,
|
||||
FSMDEF_CALL_TYPE_OUTGOING = CC_CALL_TYPE_OUTGOING,
|
||||
FSMDEF_CALL_TYPE_FORWARD = CC_CALL_TYPE_FORWARDED,
|
||||
FSMDEF_CALL_TYPE_MAX
|
||||
} fsmdef_call_types_t;
|
||||
|
||||
typedef enum {
|
||||
FSMDEF_S_MIN = -1,
|
||||
FSMDEF_S_IDLE,
|
||||
FSMDEF_S_COLLECT_INFO,
|
||||
FSMDEF_S_CALL_SENT,
|
||||
FSMDEF_S_OUTGOING_PROCEEDING,
|
||||
FSMDEF_S_KPML_COLLECT_INFO,
|
||||
FSMDEF_S_OUTGOING_ALERTING,
|
||||
FSMDEF_S_INCOMING_ALERTING,
|
||||
FSMDEF_S_CONNECTING,
|
||||
FSMDEF_S_JOINING,
|
||||
FSMDEF_S_CONNECTED,
|
||||
FSMDEF_S_CONNECTED_MEDIA_PEND,
|
||||
FSMDEF_S_RELEASING,
|
||||
FSMDEF_S_HOLD_PENDING,
|
||||
FSMDEF_S_HOLDING,
|
||||
FSMDEF_S_RESUME_PENDING,
|
||||
FSMDEF_S_PRESERVED,
|
||||
FSMDEF_S_MAX
|
||||
} fsmdef_states_t;
|
||||
|
||||
typedef enum {
|
||||
FSMDEF_MRTONE_NO_ACTION = 0,
|
||||
FSMDEF_MRTONE_PLAYED_MONITOR_TONE,
|
||||
FSMDEF_MRTONE_PLAYED_RECORDER_TONE,
|
||||
FSMDEF_MRTONE_PLAYED_BOTH_TONES,
|
||||
FSMDEF_MRTONE_RESUME_MONITOR_TONE,
|
||||
FSMDEF_MRTONE_RESUME_RECORDER_TONE,
|
||||
FSMDEF_MRTONE_RESUME_BOTH_TONES
|
||||
} fsmdef_monrec_tone_action_e;
|
||||
|
||||
typedef enum {
|
||||
FSMDEF_PLAYTONE_NO_ACTION = 0,
|
||||
FSMDEF_PLAYTONE_ZIP
|
||||
} fsmdef_play_tone_action_e;
|
||||
|
||||
/* Local crypto parameter is the local parameters to offer */
|
||||
typedef struct fsmdef_crypto_param_t_ {
|
||||
int32_t tag; /* crypto attribute tag */
|
||||
vcm_crypto_algorithmID algorithmID; /* encryption algorithm. */
|
||||
vcm_crypto_key_t key; /* local key */
|
||||
} fsmdef_crypto_param_t;
|
||||
|
||||
/* Negotiated crypto parameter */
|
||||
#define FSMDEF_CRYPTO_TX_CHANGE (1 << 0) /* crypto Tx parms. change */
|
||||
#define FSMDEF_CRYPTO_RX_CHANGE (1 << 1) /* crypto Tx parms. change */
|
||||
typedef struct fsmdef_negotiated_crypto_t_ {
|
||||
int32_t tag; /* crypto attribute tag */
|
||||
vcm_crypto_algorithmID algorithmID; /* algorithm ID */
|
||||
vcm_crypto_key_t tx_key; /* tx key */
|
||||
vcm_crypto_key_t rx_key; /* rx key */
|
||||
uint32_t flags; /* misc. flags. */
|
||||
char algorithm[FSMDEF_MAX_DIGEST_ALG_LEN];
|
||||
char digest[FSMDEF_MAX_DIGEST_LEN];
|
||||
} fsmdef_negotiated_crypto_t;
|
||||
|
||||
/*
|
||||
* Saved attributes of interest from previously received SDP
|
||||
*/
|
||||
typedef struct fsmdef_previous_sdp_ {
|
||||
uint16_t dest_port;
|
||||
cpr_ip_addr_t dest_addr;
|
||||
int32_t avt_payload_type;
|
||||
|
||||
/*
|
||||
* This field contains the number of elements in the payloads field.
|
||||
*/
|
||||
int32_t num_payloads;
|
||||
vcm_payload_info_t* payloads;
|
||||
|
||||
uint16_t packetization_period;
|
||||
uint16_t max_packetization_period;
|
||||
sdp_direction_e direction;
|
||||
int32_t tias_bw;
|
||||
int32_t profile_level;
|
||||
} fsmdef_previous_sdp_t;
|
||||
|
||||
typedef struct fsmdef_media_t_ {
|
||||
sll_lite_node_t node; /* link node, must be first member of struct */
|
||||
media_refid_t refid; /* media reference id */
|
||||
sdp_media_e type; /* audio, video etc. media */
|
||||
sdp_addrtype_e addr_type;/* ipv4, ipv6 */
|
||||
int32_t avt_payload_type;
|
||||
vcm_vad_t vad;
|
||||
uint16_t packetization_period;
|
||||
uint16_t max_packetization_period;
|
||||
uint16_t mode;
|
||||
uint16_t level;
|
||||
boolean direction_set;
|
||||
sdp_direction_e direction; /* current negotiated direction */
|
||||
sdp_direction_e support_direction; /* supported direction */
|
||||
sdp_transport_e transport;
|
||||
uint16_t src_port; /* source port for this media stream */
|
||||
cpr_ip_addr_t src_addr; /* source addr for this media stream */
|
||||
uint16_t dest_port; /* destination port for this media stream */
|
||||
cpr_ip_addr_t dest_addr; /* destination addr for this media straam */
|
||||
/* Flag to indicate if Multicast */
|
||||
boolean is_multicast;
|
||||
uint16_t multicast_port;
|
||||
/*
|
||||
* rcv_chan indicates if the receive media stream has been opened
|
||||
*/
|
||||
boolean rcv_chan;
|
||||
/*
|
||||
* xmit_chan indicates if the transmit media stream has been opened
|
||||
*/
|
||||
boolean xmit_chan;
|
||||
|
||||
/*
|
||||
* SRTP support.
|
||||
*/
|
||||
fsmdef_negotiated_crypto_t negotiated_crypto;
|
||||
|
||||
/*
|
||||
* Local crypto holds the local offered crypto set, keeps it in the
|
||||
* dcb for fast access. The alternative to be kept in the
|
||||
* SDP structure but is slower in retrieving it. In the future,
|
||||
* it is possible that more than 1 crypto lines are offered but
|
||||
* for now it is one.
|
||||
*/
|
||||
fsmdef_crypto_param_t local_crypto;
|
||||
|
||||
/*
|
||||
* Used to track previously received SDP for comparisons to
|
||||
* newly received media to determine if RTP port recycling is
|
||||
* required. Eliminates unnecessary recycling of ports which
|
||||
* causes breaks in the audio stream.
|
||||
*/
|
||||
fsmdef_previous_sdp_t previous_sdp;
|
||||
|
||||
/*
|
||||
* hold tracks the hold state. The flag is a bit map so it is possible that
|
||||
* the phone may have multiple holding states, ie. local and remote
|
||||
*/
|
||||
uint32_t hold;
|
||||
/*
|
||||
* Flags fields for various bit flags
|
||||
*/
|
||||
#define FSM_MEDIA_F_SUPPORT_SECURITY (1 << 0) /* supported security */
|
||||
uint32_t flags;
|
||||
|
||||
/*
|
||||
* capability index. The index into the media capbilty table
|
||||
* that this media entry is coresponding to.
|
||||
*/
|
||||
uint8_t cap_index;
|
||||
|
||||
/* Values cached from attributes */
|
||||
int32_t tias_bw;
|
||||
int32_t profile_level;
|
||||
|
||||
void *video;
|
||||
|
||||
/* ICE Candidates */
|
||||
char **candidatesp;
|
||||
int candidate_ct;
|
||||
|
||||
/*
|
||||
* rtcp-mux indicates media stream is muxed for RTP and RTCP
|
||||
*/
|
||||
boolean rtcp_mux;
|
||||
|
||||
/*
|
||||
* port number used in m= data channel line
|
||||
*/
|
||||
uint16_t sctp_port;
|
||||
|
||||
/*
|
||||
* Data Channel properties
|
||||
*/
|
||||
uint32 streams;
|
||||
char *protocol;
|
||||
|
||||
/*
|
||||
* This field contains the number of elements in the payloads field.
|
||||
*/
|
||||
int32_t num_payloads;
|
||||
|
||||
/*
|
||||
* List of active lists of payloads negotiated
|
||||
*/
|
||||
vcm_payload_info_t* payloads;
|
||||
|
||||
} fsmdef_media_t;
|
||||
|
||||
struct fsm_fcb_t_;
|
||||
|
||||
typedef struct {
|
||||
callid_t call_id;
|
||||
callid_t join_call_id;
|
||||
line_t line;
|
||||
cc_caller_id_t caller_id;
|
||||
groupid_t group_id;
|
||||
int digit_cnt;
|
||||
fsmdef_call_types_t call_type;
|
||||
fsm_session_t session;
|
||||
boolean send_release;
|
||||
int msgs_sent;
|
||||
int msgs_rcvd;
|
||||
boolean onhook_received;
|
||||
|
||||
/*
|
||||
* inband indicates if inband alerting is active
|
||||
*/
|
||||
boolean inband;
|
||||
|
||||
/*
|
||||
* inband_received indicates if inband alerting has been received.
|
||||
* Once set, this bool stays set until dcb is reset.
|
||||
*/
|
||||
boolean inband_received;
|
||||
|
||||
/*
|
||||
* outofband tracks the payload type for outofband DTMF
|
||||
*/
|
||||
int outofband;
|
||||
|
||||
/*
|
||||
* Boolean indication of whether call was originated by phone or
|
||||
* far end party.
|
||||
*/
|
||||
boolean inbound;
|
||||
|
||||
/*
|
||||
* The following data tracks the RTP info
|
||||
*/
|
||||
boolean remote_sdp_present;
|
||||
boolean remote_sdp_in_ack;
|
||||
uint16_t src_sdp_version;
|
||||
cc_sdp_t *sdp;
|
||||
|
||||
/* media list corresponding to m lines */
|
||||
sll_lite_list_t media_list;
|
||||
|
||||
/*
|
||||
* dial_mode tracks the state of the dialing mode icon, ie. alphanumeric or
|
||||
* numeric
|
||||
*/
|
||||
dialMode_t dial_mode;
|
||||
|
||||
/*
|
||||
* pd_updated tracks whether or not the personal directory has
|
||||
* been updated
|
||||
*/
|
||||
boolean pd_updated;
|
||||
|
||||
/* tracks the ringing pattern to play */
|
||||
vcm_ring_mode_t alerting_ring;
|
||||
|
||||
/* tracks the tone to play */
|
||||
vcm_tones_t alerting_tone;
|
||||
|
||||
/* tracks the direction to play the tone. */
|
||||
uint16_t tone_direction;
|
||||
|
||||
/* Was an alert-info header present, if so what did it contain */
|
||||
cc_alerting_type alert_info;
|
||||
|
||||
/* used to determine when SIP stack releases the call early. */
|
||||
boolean early_error_release;
|
||||
|
||||
/* used to determine when we are played a tone via the dialplan */
|
||||
boolean dialplan_tone;
|
||||
|
||||
/* active tone (i.e. tone currently being played or requested to be played) */
|
||||
vcm_tones_t active_tone;
|
||||
|
||||
/* indicates the action of monitor and recorder tones */
|
||||
fsmdef_monrec_tone_action_e monrec_tone_action;
|
||||
|
||||
/* monitor/recorder tone direction to play out to */
|
||||
uint16_t monitor_tone_direction;
|
||||
uint16_t recorder_tone_direction;
|
||||
|
||||
/* indicates the action of play tone for a single time */
|
||||
fsmdef_play_tone_action_e play_tone_action;
|
||||
|
||||
struct fsm_fcb_t_ *fcb;
|
||||
|
||||
/* Feature that is currently active */
|
||||
cc_features_t active_feature;
|
||||
|
||||
/* Reason for hold */
|
||||
cc_hold_resume_reason_e hold_reason;
|
||||
|
||||
/* Feature invocation state.
|
||||
* Each feature will correspond to unique bit in variable.
|
||||
* Bit will be Set if feature is invoked and awaiting feature ACK.
|
||||
* Bit will be Cleared if feature is ACKed or not yet invoked.
|
||||
* Each array element will hold invocation state for 32 features.
|
||||
* The resource manager utility is utilized to maintain the bit settings.
|
||||
*/
|
||||
void *feature_invocation_state;
|
||||
|
||||
/* TRUE if CCM has requested phone to show ringout UI */
|
||||
boolean spoof_ringout_requested;
|
||||
/* TRUE if GSM has applied ringout due to CCMs request to show ringout UI */
|
||||
boolean spoof_ringout_applied;
|
||||
|
||||
/* Timer to go on hook after any call error */
|
||||
cprTimer_t err_onhook_tmr;
|
||||
|
||||
/* Request pending timer */
|
||||
cprTimer_t req_pending_tmr;
|
||||
|
||||
/* Ringback delay timer */
|
||||
cprTimer_t ringback_delay_tmr;
|
||||
|
||||
/*
|
||||
* save of orientation from callInfo to update UI at any time
|
||||
* other than during call info. update such as after Tx start in
|
||||
* order to update security icon.
|
||||
*/
|
||||
cc_orientation_e orientation;
|
||||
|
||||
/*
|
||||
* This boolean is used to short circuit sending UI update requests to the platform
|
||||
* so that requests are only made when one of the call ui components requires
|
||||
* updating. The same is done for placed call history.
|
||||
*/
|
||||
boolean ui_update_required;
|
||||
boolean placed_call_update_required;
|
||||
|
||||
boolean is_conf_call;
|
||||
|
||||
cc_security_e security;
|
||||
cc_policy_e policy;
|
||||
|
||||
/* auto answer timer */
|
||||
cprTimer_t autoAnswerTimer;
|
||||
int32_t reversionInterval;
|
||||
cprTimer_t revertTimer;
|
||||
|
||||
boolean dsp_out_of_resources;
|
||||
|
||||
boolean selected;
|
||||
|
||||
boolean select_pending;
|
||||
|
||||
boolean call_not_counted_in_mnc_bt;
|
||||
|
||||
/*
|
||||
* The media_cap holds the current media caps of the call
|
||||
*/
|
||||
cc_media_cap_table_t *media_cap_tbl;
|
||||
|
||||
/*
|
||||
* Holds the remote stream track information to be passed to UI
|
||||
*/
|
||||
cc_media_remote_stream_table_t *remote_media_stream_tbl;
|
||||
|
||||
/*
|
||||
* Holds the local stream track information passed in from the UI
|
||||
*/
|
||||
cc_media_local_track_table_t *local_media_track_tbl;
|
||||
|
||||
#define FSMDEF_F_HOLD_REQ_PENDING (1 << 0)/* hold feature pending */
|
||||
#define FSMDEF_F_XFER_COMPLETE (1 << 1)/* hold feature pending */
|
||||
uint32_t flags; /* misc. flags. */
|
||||
|
||||
int log_disp;
|
||||
|
||||
uint8_t cur_video_avail;
|
||||
sdp_direction_e video_pref;
|
||||
unsigned int callref; /* Callref (CI) from CUCM */
|
||||
|
||||
char peerconnection[PC_HANDLE_SIZE]; /* A handle to the peerconnection */
|
||||
boolean peerconnection_set;
|
||||
|
||||
char *ice_ufrag;
|
||||
char *ice_pwd;
|
||||
char ice_default_candidate_addr[MAX_IPADDR_STR_LEN];
|
||||
|
||||
char digest_alg[FSMDEF_MAX_DIGEST_ALG_LEN];
|
||||
char digest[FSMDEF_MAX_DIGEST_LEN];
|
||||
|
||||
} fsmdef_dcb_t;
|
||||
|
||||
typedef enum fsm_types_t_ {
|
||||
FSM_TYPE_MIN = -1,
|
||||
FSM_TYPE_NONE = FSM_TYPE_MIN,
|
||||
FSM_TYPE_HEAD,
|
||||
FSM_TYPE_CNF,
|
||||
FSM_TYPE_B2BCNF,
|
||||
FSM_TYPE_XFR,
|
||||
FSM_TYPE_DEF,
|
||||
FSM_TYPE_MAX
|
||||
} fsm_types_t;
|
||||
|
||||
typedef enum fsm_hold_t_ {
|
||||
FSM_HOLD_MIN = -1,
|
||||
FSM_HOLD_NONE = 0,
|
||||
FSM_HOLD_LCL = 1,
|
||||
FSM_HOLD_MAX = 2
|
||||
} fsm_hold_t;
|
||||
|
||||
typedef struct fsm_data_def_t_ {
|
||||
int hold;
|
||||
} fsm_data_def_t;
|
||||
|
||||
typedef struct fsm_data_xfr_t_ {
|
||||
int xfr_id;
|
||||
} fsm_data_xfr_t;
|
||||
|
||||
typedef struct fsm_data_t_ {
|
||||
union {
|
||||
fsm_data_def_t def;
|
||||
fsm_data_xfr_t xfr;
|
||||
} data;
|
||||
} fsm_data_t;
|
||||
|
||||
typedef struct fsmcnf_ccb_t_ {
|
||||
cc_srcs_t cnf_orig;
|
||||
int cnf_id;
|
||||
callid_t cnf_call_id;
|
||||
callid_t cns_call_id;
|
||||
line_t cnf_line;
|
||||
line_t cns_line;
|
||||
boolean active;
|
||||
boolean bridged;
|
||||
|
||||
/* The following field encodes flags */
|
||||
#define JOINED 0x1
|
||||
#define XFER 0x2
|
||||
#define LCL_CNF 0x4
|
||||
uint32_t flags;
|
||||
boolean cnf_ftr_ack;
|
||||
} fsmcnf_ccb_t;
|
||||
|
||||
typedef enum fsmxfr_types_t_ {
|
||||
FSMXFR_TYPE_MIN = -1,
|
||||
FSMXFR_TYPE_NONE,
|
||||
FSMXFR_TYPE_XFR,
|
||||
FSMXFR_TYPE_BLND_XFR,
|
||||
FSMXFR_TYPE_DIR_XFR,
|
||||
FSMXFR_TYPE_MAX
|
||||
} fsmxfr_types_t;
|
||||
|
||||
typedef enum fsmxfr_modes_t_ {
|
||||
FSMXFR_MODE_MIN = -1,
|
||||
FSMXFR_MODE_TRANSFEROR,
|
||||
FSMXFR_MODE_TRANSFEREE,
|
||||
FSMXFR_MODE_TARGET
|
||||
} fsmxfr_modes_t;
|
||||
|
||||
struct fsmxfr_xcb_t_;
|
||||
typedef struct fsmxfr_xcb_t_ {
|
||||
cc_srcs_t xfr_orig;
|
||||
int xfr_id;
|
||||
callid_t xfr_call_id;
|
||||
callid_t cns_call_id;
|
||||
line_t xfr_line;
|
||||
line_t cns_line;
|
||||
fsmxfr_types_t type;
|
||||
cc_xfer_methods_t method;
|
||||
char *dialstring;
|
||||
char *queued_dialstring;
|
||||
char *referred_by;
|
||||
boolean active;
|
||||
boolean cnf_xfr;
|
||||
boolean xfer_comp_req;
|
||||
fsmxfr_modes_t mode;
|
||||
struct fsmxfr_xcb_t_ *xcb2;
|
||||
} fsmxfr_xcb_t;
|
||||
|
||||
|
||||
typedef struct fsm_fcb_t_ {
|
||||
callid_t call_id;
|
||||
|
||||
int state;
|
||||
int old_state;
|
||||
|
||||
fsm_types_t fsm_type;
|
||||
|
||||
|
||||
/*
|
||||
* fsmdef specific data
|
||||
*/
|
||||
fsmdef_dcb_t *dcb;
|
||||
|
||||
/*
|
||||
* fsmxfr specific data
|
||||
*/
|
||||
|
||||
fsmxfr_xcb_t *xcb;
|
||||
/*
|
||||
* fsmcnf specific data
|
||||
*/
|
||||
fsmcnf_ccb_t *ccb;
|
||||
|
||||
/*
|
||||
* fsmb2bcnf specific data
|
||||
*/
|
||||
fsmcnf_ccb_t *b2bccb;
|
||||
|
||||
} fsm_fcb_t;
|
||||
|
||||
typedef enum {
|
||||
FSMDEF_MSG_MIN = -1,
|
||||
FSMDEF_MSG_NONE = 0,
|
||||
FSMDEF_MSG_SETUP = 1,
|
||||
FSMDEF_MSG_SETUP_ACK = 2,
|
||||
FSMDEF_MSG_PROCEEDING = 4,
|
||||
FSMDEF_MSG_ALERTING = 8,
|
||||
FSMDEF_MSG_CONNECTED = 16,
|
||||
FSMDEF_MSG_CONNECTED_ACK = 32,
|
||||
FSMDEF_MSG_RELEASE = 64,
|
||||
FSMDEF_MSG_RELEASE_COMPLETE = 128,
|
||||
FSMDEF_MSG_MAX
|
||||
} fsmdef_msgs_t;
|
||||
|
||||
#define FSM_FOR_ALL_CBS(cb, cbs, max_cbs) \
|
||||
for ((cb) = (cbs); (cb) <= &((cbs)[(max_cbs-1)]); (cb)++)
|
||||
|
||||
#define FSM_CHK_FLAGS(flags, flag) ((flags) & (flag))
|
||||
#define FSM_SET_FLAGS(flags, flag) ((flags) |= (flag))
|
||||
#define FSM_RESET_FLAGS(flags, flag) ((flags) &= ~(flag))
|
||||
void *fsmdef_feature_timer_timeout(cc_features_t feature_id, void *);
|
||||
void fsmdef_end_call(fsmdef_dcb_t *dcb, cc_causes_t cause);
|
||||
void fsm_sm_ftr(cc_features_t ftr_id, cc_srcs_t src_id);
|
||||
void fsm_sm_ignore_ftr(fsm_fcb_t *fcb, int fname,
|
||||
cc_features_t ftr_id);
|
||||
void fsm_sm_ignore_src(fsm_fcb_t *fcb, int fname, cc_srcs_t src_id);
|
||||
const char *fsm_state_name(fsm_types_t type, int id);
|
||||
const char *fsm_type_name(fsm_types_t type);
|
||||
fsmdef_dcb_t *fsm_get_dcb(callid_t call_id);
|
||||
void fsm_init_scb(fim_icb_t *icb, callid_t call_id);
|
||||
fsm_fcb_t *fsm_get_fcb_by_call_id(callid_t call_id);
|
||||
fsm_fcb_t *fsm_get_fcb_by_call_id_and_type(callid_t call_id, fsm_types_t type);
|
||||
void
|
||||
fsm_get_fcb_by_selected_or_connected_call_fcb(callid_t call_id, fsm_fcb_t **con_fcb_found,
|
||||
fsm_fcb_t **sel_fcb_found);
|
||||
fsm_fcb_t *fsm_get_new_fcb(callid_t call_id, fsm_types_t fsm_type);
|
||||
void fsm_init(void);
|
||||
void fsm_shutdown(void);
|
||||
void fsm_release(fsm_fcb_t *fcb, int fname, cc_causes_t cause);
|
||||
void fsm_change_state(fsm_fcb_t *fcb, int fname, int new_state);
|
||||
void fsm_init_fcb(fsm_fcb_t *fcb, callid_t call_id, fsmdef_dcb_t *dcb,
|
||||
fsm_types_t type);
|
||||
void fsm_display_no_free_lines(void);
|
||||
void fsm_display_use_line_or_join_to_complete(void);
|
||||
void fsm_display_feature_unavailable(void);
|
||||
void fsm_set_call_status_feature_unavailable(callid_t call_id, line_t line);
|
||||
|
||||
cc_causes_t fsm_get_new_outgoing_call_context(callid_t call_id, line_t line,
|
||||
fsm_fcb_t *fcb, boolean expline);
|
||||
cc_causes_t fsm_get_new_incoming_call_context(callid_t call_id, fsm_fcb_t *fcb,
|
||||
const char *called_number,
|
||||
boolean expline);
|
||||
sm_rcs_t fsmdef_release(fsm_fcb_t *fcb, cc_causes_t cause,
|
||||
boolean send_release);
|
||||
int fsmdef_get_call_type_by_call_id(callid_t call_id);
|
||||
fsmdef_call_types_t fsmdef_get_call_id_by_call_ref(int call_ref);
|
||||
fsmdef_dcb_t *fsmdef_get_dcb_by_call_id(callid_t call_id);
|
||||
void fsmdef_init_dcb(fsmdef_dcb_t *dcb, callid_t call_id,
|
||||
fsmdef_call_types_t call_type,
|
||||
const char *called_number, line_t line,
|
||||
fsm_fcb_t *fcb);
|
||||
cc_causes_t fsm_set_fcb_dcbs (fsmdef_dcb_t *dcb);
|
||||
fsmdef_dcb_t *fsmdef_get_new_dcb(callid_t call_id);
|
||||
void fsmdef_init(void);
|
||||
int fsmdef_get_active_call_cnt(callid_t callId);
|
||||
fsmdef_dcb_t *fsmdef_get_connected_call(void);
|
||||
boolean fsmdef_are_join_calls_on_same_line(line_t line);
|
||||
boolean fsmdef_are_there_selected_calls_onotherline(line_t line);
|
||||
fsmdef_dcb_t *fsmdef_get_other_dcb_by_line(callid_t call_id, line_t line);
|
||||
int fsmdef_get_dcbs_in_held_state(fsmdef_dcb_t **dcb,
|
||||
callid_t ignore_call_id);
|
||||
sm_rcs_t fsmdef_offhook(fsm_fcb_t *fcb, cc_msgs_t msg_id, callid_t call_id,
|
||||
line_t line, const char *dial_string, sm_event_t *event,
|
||||
char *global_call_id, callid_t prim_call_id,
|
||||
cc_hold_resume_reason_e consult_reason,
|
||||
monitor_mode_t monitor_mode);
|
||||
|
||||
sm_rcs_t fsmdef_dialstring(fsm_fcb_t *fcb, const char *dialstring,
|
||||
cc_redirect_t *redirect, boolean replace,
|
||||
cc_call_info_t *call_info);
|
||||
|
||||
fsmcnf_ccb_t *fsmcnf_get_ccb_by_call_id(callid_t call_id);
|
||||
callid_t fsmcnf_get_other_call_id(fsmcnf_ccb_t *ccb, callid_t call_id);
|
||||
|
||||
void fsmxfr_update_xfr_context(fsmxfr_xcb_t *xcb, callid_t old_call_id,
|
||||
callid_t new_call_id);
|
||||
fsmxfr_xcb_t *fsmxfr_get_xcb_by_call_id(callid_t call_id);
|
||||
callid_t fsmxfr_get_other_call_id(fsmxfr_xcb_t *xcb, callid_t call_id);
|
||||
fsmxfr_types_t fsmxfr_get_xfr_type(callid_t call_id);
|
||||
cc_features_t fsmxfr_type_to_feature(fsmxfr_types_t type);
|
||||
|
||||
#ifdef _WIN32
|
||||
extern void NotifyStateChange(callid_t callid, int32_t state);
|
||||
#define NOTIFY_STATE_CHANGE(fcb,callid,state) NotifyStateChange(callid,state);dcsm_update_gsm_state(fcb,callid,state)
|
||||
#else
|
||||
#define NOTIFY_STATE_CHANGE(fcb,callid,state) dcsm_update_gsm_state(fcb,callid,state)
|
||||
#endif
|
||||
|
||||
const char *fsmdef_state_name(int id);
|
||||
const char *fsmxfr_state_name(int id);
|
||||
const char *fsmcnf_state_name(int id);
|
||||
|
||||
void fsm_cac_init(void);
|
||||
void fsmcnf_init(void);
|
||||
void fsmxfr_init(void);
|
||||
void fsmdef_init(void);
|
||||
void fsmcnf_shutdown(void);
|
||||
void fsmxfr_shutdown(void);
|
||||
void fsmdef_shutdown(void);
|
||||
void fsm_cac_shutdown(void);
|
||||
void fsm_cac_call_release_cleanup(callid_t call_id);
|
||||
|
||||
void fsmdef_reversion_timeout(callid_t call_id);
|
||||
void fsm_cac_process_bw_fail_timer(void *tmr_data);
|
||||
void fsmdef_auto_answer_timeout(void *);
|
||||
const char *fsmb2bcnf_state_name(int id);
|
||||
void fsmb2bcnf_init(void);
|
||||
void fsmb2bcnf_shutdown(void);
|
||||
int fsmutil_is_b2bcnf_consult_call(callid_t call_id);
|
||||
callid_t fsmxfr_get_consult_call_id(callid_t call_id);
|
||||
callid_t fsmb2bcnf_get_consult_call_id(callid_t call_id);
|
||||
callid_t fsmb2bcnf_get_primary_call_id(callid_t call_id);
|
||||
boolean fsmdef_check_if_ok_for_dial_call(line_t line);
|
||||
boolean fsmdef_check_if_ok_to_ans_call(line_t line, callid_t call_id);
|
||||
boolean fsmdef_check_if_ok_to_resume_call(line_t line, callid_t call_id);
|
||||
boolean fsmdef_check_if_ok_to_hold_call(line_t line, callid_t call_id);
|
||||
boolean fsmdef_check_if_ok_to_monitor_update_call(line_t line, callid_t call_id);
|
||||
boolean fsmdef_check_if_ok_to_run_feature(line_t line, callid_t call_id);
|
||||
fsmdef_dcb_t *fsmdef_get_dcb_by_call_instance_id(line_t line,
|
||||
uint16 call_instance_id);
|
||||
boolean fsmb2bcnf_check_if_ok_to_setup_conf (callid_t call_id);
|
||||
boolean fsmdef_check_if_chaperone_call_exist (void);
|
||||
void fsmdef_call_cc_state_dialing(fsmdef_dcb_t *dcb, boolean suppressStutter);
|
||||
/* This macro is to identify incoming joining call */
|
||||
#define fsm_is_joining_call(feat_data) \
|
||||
((feat_data.newcall.join.join_call_id != CC_NO_CALL_ID) && \
|
||||
((feat_data.newcall.cause == CC_CAUSE_BARGE) || \
|
||||
(feat_data.newcall.cause == CC_CAUSE_MONITOR)))
|
||||
/* These macros are for SRTP support */
|
||||
#define FSM_GET_SECURITY_STATUS(dcb) (dcb->security)
|
||||
#define FSM_SET_SECURITY_STATUS(dcb, status) (dcb->security = status)
|
||||
#define FSM_GET_POLICY(dcb) (dcb->policy)
|
||||
#define FSM_SET_POLICY(dcb, status) (dcb->policy = status)
|
||||
#define FSM_GET_CACHED_ORIENTATION(dcb) (dcb->orientation)
|
||||
#define FSM_SET_CACHED_ORIENTATION(dcb, value) (dcb->orientation = value)
|
||||
#define FSM_NEGOTIATED_CRYPTO_ALGORITHM_ID(media) \
|
||||
((media->transport == SDP_TRANSPORT_RTPSAVP || \
|
||||
media->transport == SDP_TRANSPORT_RTPSAVPF) ? \
|
||||
media->negotiated_crypto.algorithmID : VCM_NO_ENCRYPTION)
|
||||
#define FSM_NEGOTIATED_CRYPTO_RX_KEY(media) \
|
||||
&media->negotiated_crypto.rx_key
|
||||
#define FSM_NEGOTIATED_CRYPTO_TX_KEY(media) \
|
||||
&media->negotiated_crypto.tx_key
|
||||
|
||||
#define FSM_NEGOTIATED_CRYPTO_DIGEST_ALGORITHM(media) \
|
||||
media->negotiated_crypto.algorithm
|
||||
|
||||
#define FSM_NEGOTIATED_CRYPTO_DIGEST(media) \
|
||||
media->negotiated_crypto.digest
|
||||
|
||||
int fsmutil_get_call_attr(fsmdef_dcb_t *dcb, line_t line, callid_t call_id);
|
||||
uint16_t fsmutil_get_ci_id(line_t line);
|
||||
void fsmutil_init_ci_map(void);
|
||||
void fsmdef_platform_dcb_init(fsmdef_dcb_t *dcb);
|
||||
void fsmutil_free_all_ci_id(void);
|
||||
void fsmutil_free_ci_id(uint16_t id, line_t line);
|
||||
void fsmutil_set_ci_id(uint16_t id, line_t line);
|
||||
void fsmutil_free_ci_map(void);
|
||||
void fsmutil_show_ci_map(void);
|
||||
void fsmutil_init_shown_calls_ci_map(void);
|
||||
void fsmutil_free_all_shown_calls_ci_map(void);
|
||||
void fsmutil_clear_shown_calls_ci_element(uint16_t id, line_t line);
|
||||
void fsmutil_set_shown_calls_ci_element(uint16_t id, line_t line);
|
||||
boolean fsmutil_is_shown_calls_ci_element_set(uint16_t id, line_t line);
|
||||
|
||||
|
||||
callid_t fsmxfr_get_primary_call_id(callid_t call_id);
|
||||
uint16_t fsmutil_get_num_selected_calls(void);
|
||||
int fsmutil_is_cnf_consult_call(callid_t call_id);
|
||||
int fsmutil_is_cnf_consult_leg(callid_t call_id, fsmcnf_ccb_t *fsmcnf_ccbs,
|
||||
uint16_t max_ccbs);
|
||||
int fsmutil_is_xfr_consult_call(callid_t call_id);
|
||||
int fsmutil_is_xfr_consult_leg(callid_t call_id, fsmxfr_xcb_t *fsmxfr_xcbs,
|
||||
uint16_t max_xcbs);
|
||||
void fsmutil_init_groupid(fsmdef_dcb_t *dcb, callid_t call_id,
|
||||
fsmdef_call_types_t call_type);
|
||||
void fsmutil_process_feature_ack(fsmdef_dcb_t *dcb, cc_features_t feature_id);
|
||||
void fsmutil_clear_all_feature_invocation_state(fsmdef_dcb_t *dcb);
|
||||
void fsmutil_init_feature_invocation_state(fsmdef_dcb_t *dcb);
|
||||
void fsmutil_free_feature_invocation_state(fsmdef_dcb_t *dcb);
|
||||
|
||||
void fsmdef_error_onhook_timeout(void *data);
|
||||
|
||||
int fsmutil_is_xfr_leg(callid_t call_id, fsmxfr_xcb_t *fsmxfr_xcbs,
|
||||
unsigned short max_xcbs);
|
||||
int fsmutil_is_cnf_leg(callid_t call_id, fsmcnf_ccb_t *fsmcnf_ccbs,
|
||||
unsigned short max_ccbs);
|
||||
|
||||
void fsm_display_control_ringin_calls(boolean hide);
|
||||
void fsmdef_update_media_cap_feature_event(cc_feature_t *msg);
|
||||
boolean fsmcnd_conf_call_id_valid(fsmcnf_ccb_t *ccb);
|
||||
|
||||
boolean fsmdef_check_retain_fwd_info_state(void);
|
||||
#endif
|
59
libs/sipcc/core/gsm/h/gsm.h
Executable file
59
libs/sipcc/core/gsm/h/gsm.h
Executable file
@ -0,0 +1,59 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _GSM_H_
|
||||
#define _GSM_H_
|
||||
|
||||
#include "cpr_types.h"
|
||||
#include "cpr_memory.h"
|
||||
#include "cpr_ipc.h"
|
||||
#include "cpr_stdio.h"
|
||||
|
||||
#define GSM_ERR_MSG err_msg
|
||||
typedef void(* media_timer_callback_fp) (void);
|
||||
void gsm_set_media_callback(media_timer_callback_fp* callback);
|
||||
|
||||
void gsm_set_initialized(void);
|
||||
cpr_status_e gsm_send_msg(uint32_t cmd, cprBuffer_t buf, uint16_t len);
|
||||
cprBuffer_t gsm_get_buffer(uint16_t size);
|
||||
boolean gsm_is_idle(void);
|
||||
|
||||
/*
|
||||
* List of timers that the GSM task is responsible for.
|
||||
* CPR will send a msg to the GSM task when these
|
||||
* timers expire. CPR expects a timer id when the timer
|
||||
* is created, this enum serves that purpose.
|
||||
*/
|
||||
typedef enum {
|
||||
GSM_ERROR_ONHOOK_TIMER,
|
||||
GSM_AUTOANSWER_TIMER,
|
||||
GSM_DIAL_TIMEOUT_TIMER,
|
||||
GSM_KPML_INTER_DIGIT_TIMER,
|
||||
GSM_KPML_CRITICAL_DIGIT_TIMER,
|
||||
GSM_KPML_EXTRA_DIGIT_TIMER,
|
||||
GSM_KPML_SUBSCRIPTION_TIMER,
|
||||
GSM_MULTIPART_TONES_TIMER,
|
||||
GSM_CONTINUOUS_TONES_TIMER,
|
||||
GSM_REQ_PENDING_TIMER,
|
||||
GSM_RINGBACK_DELAY_TIMER,
|
||||
GSM_REVERSION_TIMER,
|
||||
GSM_FLASH_ONCE_TIMER,
|
||||
GSM_CAC_FAILURE_TIMER,
|
||||
GSM_TONE_DURATION_TIMER
|
||||
} gsmTimerList_t;
|
||||
|
||||
/*
|
||||
* The common code creating the GSM timers needs to have
|
||||
* access to the gsm_msg_queue variable since CPR
|
||||
* needs to know where to send the timer expiration
|
||||
* message.
|
||||
*/
|
||||
extern cprMsgQueue_t gsm_msg_queue;
|
||||
|
||||
extern void kpml_process_msg(uint32_t cmd, void *msg);
|
||||
extern void dp_process_msg(uint32_t cmd, void *msg);
|
||||
extern void kpml_init(void);
|
||||
extern void kpml_shutdown(void);
|
||||
|
||||
#endif
|
139
libs/sipcc/core/gsm/h/gsm_sdp.h
Normal file
139
libs/sipcc/core/gsm/h/gsm_sdp.h
Normal file
@ -0,0 +1,139 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _GSM_SDP_H_
|
||||
#define _GSM_SDP_H_
|
||||
|
||||
|
||||
#define GSMSDP_VERSION_STR_LEN (20)
|
||||
|
||||
#define GSMSDP_MEDIA_VALID(media) \
|
||||
((media != NULL) && (media->refid != CC_NO_MEDIA_REF_ID))
|
||||
|
||||
#define GSMSDP_MEDIA_ENABLED(media) \
|
||||
(GSMSDP_MEDIA_VALID(media) && (media->src_port != 0))
|
||||
|
||||
#define GSMSDP_MEDIA_COUNT(dcb) \
|
||||
(SLL_LITE_NODE_COUNT(&dcb->media_list))
|
||||
|
||||
#define GSMSDP_FIRST_MEDIA_ENTRY(dcb) \
|
||||
((fsmdef_media_t *)SLL_LITE_LINK_HEAD(&dcb->media_list))
|
||||
|
||||
#define GSMSDP_NEXT_MEDIA_ENTRY(media) \
|
||||
((fsmdef_media_t *)SLL_LITE_LINK_NEXT_NODE(media))
|
||||
|
||||
#define GSMSDP_FOR_MEDIA_LIST(media, start_media, end_media, dcb) \
|
||||
for (media = start_media; (media != NULL); \
|
||||
media = (media != end_media ? \
|
||||
GSMSDP_NEXT_MEDIA_ENTRY(media) : NULL))
|
||||
|
||||
#define GSMSDP_FOR_ALL_MEDIA(media, dcb) \
|
||||
for (media = GSMSDP_FIRST_MEDIA_ENTRY(dcb); (media != NULL); \
|
||||
media = GSMSDP_NEXT_MEDIA_ENTRY(media))
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
int value;
|
||||
} gsmsdp_key_table_entry_t;
|
||||
|
||||
typedef enum constraints_ {
|
||||
OfferToReceiveAudio = 0,
|
||||
OfferToReceiveVideo = 1,
|
||||
VoiceActivityDetection = 2
|
||||
} constraints;
|
||||
|
||||
static const gsmsdp_key_table_entry_t constraints_table[] = {
|
||||
{"OfferToReceiveAudio", OfferToReceiveAudio},
|
||||
{"OfferToReceiveVideo", OfferToReceiveVideo},
|
||||
{"VoiceActivityDetection", VoiceActivityDetection}
|
||||
};
|
||||
|
||||
cc_causes_t gsmsdp_create_local_sdp(fsmdef_dcb_t *dcb_p, boolean force_streams_enabled,
|
||||
boolean audio, boolean video, boolean data, boolean offer);
|
||||
void gsmsdp_create_options_sdp(cc_sdp_t **sdp_pp);
|
||||
void gsmsdp_reset_local_sdp_media(fsmdef_dcb_t *dcb, fsmdef_media_t *media,
|
||||
boolean hold);
|
||||
void gsmsdp_set_local_sdp_direction(fsmdef_dcb_t *dcb_p, fsmdef_media_t *media,
|
||||
sdp_direction_e direction);
|
||||
void gsmsdp_set_local_hold_sdp(fsmdef_dcb_t *dcb, fsmdef_media_t *media);
|
||||
void gsmsdp_set_local_resume_sdp(fsmdef_dcb_t *dcb, fsmdef_media_t *media);
|
||||
cc_causes_t gsmsdp_negotiate_answer_sdp(fsm_fcb_t *fcb,
|
||||
cc_msgbody_info_t *msg_body);
|
||||
cc_causes_t gsmsdp_negotiate_offer_sdp(fsm_fcb_t *fcb,
|
||||
cc_msgbody_info_t *msg_body,
|
||||
boolean init);
|
||||
cc_causes_t gsmsdp_process_offer_sdp(fsm_fcb_t *fcb,
|
||||
cc_msgbody_info_t *msg_body,
|
||||
boolean init);
|
||||
cc_causes_t
|
||||
gsmsdp_negotiate_media_lines (fsm_fcb_t *fcb_p, cc_sdp_t *sdp_p, boolean initial_offer,
|
||||
boolean offer, boolean notify_stream_added, boolean create_answer);
|
||||
|
||||
boolean gsmsdp_sdp_differs_from_previous_sdp(boolean rcv_only,
|
||||
fsmdef_media_t *media);
|
||||
cc_causes_t gsmsdp_encode_sdp(cc_sdp_t *sdp_p, cc_msgbody_info_t *msg_body);
|
||||
cc_causes_t gsmsdp_encode_sdp_and_update_version(fsmdef_dcb_t *dcb_p,
|
||||
cc_msgbody_info_t *msg_body);
|
||||
void gsmsdp_free(fsmdef_dcb_t *dcb_p);
|
||||
fsmdef_media_t *gsmsdp_find_audio_media(fsmdef_dcb_t *dcb_p);
|
||||
|
||||
#define gsmsdp_is_srtp_supported() (TRUE)
|
||||
extern void gsmsdp_init_sdp_media_transport(fsmdef_dcb_t *dcb,
|
||||
void *sdp,
|
||||
fsmdef_media_t *media);
|
||||
extern void gsmsdp_reset_sdp_media_transport(fsmdef_dcb_t *dcb,
|
||||
void *sdp,
|
||||
fsmdef_media_t *media,
|
||||
boolean hold);
|
||||
extern sdp_transport_e gsmsdp_negotiate_media_transport(fsmdef_dcb_t *dcb_p,
|
||||
cc_sdp_t *cc_sdp_p,
|
||||
boolean offer,
|
||||
fsmdef_media_t *media,
|
||||
uint16_t *inst_num,
|
||||
uint16 level);
|
||||
extern void gsmsdp_update_local_sdp_media_transport(fsmdef_dcb_t *dcb_p,
|
||||
void *sdp_p,
|
||||
fsmdef_media_t *media,
|
||||
sdp_transport_e transport,
|
||||
boolean all);
|
||||
extern void gsmsdp_update_negotiated_transport(fsmdef_dcb_t *dcb_p,
|
||||
cc_sdp_t *cc_sdp_p,
|
||||
fsmdef_media_t *media,
|
||||
uint16_t crypto_inst,
|
||||
sdp_transport_e transport,
|
||||
uint16 level);
|
||||
extern void gsmsdp_update_crypto_transmit_key(fsmdef_dcb_t *dcb_p,
|
||||
fsmdef_media_t *media,
|
||||
boolean offer,
|
||||
boolean initial_offer,
|
||||
sdp_direction_e direction);
|
||||
extern void gsmsdp_set_media_transport_for_option(void *sdp, uint16 level);
|
||||
extern boolean gsmsdp_is_crypto_ready(fsmdef_media_t *media, boolean rx);
|
||||
extern boolean gsmsdp_is_media_encrypted(fsmdef_dcb_t *dcb_p);
|
||||
extern boolean gsmsdp_crypto_params_change(boolean rcv_only,
|
||||
fsmdef_media_t *media);
|
||||
extern void gsmsdp_crypto_reset_params_change(fsmdef_media_t *media);
|
||||
extern void gsmsdp_cache_crypto_keys(void);
|
||||
extern boolean gsmsdp_create_free_media_list(void);
|
||||
extern void gsmsdp_destroy_free_media_list(void);
|
||||
extern void gsmsdp_init_media_list(fsmdef_dcb_t *dcb_p);
|
||||
extern void gsmsdp_clean_media_list(fsmdef_dcb_t *dcb);
|
||||
extern fsmdef_media_t *gsmsdp_find_media_by_refid(fsmdef_dcb_t *dcb_p,
|
||||
media_refid_t refid);
|
||||
extern boolean gsmsdp_handle_media_cap_change(fsmdef_dcb_t *dcb_p,
|
||||
boolean refresh, boolean hold);
|
||||
extern boolean gsmsdp_update_local_sdp_media_capability(fsmdef_dcb_t *dcb_p,
|
||||
boolean refresh, boolean hold);
|
||||
boolean is_gsmsdp_media_ip_updated_to_latest( fsmdef_dcb_t * dcb );
|
||||
|
||||
void gsmsdp_add_remote_stream(uint16_t idx, int pc_stream_id, fsmdef_dcb_t * dcb, fsmdef_media_t *media);
|
||||
cc_causes_t gsmsdp_install_peer_ice_attributes(fsm_fcb_t *fcb_p);
|
||||
cc_causes_t gsmsdp_configure_dtls_data_attributes(fsm_fcb_t *fcb_p);
|
||||
cc_causes_t gsmsdp_find_level_from_mid(fsmdef_dcb_t * dcb, const char * mid, uint16_t *level);
|
||||
void gsmsdp_process_cap_constraints(fsmdef_dcb_t *dcb, const cc_media_constraints_t* constraints);
|
||||
cc_causes_t
|
||||
gsmsdp_get_offered_media_types (fsm_fcb_t *fcb_p, cc_sdp_t *sdp_p, boolean *has_audio, boolean *has_video, boolean *has_data);
|
||||
fsmdef_media_t* gsmsdp_find_media_by_media_type(fsmdef_dcb_t *dcb, sdp_media_e media_type);
|
||||
#endif
|
||||
|
180
libs/sipcc/core/gsm/h/lsm.h
Executable file
180
libs/sipcc/core/gsm/h/lsm.h
Executable file
@ -0,0 +1,180 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _LSM_H_
|
||||
#define _LSM_H_
|
||||
|
||||
#include "cpr_types.h"
|
||||
#include "ccapi.h"
|
||||
#include "uiapi.h"
|
||||
#include "fsm.h"
|
||||
|
||||
|
||||
#define LSM_NO_LINE (0)
|
||||
#define LSM_NO_INSTANCE (0)
|
||||
#define NO_LINES_AVAILABLE (0)
|
||||
|
||||
/* FIXME GS - Breaking my own rule - need to figure out how to do a platform
|
||||
* specific include file here
|
||||
*/
|
||||
#define LSM_MAX_LINES MAX_REG_LINES
|
||||
#define LSM_MAX_INSTANCES (MAX_CALLS_PER_LINE-1)
|
||||
#define LSM_MAX_EXP_INSTANCES MAX_CALLS_PER_LINE
|
||||
#define LSM_MAX_CALLS MAX_CALLS
|
||||
|
||||
#define NO_FREE_LINES_TIMEOUT (10)
|
||||
#define CALL_ALERT_TIMEOUT (10)
|
||||
|
||||
/*
|
||||
* Used to play busy verfication tone
|
||||
*/
|
||||
#define BUSY_VERIFICATION_DELAY (10000)
|
||||
|
||||
/*
|
||||
* Temp until added to config
|
||||
*/
|
||||
#define TOH_DELAY (10000)
|
||||
|
||||
/*
|
||||
* Used to play msg waiting and stutter dialtones.
|
||||
* Both tones are 100ms on/off repeating 10 and
|
||||
* 3 times respectively, followed by steady dialtone.
|
||||
* Due to DSP limitations we first tell the DSP to
|
||||
* play the 100ms on/off pairs the correct number of
|
||||
* times, set a timer, and then tell it to play dialtone.
|
||||
*/
|
||||
#define MSG_WAITING_DELAY (2050)
|
||||
#define STUTTER_DELAY (650)
|
||||
|
||||
/*
|
||||
* Used to play the busy verfication tone which
|
||||
* is two seconds of dialtone followed by the
|
||||
* callwaiting tone every ten seconds.
|
||||
*/
|
||||
#define BUSY_VERIFY_DELAY (12000)
|
||||
|
||||
|
||||
/* LSM states */
|
||||
typedef enum {
|
||||
LSM_S_MIN = -1,
|
||||
LSM_S_NONE = LSM_S_MIN,
|
||||
LSM_S_IDLE,
|
||||
LSM_S_PENDING,
|
||||
LSM_S_OFFHOOK,
|
||||
LSM_S_ONHOOK,
|
||||
LSM_S_PROCEED,
|
||||
LSM_S_RINGOUT,
|
||||
LSM_S_RINGIN,
|
||||
LSM_S_CONNECTED,
|
||||
LSM_S_BUSY,
|
||||
LSM_S_CONGESTION,
|
||||
LSM_S_HOLDING,
|
||||
LSM_S_CWT,
|
||||
LSM_S_XFER,
|
||||
LSM_S_ATTN_XFER,
|
||||
LSM_S_CONF,
|
||||
LSM_S_INVALID_NUMBER,
|
||||
LSM_S_MAX
|
||||
} lsm_states_t;
|
||||
|
||||
boolean lsm_is_phone_idle(void);
|
||||
int lsm_get_instances_available_cnt(line_t line, boolean expline);
|
||||
void lsm_increment_call_chn_cnt(line_t line);
|
||||
void lsm_decrement_call_chn_cnt(line_t line);
|
||||
line_t lsm_get_newcall_line(line_t line);
|
||||
callid_t lsm_get_active_call_id(void);
|
||||
line_t lsm_get_line_by_call_id(callid_t call_id);
|
||||
/*
|
||||
* The lsm_get_facility_by_called_number() and the lsm_get_facility_by_line()
|
||||
* below are defined to allow be used by fsm state mechine to bind the
|
||||
* LSM to the FSM default state machine only.
|
||||
*/
|
||||
cc_causes_t lsm_get_facility_by_called_number(callid_t call_id,
|
||||
const char *called_number,
|
||||
line_t *free_line,
|
||||
boolean expline, void *dcb);
|
||||
cc_causes_t lsm_get_facility_by_line(callid_t call_id, line_t line,
|
||||
boolean exp, void *dcb);
|
||||
char lsm_digit2ch(int digit);
|
||||
void lsm_set_active_call_id(callid_t call_id);
|
||||
void lsm_init(void);
|
||||
void lsm_shutdown(void);
|
||||
void lsm_reset(void);
|
||||
void lsm_ui_display_notify(const char *pNotifyStr, unsigned long timeout);
|
||||
void lsm_ui_display_status(const char *pStatusStr, line_t line,
|
||||
callid_t call_id);
|
||||
string_t lsm_parse_displaystr(string_t displaystr);
|
||||
void lsm_speaker_mode(short mode);
|
||||
void lsm_add_remote_stream (line_t line, callid_t call_id, fsmdef_media_t *media, int *pc_stream_id);
|
||||
|
||||
#ifdef _WIN32
|
||||
void terminate_active_calls(void);
|
||||
#endif
|
||||
|
||||
const char *lsm_state_name(lsm_states_t id);
|
||||
void lsm_set_cfwd_all_nonccm(line_t line, char *callfwd_dialstring);
|
||||
void lsm_set_cfwd_all_ccm(line_t line, char *callfwd_dialstring);
|
||||
void lsm_clear_cfwd_all_nonccm(line_t line);
|
||||
void lsm_clear_cfwd_all_ccm(line_t line);
|
||||
int lsm_check_cfwd_all_nonccm(line_t line);
|
||||
int lsm_check_cfwd_all_ccm(line_t line);
|
||||
char *lsm_is_phone_forwarded(line_t line);
|
||||
void lsm_tmr_tones_callback(void *);
|
||||
void lsm_update_placed_callinfo(void *dcb);
|
||||
void lsm_start_multipart_tone_timer(vcm_tones_t tone, uint32_t delay,
|
||||
callid_t callId);
|
||||
void lsm_start_continuous_tone_timer(vcm_tones_t tone, uint32_t delay,
|
||||
callid_t callId);
|
||||
void lsm_start_tone_duration_timer(vcm_tones_t tone, uint32_t delay,
|
||||
cc_call_handle_t call_handle);
|
||||
void lsm_stop_multipart_tone_timer(void);
|
||||
void lsm_stop_continuous_tone_timer(void);
|
||||
void lsm_stop_tone_duration_timer(void);
|
||||
void lsm_tone_duration_tmr_callback(void *data);
|
||||
void lsm_tone_start_with_duration (vcm_tones_t tone, short alert_info, cc_call_handle_t call_handle, groupid_t group_id,
|
||||
streamid_t stream_id, uint16_t direction, uint32_t duration);
|
||||
void lsm_update_active_tone(vcm_tones_t tone, callid_t call_id);
|
||||
boolean lsm_is_tx_channel_opened(callid_t call_id);
|
||||
void lsm_update_monrec_tone_action (vcm_tones_t tone, callid_t call_id, uint16_t direction);
|
||||
void lsm_downgrade_monrec_tone_action(vcm_tones_t tone, callid_t call_id);
|
||||
char *lsm_get_gdialed_digits();
|
||||
void lsm_set_hold_ringback_status(callid_t call_id, boolean ringback_status);
|
||||
|
||||
extern callid_t lsm_get_ui_id(callid_t call_id);
|
||||
extern cc_call_handle_t lsm_get_ms_ui_call_handle(line_t line, callid_t call_id, callid_t ui_id);
|
||||
extern void lsm_set_ui_id(callid_t call_id, callid_t ui_id);
|
||||
extern lsm_states_t lsm_get_state(callid_t call_id);
|
||||
|
||||
extern void lsm_set_lcb_dusting_call(callid_t call_id);
|
||||
extern void lsm_set_lcb_call_priority(callid_t call_id);
|
||||
extern boolean lsm_is_it_priority_call(callid_t call_id);
|
||||
extern void lsm_play_tone(cc_features_t feature_id);
|
||||
extern boolean lsm_callwaiting(void);
|
||||
extern void lsm_display_control_ringin_call (callid_t call_id, line_t line, boolean hide);
|
||||
extern line_t lsm_find_next_available_line(line_t line, boolean same_dn, boolean incoming);
|
||||
extern line_t lsm_get_available_line (boolean incoming);
|
||||
extern boolean lsm_is_line_available(line_t line, boolean incoming);
|
||||
extern void lsm_ui_display_notify_str_index(int str_index);
|
||||
extern cc_causes_t lsm_allocate_call_bandwidth(callid_t call_id, int sessions);
|
||||
extern void lsm_update_gcid(callid_t call_id, char * gcid);
|
||||
extern void lsm_set_lcb_prevent_ringing(callid_t call_id);
|
||||
extern void lsm_remove_lcb_prevent_ringing(callid_t call_id);
|
||||
extern void lsm_set_lcb_dialed_str_flag(callid_t call_id);
|
||||
void lsm_update_video_avail(line_t line, callid_t call_id, int dir);
|
||||
void lsm_update_video_offered(line_t line, callid_t call_id, int dir);
|
||||
callid_t lsm_get_callid_from_ui_id (callid_t uid);
|
||||
void lsm_set_video_mute (callid_t call_id, int mute);
|
||||
int lsm_get_video_mute (callid_t call_id);
|
||||
void lsm_set_video_window (callid_t call_id, int flags, int x, int y, int h, int w);
|
||||
void lsm_get_video_window (callid_t call_id, int *flags, int *x, int *y, int *h, int *w);
|
||||
boolean lsm_is_kpml_subscribed (callid_t call_id);
|
||||
void
|
||||
lsm_util_tone_start_with_speaker_as_backup (vcm_tones_t tone, short alert_info,
|
||||
cc_call_handle_t call_handle, groupid_t group_id,
|
||||
streamid_t stream_id, uint16_t direction);
|
||||
|
||||
void lsm_data_channel_negotiated (line_t line, callid_t call_id, fsmdef_media_t *media, int *pc_stream_id);
|
||||
|
||||
#endif //_LSM_H_
|
||||
|
58
libs/sipcc/core/gsm/h/lsm_private.h
Normal file
58
libs/sipcc/core/gsm/h/lsm_private.h
Normal file
@ -0,0 +1,58 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _LSM_PRIV_H_
|
||||
#define _LSM_PRIV_H_
|
||||
|
||||
#include "phone_types.h"
|
||||
#include "ccapi.h"
|
||||
|
||||
#define LSM_ERR_MSG err_msg
|
||||
|
||||
#define LSM_DEFAULT_LINE (1)
|
||||
#define LSM_DEFAULT_INSTANCE (1)
|
||||
#define LSM_DEFAULT_PLANE (1)
|
||||
#define LSM_DEFAULT_SPEAKER (0)
|
||||
|
||||
#define LSM_MAX_LCBS (LSM_MAX_CALLS)
|
||||
|
||||
#define LSM_FLAGS_SECURE_MEDIA (1 << 0) /* encrypted tx media */
|
||||
#define LSM_FLAGS_SECURE_MEDIA_UPDATE (1 << 1) /* update secure media icon needed */
|
||||
#define LSM_FLAGS_ANSWER_PENDING (1 << 2) /* answer is pending */
|
||||
#define LSM_FLAGS_DIALED_STRING (1 << 3) /* dialed a string */
|
||||
#define LSM_FLAGS_CALL_PRIORITY_URGENT (1 << 4)
|
||||
#define LSM_FLAGS_PREVENT_RINGING (1 << 5)
|
||||
#define LSM_FLAGS_DUSTING (1 << 6) /* the call is a dusting call */
|
||||
|
||||
|
||||
typedef struct lsm_lcb_t_ {
|
||||
callid_t call_id;
|
||||
line_t line;
|
||||
call_events previous_call_event;
|
||||
lsm_states_t state;
|
||||
int mru;
|
||||
boolean enable_ringback;
|
||||
callid_t ui_id;
|
||||
uint32_t flags;
|
||||
fsmdef_dcb_t *dcb; /* the corresponding DCB chain for this lcm */
|
||||
char *gcid; /*global call identifier */
|
||||
int vid_mute;
|
||||
int vid_flags;
|
||||
int vid_x;
|
||||
int vid_y;
|
||||
int vid_h;
|
||||
int vid_w;
|
||||
} lsm_lcb_t;
|
||||
|
||||
typedef struct lsm_info_t_ {
|
||||
int call_in_progress;
|
||||
callid_t active_call_id;
|
||||
int active_call_plane;
|
||||
line_t primary_line;
|
||||
int speaker;
|
||||
} lsm_info_t;
|
||||
|
||||
lsm_lcb_t *lsm_get_lcb_by_call_id(callid_t call_id);
|
||||
|
||||
#endif
|
44
libs/sipcc/core/gsm/h/sm.h
Executable file
44
libs/sipcc/core/gsm/h/sm.h
Executable file
@ -0,0 +1,44 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _SM_H_
|
||||
#define _SM_H_
|
||||
|
||||
#include "phone_debug.h"
|
||||
|
||||
typedef enum {
|
||||
SM_RC_MIN = -2,
|
||||
SM_RC_ERROR = -1,
|
||||
SM_RC_SUCCESS,
|
||||
SM_RC_CONT,
|
||||
SM_RC_DEF_CONT,
|
||||
SM_RC_END,
|
||||
SM_RC_CLEANUP,
|
||||
SM_RC_FSM_ERROR,
|
||||
SM_RC_CSM_ERROR,
|
||||
SM_RC_MAX
|
||||
} sm_rcs_t;
|
||||
|
||||
typedef struct _sm_event_t {
|
||||
int state;
|
||||
int event;
|
||||
void *data;
|
||||
void *msg;
|
||||
} sm_event_t;
|
||||
|
||||
typedef sm_rcs_t (*sm_function_t)(sm_event_t *event);
|
||||
|
||||
typedef struct _sm_table_t {
|
||||
int min_state;
|
||||
int max_state;
|
||||
int min_event;
|
||||
int max_event;
|
||||
sm_function_t *table;
|
||||
} sm_table_t;
|
||||
|
||||
sm_rcs_t sm_process_event(sm_table_t *tbl, sm_event_t *event );
|
||||
sm_rcs_t sm_process_event2(int state_id, int event_id, sm_table_t *tbl,
|
||||
void *msg, void *cb);
|
||||
|
||||
#endif
|
6609
libs/sipcc/core/gsm/lsm.c
Executable file
6609
libs/sipcc/core/gsm/lsm.c
Executable file
File diff suppressed because it is too large
Load Diff
158
libs/sipcc/core/gsm/media_cap_tbl.c
Normal file
158
libs/sipcc/core/gsm/media_cap_tbl.c
Normal file
@ -0,0 +1,158 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <cpr_types.h>
|
||||
#include "ccapi.h"
|
||||
#include "phone_debug.h"
|
||||
#include "cc_debug.h"
|
||||
#include "CCProvider.h"
|
||||
#include "ccapi_snapshot.h"
|
||||
|
||||
/**
|
||||
* global media cap table for interaction between what platform
|
||||
* can do and the GSM-SDP module
|
||||
* AUDIO_1 is used for audio cannot be turned off
|
||||
* VIDEO_1 is used for video
|
||||
*/
|
||||
cc_media_cap_table_t g_media_table = {
|
||||
1,
|
||||
{
|
||||
{CC_AUDIO_1,SDP_MEDIA_AUDIO,TRUE,TRUE,SDP_DIRECTION_RECVONLY},
|
||||
{CC_VIDEO_1,SDP_MEDIA_VIDEO,TRUE,TRUE,SDP_DIRECTION_RECVONLY},
|
||||
{CC_DATACHANNEL_1,SDP_MEDIA_APPLICATION,FALSE,TRUE,SDP_DIRECTION_SENDRECV},
|
||||
}
|
||||
};
|
||||
|
||||
static boolean g_nativeVidSupported = FALSE;
|
||||
static boolean g_vidCapEnabled = FALSE;
|
||||
static boolean g_natve_txCap_enabled = FALSE;
|
||||
|
||||
/**
|
||||
* Simple method to trigger escalation and deescalation
|
||||
* based on media capability changes
|
||||
*/
|
||||
void escalateDeescalate() {
|
||||
g_media_table.id++;
|
||||
if ( ccapp_get_state() != CC_INSERVICE ) {
|
||||
VCM_DEBUG(MED_F_PREFIX"Ignoring video cap update\n", "escalateDeescalate");
|
||||
return;
|
||||
}
|
||||
|
||||
//post the event
|
||||
cc_int_feature(CC_SRC_UI, CC_SRC_GSM, CC_NO_CALL_ID,
|
||||
CC_NO_LINE, CC_FEATURE_UPD_MEDIA_CAP, NULL);
|
||||
}
|
||||
|
||||
cc_boolean cc_media_isTxCapEnabled() {
|
||||
return g_natve_txCap_enabled;
|
||||
}
|
||||
|
||||
cc_boolean cc_media_isVideoCapEnabled() {
|
||||
if ( g_nativeVidSupported ) {
|
||||
return g_vidCapEnabled;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* API to update the local video cap in the table
|
||||
* called when native video support or vidCap cfg changes
|
||||
*
|
||||
* This method looks at video cap in cfg & native vid support on platform
|
||||
*/
|
||||
static void updateVidCapTbl(){
|
||||
|
||||
if ( g_vidCapEnabled ) {
|
||||
if ( g_media_table.cap[CC_VIDEO_1].enabled == FALSE ) {
|
||||
// cfg is enabled but cap tbl is not
|
||||
if ( g_nativeVidSupported ) {
|
||||
// we can do native now enable cap
|
||||
g_media_table.cap[CC_VIDEO_1].enabled = TRUE;
|
||||
g_media_table.cap[CC_VIDEO_1].support_direction =
|
||||
g_natve_txCap_enabled?SDP_DIRECTION_SENDRECV:SDP_DIRECTION_RECVONLY;
|
||||
if ( g_natve_txCap_enabled == FALSE ) {
|
||||
|
||||
}
|
||||
escalateDeescalate();
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// disable vid cap
|
||||
DEF_DEBUG(MED_F_PREFIX"video capability disabled \n", "updateVidCapTbl");
|
||||
|
||||
if ( g_media_table.cap[CC_VIDEO_1].enabled ) {
|
||||
g_media_table.cap[CC_VIDEO_1].enabled = FALSE;
|
||||
escalateDeescalate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* API to update video capability on the device
|
||||
* expected to be called once in the beginning only
|
||||
*/
|
||||
void cc_media_update_native_video_support(boolean val) {
|
||||
DEF_DEBUG(MED_F_PREFIX"Setting native video support val=%d\n", "cc_media_update_native_video_support", val);
|
||||
g_nativeVidSupported = val;
|
||||
updateVidCapTbl();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* API to update video capability on the device based on config
|
||||
*/
|
||||
void cc_media_update_video_cap(boolean val) {
|
||||
DEF_DEBUG(MED_F_PREFIX"Setting video cap val=%d\n", "cc_media_update_video_cap", val);
|
||||
g_vidCapEnabled = val;
|
||||
updateVidCapTbl();
|
||||
if ( g_nativeVidSupported ) {
|
||||
ccsnap_gen_deviceEvent(CCAPI_DEVICE_EV_VIDEO_CAP_ADMIN_CONFIG_CHANGED, CC_DEVICE_ID);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* API to update video tx capability based on camera plugin events
|
||||
*/
|
||||
|
||||
void cc_media_update_native_video_txcap(boolean enable) {
|
||||
|
||||
VCM_DEBUG(MED_F_PREFIX"Setting txcap val=%d\n", "cc_media_update_video_txcap", enable);
|
||||
|
||||
if ( g_natve_txCap_enabled == enable ) {
|
||||
// nothing to do
|
||||
return;
|
||||
}
|
||||
|
||||
g_natve_txCap_enabled = enable;
|
||||
ccsnap_gen_deviceEvent(CCAPI_DEVICE_EV_CAMERA_ADMIN_CONFIG_CHANGED, CC_DEVICE_ID);
|
||||
|
||||
if ( g_nativeVidSupported && g_vidCapEnabled ) {
|
||||
// act on camera events only iof native video is enabled
|
||||
if ( g_natve_txCap_enabled ) {
|
||||
|
||||
} else if (g_media_table.cap[CC_VIDEO_1].enabled) {
|
||||
|
||||
}
|
||||
|
||||
g_media_table.cap[CC_VIDEO_1].support_direction =
|
||||
g_natve_txCap_enabled?SDP_DIRECTION_SENDRECV:SDP_DIRECTION_RECVONLY;
|
||||
|
||||
escalateDeescalate();
|
||||
}
|
||||
}
|
||||
|
||||
static cc_boolean vidAutoTxPref=FALSE;
|
||||
void cc_media_setVideoAutoTxPref(cc_boolean txPref){
|
||||
vidAutoTxPref = txPref;
|
||||
}
|
||||
|
||||
cc_boolean cc_media_getVideoAutoTxPref(){
|
||||
return vidAutoTxPref;
|
||||
}
|
||||
|
||||
|
78
libs/sipcc/core/gsm/sm.c
Executable file
78
libs/sipcc/core/gsm/sm.c
Executable file
@ -0,0 +1,78 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "cpr_stdio.h"
|
||||
#include "sm.h"
|
||||
#include "gsm.h"
|
||||
#include "fsm.h"
|
||||
#include "text_strings.h"
|
||||
#include "ccapi.h"
|
||||
|
||||
sm_rcs_t
|
||||
sm_process_event (sm_table_t *tbl, sm_event_t *event)
|
||||
{
|
||||
static const char fname[] = "sm_process_event";
|
||||
int state_id = event->state;
|
||||
int event_id = event->event;
|
||||
sm_rcs_t rc = SM_RC_ERROR;
|
||||
fsm_fcb_t *fcb = (fsm_fcb_t *) event->data;
|
||||
cc_feature_t *feat_msg = NULL;
|
||||
line_t line_id;
|
||||
fsm_types_t fsm_type;
|
||||
callid_t call_id;
|
||||
sm_function_t hdlr; /* cached handler in order to compute its addr once */
|
||||
|
||||
/*
|
||||
* validate the state and event
|
||||
* and that there is a valid function for this state-event pair.
|
||||
*/
|
||||
if ((state_id > tbl->min_state) &&
|
||||
(state_id < tbl->max_state) &&
|
||||
(event_id > tbl->min_event) &&
|
||||
(event_id < tbl->max_event)) {
|
||||
rc = SM_RC_DEF_CONT;
|
||||
/*
|
||||
* Save some paramters for debuging, the event handler may
|
||||
* free the fcb once returned.
|
||||
*/
|
||||
fsm_type = fcb->fsm_type;
|
||||
call_id = fcb->call_id;
|
||||
if ((hdlr = tbl->table[tbl->max_event * state_id + event_id]) != NULL) {
|
||||
FSM_DEBUG_SM(DEB_F_PREFIX"%s %-4d: 0x%08lx: sm entry: (%s:%s)\n",
|
||||
DEB_F_PREFIX_ARGS(FSM, fname), fsm_type_name(fsm_type), call_id,
|
||||
tbl->table[tbl->max_event * state_id + event_id],
|
||||
fsm_state_name(fsm_type, state_id),
|
||||
cc_msg_name((cc_msgs_t)(event_id)));
|
||||
|
||||
rc = hdlr(event);
|
||||
}
|
||||
|
||||
if (rc != SM_RC_DEF_CONT) {
|
||||
/* For event_id == CC_MSG_FEATURE then display the
|
||||
* feature associated with it.
|
||||
*/
|
||||
if (event_id == CC_MSG_FEATURE) {
|
||||
feat_msg = (cc_feature_t *) event->msg;
|
||||
}
|
||||
line_id = ((cc_feature_t *) event->msg)->line;
|
||||
|
||||
DEF_DEBUG(DEB_L_C_F_PREFIX"%-5s :(%s:%s%s)\n",
|
||||
DEB_L_C_F_PREFIX_ARGS(GSM, line_id, call_id, fname),
|
||||
fsm_type_name(fsm_type),
|
||||
fsm_state_name(fsm_type, state_id),
|
||||
cc_msg_name((cc_msgs_t)(event_id)),
|
||||
feat_msg ? cc_feature_name(feat_msg->feature_id):" ");
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Invalid state-event pair.
|
||||
*/
|
||||
else {
|
||||
GSM_ERR_MSG(GSM_F_PREFIX"illegal state-event pair: (%d <-- %d)\n",
|
||||
fname, state_id, event_id);
|
||||
rc = SM_RC_ERROR;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
269
libs/sipcc/core/gsm/subapi.c
Executable file
269
libs/sipcc/core/gsm/subapi.c
Executable file
@ -0,0 +1,269 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "cpr_types.h"
|
||||
#include "cpr_stdio.h"
|
||||
#include "cpr_string.h"
|
||||
#include "cpr_memory.h"
|
||||
#include "cpr_stdlib.h"
|
||||
#include "ccapi.h"
|
||||
#include "ccsip_task.h"
|
||||
#include "debug.h"
|
||||
#include "phone_debug.h"
|
||||
#include "phntask.h"
|
||||
#include "phone.h"
|
||||
#include "text_strings.h"
|
||||
#include "string_lib.h"
|
||||
#include "gsm.h"
|
||||
#include "vcm.h"
|
||||
#include "subapi.h"
|
||||
#include "misc_apps_task.h"
|
||||
|
||||
|
||||
static void
|
||||
sub_print_msg (char *pData, int len)
|
||||
{
|
||||
int ix;
|
||||
int msg_id = *((int *)pData);
|
||||
|
||||
buginf("\nCCAPI: cc_msg= %s, 0x=", cc_msg_name((cc_msgs_t)msg_id));
|
||||
for (ix = 0; ix < len; ix++) {
|
||||
if ((ix % 8 == 0) && ix) {
|
||||
buginf(" ");
|
||||
}
|
||||
if (ix % 24 == 0) {
|
||||
buginf("\n");
|
||||
}
|
||||
buginf("%02x ", *pData++);
|
||||
}
|
||||
buginf("\n");
|
||||
}
|
||||
|
||||
cc_rcs_t
|
||||
sub_send_msg (cprBuffer_t buf, uint32_t cmd, uint16_t len, cc_srcs_t dst_id)
|
||||
{
|
||||
cpr_status_e rc;
|
||||
|
||||
CC_DEBUG_MSG sub_print_msg((char *)buf, len);
|
||||
|
||||
switch (dst_id) {
|
||||
case CC_SRC_GSM:
|
||||
rc = gsm_send_msg(cmd, buf, len);
|
||||
if (rc == CPR_FAILURE) {
|
||||
cpr_free(buf);
|
||||
}
|
||||
break;
|
||||
case CC_SRC_SIP:
|
||||
rc = SIPTaskSendMsg(cmd, buf, len, NULL);
|
||||
if (rc == CPR_FAILURE) {
|
||||
cpr_free(buf);
|
||||
}
|
||||
break;
|
||||
case CC_SRC_MISC_APP:
|
||||
rc = MiscAppTaskSendMsg(cmd, buf, len);
|
||||
if (rc == CPR_FAILURE) {
|
||||
cpr_free(buf);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
rc = CPR_FAILURE;
|
||||
break;
|
||||
}
|
||||
|
||||
return (rc == CPR_SUCCESS) ? CC_RC_SUCCESS : CC_RC_ERROR;
|
||||
}
|
||||
|
||||
cc_rcs_t
|
||||
sub_int_subnot_register (cc_srcs_t src_id, cc_srcs_t dst_id,
|
||||
cc_subscriptions_t evt_pkg, void *callback_fun,
|
||||
cc_srcs_t dest_task, int msg_id, void *term_callback,
|
||||
int term_msg_id, long min_duration, long max_duration)
|
||||
{
|
||||
sipspi_msg_t *pmsg;
|
||||
|
||||
pmsg = (sipspi_msg_t *) cc_get_msg_buf(sizeof(*pmsg));
|
||||
if (!pmsg) {
|
||||
return CC_RC_ERROR;
|
||||
}
|
||||
|
||||
pmsg->msg.subs_reg.eventPackage = evt_pkg;
|
||||
pmsg->msg.subs_reg.max_duration = max_duration;
|
||||
pmsg->msg.subs_reg.min_duration = min_duration;
|
||||
pmsg->msg.subs_reg.subsIndCallback = (ccsipSubsIndCallbackFn_t)
|
||||
callback_fun;
|
||||
pmsg->msg.subs_reg.subsIndCallbackMsgID = msg_id;
|
||||
pmsg->msg.subs_reg.subsIndCallbackTask = dest_task;
|
||||
pmsg->msg.subs_reg.subsTermCallback = (ccsipSubsTerminateCallbackFn_t)
|
||||
term_callback;
|
||||
pmsg->msg.subs_reg.subsTermCallbackMsgID = term_msg_id;
|
||||
|
||||
return sub_send_msg((cprBuffer_t)pmsg, SIPSPI_EV_CC_SUBSCRIBE_REGISTER,
|
||||
sizeof(*pmsg), dst_id);
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: sub_int_subscribe()
|
||||
*
|
||||
* Parameters: msg_p - pointer to sipspi_msg_t (input parameter)
|
||||
*
|
||||
* Description: posts SIPSPI_EV_CC_SUBSCRIBE to SIP task message queue.
|
||||
*
|
||||
* Returns: CC_RC_ERROR - failed to post msg.
|
||||
* CC_RC_SUCCESS - successful posted msg.
|
||||
*/
|
||||
cc_rcs_t
|
||||
sub_int_subscribe (sipspi_msg_t *msg_p)
|
||||
{
|
||||
sipspi_msg_t *pmsg;
|
||||
|
||||
pmsg = (sipspi_msg_t *) cc_get_msg_buf(sizeof(*pmsg));
|
||||
if (!pmsg) {
|
||||
return CC_RC_ERROR;
|
||||
}
|
||||
|
||||
memcpy(pmsg, msg_p, sizeof(sipspi_msg_t));
|
||||
return sub_send_msg((cprBuffer_t)pmsg, SIPSPI_EV_CC_SUBSCRIBE,
|
||||
sizeof(*pmsg), CC_SRC_SIP);
|
||||
}
|
||||
|
||||
|
||||
cc_rcs_t
|
||||
sub_int_subscribe_ack (cc_srcs_t src_id, cc_srcs_t dst_id, sub_id_t sub_id,
|
||||
uint16_t response_code, int duration)
|
||||
{
|
||||
sipspi_msg_t *pmsg;
|
||||
|
||||
pmsg = (sipspi_msg_t *) cc_get_msg_buf(sizeof(*pmsg));
|
||||
if (!pmsg) {
|
||||
return CC_RC_ERROR;
|
||||
}
|
||||
|
||||
pmsg->msg.subscribe_resp.response_code = response_code;
|
||||
pmsg->msg.subscribe_resp.sub_id = sub_id;
|
||||
pmsg->msg.subscribe_resp.duration = duration;
|
||||
|
||||
return sub_send_msg((cprBuffer_t)pmsg, SIPSPI_EV_CC_SUBSCRIBE_RESPONSE,
|
||||
sizeof(*pmsg), dst_id);
|
||||
}
|
||||
|
||||
|
||||
cc_rcs_t
|
||||
sub_int_notify (cc_srcs_t src_id, cc_srcs_t dst_id, sub_id_t sub_id,
|
||||
ccsipNotifyResultCallbackFn_t notifyResultCallback,
|
||||
int subsNotResCallbackMsgID, ccsip_event_data_t * eventData,
|
||||
subscriptionState subState)
|
||||
{
|
||||
sipspi_msg_t *pmsg;
|
||||
|
||||
pmsg = (sipspi_msg_t *) cc_get_msg_buf(sizeof(*pmsg));
|
||||
if (!pmsg) {
|
||||
return CC_RC_ERROR;
|
||||
}
|
||||
|
||||
pmsg->msg.notify.eventData = eventData;
|
||||
pmsg->msg.notify.notifyResultCallback = notifyResultCallback;
|
||||
pmsg->msg.notify.sub_id = sub_id;
|
||||
pmsg->msg.notify.subsNotResCallbackMsgID = subsNotResCallbackMsgID;
|
||||
pmsg->msg.notify.subState = subState;
|
||||
|
||||
return sub_send_msg((cprBuffer_t) pmsg, SIPSPI_EV_CC_NOTIFY,
|
||||
sizeof(*pmsg), dst_id);
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: sub_int_notify_ack()
|
||||
*
|
||||
* Parameters: sub_id - subcription id for sip stack to track the subscription.
|
||||
* response_code - response code to be sent in response to NOTIFY.
|
||||
* cseq : CSeq for which response is being sent.
|
||||
*
|
||||
* Description: posts SIPSPI_EV_CC_NOTIFY_RESPONSE to SIP task message queue.
|
||||
*
|
||||
* Returns: CC_RC_ERROR - failed to post msg.
|
||||
* CC_RC_SUCCESS - successful posted msg.
|
||||
*/
|
||||
cc_rcs_t
|
||||
sub_int_notify_ack (sub_id_t sub_id, uint16_t response_code, uint32_t cseq)
|
||||
{
|
||||
sipspi_msg_t *pmsg;
|
||||
|
||||
pmsg = (sipspi_msg_t *) cc_get_msg_buf(sizeof(*pmsg));
|
||||
if (!pmsg) {
|
||||
return CC_RC_ERROR;
|
||||
}
|
||||
|
||||
pmsg->msg.notify_resp.sub_id = sub_id;
|
||||
pmsg->msg.notify_resp.response_code = response_code;
|
||||
pmsg->msg.notify_resp.cseq = cseq;
|
||||
|
||||
return sub_send_msg((cprBuffer_t)pmsg, SIPSPI_EV_CC_NOTIFY_RESPONSE,
|
||||
sizeof(*pmsg), CC_SRC_SIP);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Function: sub_int_subscribe_term()
|
||||
*
|
||||
* Parameters: sub_id - subcription id for sip stack to track the subscription.
|
||||
* immediate - boolean flag to indicate if the termination be immediate.
|
||||
* request_id - request id significant for out going subscriptions
|
||||
* event_package - event package type
|
||||
*
|
||||
* Description: posts SIPSPI_EV_CC_SUBSCRIPTION_TERMINATED to SIP task message queue.
|
||||
*
|
||||
* Returns: CC_RC_ERROR - failed to post msg.
|
||||
* CC_RC_SUCCESS - successful posted msg.
|
||||
*/
|
||||
cc_rcs_t
|
||||
sub_int_subscribe_term (sub_id_t sub_id, boolean immediate, int request_id,
|
||||
cc_subscriptions_t event_package)
|
||||
{
|
||||
sipspi_msg_t *pmsg;
|
||||
|
||||
pmsg = (sipspi_msg_t *) cc_get_msg_buf(sizeof(*pmsg));
|
||||
if (!pmsg) {
|
||||
return CC_RC_ERROR;
|
||||
}
|
||||
|
||||
pmsg->msg.subs_term.immediate = immediate;
|
||||
pmsg->msg.subs_term.sub_id = sub_id;
|
||||
pmsg->msg.subs_term.request_id = request_id;
|
||||
pmsg->msg.subs_term.eventPackage = event_package;
|
||||
|
||||
return sub_send_msg((cprBuffer_t)pmsg, SIPSPI_EV_CC_SUBSCRIPTION_TERMINATED,
|
||||
sizeof(*pmsg), CC_SRC_SIP);
|
||||
}
|
||||
|
||||
cc_rcs_t
|
||||
sip_send_message (ccsip_sub_not_data_t * msg_data, cc_srcs_t dest_id, int msg_id)
|
||||
{
|
||||
ccsip_sub_not_data_t *pmsg;
|
||||
|
||||
pmsg = (ccsip_sub_not_data_t *) cc_get_msg_buf(sizeof(*pmsg));
|
||||
|
||||
if (!pmsg) {
|
||||
return CC_RC_ERROR;
|
||||
}
|
||||
|
||||
memcpy(pmsg, msg_data, sizeof(*pmsg));
|
||||
|
||||
return sub_send_msg((cprBuffer_t)pmsg, msg_id, sizeof(*pmsg), dest_id);
|
||||
}
|
||||
|
||||
|
||||
cc_rcs_t
|
||||
app_send_message (void *msg_data, int msg_len, cc_srcs_t dest_id, int msg_id)
|
||||
{
|
||||
void *pmsg;
|
||||
|
||||
pmsg = (void *) cc_get_msg_buf(msg_len);
|
||||
|
||||
if (!pmsg) {
|
||||
return CC_RC_ERROR;
|
||||
}
|
||||
|
||||
memcpy(pmsg, msg_data, msg_len);
|
||||
|
||||
return sub_send_msg((cprBuffer_t)pmsg, msg_id, (uint16_t)msg_len, dest_id);
|
||||
}
|
207
libs/sipcc/core/includes/ccSession.h
Executable file
207
libs/sipcc/core/includes/ccSession.h
Executable file
@ -0,0 +1,207 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _CCSESSION_H_
|
||||
#define _CCSESSION_H_
|
||||
|
||||
#include "session.h"
|
||||
#include "sessuri.h"
|
||||
|
||||
#define SID_TYPE_SHIFT 28
|
||||
#define SID_LINE_SHIFT 16
|
||||
|
||||
#define GET_SESS_TYPE(x) ( (x & 0xF0000000) >> SID_TYPE_SHIFT )
|
||||
#define GET_LINEID(x) (line_t)( (x & 0xFFF0000) >> SID_LINE_SHIFT )
|
||||
#define GET_CALLID(x) (callid_t)(x & 0xFFFF)
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* ccSessionProviderCmd
|
||||
* CallControl Provider Management Interface
|
||||
* Called by Application to issue cmds to sipStack
|
||||
*
|
||||
* @param data - command and data
|
||||
* data->cmd - see Session Provider Commands in session.h
|
||||
* data->cmdData.ccData.reason - reason for SHUTDOWN/UNREGISTER_ALL_LINES CMD
|
||||
CC_CAUSE_NORMAL/CC_CAUSE_NONE
|
||||
* data->cmdData.ccData.reason_info - Descriptive stringa "notused"
|
||||
*
|
||||
* @return none
|
||||
*
|
||||
*/
|
||||
void ccSessionProviderCmd(sessionProvider_cmd_t *data);
|
||||
|
||||
|
||||
/**
|
||||
* ccSessionProviderState
|
||||
* Method to report provider state updates to Application
|
||||
*
|
||||
* @param state - indicates the Session Provider state CCApp_states_t
|
||||
* @param data - ccProvider_state_t indicating
|
||||
* data->stateData.ccData.mode - REGMODE CCM
|
||||
* data->stateData.ccData.cause - FAILOVER/FALLBACK
|
||||
*
|
||||
* @return none
|
||||
*
|
||||
*/
|
||||
void ccSessionProviderState(unsigned int state, ccProvider_state_t *data);
|
||||
|
||||
|
||||
/**
|
||||
* ccSessionCmd
|
||||
* Method to Handle session lifecycle command such as realize, start etc.
|
||||
*
|
||||
* @param sCmd - session liefcycle command
|
||||
* sCmd->cmd - REQUEST CMD
|
||||
* sCmd->sessID - session ID
|
||||
*
|
||||
* @return none
|
||||
*
|
||||
*/
|
||||
|
||||
void ccSessionCmd (sessionCmd_t *sCmd);
|
||||
|
||||
|
||||
/**
|
||||
* ccCreateSession
|
||||
*
|
||||
* Called by Application to create a new session
|
||||
*
|
||||
* @param param - uri_t
|
||||
* param->param.call_session_param.line_id - line on which to create the session
|
||||
* @return ccSession_id_t - id of the session created
|
||||
*/
|
||||
|
||||
session_id_t ccCreateSession(uri_t *param);
|
||||
|
||||
/**
|
||||
* ccCloseSession
|
||||
*
|
||||
* Called by Application to close a session
|
||||
*
|
||||
* @param sess_id - ID of the session to be closed
|
||||
*
|
||||
* @return 0 success -1 failure
|
||||
*
|
||||
*/
|
||||
|
||||
int ccCloseSession(session_id_t sess_id);
|
||||
|
||||
/* Need to document IDs and data for the following 4 methods */
|
||||
|
||||
/**
|
||||
* ccInvokeFeature
|
||||
*
|
||||
* Called by Application to invoke feature on session
|
||||
*
|
||||
* @param featData - featID and Additional info if needed for the feature
|
||||
*
|
||||
* @return none
|
||||
*
|
||||
*/
|
||||
|
||||
void ccInvokeFeature(session_feature_t *featData);
|
||||
|
||||
/**
|
||||
* ccInvokeProviderFeature
|
||||
*
|
||||
* Called by Application to invoke device specific features
|
||||
*
|
||||
* @param featData - Additional info if needed for the feature
|
||||
*
|
||||
* @return none
|
||||
*
|
||||
*/
|
||||
|
||||
void ccInvokeProviderFeature(session_feature_t *featData);
|
||||
|
||||
|
||||
/**
|
||||
* ccSessionUpdate
|
||||
*
|
||||
* Called by sipstack to update session state and data
|
||||
*
|
||||
* @param eventID - ID of the event updating the session data
|
||||
* @param session_data - event specific data
|
||||
*
|
||||
* @return none
|
||||
*
|
||||
*/
|
||||
|
||||
void ccSessionUpdate(session_update_t *session);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* ccFeatureUpdate
|
||||
*
|
||||
* Called by sipstack to update feature state and data
|
||||
*
|
||||
* @param featureID - ID of the feature updated
|
||||
* @param session_data - feature specific data
|
||||
*
|
||||
* @return none
|
||||
*
|
||||
*/
|
||||
|
||||
void ccFeatureUpdate(feature_update_t *session);
|
||||
|
||||
/***** Internal APIs below this line ***************/
|
||||
|
||||
/**
|
||||
* ccCreateSession
|
||||
*
|
||||
* Called to create a CC session
|
||||
*
|
||||
* @param param - ccSession_create_param_t
|
||||
* Contains the type of session and specific data
|
||||
*
|
||||
* @return ccSession_id_t - id of the session created
|
||||
*/
|
||||
session_id_t createSessionId(line_t line, callid_t call);
|
||||
|
||||
void platform_sync_cfg_vers (char *cfg_ver, char *dp_ver, char *softkey_ver);
|
||||
/********************************************************************************/
|
||||
|
||||
/* Misc getter/setter function to get set the following */
|
||||
|
||||
#define PROPERTY_ID_MWI 1 // per line
|
||||
#define PROPERTY_ID_TIME 2 // unsigned long
|
||||
#define PROPERTY_ID_KPML 3
|
||||
#define PROPERTY_ID_REGREASON 4
|
||||
#define PROPERTY_ID_SPKR_HDST 5 1
|
||||
|
||||
void setIntProperty(unsigned int id, int val);
|
||||
int getIntProperty(unsigned int id);
|
||||
void setStrProperty(unsigned int id, char * val);
|
||||
char * getStrProperty(unsigned int id);
|
||||
|
||||
|
||||
/* Preserved API's from TNP Platform */
|
||||
char *ccSetDP(const char *dp_file_name);
|
||||
// update_label_n_speed_dial method here
|
||||
void setPropertyCacheBoolean(int cfg_id, int bool_value);
|
||||
void setPropertyCacheInteger(int cfg_id, int int_value);
|
||||
void setPropertyCacheString(int cfg_id, const char *string_value);
|
||||
void setPropertyCacheByte(int cfg_id, char byte_value);
|
||||
void setPropertyCacheByteArray(int cfg_id, char *byte_value, int length);
|
||||
|
||||
/* BLF */
|
||||
void ccBLFSubscribe(int request_id, int duration, const char *watcher,
|
||||
const char *presentity, int app_id, int feature_mask);
|
||||
void ccBLFUnsubscribe(int request_id);
|
||||
void ccBLFUnsubscribeAll();
|
||||
void blf_notification(int request_id, int status, int app_id);
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
|
||||
MID_JPlatUi_ui_log_status_msg, Ask RCDN team if log is changing?
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#endif
|
||||
|
1578
libs/sipcc/core/includes/ccapi.h
Executable file
1578
libs/sipcc/core/includes/ccapi.h
Executable file
File diff suppressed because it is too large
Load Diff
46
libs/sipcc/core/includes/check_sync.h
Normal file
46
libs/sipcc/core/includes/check_sync.h
Normal file
@ -0,0 +1,46 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef CHECK_SYNC_H
|
||||
#define CHECK_SYNC_H
|
||||
|
||||
#include "util_parse.h"
|
||||
|
||||
typedef enum {
|
||||
SYNCS_ANY,
|
||||
SYNCS_GOT_VERSION,
|
||||
SYNCS_GOT_VERSION_EQ,
|
||||
SYNCS_GOT_SYNC,
|
||||
SYNCS_GOT_SYNC_EQ,
|
||||
SYNCS_GOT_GENERIC,
|
||||
SYNCS_GOT_GENERIC_EQ
|
||||
} sync_states;
|
||||
|
||||
typedef enum {
|
||||
SYNCF_NONE,
|
||||
SYNCF_MY,
|
||||
SYNCF_WILD
|
||||
} SyncVersionFound_t;
|
||||
|
||||
typedef struct {
|
||||
char myVersion[MAX_LOAD_ID_STRING];
|
||||
char resetSync[MAX_SYNC_LEN];
|
||||
SyncVersionFound_t versionFound;
|
||||
} VersionSync_t;
|
||||
|
||||
#define SYNCINFO_XML "syncinfo.xml"
|
||||
#define SYNC_BUF_SIZE 4096
|
||||
|
||||
extern int CheckSync;
|
||||
extern int SyncInfoInProgress;
|
||||
extern char *SyncBuffer;
|
||||
|
||||
int check_sync_get(void);
|
||||
void add_sync_info(char *version, char *sync, VersionSync_t *versionSync);
|
||||
int parse_sync_entry(char **parseptr, VersionSync_t *versionSync);
|
||||
int parse_sync_info(char *parseptr, VersionSync_t *versionSync);
|
||||
void process_sync_info(char *syncInfo);
|
||||
short handle_sync_message(short cmd, void *pData);
|
||||
|
||||
#endif
|
34
libs/sipcc/core/includes/ci.h
Normal file
34
libs/sipcc/core/includes/ci.h
Normal file
@ -0,0 +1,34 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _CI_INCLUDED_H
|
||||
#define _CI_INCLUDED_H
|
||||
|
||||
#include "plat_api.h"
|
||||
#include "plat_debug.h"
|
||||
|
||||
|
||||
/* return codes for CI command processing */
|
||||
#define CI_OK (0)
|
||||
#define CI_ERROR (1)
|
||||
#define CI_INVALID (2)
|
||||
#define CI_AMBIGUOUS (3)
|
||||
|
||||
/* flags for CI processing */
|
||||
#define CI_PROMPT (0x0001)
|
||||
|
||||
/*
|
||||
* Prototypes for public functions
|
||||
*/
|
||||
void ci_init();
|
||||
int ci_process_input(const char *str, char *wkspace, int wklen);
|
||||
int32_t ci_show_cmds(int32_t argc, const char *argv[]);
|
||||
ci_callback ci_set_interceptor(ci_callback func);
|
||||
|
||||
int ci_err_too_few(void); /* "Too few arguments" */
|
||||
int ci_err_too_many(void); /* "Too many arguments" */
|
||||
int ci_err_inv_arg(void); /* "Invalid argument" */
|
||||
uint32_t ci_streval(const char *str);
|
||||
|
||||
#endif /* _CI_INCLUDED_H */
|
196
libs/sipcc/core/includes/config.h
Executable file
196
libs/sipcc/core/includes/config.h
Executable file
@ -0,0 +1,196 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _CONFIG_H_
|
||||
#define _CONFIG_H_
|
||||
|
||||
#include "cpr_types.h"
|
||||
#include "cpr_timers.h"
|
||||
#include "cfgfile_utils.h"
|
||||
#include "configmgr.h"
|
||||
#include "prot_configmgr.h"
|
||||
#include "phone.h"
|
||||
|
||||
/*
|
||||
* List of timers that the CFG task is responsible for.
|
||||
* CPR will send a msg to the CFG task when these
|
||||
* timers expire. CPR expects a timer id when the timer
|
||||
* is created, this enum serves that purpose.
|
||||
*/
|
||||
typedef enum {
|
||||
CFG_TFTP_RETRY_TIMER
|
||||
} cfgTimerList_t;
|
||||
|
||||
#define MAX_REQ_FIELDS 20
|
||||
#define MAX_FIELD_NAME_SIZE 30
|
||||
#define MAX_FIELD_VALUE_SIZE 30
|
||||
#define MAX_FIELDDESC_STR (MAX_FIELD_VALUE_SIZE+2)
|
||||
#define MAX_TFTP_PATH_LEN 64
|
||||
|
||||
/*
|
||||
* Definition of bits used in pDHCPInfo->extFields.ext.appStatus (32bits).
|
||||
* Please note that some of these flags correspond to status flags
|
||||
* asserted by Little App. Please see little_app.c, and make sure these
|
||||
* flags are kept consistent.
|
||||
*/
|
||||
|
||||
#define APPSTATUS_UPGRADE_FAILED 0x80000000L
|
||||
|
||||
/* maximum length of config file including comments */
|
||||
#define MAX_CFG_FILE_LENGTH 0x2000
|
||||
|
||||
/* minimum length of a registrion in seconds */
|
||||
#define MIN_REGISTRATION_PERIOD 20
|
||||
|
||||
#define BUF_TEST();
|
||||
|
||||
typedef enum {
|
||||
ERASE_PROGRAM,
|
||||
ERASE_ONLY,
|
||||
PROGRAM_ONLY
|
||||
} flash_mode_t;
|
||||
|
||||
extern var_t prot_cfg_table[];
|
||||
extern cfg_rom_t *const prot_startup_config;
|
||||
extern cfg_rom_t *const prot_running_config;
|
||||
extern cfg_rom_t *const prot_temp_config;
|
||||
extern int config_commit(int);
|
||||
extern int prot_sanity_check_config_settings(void);
|
||||
extern boolean prot_option_allowed_in_cfg_file(const char *);
|
||||
extern void prot_shutdown(void);
|
||||
extern int prot_config_change_notify(int);
|
||||
extern void prot_disconnected(int);
|
||||
extern int FlashaProgram(uint16_t *Source, uint16_t *Dest, uint32_t Size,
|
||||
flash_mode_t mode);
|
||||
|
||||
extern uint16_t g_NewVlan;
|
||||
extern uint16_t g_NewRelease;
|
||||
extern uint16_t g_NewErase;
|
||||
extern char local_media_type_string[];
|
||||
extern char local_net_dev_type_string[];
|
||||
|
||||
void CFGTftpTimeout(int /*cpr_timer_t*/ *tmr);
|
||||
int CFGProgramFlash(uint8_t *src, uint8_t *dst, uint32_t len);
|
||||
int CFGEraseFlash(uint8_t *src, uint8_t *dst, uint32_t len);
|
||||
int CFGEraseProgramFlash(uint8_t *src, uint8_t *dst, uint32_t len);
|
||||
int CFGChksum(uint8_t *ptr, uint32_t len, uint32_t *csum, int dspmode,
|
||||
int cmpmode);
|
||||
int CFGGetUISettings(uint8_t *pData);
|
||||
int CFGSetUISettings(void);
|
||||
void CFGSetLockState(boolean);
|
||||
boolean CFGIsLocked(void);
|
||||
void cfg_set_running_config(void);
|
||||
void cfg_get_stored_prot_settings(void);
|
||||
void LoadTempConfigData(void);
|
||||
void config_handle_cdp(int);
|
||||
void cfg_sanity_check_media_range(void);
|
||||
void cfg_check_la_appStatus(unsigned long appStatus);
|
||||
void cfg_set_inhibitLoading(int yesno);
|
||||
int cfg_get_inhibitLoading(void);
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// Configuration Variables replacing CUCM config file
|
||||
//
|
||||
////
|
||||
//////
|
||||
|
||||
static const int gStartMediaPort = 16384;
|
||||
static const int gStopMediaPort = 32766;
|
||||
static const boolean gCallerIdBlocking = FALSE;
|
||||
static const boolean gAnonblock = FALSE;
|
||||
static const char gPreferredCodec[] = "none";
|
||||
static const char gDtmfOutOfBand[] = "avt";
|
||||
static const int gDtmfAvtPayload = 101;
|
||||
static const int gDtmfDbLevel = 3;
|
||||
static const int gSipRetx = 10;
|
||||
static const int gSipInviteRetx = 6;
|
||||
static const int gTimerT1 = 500;
|
||||
static const int gTimerT2 = 4000;
|
||||
static const int gTimerInviteExpires = 180;
|
||||
static const int gTimerRegisterExpires = 3600;
|
||||
static const boolean gRegisterWithProxy = TRUE;
|
||||
static const char gBackupProxy[] = "USECALLMANAGER";
|
||||
static const int gBackupProxyPort = 5060;
|
||||
static const char gEmergencyProxy[] = "USECALLMANAGER";
|
||||
static const int gEmergencyProxyPort = 5060;
|
||||
static const char gOutboundProxy[] = "USECALLMANAGER";
|
||||
static const int gOutboundProxyPort = 5060;
|
||||
static const boolean gNatRecievedProcessing = FALSE;
|
||||
static const char gUserInfo[] = "None";
|
||||
static const boolean gRemotePartyID = TRUE;
|
||||
static const boolean gSemiAttendedTransfer = TRUE;
|
||||
static const int gCallHoldRingback = 2;
|
||||
static const boolean gStutterMsgWaiting = FALSE;
|
||||
static const char gCallForwardURI[] = "x-cisco-serviceuri-cfwdall";
|
||||
static const boolean gCallStats = TRUE;
|
||||
static const int gTimerRegisterDelta = 5;
|
||||
static const int gMaxRedirects = 70;
|
||||
static const boolean gRfc2543Hold = FALSE;
|
||||
static const boolean gLocalCfwdEnable = TRUE;
|
||||
static const int gConnectionMonitorDuration = 120;
|
||||
static const int gCallLogBlfEnabled = 3 & 0x1;
|
||||
static const boolean gRetainForwardInformation = FALSE;
|
||||
static const int gRemoteCcEnable = 1;
|
||||
static const int gTimerKeepAliveExpires = 120;
|
||||
static const int gTimerSubscribeExpires = 120;
|
||||
static const int gTimerSubscribeDelta = 5;
|
||||
static const int gKpml = 3;
|
||||
static const boolean gNatEnabled = FALSE;
|
||||
static const char gNatAddress[] = "";
|
||||
static const boolean gAnableVad = FALSE;
|
||||
static const boolean gAutoAnswerAltBehavior = FALSE;
|
||||
static const int gAutoAnswerTimer = 1;
|
||||
static const boolean gAutoAnswerOverride = TRUE;
|
||||
static const int gOffhookToFirstDigitTimer = 15000;
|
||||
static const int gSilentPeriodBetweenCallWaitingBursts = 10;
|
||||
static const int gRingSettingBusyStationPolicy = 0;
|
||||
static const int gBlfAudibleAlertSettingOfIdleStation = 0;
|
||||
static const int gBlfAudibleAlertSettingOfBusyStation = 0;
|
||||
static const int gJoinAcrossLines = 0;
|
||||
static const boolean gCnfJoinEnabled = TRUE;
|
||||
static const int gRollover = 0;
|
||||
static const boolean gTransferOnhookEnabled = FALSE;
|
||||
static const int gDscpForAudio = 184;
|
||||
static const int gDscpVideo = 136;
|
||||
static const int gT302Timer = 5000;
|
||||
static const int gLineIndex = 1;
|
||||
static const int gFeatureID = 9;
|
||||
static const char gProxy[] = "USECALLMANAGER";
|
||||
static const int gPort = 5060;
|
||||
static const char gDisplayName[] = "";
|
||||
static const char gMessagesNumber[] = "";
|
||||
static const boolean gCallerName = TRUE;
|
||||
static const boolean gCallerNumber = FALSE;
|
||||
static const boolean gRedirectedNumber = FALSE;
|
||||
static const boolean gDialedNumber = TRUE;
|
||||
static const unsigned char gMessageWaitingLampPolicy = 3;
|
||||
static const unsigned char gMessageWaitingAMWI = 1;
|
||||
static const unsigned char gRingSettingIdle = 4;
|
||||
static const unsigned char gRingSettingActive = 5;
|
||||
static const int gMaxNumCalls = 1;
|
||||
static const int gBusyTrigger = 1;
|
||||
static const unsigned char gAutoAnswerEnabled = 2 & 0x1;
|
||||
static const unsigned char gCallWaiting = 3 & 0x1;
|
||||
static const int gDeviceSecurityMode = 1;
|
||||
static const int gCcm2_sip_port = 5060;
|
||||
static const int gCcm3_sip_port = 5060;
|
||||
static const boolean gCcm1_isvalid = TRUE;
|
||||
static const int gDscpCallControl = 1;
|
||||
static const int gSpeakerEnabled = 1;
|
||||
static const char gExternalNumberMask[] = "";
|
||||
static const char gVersion[] = "0.1";
|
||||
static const boolean gRTCPMUX = FALSE;
|
||||
static boolean gRTPSAVPF = TRUE; /* TRUE = RTP/SAVPF , FALSE = RTP/SAVP */
|
||||
static const boolean gMAXAVBITRATE = FALSE; /* Following six are OPUS fmtp options */
|
||||
static const boolean gMAXCODEDAUDIOBW = FALSE;
|
||||
static const boolean gUSEDTX = FALSE;
|
||||
static const boolean gSTEREO = FALSE;
|
||||
static const boolean gUSEINBANDFEC = FALSE;
|
||||
static const boolean gCBR = FALSE;
|
||||
static const boolean gMAXPTIME = FALSE;
|
||||
static const int gSCTPPort = 5000;
|
||||
static const int gNumDataStreams = 16;
|
||||
|
||||
#endif /* _CONFIG_H_ */
|
13
libs/sipcc/core/includes/configapp.h
Normal file
13
libs/sipcc/core/includes/configapp.h
Normal file
@ -0,0 +1,13 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef CONFIGAPP_H
|
||||
#define CONFIGAPP_H
|
||||
|
||||
extern void configapp_init();
|
||||
extern void configapp_shutdown();
|
||||
extern void configapp_process_msg(uint32_t cmd, void *msg);
|
||||
|
||||
#endif
|
||||
|
62
libs/sipcc/core/includes/configmgr.h
Executable file
62
libs/sipcc/core/includes/configmgr.h
Executable file
@ -0,0 +1,62 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _CONFIGMGR_H_
|
||||
#define _CONFIGMGR_H_
|
||||
|
||||
/*
|
||||
* #defines for maximum length of the image names
|
||||
* The MAX_LOAD_ID_LENGTH must be larger (or the same as)
|
||||
* MAX_OLD_LOAD_ID_LENGTH or strange things may
|
||||
* happen because they are used as indexes into
|
||||
* arrays.
|
||||
*/
|
||||
#include "cpr_types.h"
|
||||
#define MAX_LOAD_ID_LENGTH 60
|
||||
#define MAX_LOAD_ID_STRING MAX_LOAD_ID_LENGTH + 1
|
||||
#define MAX_OLD_LOAD_ID_LENGTH 8
|
||||
#define MAX_OLD_LOAD_ID_STRING MAX_OLD_LOAD_ID_LENGTH + 1
|
||||
#define MAX_URL_LENGTH 128
|
||||
|
||||
#define MAX_SYNC_LEN 33
|
||||
#define MAX_PHONE_LABEL 32
|
||||
|
||||
/* Start of section for new "protocol-inspecific" calls */
|
||||
|
||||
#define MAX_CONFIG_STRING_NAME 64
|
||||
#define DEFAULT_LINE 1
|
||||
|
||||
#define YESSTR "YES"
|
||||
#define NOSTR "NO"
|
||||
#define IPOFZEROS "0.0.0.0"
|
||||
|
||||
enum ACTIONATTR {
|
||||
AA_IGNORE = 0,
|
||||
AA_COMMIT = 1,
|
||||
AA_RELOAD = 1 << 1,
|
||||
AA_REGISTER = 1 << 2,
|
||||
AA_FORCE = 1 << 3,
|
||||
AA_RESET = 1 << 4,
|
||||
AA_SETTINGS = 1 << 5,
|
||||
AA_BU_REG = 1 << 6
|
||||
};
|
||||
|
||||
/*********************************************************
|
||||
*
|
||||
* External Function Prototypes
|
||||
*
|
||||
*********************************************************/
|
||||
void config_get_string(int id, char *buffer, int buffer_len);
|
||||
void config_set_string(int id, char *buffer);
|
||||
void config_get_value(int id, void *buffer, int length);
|
||||
void config_set_value(int id, void *buffer, int length);
|
||||
|
||||
void config_get_line_string(int id, char *buffer, int line, int buffer_len);
|
||||
void config_set_line_string(int id, char *buffer, int line);
|
||||
void config_get_line_value(int id, void *buffer, int length, int line);
|
||||
void config_set_line_value(int id, void *buffer, int length, int line);
|
||||
|
||||
void config_init(void);
|
||||
|
||||
#endif /* _CONFIGMGR_H_ */
|
107
libs/sipcc/core/includes/debug.h
Normal file
107
libs/sipcc/core/includes/debug.h
Normal file
@ -0,0 +1,107 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _DEBUG_INCLUDED_H /* allows multiple inclusion */
|
||||
#define _DEBUG_INCLUDED_H
|
||||
|
||||
#include "cpr_types.h"
|
||||
#include "plat_api.h"
|
||||
#include "phone_debug.h"
|
||||
#include "CSFLog.h"
|
||||
|
||||
typedef cc_int32_t (*debug_callback)(cc_int32_t argc, const char *argv[]);
|
||||
typedef cc_int32_t (*show_callback)(cc_int32_t argc, const char *argv[]);
|
||||
typedef cc_int32_t (*clear_callback)(cc_int32_t argc, const char *argv[]);
|
||||
|
||||
typedef enum {
|
||||
TEST_OPEN,
|
||||
TEST_CLOSE,
|
||||
TEST_KEY,
|
||||
TEST_ONHOOK,
|
||||
TEST_OFFHOOK,
|
||||
TEST_SHOW,
|
||||
TEST_HIDE,
|
||||
TEST_PROFILE,
|
||||
TEST_C3PO
|
||||
} test_command_t;
|
||||
|
||||
|
||||
typedef int32_t (*test_callback)(int32_t argc, const char *argv[],
|
||||
test_command_t command);
|
||||
|
||||
extern int32_t TestMode;
|
||||
extern int32_t TestShow;
|
||||
|
||||
typedef enum {
|
||||
DEBUG_ENTRY_TYPE_FLAG,
|
||||
DEBUG_ENTRY_TYPE_DEBUG_FUNC,
|
||||
DEBUG_ENTRY_TYPE_SHOW_FUNC
|
||||
} debug_entry_type_e;
|
||||
|
||||
typedef struct {
|
||||
const char *keyw;
|
||||
union {
|
||||
int32_t *flag;
|
||||
debug_callback func;
|
||||
show_callback show_func;
|
||||
} u;
|
||||
debug_entry_type_e type;
|
||||
boolean show_tech;
|
||||
} debug_entry_t;
|
||||
|
||||
typedef struct {
|
||||
const char *keyw;
|
||||
union {
|
||||
int32_t *flag;
|
||||
clear_callback func;
|
||||
} u;
|
||||
} clear_entry_t;
|
||||
|
||||
typedef struct {
|
||||
const char *keyw;
|
||||
const char *abrv;
|
||||
const char *help;
|
||||
boolean hidden;
|
||||
union {
|
||||
int32_t *flag;
|
||||
test_callback func;
|
||||
} u;
|
||||
test_command_t command;
|
||||
} test_entry_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned char flag;
|
||||
unsigned char hookevent;
|
||||
unsigned char keyevent; // keyevent and key will double as a timer value internally
|
||||
unsigned char key;
|
||||
} testevent_t;
|
||||
|
||||
// The next 4 defines are used as flag values to specify the event types in the queue.
|
||||
// Note that we cannot use the HOOKSCAN and KEYSCAN that are defined in phone.h, because
|
||||
// HOOKSCAN requires a full integer. In order to minimize space in the test event queue
|
||||
// we need short numbers.
|
||||
#define TEST_NONE 0
|
||||
#define TEST_KEYSCAN 1
|
||||
#define TEST_HOOKSCAN 2
|
||||
#define TEST_TIMER 0x80
|
||||
|
||||
|
||||
#define MAX_DEBUG_NAME 50
|
||||
#define MAX_SHOW_NAME 50
|
||||
#define MAX_CLEAR_NAME 50
|
||||
|
||||
/*
|
||||
* Prototypes for public functions
|
||||
*/
|
||||
void bind_test_keyword(const char *keyword, const char *abrv, boolean hidden,
|
||||
test_callback func, test_command_t command,
|
||||
const char *help);
|
||||
testevent_t TESTGetEvent(void);
|
||||
|
||||
// Send debug output to CSFLog
|
||||
#define debugif_printf(format, ...) CSFLogDebug("debugif", format, ## __VA_ARGS__ )
|
||||
|
||||
|
||||
#endif /* _DEBUG_INCLUDED_H */
|
111
libs/sipcc/core/includes/dialplan.h
Executable file
111
libs/sipcc/core/includes/dialplan.h
Executable file
@ -0,0 +1,111 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef DIALPLAN_H
|
||||
#define DIALPLAN_H
|
||||
|
||||
#include <vcm.h>
|
||||
#include "phone_types.h"
|
||||
|
||||
#define DIALPLAN_MAX_SIZE 0x2000
|
||||
#define MAX_SUBTITUTIONS 5
|
||||
#define MAX_TONES 3
|
||||
#define MAX_TEMPLATE_LENGTH 196
|
||||
#define DIAL_ESCAPE '\\'
|
||||
#define MAX_DIALSTRING 256
|
||||
#define DIAL_TIMEOUT 10
|
||||
#define MAX_DP_VERSION_STAMP_LEN (64+1)
|
||||
extern char g_dp_version_stamp[MAX_DP_VERSION_STAMP_LEN];
|
||||
|
||||
typedef enum {
|
||||
DIAL_NOMATCH = 0,
|
||||
DIAL_GIVETONE,
|
||||
DIAL_WILDPATTERN,
|
||||
DIAL_FULLPATTERN,
|
||||
DIAL_FULLMATCH,
|
||||
DIAL_IMMEDIATELY
|
||||
} DialMatchAction;
|
||||
|
||||
/* Set enum values to match DialMatchAction */
|
||||
typedef enum {
|
||||
DIALTONE_NOMATCH = 0,
|
||||
DIALTONE_WILD = 2,
|
||||
DIALTONE_FULL,
|
||||
DIALTONE_EXACT
|
||||
} DialToneMatch;
|
||||
|
||||
typedef enum {
|
||||
UserUnspec,
|
||||
UserPhone,
|
||||
UserIP
|
||||
} UserMode;
|
||||
|
||||
typedef enum {
|
||||
RouteDefault, // Route using the default proxy
|
||||
RouteEmergency, // Route using the emergency proxy
|
||||
RouteFQDN // Route according to the FQDN in the entry
|
||||
} RouteMode;
|
||||
|
||||
struct DialTemplate {
|
||||
struct DialTemplate *next;
|
||||
char *pattern;
|
||||
line_t line;
|
||||
char *rewrite;
|
||||
int timeout;
|
||||
UserMode userMode;
|
||||
RouteMode routeMode;
|
||||
int tones_defined;
|
||||
vcm_tones_t tone[MAX_TONES];
|
||||
};
|
||||
|
||||
struct StoredDialTemplate {
|
||||
short size; // Size of header part of structure
|
||||
short nextOffset; // total Number of bytes used in the entry
|
||||
// A zero here is used as a last entry
|
||||
int timeout;
|
||||
line_t line;
|
||||
UserMode userMode;
|
||||
short pattern_offset; // Offset to the pattern string
|
||||
short rewrite_offset; // Offset to the rewrite string
|
||||
RouteMode routeMode;
|
||||
int tones_defined;
|
||||
vcm_tones_t tone[MAX_TONES];
|
||||
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
STATE_ANY,
|
||||
STATE_GOT_MATCH,
|
||||
STATE_GOT_MATCH_EQ,
|
||||
STATE_GOT_LINE,
|
||||
STATE_GOT_LINE_EQ,
|
||||
STATE_GOT_TIMEOUT,
|
||||
STATE_GOT_TIMEOUT_EQ,
|
||||
STATE_GOT_USER,
|
||||
STATE_GOT_USER_EQ,
|
||||
STATE_GOT_REWRITE,
|
||||
STATE_GOT_REWRITE_EQ,
|
||||
STATE_GOT_ROUTE,
|
||||
STATE_GOT_ROUTE_EQ,
|
||||
STATE_GOT_TONE,
|
||||
STATE_GOT_TONE_EQ,
|
||||
STATE_START_TAG_COMPLETED, /* start tag parsing is complete when self-terminating (<tag/>) format is not used */
|
||||
STATE_END_TAG_STARTED, /* end tag started when we see "</" */
|
||||
STATE_END_TAG_FOUND /* end tag is parsed */
|
||||
} ParseDialState;
|
||||
|
||||
extern DialMatchAction MatchDialTemplate(const char *pattern,
|
||||
const line_t line,
|
||||
int *timeout,
|
||||
char *rewrite, int rewritelen,
|
||||
RouteMode *pRouteMode,
|
||||
vcm_tones_t *pTone);
|
||||
void SaveDialTemplate(void);
|
||||
void RestoreDialPlan(void);
|
||||
void InitDialPlan(boolean);
|
||||
void FreeDialTemplates(void);
|
||||
extern short handle_dialplan(short, void *);
|
||||
extern boolean ParseDialTemplate(char *parseptr);
|
||||
|
||||
#endif //DIALPLAN_H
|
93
libs/sipcc/core/includes/dialplanint.h
Executable file
93
libs/sipcc/core/includes/dialplanint.h
Executable file
@ -0,0 +1,93 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef DIALPLANINT_H
|
||||
#define DIALPLANINT_H
|
||||
|
||||
#include "phone_types.h"
|
||||
#include "dialplan.h"
|
||||
|
||||
#define BKSPACE_KEY 90
|
||||
#define DEFAULT_DIALTIMEOUT 30
|
||||
#define CISCO_PLAR_STRING "x-cisco-serviceuri-offhook"
|
||||
|
||||
typedef struct timer_index_ {
|
||||
line_t line;
|
||||
callid_t call_id;
|
||||
} timer_index_t;
|
||||
|
||||
typedef union timer_info_t_ {
|
||||
void *whole;
|
||||
timer_index_t index;
|
||||
} timer_info_t;
|
||||
|
||||
/* dialplan interface data structure */
|
||||
typedef struct dp_int_t_ {
|
||||
line_t line;
|
||||
callid_t call_id;
|
||||
char digit;
|
||||
char digit_str[MAX_DIALSTRING];
|
||||
boolean collect_more;
|
||||
void *tmr_ptr;
|
||||
char global_call_id[CC_GCID_LEN];
|
||||
monitor_mode_t monitor_mode;
|
||||
} dp_int_t;
|
||||
|
||||
typedef enum {
|
||||
DP_NONE_TIMER,
|
||||
DP_OFFHOOK_TIMER,
|
||||
DP_INTERDIGIT_TIMER
|
||||
} dp_timer_type_e;
|
||||
|
||||
typedef struct dp_data_t_ {
|
||||
char gDialed[MAX_DIALSTRING];
|
||||
char gReDialed[MAX_DIALSTRING];
|
||||
line_t gRedialLine;
|
||||
char empty_rewrite[MAX_DIALSTRING];
|
||||
|
||||
uint32_t offhook_timeout; /* timeout configured to wait after offhook */
|
||||
void *dial_timer;
|
||||
boolean gDialplanDone;
|
||||
/* Indicates that local dialplan match has been completed */
|
||||
boolean allow_proceed;
|
||||
/* under certain conditions proceed has to be passed to
|
||||
* UI even KPML is enabled. For example redial, which not
|
||||
* collect more digits so freeze the screen by sending
|
||||
* proceed to UI
|
||||
*/
|
||||
|
||||
line_t line; /* Line where which dialing is currently active */
|
||||
callid_t call_id; /* call id of currently dialing call */
|
||||
boolean url_dialing; /* Indicates dialing is url dialing */
|
||||
timer_info_t timer_info;
|
||||
dp_timer_type_e gTimerType;
|
||||
} dp_data_t;
|
||||
|
||||
void dp_dial_timeout(void *);
|
||||
void dp_int_init_dialing_data(line_t line, callid_t call_id);
|
||||
void dp_int_update_key_string(line_t line, callid_t call_id, char *digits);
|
||||
void dp_int_store_digit_string(line_t line, callid_t call_id, char *digit_str);
|
||||
void dp_int_update_keypress(line_t line, callid_t call_id, unsigned char digit);
|
||||
void dp_int_dial_immediate(line_t line, callid_t call_id, boolean collect_more,
|
||||
char *digit_str, char *g_call_id,
|
||||
monitor_mode_t monitor_mode);
|
||||
void dp_int_do_redial(line_t line, callid_t call_id);
|
||||
void dp_int_onhook(line_t line, callid_t call_id);
|
||||
void dp_int_offhook(line_t line, callid_t call_id);
|
||||
void dp_int_update(line_t line, callid_t call_id, string_t called_num);
|
||||
int dp_init_template(const char *dp_file_name, int maxSize);
|
||||
void dp_int_cancel_offhook_timer(line_t line, callid_t call_id);
|
||||
|
||||
|
||||
boolean dp_offhook (line_t line, callid_t call_id);
|
||||
boolean dp_get_kpml_state(void);
|
||||
void dp_delete_last_digit(line_t line_id, callid_t call_id);
|
||||
void dp_store_digits(line_t line, callid_t call_id, unsigned char digit);
|
||||
char *dp_get_gdialed_digits(void);
|
||||
line_t dp_get_redial_line(void);
|
||||
void dp_reset(void);
|
||||
boolean dp_check_for_plar_line(line_t line);
|
||||
void dp_cancel_offhook_timer(void);
|
||||
|
||||
#endif /* DIALPLANINT_H */
|
42
libs/sipcc/core/includes/digcalc.h
Normal file
42
libs/sipcc/core/includes/digcalc.h
Normal file
@ -0,0 +1,42 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _DIGCALC_H_
|
||||
#define _DIGCALC_H_
|
||||
|
||||
#define HASHLEN 16
|
||||
typedef char HASH[HASHLEN];
|
||||
#define HASHHEXLEN 32
|
||||
typedef char HASHHEX[HASHHEXLEN + 1];
|
||||
|
||||
#define IN
|
||||
#define OUT
|
||||
|
||||
/* calculate H(A1) as per HTTP Digest spec */
|
||||
void DigestCalcHA1(
|
||||
IN char *pszAlg,
|
||||
IN char *pszUserName,
|
||||
IN char *pszRealm,
|
||||
IN char *pszPassword,
|
||||
IN char *pszNonce,
|
||||
IN char *pszCNonce,
|
||||
OUT HASHHEX SessionKey
|
||||
);
|
||||
|
||||
/* calculate request-digest/response-digest as per HTTP Digest spec */
|
||||
void DigestCalcResponse(
|
||||
IN HASHHEX HA1, /* H(A1) */
|
||||
IN char *pszNonce, /* nonce from server */
|
||||
IN char *pszNonceCount, /* 8 hex digits */
|
||||
IN char *pszCNonce, /* client nonce */
|
||||
IN char *pszQop, /* qop-value: "", "auth", "auth-int" */
|
||||
IN char *pszMethod, /* method from the request */
|
||||
IN char *pszDigestUri, /* requested URL */
|
||||
IN HASHHEX HEntity, /* H(entity body) if qop="auth-int" */
|
||||
OUT HASHHEX Response /* request-digest or response-digest */
|
||||
);
|
||||
|
||||
void DigestString(char *string, HASHHEX response);
|
||||
|
||||
#endif
|
77
libs/sipcc/core/includes/dns_utils.h
Normal file
77
libs/sipcc/core/includes/dns_utils.h
Normal file
@ -0,0 +1,77 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _DNS_UTILS_INCLUDED_H
|
||||
#define _DNS_UTILS_INCLUDED_H
|
||||
|
||||
#include "dns_util.h"
|
||||
|
||||
#define MAX_DNS_CON 10
|
||||
#define DNS_TO_CNT 400
|
||||
#define DNS_RSP_FLG 0x8000
|
||||
#define DNS_RSP_CODE 0xf
|
||||
|
||||
#define DNS_HOST_TYPE 0x01
|
||||
#define DNS_CNAME_TYPE 0x05
|
||||
#define DNS_SRV_TYPE 0x21
|
||||
#define DNS_PTR_TYPE 0xc0
|
||||
|
||||
#define DNS_IN_CLASS 1
|
||||
|
||||
#define DNS_INUSE_FREE 0
|
||||
#define DNS_INUSE_WAIT 1
|
||||
#define DNS_INUSE_CACHED 2
|
||||
|
||||
/* per suggestion RFC in about sanity checking */
|
||||
#define DNS_MIN_TTL (5*60) /* 5 minutes */
|
||||
#define DNS_MAX_TTL (24*60*60) /* 1 day */
|
||||
|
||||
#define KAZOO_DNS_DEBUG 1
|
||||
|
||||
#define DNS_OK 0
|
||||
#define DNS_ERR_NOBUF 1
|
||||
#define DNS_ERR_INUSE 2
|
||||
#define DNS_ERR_TIMEOUT 3
|
||||
#define DNS_ERR_NOHOST 4
|
||||
#define DNS_ERR_HOST_UNAVAIL 5
|
||||
#define DNS_ERR_BAD_DATA 6
|
||||
#define DNS_ERR_LINK_DOWN 7
|
||||
#define DNS_ENTRY_VALID 8
|
||||
#define DNS_ENTRY_INVALID 9
|
||||
#define DNS_ERR_TTL_EXPIRED 10
|
||||
|
||||
#define DNS_MAX_SRV_REQ 20
|
||||
|
||||
#define DNS_HNAME_PAD 10
|
||||
#define DOMAIN_NAME_LENGTH 256
|
||||
|
||||
typedef struct rr_reply_rec_ {
|
||||
uint8_t ordered;
|
||||
uint32_t priority;
|
||||
uint32_t weight;
|
||||
uint32_t rweight;
|
||||
uint32_t ttl;
|
||||
uint32_t port;
|
||||
uint32_t rcvd_order;
|
||||
int8_t *name;
|
||||
} rr_reply_rec_t;
|
||||
|
||||
typedef struct master_rr_list_ {
|
||||
uint8_t valid;
|
||||
uint16_t ref_count;
|
||||
uint8_t num_recs;
|
||||
int8_t domain_name[DOMAIN_NAME_LENGTH + 1];
|
||||
rr_reply_rec_t **rr_recs_order;
|
||||
} master_rr_list_t;
|
||||
|
||||
typedef struct call_rr_list_ {
|
||||
uint8_t current_index;
|
||||
uint8_t max_index;
|
||||
uint8_t master_index;
|
||||
int8_t *domain_name;
|
||||
rr_reply_rec_t **rr_recs_order;
|
||||
} call_rr_list_t;
|
||||
|
||||
|
||||
#endif /* _DNS_UTILS_INCLUDED_H */
|
27
libs/sipcc/core/includes/dtmf.h
Normal file
27
libs/sipcc/core/includes/dtmf.h
Normal file
@ -0,0 +1,27 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _DTMF_H_
|
||||
#define _DTMF_H_
|
||||
|
||||
typedef enum _DTMFState {
|
||||
DTMF_IDLE,
|
||||
DTMF_START,
|
||||
DTMF_CONT,
|
||||
DTMF_END
|
||||
} DTMFState;
|
||||
|
||||
typedef enum {
|
||||
DTMF_OUTOFBAND_NONE = 0,
|
||||
DTMF_OUTOFBAND_AVT,
|
||||
DTMF_OUTOFBAND_AVT_ALWAYS
|
||||
} DtmfOutOfBandTransport_t;
|
||||
|
||||
boolean RTPDtmfInbandGet(void);
|
||||
DtmfOutOfBandTransport_t RTPDtmfOutofbandGet(void);
|
||||
void RTPDtmfInbandSet(boolean val);
|
||||
void RTPDtmfOutofbandSet(uint16_t channel, DtmfOutOfBandTransport_t transport,
|
||||
int payload_type);
|
||||
|
||||
#endif
|
24
libs/sipcc/core/includes/embedded.h
Normal file
24
libs/sipcc/core/includes/embedded.h
Normal file
@ -0,0 +1,24 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef embedded_hpp
|
||||
#define embedded_hpp
|
||||
|
||||
typedef signed char INT8;
|
||||
typedef signed short INT16;
|
||||
typedef signed int INT32;
|
||||
|
||||
typedef unsigned char UINT8;
|
||||
typedef unsigned short UINT16;
|
||||
typedef unsigned int UINT32;
|
||||
|
||||
typedef signed char int8;
|
||||
typedef signed short int16;
|
||||
typedef signed int int32;
|
||||
|
||||
typedef unsigned char uint8;
|
||||
typedef unsigned short uint16;
|
||||
typedef unsigned int uint32;
|
||||
|
||||
#endif
|
19
libs/sipcc/core/includes/intelpentiumtypes.h
Normal file
19
libs/sipcc/core/includes/intelpentiumtypes.h
Normal file
@ -0,0 +1,19 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef IntelPentium_hpp
|
||||
#define IntelPentium_hpp
|
||||
|
||||
typedef char INT8;
|
||||
typedef short INT16;
|
||||
typedef int INT32;
|
||||
|
||||
typedef unsigned char UINT8;
|
||||
typedef unsigned short UINT16;
|
||||
typedef unsigned int UINT32;
|
||||
|
||||
typedef float FLOAT32;
|
||||
typedef double FLOAT64;
|
||||
|
||||
#endif
|
49
libs/sipcc/core/includes/kpml_common_util.h
Executable file
49
libs/sipcc/core/includes/kpml_common_util.h
Executable file
@ -0,0 +1,49 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef __KPML_COMMON_UTIL_H__
|
||||
#define __KPML_COMMON_UTIL_H__
|
||||
|
||||
/* KPML status code for kpml decoder */
|
||||
typedef enum {
|
||||
KPML_STATUS_OK,
|
||||
KPML_ERROR_ENCODE,
|
||||
KPML_ERROR_INVALID_ATTR,
|
||||
KPML_ERROR_INVALID_ELEM,
|
||||
KPML_ERROR_INVALID_VALUE,
|
||||
KPML_ERROR_INTERNAL,
|
||||
KPML_ERROR_MISSING_ATTR,
|
||||
KPML_ERROR_MISSING_FIELD,
|
||||
KPML_ERROR_NOMEM,
|
||||
KPML_ERROR_XML_PARSER
|
||||
} kpml_status_type_t;
|
||||
|
||||
|
||||
/* single_digit_bitmask */
|
||||
#define REGEX_0 1
|
||||
#define REGEX_1 (1<<1)
|
||||
#define REGEX_2 (1<<2)
|
||||
#define REGEX_3 (1<<3)
|
||||
#define REGEX_4 (1<<4)
|
||||
#define REGEX_5 (1<<5)
|
||||
#define REGEX_6 (1<<6)
|
||||
#define REGEX_7 (1<<7)
|
||||
#define REGEX_8 (1<<8)
|
||||
#define REGEX_9 (1<<9)
|
||||
#define REGEX_STAR (1<<10)
|
||||
#define REGEX_POUND (1<<11)
|
||||
#define REGEX_A (1<<12)
|
||||
#define REGEX_B (1<<13)
|
||||
#define REGEX_C (1<<14)
|
||||
#define REGEX_D (1<<15)
|
||||
#define REGEX_PLUS (1<<16)
|
||||
|
||||
#define REGEX_0_9 REGEX_0|REGEX_1|REGEX_2|REGEX_3|REGEX_4|REGEX_5|REGEX_6|REGEX_7|REGEX_8|REGEX_9
|
||||
|
||||
#define KPML_DEFAULT_DTMF_REGEX "[x*#ABCD]"
|
||||
|
||||
kpml_status_type_t kpml_parse_regex_str(char *regex_str,
|
||||
kpml_regex_match_t *regex_match);
|
||||
|
||||
#endif /* __KPML_COMMON_UTIL_H__ */
|
177
libs/sipcc/core/includes/kpmlmap.h
Executable file
177
libs/sipcc/core/includes/kpmlmap.h
Executable file
@ -0,0 +1,177 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef KPMLMAP_H
|
||||
#define KPMLMAP_H
|
||||
|
||||
#include "xml_parser_defines.h"
|
||||
#include "singly_link_list.h"
|
||||
#include "subapi.h"
|
||||
|
||||
#define KPML_ESCAPE '\\'
|
||||
#define MAX_DIALSTRING 256
|
||||
#define DIAL_TIMEOUT 10
|
||||
#define MAX_KPML_TAG_STRING 32
|
||||
#define MAX_KPML_TEXT_STRING 16
|
||||
#define KPML_BUFFERS_NUM 100
|
||||
|
||||
#define KPML_VER_STR "1.0"
|
||||
#define KPML_ENTER_STR "#"
|
||||
#define NUM_OF_REGX 1
|
||||
|
||||
typedef enum {
|
||||
KPML_NOMATCH = 0,
|
||||
KPML_GIVETONE,
|
||||
KPML_WILDPATTERN,
|
||||
KPML_FULLPATTERN,
|
||||
KPML_FULLMATCH,
|
||||
KPML_IMMEDIATELY
|
||||
} kpml_match_action_e;
|
||||
|
||||
typedef enum {
|
||||
KPML_SUCCESS = 200,
|
||||
KPML_USER_TERM_NOMATCH = 402,
|
||||
KPML_TIMER_EXPIRE = 423,
|
||||
KPML_NO_DIALOG = 481,
|
||||
KPML_SUB_EXPIRE = 487,
|
||||
KPML_BAD_EVENT = 489,
|
||||
KPML_BAD_DOC = 501,
|
||||
KPML_NO_PERSISTENT = 531,
|
||||
KPML_NO_MULTIPLE = 532,
|
||||
KPML_NO_MULITPLE_CALL_LEG = 533
|
||||
} kpml_resp_code_e;
|
||||
|
||||
typedef enum {
|
||||
KPML_NONE = 0x0,
|
||||
KPML_SIGNAL_ONLY = 0x1,
|
||||
KPML_DTMF_ONLY = 0x2,
|
||||
KPML_BOTH = 0x3
|
||||
} kpml_config_e;
|
||||
|
||||
#define KPML_SUCCESS_STR "OK"
|
||||
#define KPML_USER_TERM_NOMATCH_STR "No Match"
|
||||
#define KPML_TIMER_EXPIRE_STR "Timer Expired"
|
||||
#define KPML_SUB_EXPIRE_STR "Subscription Expired"
|
||||
#define KPML_ATTR_NOT_SUPPORTED_STR "Attribute not supported"
|
||||
#define KPML_TRYING_STR "Trying"
|
||||
|
||||
|
||||
typedef enum {
|
||||
KPML_ONE_SHOT = 0,
|
||||
KPML_PERSISTENT,
|
||||
KPML_SINGLY_NOTIFY
|
||||
} kpml_sub_type_e;
|
||||
|
||||
typedef enum {
|
||||
KPML_NO_TIMER,
|
||||
KPML_INTERDIGIT_TIMER,
|
||||
KPML_CRITICAL_TIMER,
|
||||
KPML_EXTRADIGIT_TIMER,
|
||||
KPML_LONGDIGIT_TIMER
|
||||
} kpml_timer_e;
|
||||
|
||||
typedef enum {
|
||||
NO_SUB_DATA = 0,
|
||||
SUB_DATA_FOUND = 1,
|
||||
NOTIFY_SENT
|
||||
} kpml_state_e;
|
||||
|
||||
typedef struct kpml_Q_digit_t_ {
|
||||
char digits[MAX_DIALSTRING];
|
||||
int dig_head;
|
||||
int dig_tail;
|
||||
} kpml_Q_dig;
|
||||
|
||||
typedef struct {
|
||||
line_t line;
|
||||
callid_t call_id;
|
||||
void *timer;
|
||||
} kpml_key_t;
|
||||
|
||||
typedef struct kpml_regex_match_s {
|
||||
int num_digits;
|
||||
union {
|
||||
unsigned long single_digit_bitmask;
|
||||
} u;
|
||||
} kpml_regex_match_t;
|
||||
|
||||
typedef struct kpml_data_t_ {
|
||||
|
||||
line_t line;
|
||||
callid_t call_id;
|
||||
sub_id_t sub_id;
|
||||
|
||||
unsigned long sub_duration;
|
||||
void *sub_timer;
|
||||
kpml_key_t subtimer_key;
|
||||
|
||||
/* Hold regx received by SUB */
|
||||
struct Regex regex[NUM_OF_REGX];
|
||||
|
||||
kpml_regex_match_t regex_match[NUM_OF_REGX];
|
||||
|
||||
/* If this is set then send out 402 response after # key */
|
||||
boolean enterkey;
|
||||
|
||||
uint32_t kpml_id;
|
||||
|
||||
/* if this persistent */
|
||||
kpml_sub_type_e persistent;
|
||||
int flush;
|
||||
|
||||
/* timeout duration */
|
||||
xml_unsigned32 inttimeout;
|
||||
xml_unsigned32 crittimeout;
|
||||
xml_unsigned32 extratimeout;
|
||||
|
||||
/* timer pointers for digits */
|
||||
void *inter_digit_timer;
|
||||
void *critical_timer;
|
||||
void *extra_digit_timer;
|
||||
|
||||
kpml_key_t inttime_key;
|
||||
kpml_key_t crittime_key;
|
||||
kpml_key_t extratime_key;
|
||||
|
||||
xml_unsigned16 longhold;
|
||||
xml_unsigned8 longrepeat;
|
||||
xml_unsigned8 nopartial;
|
||||
|
||||
/* Store dialed digits */
|
||||
char kpmlDialed[MAX_DIALSTRING];
|
||||
boolean last_dig_bkspace;
|
||||
|
||||
char q_digits[MAX_DIALSTRING];
|
||||
int dig_head;
|
||||
int dig_tail;
|
||||
|
||||
boolean sub_reject; /* If this varilable is set reject
|
||||
* the subscription. There are cases
|
||||
* where INV has been sent out premeturaly
|
||||
* If the B2BUA asks for more digit by
|
||||
* subsctiption, then reject thoese
|
||||
*/
|
||||
|
||||
boolean pending_sub;
|
||||
|
||||
boolean enable_backspace;
|
||||
/* Setting this variable will enable backspace
|
||||
*/
|
||||
|
||||
} kpml_data_t;
|
||||
|
||||
kpml_state_e kpml_update_dialed_digits(line_t line, callid_t call_id,
|
||||
char digit);
|
||||
void kpml_flush_quarantine_buffer(line_t line, callid_t call_id);
|
||||
void kpml_sm_register(void);
|
||||
void kpml_quarantine_digits(line_t line, callid_t call_id, char digit);
|
||||
void kpml_init(void);
|
||||
void kpml_shutdown(void);
|
||||
void kpml_set_subscription_reject(line_t line, callid_t call_id);
|
||||
boolean kpml_get_state(void);
|
||||
void kpml_inter_digit_timer_callback(void *);
|
||||
void kpml_subscription_timer_callback(void *);
|
||||
boolean kpml_is_subscribed (callid_t call_id, line_t line);
|
||||
|
||||
#endif //KPMLMAP_H
|
57
libs/sipcc/core/includes/md5.h
Normal file
57
libs/sipcc/core/includes/md5.h
Normal file
@ -0,0 +1,57 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
|
||||
* rights reserved.
|
||||
*
|
||||
* License to copy and use this software is granted provided that it
|
||||
* is identified as the "RSA Data Security, Inc. MD5 Message-Digest
|
||||
* Algorithm" in all material mentioning or referencing this software
|
||||
* or this function.
|
||||
*
|
||||
* License is also granted to make and use derivative works provided
|
||||
* that such works are identified as "derived from the RSA Data
|
||||
* Security, Inc. MD5 Message-Digest Algorithm" in all material
|
||||
* mentioning or referencing the derived work.
|
||||
*
|
||||
* RSA Data Security, Inc. makes no representations concerning either
|
||||
* the merchantability of this software or the suitability of this
|
||||
* software for any particular purpose. It is provided "as is"
|
||||
* without express or implied warranty of any kind.
|
||||
*
|
||||
* These notices must be retained in any copies of any part of this
|
||||
* documentation and/or software.
|
||||
*/
|
||||
|
||||
#ifndef _MD5_H
|
||||
#define _MD5_H
|
||||
|
||||
/* delineate the cisco changes to the RSA supplied module */
|
||||
#define CISCO_MD5_MODS
|
||||
|
||||
#if defined(CISCO_MD5_MODS)
|
||||
|
||||
#define MD5_LEN 16
|
||||
|
||||
#endif /* defined(CISCO_MD5_MODS) */
|
||||
|
||||
/* MD5 context. */
|
||||
typedef struct {
|
||||
unsigned long int state[4]; /* state (ABCD) */
|
||||
unsigned long int count[2]; /* number of bits, modulo 2^64 (lsb first) */
|
||||
unsigned char buffer[64]; /* input buffer */
|
||||
} MD5_CTX;
|
||||
|
||||
void MD5Init(MD5_CTX *);
|
||||
void MD5Update(MD5_CTX *, unsigned char *, unsigned int);
|
||||
void MD5Final(unsigned char[16], MD5_CTX *);
|
||||
|
||||
//#define MD5TESTSUITE 1
|
||||
#if defined(MD5TESTSUITE) /* only needed if running MD5 verfication tests */
|
||||
void MDString(char *string);
|
||||
void MDPrint(char *digest);
|
||||
void MDTestSuite(void);
|
||||
#endif
|
||||
|
||||
#endif /* _MD5_H */
|
35
libs/sipcc/core/includes/memory.h
Executable file
35
libs/sipcc/core/includes/memory.h
Executable file
@ -0,0 +1,35 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef _MEMORY_H_
|
||||
#define _MEMORY_H_
|
||||
|
||||
/*
|
||||
* DESCRIPTION
|
||||
* This module contains the functions which implement the dynamic memory
|
||||
* management routines. The following assumptions/rules apply:
|
||||
* 1) Packets are allocated a minimum of MIN_BLOCK + BLOCK_OVERHEAD bytes.
|
||||
* 2) The size of the heap is set at link time, using the -heap flag
|
||||
* The allocation and sizing of the heap is a cooperative effort
|
||||
* involving the linker, this file, and "sysmem.c".
|
||||
* 3) The heap can be reset at any time by calling the function "minit"
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
*--------------------DEPRECATED FILE-------------------------------
|
||||
*
|
||||
* As part of Skittles project this file is deprecated.
|
||||
* DO NOT add anything to this file. use cpr_stdlib.h instead
|
||||
* If you are doing SYNC merges _DO_ _NOT_ merge anything from parent
|
||||
* This file is kept here because it comes from parent/grand parent branches
|
||||
* and will not be removed from clearcase till Skittles collapses.
|
||||
* [The fAQ on cc tools contains details of why ]
|
||||
*
|
||||
* If you have questions send email to skittles-dev
|
||||
*---------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#endif
|
14
libs/sipcc/core/includes/misc_apps_task.h
Normal file
14
libs/sipcc/core/includes/misc_apps_task.h
Normal file
@ -0,0 +1,14 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef MISC_APP_TASK_H
|
||||
#define MISC_APP_TASK_H
|
||||
|
||||
extern cprMsgQueue_t s_misc_msg_queue;
|
||||
|
||||
extern cpr_status_e MiscAppTaskSendMsg(uint32_t cmd, cprBuffer_t buf,
|
||||
uint16_t len);
|
||||
extern void MiscAppTask(void *arg);
|
||||
|
||||
#endif /* MISC_APP_TASK_H */
|
9
libs/sipcc/core/includes/misc_util.h
Normal file
9
libs/sipcc/core/includes/misc_util.h
Normal file
@ -0,0 +1,9 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef __MISC_UTIL_H__
|
||||
#define __MISC_UTIL_H__
|
||||
unsigned long gmt_string_to_seconds(char *gmt_string, unsigned long *seconds);
|
||||
long diff_current_time(unsigned long t1, unsigned long *difference);
|
||||
#endif
|
309
libs/sipcc/core/includes/phntask.h
Normal file
309
libs/sipcc/core/includes/phntask.h
Normal file
@ -0,0 +1,309 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef PHNTASK_H
|
||||
#define PHNTASK_H
|
||||
|
||||
/* used for certain bugtraps */
|
||||
#define ERRid 0xE0
|
||||
#define ERR_1 0xE1
|
||||
#define ERR_2 0XE2
|
||||
#define ERR_3 0XE3
|
||||
#define ERR_4 0XE4
|
||||
#define ERR_5 0XE5
|
||||
|
||||
/*
|
||||
* SysHdr Network Command definitions (0x00 - 0x0F)
|
||||
*/
|
||||
#define RCV_CMD 0x00
|
||||
#define TRAP_CMD 0x01
|
||||
#define OPEN_CMD 0x02
|
||||
#define CLOSE_CMD 0x03
|
||||
#define HANG_CMD 0x04
|
||||
#define TO_CMD 0x05
|
||||
#define ISR_CMD 0x06
|
||||
#define ACK_CMD 0x07
|
||||
#define NACK_CMD 0x08
|
||||
#define PING_CMD 0x09
|
||||
#define JOIN_CMD 0x0A
|
||||
#define LEAVE_CMD 0x0B
|
||||
#define TO2_CMD 0x0C
|
||||
#define TO3_CMD 0x0D
|
||||
|
||||
/*---------------------------------------------
|
||||
* Message Definition
|
||||
*
|
||||
* original requirement is to get a unique id I guess
|
||||
* for TNP we just get some unique numbers through enum
|
||||
*/
|
||||
|
||||
enum {
|
||||
/* CPR Messages */
|
||||
TIMER_EXPIRATION,
|
||||
|
||||
/* DHCP Messages */
|
||||
DHCP_UDP,
|
||||
DHCP_TMR,
|
||||
DHCP_TFTP,
|
||||
DHCP_DHCP,
|
||||
DHCP_TO,
|
||||
DHCP_RESET_IP,
|
||||
DHCP_DNS,
|
||||
DHCP_CFG,
|
||||
DHCP_CDP,
|
||||
DHCP_RESTART,
|
||||
DHCP_SOC,
|
||||
DHCP_UI,
|
||||
|
||||
/* SNTP Messages */
|
||||
SNTP_UDP,
|
||||
SNTP_REQ,
|
||||
|
||||
/* TFTP Messages */
|
||||
TFTP_PHN,
|
||||
TFTP_CFG,
|
||||
TFTP_DHCP,
|
||||
TFTP_UDP,
|
||||
TFTP_TO,
|
||||
|
||||
/* UDP Messages */
|
||||
UDP_TFTP,
|
||||
UDP_DHCP,
|
||||
UDP_DNS,
|
||||
UDP_RTP,
|
||||
UDP_SNTP,
|
||||
|
||||
/* TCP Messages */
|
||||
TCP_PHN,
|
||||
TCP_PHN_OPEN,
|
||||
TCP_PHN_CLOSE,
|
||||
TCP_CFG,
|
||||
TCP_CFG_OPEN,
|
||||
TCP_CFG_CLOSE,
|
||||
TCP_TO,
|
||||
TCP_SOC,
|
||||
|
||||
/* HTTP Messages */
|
||||
HTTP_RCV,
|
||||
|
||||
/* Socket Messages */
|
||||
ICMP_DHCP,
|
||||
ICMP_ARP,
|
||||
ICMP_RTP,
|
||||
SOC_ICMP,
|
||||
SOC_IGMP,
|
||||
SOC_ROUTE,
|
||||
SOC_FRAG,
|
||||
IGMP_PHN_JOIN,
|
||||
IGMP_PHN_LEAVE,
|
||||
IP_PHN,
|
||||
SOC_ISR,
|
||||
NET_CDP,
|
||||
|
||||
/* Phone Messages */
|
||||
PHN_TCP,
|
||||
PHN_CFG,
|
||||
PHN_CFG_UI,
|
||||
PHN_TFTP,
|
||||
PHN_TICK_TO,
|
||||
PHN_DSP,
|
||||
PHN_REG,
|
||||
|
||||
PHN_DIS,
|
||||
|
||||
/* DNS Messages */
|
||||
DNS_DHCP,
|
||||
DNS_CFG,
|
||||
DNS_CFG_URL,
|
||||
DNS_UDP,
|
||||
DNS_TO,
|
||||
|
||||
|
||||
CFG_DNS,
|
||||
CFG_TFTP,
|
||||
CFG_TMR,
|
||||
CFG_CDP_TMR,
|
||||
CFG_UI,
|
||||
CFG_NET_CFG,
|
||||
CFG_FMW_CFG,
|
||||
CFG_STA_CFG,
|
||||
CFG_KAZOO_CFG,
|
||||
CFG_ETH_MEDIA,
|
||||
TCP_PHN_CFG_TCP_DONE,
|
||||
|
||||
NET_DNS,
|
||||
CDP_C3PO,
|
||||
CDP_TO_WAIT,
|
||||
CDP_ETH,
|
||||
CDP_TO_SYNC,
|
||||
CDP_SEND,
|
||||
CDP_CACHE_TO,
|
||||
CDP_NET,
|
||||
CDP_TRIG,
|
||||
C3PO_ETH_MODE,
|
||||
|
||||
/* RTP Messages */
|
||||
RTP_ISR,
|
||||
RTP_UDP,
|
||||
|
||||
/* TTY Messages */
|
||||
TTY_TTY,
|
||||
|
||||
/* SIP Task Messages */
|
||||
SIP_UDP,
|
||||
SIP_GSM,
|
||||
SIP_REG_REQ,
|
||||
SIP_REG_CANCEL,
|
||||
SIP_REG_PHONE_IDLE,
|
||||
SIP_REG_FALLBACK,
|
||||
SIP_TMR_REG_ACK,
|
||||
SIP_TMR_REG_EXPIRE,
|
||||
SIP_TMR_REG_WAIT,
|
||||
SIP_TMR_REG_RETRY,
|
||||
SIP_TMR_REG_STABLE,
|
||||
SIP_TMR_INV_LOCALEXPIRE,
|
||||
SIP_TMR_INV_EXPIRE,
|
||||
SIP_TMR_MSG_RETRY,
|
||||
SIP_REG_CLEANUP,
|
||||
CC_EVENT,
|
||||
SIP_ICMP_UNREACHABLE,
|
||||
SIP_TMR_SUPERVISION_DISCONNECT,
|
||||
SIP_TMR_CALL_DISCONNECT,
|
||||
SIP_TMR_MSG_RETRY_SUBNOT,
|
||||
SIP_TMR_PERIODIC_SUBNOT,
|
||||
SIP_TMR_GLARE_AVOIDANCE,
|
||||
SIPSPI_EV_CC_SUBSCRIBE_REGISTER,
|
||||
SIPSPI_EV_CC_SUBSCRIBE,
|
||||
SIPSPI_EV_CC_SUBSCRIBE_RESPONSE,
|
||||
SIPSPI_EV_CC_NOTIFY,
|
||||
SIPSPI_EV_CC_NOTIFY_RESPONSE,
|
||||
SIPSPI_EV_CC_SUBSCRIPTION_TERMINATED,
|
||||
SIPSPI_EV_CC_PUBLISH_REQ,
|
||||
REG_MGR_STATE_CHANGE,
|
||||
SUB_MSG_KPML_TERMINATE,
|
||||
SUB_MSG_KPML_SUBSCRIBE,
|
||||
SUB_MSG_KPML_NOTIFY_ACK,
|
||||
SUB_MSG_KPML_SUBSCRIBE_TIMER,
|
||||
SUB_MSG_KPML_DIGIT_TIMER,
|
||||
DP_MSG_INIT_DIALING,
|
||||
DP_MSG_DIGIT_TIMER,
|
||||
DP_MSG_DIGIT_STR,
|
||||
DP_MSG_STORE_DIGIT,
|
||||
DP_MSG_DIGIT,
|
||||
DP_MSG_DIAL_IMMEDIATE,
|
||||
DP_MSG_REDIAL,
|
||||
DP_MSG_ONHOOK,
|
||||
DP_MSG_OFFHOOK,
|
||||
DP_MSG_CANCEL_OFFHOOK_TIMER,
|
||||
DP_MSG_UPDATE,
|
||||
SIP_TMR_STANDBY_KEEPALIVE,
|
||||
SUB_MSG_PRESENCE_GET_STATE,
|
||||
SUB_MSG_PRESENCE_TERM_REQ,
|
||||
SUB_MSG_PRESENCE_TERM_REQ_ALL,
|
||||
SUB_MSG_PRESENCE_SUBSCRIBE_RESP,
|
||||
SUB_MSG_PRESENCE_NOTIFY,
|
||||
SUB_MSG_PRESENCE_UNSOLICITED_NOTIFY,
|
||||
SUB_MSG_PRESENCE_TERMINATE,
|
||||
SUB_HANDLER_INITIALIZED,
|
||||
SIP_TMR_DM_SHR_WAIT_DM_UPD_EVENT,
|
||||
SIP_SHUTDOWN,
|
||||
SIP_TMR_SHUTDOWN_PHASE2,
|
||||
SIP_RESTART,
|
||||
SUB_MSG_CONFIGAPP_SUBSCRIBE,
|
||||
SUB_MSG_CONFIGAPP_TERMINATE,
|
||||
SUB_MSG_CONFIGAPP_NOTIFY,
|
||||
SUB_MSG_CONFIGAPP_NOTIFY_ACK,
|
||||
SIP_REG_UPDATE,
|
||||
SUB_MSG_FEATURE_SUBSCRIBE_RESP,
|
||||
SUB_MSG_FEATURE_NOTIFY,
|
||||
SUB_MSG_FEATURE_TERMINATE,
|
||||
SUB_MSG_B2BCNF_SUBSCRIBE_RESP,
|
||||
SUB_MSG_B2BCNF_NOTIFY,
|
||||
SUB_MSG_B2BCNF_TERMINATE,
|
||||
THREAD_UNLOAD,
|
||||
DCSM_EV_READY,
|
||||
|
||||
/* GSM Messages */
|
||||
GSM_RM,
|
||||
GSM_FM,
|
||||
GSM_GSM,
|
||||
GSM_SIP,
|
||||
FM_GSM
|
||||
};
|
||||
|
||||
#define REG_CMD_PRINT(arg) \
|
||||
(arg == SIP_REG_REQ ? "SIP_REG_REQ" : \
|
||||
arg == SIP_REG_CANCEL ? "SIP_REG_CANCEL" : \
|
||||
arg == SIP_REG_PHONE_IDLE ? "SIP_REG_PHONE_IDLE" : \
|
||||
arg == SIP_REG_FALLBACK ? "SIP_REG_FALLBACK" : \
|
||||
arg == SIP_TMR_REG_ACK ? "SIP_TMR_REG_ACK" : \
|
||||
arg == SIP_TMR_REG_EXPIRE ? "SIP_TMR_REG_EXPIRE" : \
|
||||
arg == SIP_TMR_REG_WAIT ? "SIP_TMR_REG_WAIT" : \
|
||||
arg == SIP_TMR_REG_RETRY ? "SIP_TMR_REG_RETRY" : \
|
||||
arg == SIP_TMR_REG_STABLE ? "SIP_TMR_REG_STABLE" : \
|
||||
arg == SIP_REG_CLEANUP ? "SIP_REG_CLEANUP" : "")\
|
||||
|
||||
|
||||
|
||||
#define TCP_USR_OPEN TCP_PHN_OPEN
|
||||
#define TCP_USR_CLOSE TCP_PHN_CLOSE
|
||||
#define TCP_USR TCP_PHN
|
||||
#define IGMP_USR_JOIN IGMP_PHN_JOIN
|
||||
#define IGMP_USR_LEAVE IGMP_PHN_LEAVE
|
||||
|
||||
/*
|
||||
* END INTER-TASK COMMANDS
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* This is used by the config task to allow it to
|
||||
* accept messages sent to it by the phone task.
|
||||
*/
|
||||
#define TFTP_USR TFTP_PHN
|
||||
|
||||
|
||||
/*
|
||||
* Stack Definition
|
||||
* Stacks need to be 32bit aligned.
|
||||
*/
|
||||
|
||||
#define STKSZ 61440 //default stacksize rountable platform
|
||||
|
||||
|
||||
#if defined SIP_OS_LINUX
|
||||
|
||||
#define NICE_STEP -4
|
||||
#define TIMER_THREAD_RELATIVE_PRIORITY 4*(NICE_STEP) /* -16 */
|
||||
/* redid priorities to adjust relative priority with EDT cannot
|
||||
use NICE_STEP so using absolute numbers here */
|
||||
#define GSM_THREAD_RELATIVE_PRIORITY -14
|
||||
#define SIP_THREAD_RELATIVE_PRIORITY -14
|
||||
#define APP_THREAD_RELATIVE_PRIORITY -14
|
||||
#define CCPROVIDER_THREAD_RELATIVE_PRIORITY -14
|
||||
|
||||
#elif defined SIP_OS_OSX
|
||||
|
||||
#define NICE_STEP -4
|
||||
#define TIMER_THREAD_RELATIVE_PRIORITY 4*(NICE_STEP) /* -16 */
|
||||
#define GSM_THREAD_RELATIVE_PRIORITY 3*(NICE_STEP) /* -12 */
|
||||
#define SIP_THREAD_RELATIVE_PRIORITY 3*(NICE_STEP) /* -12 */
|
||||
#define APP_THREAD_RELATIVE_PRIORITY 3*(NICE_STEP) /* -12 */
|
||||
#define CCPROVIDER_THREAD_RELATIVE_PRIORITY 3*(NICE_STEP) /*-12 */
|
||||
|
||||
#elif defined SIP_OS_WINDOWS
|
||||
|
||||
#define TIMER_THREAD_RELATIVE_PRIORITY 0
|
||||
#define GSM_THREAD_RELATIVE_PRIORITY -1
|
||||
#define SIP_THREAD_RELATIVE_PRIORITY -1
|
||||
#define APP_THREAD_RELATIVE_PRIORITY -1
|
||||
#define CCPROVIDER_THREAD_RELATIVE_PRIORITY -1
|
||||
|
||||
#endif
|
||||
|
||||
extern int platThreadInit(char *threadName);
|
||||
|
||||
#endif /* PHNTASK_H */
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user