如果你在开发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);