[sr-dev] How to parse msg stored in the tm correctly?
Andrei Pelinescu-Onciul
andrei at iptel.org
Sat Dec 19 11:50:54 CET 2009
On Dec 18, 2009 at 22:29, Min Wang <wang at basis-audionet.com> wrote:
> Hi Ser Gurus:
>
> How to parse msg stored in the tm correctly?
>
> e.g in the reply msg, we can get the corresponding request from tm:
>
> msg = t->uas.request;
>
> The sip_msg_cloner seems copy only via/from/to/cseq/auth headers and
> parsed headers to the shm, right?
>
> what if we want to parse the other headers,
>
> e.g: parse_headers(msg, HDR_ROUTE_F, 0)<0)
By default all headers are parsed before creating the transaction, so
you'll have all the headers in the shm copy.
What you don't always have parsed is the content of a header (but that
depends on the header type).
>
> The parse_headers uses pkg_alloc, thus the parsed result is
> pkg_alloced and stored the tm structure, then it never get freed until
> tm is destoried ( but even in this case tm may call shm_free instead of
> pkg_free???? )
In general one calls parse_headers only on a copy of the message stored
in tm (see fake_req()).
>
> So how can we parsed the tm-stored msg and how to do it correctly?
If you could be more specific (what headers do you need and from where,
e.g. failure route or a tm hook) it would help.
Andrei
More information about the sr-dev
mailing list