Rohit
Rohit

Reputation: 1001

PJsip Extract the value of header from a sip method

  NOTIFY sip:[email protected] SIP/2.0
    To: sip:[email protected]:1234
    From: sip:[email protected]
    CSeq: 1 NOTIFY
    Call-ID:1234
    Event: check-sync;reboot=false

I want to Extract event header with the connected string check-sync;reboot=false

Upvotes: 2

Views: 3397

Answers (2)

Jeremiah Gowdy
Jeremiah Gowdy

Reputation: 5622

pj_str_t event_hdr_name = pj_str("Event");
pjsip_generic_string_hdr *event_hdr = (pjsip_generic_string_hdr*)pjsip_msg_find_hdr_by_name(message, &event_hdr_name, NULL);
if (event_hdr == NULL)
    return NULL;
pj_str_t event_value = event_hdr->value;`

Upvotes: 1

raj_paps
raj_paps

Reputation: 114

I had to deal with an custom header, a bit similar to your case. It may help you.

You'll have to start with init_parser. Here SIP messages are parsed. Add your own custom function here. Add an element in pjsip_rx_data and store the result. This information will be passed downstream. Finally implement your stuff here pres_process_rx_notify

Upvotes: 0

Related Questions