[pjsip] Accessing NOTIFY body from python

Benny Prijono bennylp at teluu.com
Mon Aug 24 11:56:50 EDT 2009


On Sat, Aug 22, 2009 at 1:55 PM, Saúl Ibarra<saghul at gmail.com> wrote:
> Hi,
>
> For interactin with an external XCAP library it would be really nice
> if we could access an incoming NOTIFY request's body, so that we can
> parse it...
>
> I guess some (I hope little) modification is needed in _pjsua.c, but
> can't find where. If someone could point me I'd try to make the patch
> myself ;)
>

Is the information you're looking for encoded inside the <tuple>
element? If so then there is hope. :)

If you look at "pjsua_buddy_info", you see "pres_status", which is a
"pjsip_pres_status" structure. Inside pjsip_pres_status, there is
"tuple_node", which contains the full <tuple> XML node.

So what you can do is add a new string field in PyObj_pjsua_buddy_info
(_pjsua.h), and fill this field in PyObj_pjsua_buddy_info_import() by
printing the <tuple> XML node (with pj_xml_print()) to a string
buffer.

Then when you're notified about incoming NOTIFY (in buddy.on_state()
callback), you can get the string with buddy.info()

Cheers
 Benny




More information about the pjsip mailing list