📄 init.c
字号:
/******************************************************************** * * File: init.c * * Description: * Initialization functions. * * Revisions: * 04-may-01 J.H and S.J.M initial version. * * Copyright 2001 Netergy Microelectronics, Inc. All rights reserved. * ********************************************************************/#include "h248app.h"#include "setupnet.h"DLLIST *pdllConn;pthread_mutex_t mMutexConn;DWORD g_dwLANIPAddr=0;DWORD g_dwLocalIPAddr=0;char g_sMgIpAddr[30];WORD g_wMgPort = 55555;char g_sMgcIpAddr[30];WORD g_wMgcPort = 2944;OCTET g_oMacAddress[6];END_POINT xEndPoint[MAX_END_POINT_NUM];DWORD dbg_dwInit = 0;char g_sMgDeviceName[30]="";char g_sMacAddr[20];BOOL g_bDHCPMode;void *snmp_handle;extern char g_MegacoOnHookString[30];/************************************************************************** * _WebSubstCallBackFunction * To substitute non-config file variables into html files **************************************************************************/int _WebSubstCallBackFunction(SubstParam* sp){ /* Start with default substitutions or this will nuke new substitutions */ DefaultWebSubstCallback(sp); SetupNetWebSubstCallback((H_WEBDATA)sp); if (!strcmp(sp->pchParamName,"NUMLINES")) { sprintf(sp->chParamValue, "%d", 1); } else if (!strcmp(sp->pchParamName,"SUPPORTEDCODECS")) { DWORD dwBits = 0;#ifdef AUD_G723 dwBits |= 2;#endif#ifdef AUD_G726 dwBits |= 4;#endif#ifdef AUD_G729 dwBits |= 16;#endif sprintf(sp->chParamValue,"%ld", dwBits); } return 1;}/************************************************************************** * _Initialization * Initialization of all protocol stacks, instances, device drivers etc... **************************************************************************/void _Initialization(){ #ifdef _NNOS char chParamValue[CONFIG_MAXPARAMLENGTH+1];#endif /* startup the IP stack, etc. */ HandsetDisplayString("Network Stack ...", 1); _InitializeNetwork(); #ifdef _NNOS /* open hardware drivers */ HandsetInitialize(); HandsetStart(1);#endif #ifdef _NNOS /* startup the webserver */ HandsetDisplayString("HTTP Server ...", 1); HttpSubstRegister(_WebSubstCallBackFunction); HttpWebserverStart(); /* Initialize NTP and handset clock */ HandsetDisplayString("Clock (NTP) ...", 1); HandsetInitializeClock();#else // Startup NTP NtpInit(0);#endif MediaStreamInit(g_dwLocalIPAddr, g_oMacAddress); #ifdef _NNOS if (ConfigGetParam("VLANTAG_RTP",chParamValue,CONFIG_MAXPARAMLENGTH)==CONFIG_OK) { RTPProtocolSetVLanTag(strtoul(chParamValue,NULL,0)); } if (ConfigGetParam("PRIORITYTAG_RTP",chParamValue,CONFIG_MAXPARAMLENGTH)==CONFIG_OK) { RTPProtocolSetPriorityTag(strtoul(chParamValue,NULL,0)); }#endif EndPointInit(&xEndPoint[0], 1); _InitializeParam(); HandsetDisplayString("Megaco Stack ...", 1); _InitializeH248();#ifdef _NNOS if (ConfigGetParam("VLANTAG_CALL",chParamValue,CONFIG_MAXPARAMLENGTH)==CONFIG_OK) { H248ProtocolSetVLanTag(strtoul(chParamValue,NULL,0)); } if (ConfigGetParam("PRIORITYTAG_CALL",chParamValue,CONFIG_MAXPARAMLENGTH)==CONFIG_OK) { H248ProtocolSetPriorityTag(strtoul(chParamValue,NULL,0)); }#endif pdllConn = new_DLLIST(); { pthread_mutexattr_t attr; pthread_mutexattr_init(&attr); pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); pthread_mutex_init(&mMutexConn, &attr); pthread_mutexattr_destroy(&attr); } HandsetRegisterInfoStrings(g_sMgIpAddr, g_sMacAddr, g_sMgcIpAddr, NULL, NULL); }void RegisteringComplete(){ sprintf(g_MegacoOnHookString,"%s","Megaco IP Phone"); HandsetDisplayString(g_MegacoOnHookString,1); HandsetRegisterOnHookDisplayString(g_MegacoOnHookString); HandsetRegisterOnHookDisplayNumber("");}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -