Working on my test app for the iPhone I just wanted to get the payload
from a SIP message and display it.  Is this what you want to do?

I did it by doing the following (which may not be the RightThing, but it
works for me).  I my event_callback I output the following to my logs:

sip->sip_payload->pl_data

Again, it's probably not the correct way to do what you want but I can
pop a dialog window on the iPhone simulator with the text of the message
I sent to my UA.

Hope this helps.

> -----Original Message-----
> From: Stefano Sabatini [mailto:[EMAIL PROTECTED]
> Sent: Thursday, November 20, 2008 7:38 AM
> To: sofia-sip-devel@lists.sourceforge.net
> Subject: Re: [Sofia-sip-devel] [NEWBIE] How to print a SIP message
> 
> On date Thursday 2008-11-20 10:49:21 +0100, Stefano Sabatini phoned
this:
> [...]
> > How can I get a msg_t from a sip_t?
> >
> > I can convert a msg_t -> sip_t using sip_object, but how can I
perform
> > the inverse conversion?
> 
> Again auto-replying to myself...
> 
> Contemplating the sip module doc picture I finally got for the first
> time a complete understanding of the msg_t struct.
> 
> I don't know if there is function for such a conversion, anyway it
> shouldn't too hard to define a function to create a msg_t struct and
> fill the fields in order to create (maybe even refactorizing some code
> from msg_as_string()).
> 
> As suggested by Pessa in a previous mail, for example it should be
> possible to iterate through the headers contained in sip_t, print a
> representation of them (e.g. using sip_header_as_string()) and fill a
> buffer which will be equivalent to the original buffer.
> 
> > All I want to do is to simply print out the sip_t message received
by
> > the event callback, so the solution looks either convert sip_t ->
> > msg_t and use msg_as_string() either to print sip_t using some to
text
> > conversion function, which I can't find.
> 
> Even without to access the sip_t struct there is a solution using the
> nua_current_request() function. Sofia-sip somehow stores the current
> message processed (the name is misleading, since it also stores
> response messages), the following snippet may be executed for example
> at the beginning of the event callback:
> 
>         /* print the incoming message */
>         int msg_size = 0;
>         msg_t* msg = nua_current_request(nua);
>         if (msg) {
>             char * msg_str = msg_as_string(home, msg, NULL, 0,
&msg_size);
>             printf ("SIP message:\n"
>                     "%s\n", msg_str);
>         }
> 
> Regards.
> 
>
------------------------------------------------------------------------
-
> This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
> Build the coolest Linux based applications with Moblin SDK & win great
prizes
> Grand prize is a trip for two to an Open Source event anywhere in the
world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Sofia-sip-devel mailing list
> Sofia-sip-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Confidentiality Notice: This e-mail message including attachments, if any, is 
intended only for the person or entity to which it is addressed and may contain 
confidential and/or privileged material. Any unauthorized review, use, 
disclosure or distribution is prohibited. If you are not the intended 
recipient, please contact the sender by reply e-mail and destroy all copies of 
the original message. If you are the intended recipient, but do not wish to 
receive communications through this medium, please so advise the sender 
immediately.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to