📄 ipp_endpoint.c
字号:
/////////////////////////////////////////////////////////////////////// ipp_endpoint.c//// handset/endpoint related event handling module for IP phone app//// Copyright Netergy Microelectronics 2000, 2001//////////////////////////////////////////////////////////////////////#include "NNstyle.h"#include <string.h>#include <stdlib.h>#include "endpoint.h"#include "common.h"////////////////////////////////////////////////////////////////////// EndPointProcessRedialEvent//// Process redial event: generaqte DTMF tone and dial////////////////////////////////////////////////////////////////////ENDPOINT_EVENT EndPointProcessRedialEvent(END_POINT* pEndPoint, CALL* pCall, ENDPOINT_EVENT eEvent){ /* handle redial string */ if (pEndPoint->pszRedialString) { if (pEndPoint->pszRedialString[pEndPoint->oRedialStringIndex]) { if (eEvent==EVENT_NONE && pEndPoint->dwTimer > REDIALDIGITTIMER) { pEndPoint->dwTimer=0; if (pEndPoint->oRedialStringIndex>0) { /* stop encoding previous tone */ EndPointEncodeDtmf(pEndPoint, pCall, pEndPoint->pszRedialString[pEndPoint->oRedialStringIndex-1], FALSE); // stop encoding } /* start encoding new tone */ EndPointEncodeDtmf(pEndPoint, pCall, pEndPoint->pszRedialString[pEndPoint->oRedialStringIndex], TRUE); // start encoding eEvent=EndPointEvent(pEndPoint, pEndPoint->pszRedialString[pEndPoint->oRedialStringIndex]); EndPointTelephoneEvent(pEndPoint, HANDSET_DTMF_START_EVENT, pEndPoint->pszRedialString[pEndPoint->oRedialStringIndex]); EndPointDtmfTone(pEndPoint->wChannel,pEndPoint->pszRedialString[pEndPoint->oRedialStringIndex] + AUDIO_DTMF_KEY_0 - '0',TRUE); pEndPoint->oRedialStringIndex++; } } else { /* stop encoding inband DTMF */ EndPointEncodeDtmf(pEndPoint, pCall, pEndPoint->pszRedialString[pEndPoint->oRedialStringIndex-1], FALSE); // stop encoding free (pEndPoint->pszRedialString); pEndPoint->pszRedialString=0; pEndPoint->oRedialStringIndex=0; } } return eEvent;}////////////////////////////////////////////////////////////////////// EndPointEncodeDtmf//// Start/stop encoding inband DTMF signalling for keypad input////////////////////////////////////////////////////////////////////void EndPointEncodeDtmf(END_POINT *pEndPoint, CALL* pCall, char chKey, BOOL bStart){ if (pCall && g_bSendInbandDTMF) { if (chKey=='*') { chKey=AUDIO_DTMF_KEY_STAR_CONT; } else if (chKey=='#') { chKey=AUDIO_DTMF_KEY_POUND_CONT; } else { chKey=AUDIO_DTMF_KEY_0_CONT+chKey-'0'; }#if 0 /* stop encoding tone */ EndPointEncodeStreamTone(pEndPoint->wChannel, hStream, (DWORD)(chKey), bStart);#else /* if 0 */ MediaStreamChannelUpdEncodeTone(pEndPoint->wChannel, chKey, bStart);#endif /* if 0 else */ }}////////////////////////////////////////////////////////////////////// EndPointDisplayCallerID//// ////////////////////////////////////////////////////////////////////void EndPointDisplayCallerID(END_POINT *pEndPoint, char *pchCallerName, char *pchCallerNumber){ CALLER_ID_INFO xCallerIdInfo; memset(&xCallerIdInfo, 0, sizeof(CALLER_ID_INFO)); if (pchCallerNumber) { strncpy(xCallerIdInfo.pcCallerNumber,pchCallerNumber,19); } if (pchCallerName) { strncpy(xCallerIdInfo.pcCallerName,pchCallerName,19); } HandsetStoreCallerID(1,&xCallerIdInfo); HandsetDisplayCallerID(1,&xCallerIdInfo);}////////////////////////////////////////////////////////////////////// EndPointUpdateHoldIndicator//// correctly represents the existence of held call by examinig call// states////////////////////////////////////////////////////////////////////void EndPointUpdateHoldIndicator(END_POINT *pEndPoint){ // this function should be better inside handset api, if possible if (EndPointFindCallState(pEndPoint, CALL_HOLD)) { LEDON(LED_ID_HOLD,LED_COLOR_RED); } else { LEDOFF(LED_ID_HOLD); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -