[asterisk-dev] Questions before I wrap up res_pjsip_header_funcs

Mark Michelson mmichelson at digium.com
Thu Sep 12 16:41:51 CDT 2013


On 09/12/2013 03:56 PM, George Joseph wrote:
> To recap...  This module implements PJSIP_HEADER, PJSIPAddHeader and
> PJSIPRemoveHeader.
>
> If you don't like the module name, let me know now. :)
>
> Questions...
>
> Is there really no way to read the string value of an arbitrary pjsip
> header?  There's pjsip_generic_string_header which has a hvalue, but
> that's only a parent for the non-frequent headers.  All the more
> frequent ones have their own structures which you have to know at
> compile time.  I.E.  You're asking for the "From" header so you know
> the structure is going to be a pjsip_from_hdr.   For arbitrary
> headers, my only option seems to be to call the header's print_to
> function (which they all implement) to a buffer then trim off the
> leading header name and ': '.  Any other ideas?

Hm, I'm not able to think of anything off the top of my head. I think 
the method you've come up with is the best way to go without writing 
individual cases for each type of header supported in PJSIP.

>
> Also, is there any way to get the pj_pool from the ast_channel passed
> to an app or function implementation?  I'm using a pjsip_msg structure
> to accumulate the outgoing headers and most of the helper functions
> for pjsip need the pool.

The best option here is to use the pjsip_dialog's pool. You can get 
there like so, assuming that "chan" is an ast_channel:

struct ast_sip_channel_pvt *chan_pvt = ast_channel_tech_pvt(chan);
pj_pool *pool = chan_pvt->session->inv_session->dlg->pool;

And there you have a pool!

Mark Michelson

> george
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>     http://lists.digium.com/mailman/listinfo/asterisk-dev




More information about the asterisk-dev mailing list