[SR-Users] $(hdr(name)[N]) question

Juha Heinanen jh at tutpro.com
Fri Apr 25 16:15:55 CEST 2014


Juha Heinanen writes:

> wiki was this related to $(hdr(name)[N]):
> 
>   If [N] is omitted then the body of the first header is printed. The
>   first header is got when N=0, for the second N=1, a.s.o. In case of a
>   comma-separated multi-body headers, it returns all the bodies,
>   comma-separated.
> 
> i don't understand the last sentence. how can i get all bodies of all
> headers of name=x as a comma separated list?

perhaps the above "In case" sentence should read:

  In case of comma-separated multi-body headers, $(hdr(name)[*]) returns
  all the bodies, comma-separated.

while testing this, i found a bug.  when incoming request has

Test: <sip:user1 at foo.bar>.
Test: <sip:user2 at foo.bar>,<sip:user3 at foo.bar>.

xlog("L_INFO", "Test '$(hdr(test)[*])'\n");

produces:

Apr 25 17:11:37 siika /usr/sbin/sip-proxy[9801]: INFO: Test '<sip:user1 at foo.bar>, <sip:user2 at foo.bar>,<sip:user3 at foo.bar>'

the bug is the extra space char after first comma.

-- juha



More information about the sr-users mailing list