[OpenSER-Devel] xlog $hdr problem

Dan Pascu dan at ag-projects.com
Fri Oct 26 06:55:34 UTC 2007


On Friday 26 October 2007, Juha Heinanen wrote:
> Daniel-Constantin Mierla writes:
>  > what version are you using? I tried with trunk and got:
>  >
>  > REGISTER registration for sip:123 at test.com (kphone/4.2)
>  >
>  > for: xlog("L_INFO", "$rm $hdr(event) for $fu ($ua)\n");
>
> i tried with svnrevision: 1:2981MS and $hdr(event) works fine here.

It may work fine because you probably tested with a fairly complex script 
that happens to call something that parses all the headers up to at least 
your Event header before you called $hdr(event). The issue appears if you 
use $hdr(something) before that header was actually parsed by other 
means. It appears that using the short form of pvars doesn't suffer from 
this problem, so if I use $cs and after I use $hdr(cseq) it works, but 
the other way around it doesn't.

The minimal script below shows the problem. If you check the debugging 
output, you will notice it doesn't even attempt to parse the cseq header 
until $cs is used. after that $hdr(cseq) works as expected.

-------------------------------------------

fork         = no
debug        = 7 
log_stderror = yes

listen       = 127.0.0.1:5060
children     = 5

mpath = "/usr/lib/openser/modules"
loadmodule "xlog.so"


route {

xlog("L_INFO", "Message received: $$rm=$rm $$hdr(cseq)=$hdr(cseq)\n");
xlog("L_INFO", "Now using the short form pvar: $$cs=$cs\n");
xlog("L_INFO", "And now $$hdr(cseq) works: $$hdr(cseq)=$hdr(cseq)\n");

}

-------------------------------------------


-- 
Dan



More information about the Devel mailing list