[Kamailio-Users] SUBSCRIBE message with a private header

Iñaki Baz Castillo ibc at aliax.net
Fri Sep 26 18:10:13 CEST 2008


El Jueves, 25 de Septiembre de 2008, Yoo Chan Jeon escribió:
> Hi,
> Thank you for your reponse.
> By using $hdr(HEADER-NAME),  it returns "Private-Header:value".
> Now I have other problems.
> I would like to check if the header exist, then I want to get the value.
> How do I get the value from $hdr(HEADER-NAME) ?

Well, let me explain:

Imagine the request contains a header like:
  Private-Header-1: aaabbbccc
but not a header "Private-Header-2".

So if you do:

  if $hdr(Private-Header-1) {
      # block
  }

it will return TRUE and the block executed.

If you want to read the header value you do it in the same way:

  xlog("L_INFO","---private header 1 value = $hdr(Private-Header-1) ---\n");


If you want to check if Private-Header-2 then:

  if $hdr(Private-Header-2) {
      # block
  }

This "if" return FALSE and the block is not runned since the header doesn't 
exist.

Hope it clarifies you a bit.



-- 
Iñaki Baz Castillo




More information about the Users mailing list