GB35114---基于pjsip协议库开发问题

如果你在开发GB28181时选用了pjsip作为sip协议栈,那么在插入GB35114认证消息时惊奇的发现,我接收不到GB35114的sip消息了。

是的,pjsip将gb35114的消息进行过滤了。

既然过滤掉了我们的消息,我们就要让它对我们需要的消息放行(暴力)。

在sip_parser.c文件内有函数

static pjsip_msg *int_parse_msg( pjsip_parse_ctx *ctx,
                 pjsip_parser_err_report *err_list);

该函数会对接收到的消息进行格式解析,如果错误会将其插入到err list。

我们在PJ_CATCH_ANY下对gb35114认证消息进行筛选

PJ_CATCH_ANY 
    {
	/* Exception was thrown during parsing. 
	 * Skip until newline, and parse next header. 
	 */
	 //add 35114 Authorization bob 2019/10/28
	
	int i,code = 1;
	for(i = 0;gb_arry[i].ptr;i++)
	{
		if(!memcmp(hname.ptr,gb_arry[i].ptr,gb_arry[i].len))
		{
			//printf("get 35114 msg\n");
			code =0;
			break;
		}
	}
	if(code)
	{
		if (err_list) { 
			pjsip_parser_err_report *err_info;
		
			printf("enter err_list\n");
			err_info = PJ_POOL_ALLOC_T(pool, pjsip_parser_err_report);
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值