我正在使用 pjsip 作为 sip 堆栈为 I-phone 开发 voip 应用程序,我想添加自定义标头可以添加,但只添加了一个,我卡住了,我不明白出了什么问题,下面是我的代码片段
pj_status_t status = PJ_SUCCESS;
pj_str_t pj_uri;
pjsua_msg_data msg_data;
pjsip_generic_string_hdr subject;
pj_str_t hvalue, hname;
pj_uri = pj_str((char *)uri);
for(NSString *key in [headers allKeys]){
NSLog(@"Call.m key value in call %@,%@",key,[headers objectForKey:key] );
pjsua_msg_data_init(&msg_data);
hname = pj_str((char *)[key UTF8String]);
char * headerValue=(char *)[(NSString *)[headers objectForKey:key] UTF8String];
hvalue = pj_str(headerValue);
pjsip_generic_string_hdr_init2 (&subject, &hname, &hvalue);
pj_list_push_back(&msg_data.hdr_list, &subject);
}
status = pjsua_call_make_call(acc_id, &pj_uri, 0, NULL, &msg_data, call_id);