#include "PalmType.h"
#include "p_util.h"
#include "p_dsp.h"
#include "p_tcpip.h"
#include "p_h323.h"

BOOLEAN IsInCall()
{
	if (Task_bConnected)		return TRUE;
	if (Task_bConnecting)		return TRUE;
	return FALSE;
}

static CCHAR _cG7231FrameLen[4] = {G7231_R63_LEN, G7231_R53_LEN, G7231_CNG_LEN, G7231_VAD_LEN};

UCHAR G7231GetFrameLen(UCHAR iFirst)
{
	iFirst &= 0x03;
	return _cG7231FrameLen[iFirst];
}

USHORT ParseDnsAddr(PXCHAR pSrc, PXCHAR pDstIP, PXCHAR pDstDns)
{
	PXCHAR_D pCur;
	DSHORT iPort;

	p_strcpy_x2x(pDstDns, pSrc);

	pCur = p_strchr_x(pDstDns, (UCHAR)':');
	if (pCur)
	{
		pCur[0] = 0;
		pCur ++;
		iPort = p_atoi(pCur, 10);
	}
	else
	{
		iPort = 0;
	}

	if (p_String2IP(pDstDns, pDstIP))
	{
		pDstDns[0] = 0;
	}
	else
	{
		p_memset_ip_0(pDstIP);
	}

	return iPort;
}

