PJSIP User Registration Header

I am trying to configure SIP communication with an internal server (using the PJSIP library), however this server requires its own header field with the specified header value for calling REGISTRATION . For example, we will call this header MyHeader .

From what I found, the pjsua_acc_add() function will add the account and register it on the server using the configuration structure.

The reg_hdr_list parameter of the configuration structure has a description:

Additional custom SIP headers to be placed in the registration request.

This seems to be exactly what I need, however it does not seem to affect the call itself.

Here is what I still have:

  pjsua_acc_config cfg; pjsua_acc_config_default(&cfg); //...Some other config stuff related to the server... pjsip_hdr test; test.name = pj_str("MyHeader"); test.sname = pj_str("MyHdr"); test.type = PJSIP_H_OTHER; test.prev = cfg.reg_hdr_list.prev; test.next = cfg.reg_hdr_list.next; cfg.reg_hdr_list = test; pj_status_t status; status = pjsua_acc_add(&cfg, PJ_TRUE, &acc_id); 

On the server side, there are no additional header fields or anything else. And the structure that is used to define the header ( pjsua_hdr ) has no value or equivalent field, so even if he created the header, how does it set the value?

Here is a link for defining a list of headers and a link for a heading structure.

Edit: I found a solution thanks to an employee:

  struct pjsip_generic_string_hdr CustomHeader; pj_str_t name = pj_str("MyHeader"); pj_str_t value = pj_str("HeaderValue"); pjsip_generic_string_hdr_init2(&CustomHeader, &name, &value); pj_list_push_back(&cfg.reg_hdr_list, &CustomHeader); 

This seems to work as expected.

+44
ios header registration sip pjsip
Nov 11 '11 at 17:46
source share
1 answer

Just indicating OP as , he found a solution , but forgot to add it as an answer:

Edit: I found a solution thanks to an employee:

 struct pjsip_generic_string_hdr CustomHeader; pj_str_t name = pj_str("MyHeader"); pj_str_t value = pj_str("HeaderValue"); pjsip_generic_string_hdr_init2(&CustomHeader, &name, &value); pj_list_push_back(&cfg.reg_hdr_list, &CustomHeader); 

This seems to work as expected.

+1
Nov 26 '15 at 6:27
source share



All Articles