⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 复件 (2) h323f.cpp

📁 基于h323协议的软phone
💻 CPP
📖 第 1 页 / 共 5 页
字号:
/************************************************************************
 *
 *    Version %I%
 *
 *       Copyright (C) 2002 By BEP Corporation.
 * This Document Contains Proprietary Information Of BEP Corporation.
 * No Distribution Is Granted Except  With Written Permission From
 * BEP Corporation.
 *************************************************************************/
/*
 **
 ** MODULE: h323f.cpp
 **
 ** PURPOSE:
 **
 ** LIMITATIONS:
 **
 ** DATE CREATED: 10-29-2003
 **
 ** AUTHOR(S): aoto created
 **
 ** MODIFICATIONS:
 **     userId                  Date            Description
 **
 ** QA Status:
 **      status                   Date             Owner
 **
 */

#include <h/drv/eeprom/BackPane.h>
#include "h323common.h"
#include "pingLib.h"
#include "h323info.h"
//#include "h/drv/eeprom/BackPane.h"
#include "etherLib.h"
#include "muxlib.h"

#ifdef INCLUDE_RV_RTP
#include "payload.h"
#endif

#ifdef INCLUDE_PROXY_CLIENT
#include "ipagentLib.h"
#define AGENT_SERVER_PORT	1080	/* 防火墙服务器端口 */
#endif

#define LCD_WIDTH 20

#ifdef H323_DEBUG
	#define H323TRACE printf
#else
	#define H323TRACE
#endif
//U16 codeTypeNum =  0;/* Indicate codec 0-g723,1-g711u,2-g711a,3-g729*/
WpCodex codeTypeNum = AUDIO_G723;
extern int versionNumber;
#ifdef INCLUDE_PPPOE_APP
extern SEM_ID g_sem_pppoe_flashconfig;
#endif


/*	//not so good sound
char toneOne[100][24] = {
{96,159,141,112,64,148,129,216,168,28,70,119,44,230,232,22,212,54,64,26,88,50,175,118},
{128,51,100,1,128,216,27,108,96,196,141,236,102,198,2,176,164,160,190,94,2,0,129,121},
{112,43,28,9,136,84,5,213,111,253,45,217,64,2,216,201,73,36,71,145,7,168,170,74},
{132,39,28,1,138,96,23,214,223,179,149,178,54,194,175,31,244,161,34,157,160,232,169,77},
{88,131,46,69,18,224,248,141,92,5,248,213,210,128,233,3,74,119,5,243,178,19,138,174},
{88,43,44,69,2,240,105,222,98,169,70,87,54,80,185,144,115,94,88,218,210,109,137,172},
{112,43,44,69,132,216,18,149,242,254,54,114,0,128,32,86,91,120,109,93,121,181,77,105},
{112,39,28,9,136,84,2,254,254,248,110,248,82,66,167,7,159,178,233,88,3,180,202,69},
{132,131,30,1,136,84,151,237,111,145,117,161,22,64,149,150,207,163,102,13,26,204,34,85},
{88,39,44,69,18,224,254,213,108,2,0,71,8,211,206,100,32,182,128,146,238,63,102,173},
{112,43,44,69,2,96,214,109,88,169,141,127,80,153,205,226,47,0,219,128,55,166,73,86},
{112,43,44,69,134,120,17,150,242,254,102,5,224,71,76,53,144,47,158,17,128,185,59,90},
{112,39,28,9,128,88,2,0,119,98,110,192,148,146,58,252,252,68,205,29,160,21,134,198},
{132,131,30,1,136,84,169,239,215,176,118,161,88,130,225,2,22,138,118,39,79,196,9,242},
{88,39,44,69,18,240,254,214,100,2,0,215,98,134,107,204,201,179,128,82,250,113,110,173},
{112,43,44,69,10,224,233,62,112,41,0,247,14,203,157,118,158,251,92,209,214,82,212,122},
{88,43,44,65,134,248,48,150,242,126,54,2,184,200,43,180,237,24,26,73,49,169,83,93},
{112,39,28,1,138,100,41,215,247,242,110,240,170,3,127,195,4,248,71,145,60,150,136,170},
{132,131,30,1,136,112,113,230,238,146,149,50,90,198,207,226,20,86,18,240,45,208,143,42},
{88,39,44,69,18,240,254,101,109,2,0,199,40,83,150,100,107,169,5,219,76,33,207,74},
{88,43,44,69,10,240,248,109,120,41,255,214,32,7,251,115,29,42,155,91,37,104,166,68},
{112,43,44,65,134,232,54,151,226,254,102,37,176,74,43,116,147,203,59,133,81,173,169,81},
{12,39,28,5,136,228,0,253,110,232,21,249,88,78,86,118,194,91,200,56,109,24,7,77},
{132,131,30,5,136,80,169,255,230,146,149,2,156,3,40,37,114,183,128,253,45,140,21,45},
{88,43,44,73,16,112,125,54,82,2,0,183,128,84,17,250,56,171,1,160,43,70,53,107},
{88,43,44,69,12,224,233,61,136,41,0,87,206,0,174,128,51,71,40,59,225,187,138,236},
{112,43,44,69,140,244,15,150,98,253,102,2,46,194,79,213,203,89,254,60,81,189,127,89},
{112,39,28,9,136,84,2,0,7,255,111,240,138,143,108,121,51,53,254,220,133,24,73,99},
{132,131,30,1,136,80,151,229,222,146,149,162,0,0,114,69,14,54,3,240,90,202,205,170},
{88,39,44,69,2,224,254,102,93,41,237,207,180,83,94,37,144,128,180,11,52,36,139,109},
{112,43,44,69,18,224,212,62,128,41,249,117,56,132,220,2,157,27,122,133,163,175,117,70},
{88,43,44,65,140,244,78,150,114,253,222,234,2,128,190,149,219,221,86,58,139,182,68,177},
{112,39,28,1,138,84,41,212,111,232,110,240,202,90,172,125,213,80,254,28,134,72,110,107},
{132,131,74,1,136,84,151,69,111,98,117,241,98,128,225,2,140,19,114,218,203,198,230,125},
{88,43,44,69,18,224,254,214,212,9,0,199,136,64,222,23,70,197,99,63,51,134,138,107},
{112,43,44,69,12,240,105,61,112,125,255,54,20,141,197,75,210,185,164,170,65,80,133,34},
{88,39,44,65,140,100,44,150,114,253,102,37,62,4,48,198,104,7,183,96,147,214,72,237},
{112,43,28,1,136,84,41,237,239,236,110,240,4,64,93,138,100,240,182,176,193,172,115,237},
{132,127,30,1,136,80,211,69,111,145,149,178,32,128,225,2,140,227,100,125,215,196,102,229},
{88,43,44,69,18,240,254,102,221,12,0,199,38,211,154,228,33,224,41,107,177,47,207,42},
{88,43,44,69,10,0,121,108,136,41,0,87,92,134,221,117,52,83,114,53,225,103,74,238},
{36,163,194,142,188,12,115,42,0,2,192,117,18,161,225,57,49,235,89,37,253,40,77,234},
{188,57,145,50,84,122,182,223,224,22,175,230,160,225,229,39,57,245,71,205,159,231,125,140},
{120,167,216,78,82,253,25,133,105,114,175,99,54,116,157,193,191,198,104,182,202,51,130,149},
{108,97,213,110,15,106,30,77,211,97,238,110,90,213,154,194,39,47,158,39,161,203,221,138},
{216,57,185,174,130,97,9,101,80,138,13,65,16,89,135,229,241,38,39,73,0,133,131,99},
{116,135,190,114,80,77,12,100,72,69,76,35,58,193,88,212,96,206,90,201,181,222,235,81},
{116,211,138,110,138,206,10,132,193,22,35,244,236,65,21,174,80,87,67,227,158,199,43,142},
{88,138,4,179,110,197,193,52,48,66,91,222,22,4,183,185,48,1,186,37,97,187,152,71},
{118,151,138,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{158,150,242,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{222,189,136,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{90,106,168,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{114,191,44,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{98,98,213,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{118,151,138,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{118,151,138,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{118,151,138,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{118,151,138,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{118,151,138,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{118,151,138,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{118,151,138,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{118,151,138,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{118,151,138,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{118,151,138,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
};
*/	

/*from liantong****/	
char toneOne[100][24] = {
{160,214,102,49,179,61,24,227,145,1,35,36,136,172,46,221,237,137,137,193,72,233,57,199},
{132,22,100,1,138,196,126,237,191,51,170,18,178,178,252,174,51,211,230,48,221,107,78,158},
{168,14,100,1,2,164,51,42,148,36,74,117,72,67,17,168,153,162,25,244,85,74,141,46},
{168,82,101,69,138,168,99,160,36,98,234,100,192,64,3,128,135,186,61,209,57,106,85,173},
{168,82,101,69,148,160,69,202,163,66,227,115,238,148,85,47,205,11,119,120,62,173,177,30},
{164,14,100,1,138,56,68,162,4,74,65,84,186,32,146,82,176,29,53,236,147,80,74,43},
{168,94,101,1,146,20,68,66,28,68,66,148,132,196,20,180,172,63,16,27,152,33,180,211},
{168,14,100,1,2,52,71,17,36,68,66,196,48,79,125,185,76,17,193,139,230,122,29,83},
{164,90,101,1,138,148,66,137,172,72,161,20,226,102,57,52,51,55,107,125,131,112,163,253},
{168,22,100,1,146,32,74,121,18,68,175,43,28,167,43,127,128,176,104,245,101,220,180,147},
{132,82,101,73,138,36,68,65,20,74,162,148,20,192,41,165,174,215,7,208,89,166,6,85},
{160,14,100,1,138,36,74,67,36,65,225,227,248,139,49,237,192,199,206,12,19,7,165,180},
{168,94,101,69,2,36,74,177,51,68,138,52,64,35,192,229,110,85,25,176,94,90,172,38},
{132,14,100,1,144,16,68,226,51,68,89,196,148,54,31,21,220,6,176,41,235,230,209,190},
{168,14,100,69,2,20,59,177,35,68,139,36,30,47,88,152,180,18,64,55,168,228,62,117},
{168,94,101,73,136,56,71,91,36,202,203,67,28,71,176,227,177,53,254,108,220,205,66,87},
{132,14,100,69,4,180,72,67,20,65,114,68,58,87,213,159,112,240,21,105,101,186,129,212},
{168,22,100,73,136,20,68,137,36,62,177,147,60,142,73,164,60,75,179,109,153,58,106,20},
{132,82,101,69,2,20,62,161,132,72,66,100,160,29,174,243,138,185,106,34,88,171,187,178},
{168,14,100,1,138,36,68,65,164,69,90,180,138,130,76,120,165,224,103,158,203,30,179,76},
{164,90,101,69,140,36,62,66,164,69,226,219,136,66,10,192,110,57,201,31,60,160,71,168},
{168,14,100,1,138,164,72,202,163,72,176,243,86,217,35,22,69,227,201,122,203,105,41,27},
{160,82,101,1,2,20,53,66,36,71,138,180,220,194,202,216,145,51,216,98,180,210,211,86},
{132,22,100,69,146,144,69,163,132,72,138,52,50,211,245,53,169,160,208,29,68,172,210,155},
{168,82,101,1,2,160,200,42,164,72,186,84,44,199,142,116,67,119,78,48,159,20,119,108},
{164,90,101,1,138,148,66,137,172,72,161,20,226,102,57,52,51,55,107,125,131,112,163,253},
{168,22,100,1,146,32,74,121,18,68,175,43,28,167,43,127,128,176,104,245,101,220,180,147},
{132,82,101,73,138,36,68,65,20,74,162,148,20,192,41,165,174,215,7,208,89,166,6,85},
{160,14,100,1,138,36,74,67,36,65,225,227,248,139,49,237,192,199,206,12,19,7,165,180},
{168,94,101,69,2,36,74,177,51,68,138,52,64,35,192,229,110,85,25,176,94,90,172,38},
{132,14,100,1,144,16,68,226,51,68,89,196,148,54,31,21,220,6,176,41,235,230,209,190},
{168,14,100,69,2,20,59,177,35,68,139,36,30,47,88,152,180,18,64,55,168,228,62,117},
{168,94,101,73,136,56,71,91,36,202,203,67,28,71,176,227,177,53,254,108,220,205,66,87},
{132,14,100,69,4,180,72,67,20,65,114,68,58,87,213,159,112,240,21,105,101,186,129,212},
/*{168,22,100,73,136,20,68,137,36,62,177,147,60,142,73,164,60,75,179,109,153,58,106,20},
{132,82,101,69,2,20,62,161,132,72,66,100,160,29,174,243,138,185,106,34,88,171,187,178},
{168,14,100,1,138,36,68,65,164,69,90,180,138,130,76,120,165,224,103,158,203,30,179,76},
{164,90,101,69,140,36,62,66,164,69,226,219,136,66,10,192,110,57,201,31,60,160,71,168},
{168,14,100,1,138,164,72,202,163,72,176,243,86,217,35,22,69,227,201,122,203,105,41,27},
{160,82,101,1,2,20,53,66,36,71,138,180,220,194,202,216,145,51,216,98,180,210,211,86},
{132,22,100,69,146,144,69,163,132,72,138,52,50,211,245,53,169,160,208,29,68,172,210,155},
{168,82,101,1,2,160,200,42,164,72,186,84,44,199,142,116,67,119,78,48,159,20,119,108},*/
{164,14,100,1,2,164,200,202,19,68,41,228,250,66,164,7,205,58,54,16,49,85,66,163},
{168,90,101,1,138,56,68,66,36,74,67,52,192,192,64,148,181,51,23,177,197,170,122,101},
{132,14,100,73,144,32,71,161,164,60,162,20,120,97,34,212,38,98,110,249,167,203,109,77},
{168,94,101,1,146,148,200,66,36,68,66,180,246,2,73,132,134,240,232,47,92,115,70,128},
{164,14,100,69,4,164,200,56,171,66,66,164,232,14,179,154,162,68,24,69,249,62,209,90},
{168,90,101,73,0,36,68,162,44,53,66,132,190,153,97,144,6,96,90,190,104,170,85,253},
{164,14,100,1,146,36,68,67,36,71,201,75,74,223,175,40,150,119,51,212,53,127,54,94},
{168,14,100,73,0,148,194,161,52,68,67,100,72,222,177,175,99,130,215,2,242,82,179,172},
{168,46,84,1,200,80,74,190,52,5,78,48,198,0,191,122,217,191,44,205,48,84,22,39},
{196,214,78,84,196,9,92,176,128,54,47,146,16,103,163,171,198,250,108,246,68,70,166,106},
{168,30,165,81,157,1,11,87,113,75,103,217,200,10,178,126,205,185,15,240,42,201,240,31},
{44,70,117,153,73,102,69,54,224,28,86,234,200,176,252,195,11,214,231,238,183,46,25,51},
{168,98,73,132,22,66,143,221,211,22,53,112,212,1,26,0,44,32,95,37,67,145,79,47},
{68,34,56,201,4,87,72,173,67,21,77,176,160,14,55,172,85,137,66,240,62,89,173,109},
{132,134,85,185,130,201,10,180,193,169,163,11,194,117,108,0,105,205,104,126,90,240,154,247},
{176,98,181,116,9,76,18,84,58,155,195,64,130,116,234,142,159,239,176,22,251,174,125,248},
{180,30,225,246,248,73,9,116,50,21,84,106,116,205,236,194,23,218,154,128,122,168,183,50},
{170,34,77,4},
{170,66,61,4},
{98,178,61,4},
{170,66,165,4},
{246,6,74,4},
{170,34,77,4},
{170,66,61,4},
{98,178,61,4},
{170,66,165,4},
{246,6,74,4},
{170,34,77,4},
{170,66,61,4},
{98,178,61,4},
{170,66,165,4},
{246,6,74,4},
{170,34,77,4},
{170,66,61,4},
{98,178,61,4},
{170,66,165,4},
{246,6,74,4},
{170,34,77,4},
{170,66,61,4},
{98,178,61,4},
{170,66,165,4},
{246,6,74,4},
{170,34,77,4},
{170,66,61,4},
{98,178,61,4},
{170,66,165,4},
{246,6,74,4},
{170,34,77,4},
{170,66,61,4},
{98,178,61,4},
{170,66,165,4},
{246,6,74,4},
{170,66,61,4},
{98,178,61,4},
{170,66,165,4},
{170,34,77,4},
{170,66,61,4},
{170,66,61,4},
{170,66,61,4},
{170,66,61,4},
{170,66,61,4},
{170,66,61,4},
{170,66,61,4},
{170,66,61,4},
{170,66,61,4},
{170,66,61,4}
};

char toneRing[50][24] = {
{104,141,30,41,67,188,106,218,176,7,24,135,68,178,174,68,34,107,237,122,202,222,189,165},
{44,51,73,61,112,20,115,145,119,244,175,141,156,143,152,146,117,137,50,67,3,212,156,187},
{24,37,48,19,44,172,160,207,80,92,26,207,112,198,171,188,19,48,70,109,175,229,51,111},
{44,51,73,61,240,196,77,179,149,181,89,11,0,64,33,131,250,237,105,122,133,137,48,241},
{24,61,233,13,54,196,32,6,66,148,219,164,12,83,186,220,251,246,126,48,201,118,26,32},
{44,51,29,53,116,84,124,147,36,198,89,11,194,143,17,14,192,136,68,178,211,253,187,66},
{24,37,232,21,48,64,127,87,64,20,35,213,48,211,10,193,223,211,126,120,202,186,107,92},
{28,122,116,53,236,80,124,58,218,47,91,0,70,78,199,199,34,221,248,100,186,53,97,149},
{104,183,236,22,154,69,32,106,22,8,16,209,220,128,186,239,85,137,211,3,194,215,20,170},
{92,137,198,38,93,138,111,136,241,187,104,128,74,147,244,211,69,76,14,83,240,159,237,42},
{84,62,145,158,193,6,134,135,228,58,48,43,194,159,63,42,12,148,217,35,234,215,146,67},
{116,67,161,158,231,116,9,223,243,94,15,129,184,166,230,180,49,157,73,77,68,100,129,68},
{108,99,185,70,169,244,190,126,224,88,246,166,90,6,244,80,98,102,205,194,172,196,60,215},
{88,134,158,82,30,85,6,125,88,54,5,240,80,247,228,41,184,50,226,139,199,41,216,170},
{108,171,13,127,208,100,108,60,209,22,173,128,96,56,188,86,239,65,48,65,174,156,161,81},
{40,190,60,230,116,212,13,172,67,108,140,226,232,232,151,12,221,194,150,208,193,178,114,243},
{84,66,161,54,157,54,30,228,65,123,4,163,214,78,188,159,142,86,187,61,232,78,29,199},
{96,141,206,241,26,66,186,166,219,106,235,159,60,71,224,251,142,192,133,203,200,222,3,243},
{120,48,29,61,112,52,213,178,29,201,88,59,16,147,213,30,126,33,51,174,210,234,37,3},
{92,37,232,21,32,92,100,87,208,12,3,215,108,77,219,250,89,186,96,128,192,146,38,223},
{120,48,73,53,116,196,125,170,12,198,89,27,86,156,129,74,9,129,220,72,176,11,36,162},
{24,61,49,19,44,204,32,88,64,160,234,190,110,25,85,9,0,176,72,141,71,236,159,16},
{24,37,48,23,40,68,100,89,176,140,234,142,30,0,3,110,1,128,112,141,71,0,225,239},
{44,51,73,61,112,68,180,219,148,181,88,27,240,21,108,216,128,33,239,244,97,36,164,222},
{24,61,233,17,44,76,243,89,96,148,26,239,96,134,112,185,2,208,23,128,71,28,95,16},
{44,51,29,61,112,68,177,58,2,201,89,27,210,21,108,216,188,134,93,161,22,219,179,116},
{24,37,232,21,34,72,127,87,64,32,59,133,184,204,227,77,78,231,6,32,176,136,135,203},
{44,51,73,53,116,212,125,42,158,172,201,90,42,214,226,51,226,173,52,74,228,106,116,75},
{24,61,49,15,54,204,32,208,80,20,250,221,88,25,85,9,58,70,102,192,106,238,156,144},
{44,51,73,53,116,84,79,43,158,172,89,27,236,2,176,160,30,149,209,45,210,245,243,162},
{24,37,48,19,34,184,160,208,64,160,59,245,72,205,74,224,2,211,238,192,200,230,199,136},
{44,51,73,53,116,84,79,43,150,181,201,90,46,131,24,26,243,161,103,218,225,42,96,91},
{24,61,233,13,54,196,32,208,96,20,147,159,108,25,85,73,14,246,114,141,86,236,28,48},
{44,51,29,61,112,196,154,147,132,172,89,123,14,216,159,219,15,32,145,14,209,249,18,85},
{24,37,232,17,44,220,32,208,112,20,58,250,176,140,19,108,0,112,1,64,42,195,225,127},
{44,51,73,61,240,208,104,99,164,44,194,124,122,66,137,85,190,182,10,221,238,6,13,73},
{88,158,250,12,40,68,25,183,80,5,113,17,36,73,254,139,194,50,6,32,17,52,83,232},
{100,124,118,123,80,129,45,129,240,154,48,14,44,190,14,192,191,193,15,9,154,148,203,28},
{104,59,213,118,58,9,139,72,130,87,47,141,142,131,36,10,170,128,222,101,104,212,97,203},
{116,135,138,178,88,117,111,96,117,18,95,30,122,110,109,231,249,115,244,8,49,48,138,39},
{28,59,133,230,71,244,22,7,211,64,230,225,120,89,88,48,249,159,131,93,45,140,194,4},
{88,150,146,42,219,97,207,174,86,30,181,33,250,148,0,159,164,166,255,38,169,224,54,206},
{164,151,154,170,185,213,58,133,87,27,37,103,168,111,217,10,170,252,88,159,33,26,23,56},
{156,70,217,146,232,80,3,45,85,36,12,20,210,135,72,75,112,206,124,215,53,85,165,152},
{84,191,32,46,195,217,58,29,214,40,181,17,98,32,159,31,4,136,172,31,107,57,105,145},
{90,210,146,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{78,59,137,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{162,34,172,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{96,45,137,53,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
};

U16 isPlayTone = 0;
SEM_ID  semPlayTone;
//chenguoyin
int  isPlayRing = 0;
extern int on_speakerphone;
/****replace PlayTone(1)****/
void cPlayTone(void)
{
	int i = 0;
	while(1)
	{ 		
		
	      if(isPlayRing == 0)
	      	{
	      		i %=100;//65
	       	dspApiDecoder[0]->putBuffer(toneOne[i], 1, 24);
			i++;
		}
		else
		{
			i %=49;
			dspApiDecoder[0]->putBuffer(toneRing[i], 1, 24);
			i++;
		 }
		if (!isPlayTone)
		{
			i = 0;
			semTake(semPlayTone,WAIT_FOREVER);
		}
	}
	return;
}
/***for record playtone(1)***/
/*void cGetTone(void)
{
   U16 size = 24;
   U16 nframes =1;
  for( int i = 0;i<200;i++)
  {
         size = 24;
         nframes =1;
  	 dspApiEncoder[0]->getBuffer(getTone[i], &nframes, &size);
	 for(int j = 0;j<size;j++)
	 	printf("%d,",getTone[i][j]);
	 printf("\nsize = %d\n",size);
  }

}*/
void bufferPlayTone( void )
{
	//cGetTone();
  	 // return;
  	static int first = 0;
	isPlayTone = 1;
	if(codeTypeNum != AUDIO_G723)
		AppSetCodec(AUDIO_G723, AUDIO_G723);
  	printf("####bufferPlayTone(void)####\n");
  	  if(first ==0)
	  {
	  	printf("fist = 0\n");
	  	semPlayTone = semBCreate( SEM_Q_PRIORITY, SEM_EMPTY );
	    	int playtoneId = taskSpawn("tcPlayTone", 100, 0, 8192, (FUNCPTR)cPlayTone,
                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
			printf("taskSpawn\n");
	 }
	else
	       semGive(semPlayTone);
	first ++;
	return;
	
//chenguoyin
   
//chenguoyin		
    return;

}
void bufferStopTone(void)
{
	printf("\n####bufferStopTone(void)####\n");
	isPlayTone = 0;
	//semTake(semPlayTone,2);
	taskDelay(5);
}
/**
 * LCD清屏并播放等待拨号音;
 * 设置等待第一次拨号的计时器
 */
int h323_on_hook_state_local_off_hook_event(s_event* psEvent, s_task* psTask)
{	
	H323TRACE("action: h323_on_hook_state_local_off_hook_event\n");

	ClearLcd();
	if (num_digits == 0 && toAddr[0] == '\0')
	{		
		LcdDShowCursor(TRUE);
	}
	else /* 如果已输入部分号码,将其保留 */
	{
		char tempMsg[LCD_WIDTH+1];

		num_digits = strlen(toAddr);
		strncpy(digit_set, toAddr,MAX_PHONE_NUMBER_LEN);
		digit_set[MAX_PHONE_NUMBER_LEN]='\0';
		if (toAddr[0] == '*')
			digitCollectAmount = 13;
		else
			digitCollectAmount = -1;
		
		strncpy(tempMsg, toAddr, LCD_WIDTH);
		tempMsg[LCD_WIDTH] = '\0';
		WriteLcd(tempMsg, 0, 0);
		if (num_digits == LCD_WIDTH)
		{
			lcdCursorPos pos;
			pos.row = 1;
			pos.col = 0;
			lcdSetCurPos(pos);
		}
		else if (num_digits > LCD_WIDTH)
		{
			WriteLcd(&toAddr[LCD_WIDTH], 1, 0);
		}
		LcdDShowCursor(TRUE);		
		return to_collect_digits_state;
	}
	tone_playing = dial_tone;
	PlayTone(dial_tone);
	DeleteTimer(&h323_timer);
	h323_timer = CreateTimer(FIFTEEN_SEC);	
	return null_event;
}

/**
 * LCD显示呼叫方信息,指示灯亮;
 * 处理允许无条件转移的情况;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -