资源简介
GBT28181_Register.tar.bz2
代码片段和文件信息
#include
#include
#include
#include
#include //INADDR_ANY
#include
char *pcServerID = “34010000002000000001“;
char *pcServerIP = “192.168.120.107“;
int iServerPort = 5060;
char *pcClientID = “34010000001310000001“;
int iClientPort = 5062;
char *pcPassword = “12345“;
int g_Rid = 0;
/**
* @brief 注册 向上级服务器注册
* @param pSClientGB
* @return
*/
#define GBT28181_REGISTER_SUCCESS 0
#define GBT28181_REGISTER_FAILURE -1
#define GBT28181_REGISTER_TIMEOUT -2
int GBT28181_Register(struct eXosip_t * peCtx)
{
int i = 0;
int iRid = 0;
osip_message_t * reg = NULL;
char acClientURI[128];
char acServerURI[128];
char acDeiveID10Bit[11];
memset(acDeiveID10Bit011);
strncpy(acDeiveID10BitpcClientID10);
sprintf(acClientURI“sip:%s@%s:%d“pcClientIDacDeiveID10BitiClientPort);
sprintf(acServerURI“sip:%s@%s:%d“pcServerIDpcServerIPiServerPort);
iRid = eXosip_register_build_initial_register(peCtxacClientURIacServerURINULL3600®);
if (iRid < 0)
{
return -1;
}
g_Rid = iRid;
i = eXosip_register_send_register (peCtxiRidreg);
if ( i != OSIP_SUCCESS )
{
return GBT28181_REGISTER_TIMEOUT;
}
else
{
}
return GBT28181_REGISTER_SUCCESS;
}
static void *MainProcess(void * pvSClientGB)
{
struct eXosip_t * peCtx = (struct eXosip_t *)pvSClientGB;
int iHasStartFlag = 0;
for(;;)
{
eXosip_event_t *je = NULL;
je = eXosip_event_wait (peCtx04);
if ( iHasStartFlag == 0 )
{
iHasStartFlag = 1;
}
if ( iHasStartFlag == 1 )
{
//Send Register to Server
GBT28181_Register(peCtx);
iHasStartFlag = 2;
}
if (je == NULL)
{
osip_usleep(10000);
continue;
}
switch (je->type)
{
case EXOSIP_REGISTRATION_SUCCESS:
{
if ( je->response != NULL )
{
osip_header_t *Date = NULL;
osip_message_header_get_byname (je->response“Date“0&Date);
if ( (Date != NULL) && (Date->hvalue != NULL) )
{
char *pcDate = Date->hvalue;
//HandleTiming(pSClientGBpcDate); //处理校时指令
fprintf(stderr“Register Success!!\n“);
}
}
}
break;
case EXOSIP_REGISTRATION_FAILURE:
{
//发送带用户名密码的注册消息
if ( je->response != NULL )
{
if(je->response->status_code == 401 || je->response->status_code == 407)
{
eXosip_lock(peCtx);
eXosip_add_authentication_info (peCtxpcClientIDpcClientIDpcPassword“MD5“NULL);//向eXosip提
- 上一篇:《数据结构》严蔚敏第二版课后习题+答案
- 下一篇:NI汽车行业应用与选型指南
相关资源
- RHCSARHCE题库.docx
- plcjiemi_7334389.zip
- 人人商城详细功能思维图.zip
- TouchExplorer6.60SP2.2.1.rar
- percent10_10707636.zip
- 数字签名和数字证书
- 国家电网公司继电保护培训教材(上
- chrome印象笔记插件extension_6_12.crx
- 灰鸽子2010破解版.rar
- 二手市场.zip
- 直升机飞行控制系统(王昆玉).pdf
- OpenHoldem.rar
- LOL网吧特权连接工具源码.zip
- 品牌词库总.txt
- ProfessionalCMake_APracticalGuide.pdf
- 秒余额快捷马0.1完美版.rar
- 《go圣经》和《go语言》中文版.zip
- VM装XP傻白甜教程.pdf
- 微擎微赞模块钻石投票v5.50.8原版.ra
- InformationTheoryandNetworkCodingSpringer2008.
- liwenggg-10220834-最优化导论Solutions_Man
- 基于VC的包过滤防火墙论文源码有效地
- 网络攻击及防御技术.ppt
- smppapi-0.3.9.rar
- ex4_to_mq4_freeware(真正有用的破解程序
- EasyBuy.rar115487
-
new_one_ob
ject_9563362.zip - c本质论(第4版)源代码.tar
- 2.5.zip
- 微擎-万能表单7.0.1dayu_form修改版-201
评论
共有 条评论