[pjsip] User-agent parsing in 200 OK response message after Register

Barbieri Davide d.barbieri at reply.it
Thu Jan 26 06:02:45 EST 2012


Thanks for your response.

Another similar question: I need to parse the Reason header field in an incoming CANCEL message.
Using the available callbacks in the pjsua struct, I cannot retrieve the entire CANCEL message. I tried with on_call_state and on_call_tsx_state. The problem is that rxdata retrieved from the event does not contain any more the received CANCEL.

I think these callbacks are called too late, after sending the 200/OK response.
Should I create another callback to achieve my purpose?


Regards,

Davide



-----Original Message-----
From: pjsip-bounces at lists.pjsip.org [mailto:pjsip-bounces at lists.pjsip.org] On Behalf Of Alain Totouom
Sent: sabato 14 gennaio 2012 18:42
To: pjsip list
Subject: Re: [pjsip] User-agent parsing in 200 OK response message after Register

Buona sera Davide,

On 12-Jan-12 20:27, Barbieri Davide wrote:
> I need to parse the User-Agent in the 200 OK response message after sending a Register to the SIP server. I think that's possible in the "on-reg_state" callback using pjsip_parse_hdr(...) function. The problem is that I need to the get the entire response message to use that function (in practice the buffer for received messages).
>
> How can I get the message header in this callback? Or should I use another callback to obtain it?
>

at that state the message is already decoded.
You therefor just need a callback that will give you access to the
pjsip_msg data structure.

*on_reg_state2* is the one to be used since through its
*pjsua_reg_info* parameter you can access the underlaying
*pjsip_msg* data structure.
You can then use *pjsip_msg_find_hdr* or better
*pjsip_msg_find_hdr_by_names* to retrieve the User-Agent Header
(generic string) and its value if provided by the UAS ;o)

Ciao,
Alain




>
>
> Davide Barbieri
>
> [Concept Reply]Concept Reply
> P: +39 011 29100
> E: d.barbieri at reply.it<mailto:d.barbieri at reply.it>
> W: www.reply.it<http://www.reply.it>
>
> ________________________________
>
> --
> The information transmitted is intended for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.
>
>
>
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

--
                            ""
                          (o)(o)
                _____o00o__(__)__o00o_____
3072D/146D10DE 2011-09-29    Alain Totouom  <totouom at gmx.de>
PGP Fingerprint 39A4F092 FFA7C746 CC305CB0 69091911 146D10DE

_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip at lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

________________________________

--
The information transmitted is intended for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.



More information about the pjsip mailing list