< Previous by Date Date Index Next by Date >
< Previous in Thread Thread Index Next in Thread >

Re: [reSIProcate-users] How to got the header defination "h_xxx" by the header name ?


It looks like SipMessage::addHeader never copies the passed in buffer, so it’s probably being deleted at some point in your code.  This means that my example needs some work.  You can take a look at addHeader() and see what it’s doing, but basically you could create a HeaderFieldValueList and initialize the header with a HeaderFieldValue that owns a copy of the field contents.  Then I would lean towards using setRawHeader/getRawHeader instead of addHeader().

 

On a side note, it looks like ::addHeader is used internally by the parser when building a message from the network, it’s use seems limited by users of resip.  Not copying the buffer is probably done for performance/design reasons, but this starts to delve into the parser…

 

-justin

 

From: Karlsson [mailto:boost.regex@xxxxxxxxx]
Sent: Friday, October 03, 2008 12:25 PM
To: Justin Matthews
Cc: resiprocate-users
Subject: Re: [reSIProcate-users] How to got the header defination "h_xxx" by the header name ?

 

I'm modify the header value in this function: decorateMessage

 

after I modify the SipMessage, I'm using the MessageBoxA to show this message, the modifiy header value is correctly.

But why it goes wrong when send out or write to log.

 



 

On Sat, Oct 4, 2008 at 12:20 AM, Karlsson <boost.regex@xxxxxxxxx> wrote:

I have use the reSIProcate DEBUG log, got the same wrong result:

 

Supported: replaces

User-Agent: Dn%cb%01

Event: message-summary

Content-Length: 0

 

 

I just want to modify the user agent as: "myua"

 



 

On Fri, Oct 3, 2008 at 11:49 PM, Justin Matthews <jmatthewsr@xxxxxxxxx> wrote:

Not sure why you would get that.  You can take a look at the resip logs to see what message was actually sent to the network and see if it's corrupted before sending.

 

-justin

 

From: Karlsson [mailto:boost.regex@xxxxxxxxx]
Sent: Friday, October 03, 2008 11:05 AM
To: Justin Matthews


Cc: resiprocate-users
Subject: Re: [reSIProcate-users] How to got the header defination "h_xxx" by the header name ?

 

Hi, I have encountering issue when I test it, I modify the User-Agent header to a string, and

use wireshark to capture the SIP message, but got:

 User-Agent: \370L$\000\376\377\377\377\001\000\000\000\f\016\000\000\000\000\000\000\000\000\000\000

 

The attachment is screenshot, why?

On Fri, Oct 3, 2008 at 9:59 PM, Justin Matthews <jmatthewsr@xxxxxxxxx> wrote:

Here is my response from an off-list message asking for additional help on
adding a header using the string representation of the header name.  I
haven't tested this and am not completely sure this is the best way to do
this, but here is my first take:

       const resip::Data headerName("From");
       resip::Data headerValue("some header value here");
       resip::SipMessage resipMsg;

       resip::HeaderBase *headerBase =
HeaderBase::getInstance(resip::Headers::getType(headerName.c_str(),headerNam
e.size()));

       if (headerBase)
       {
               if (resipMsg.exists(*headerBase))
               {
                       resipMsg.remove(*headerBase);
               }
               resipMsg.addHeader(headerBase->getTypeNum(),0,0,
headerValue.c_str(), headerValue.size());

               //may want to make sure that the headers added are valid...
               try {
                       resipMsg.parseAllHeaders();
               } catch (ParseException &)
               {}
       }

-justin



-----Original Message-----
From: resiprocate-users-bounces@xxxxxxxxxxxxxxx
[mailto:resiprocate-users-bounces@xxxxxxxxxxxxxxx] On Behalf Of Scott Godin
Sent: Wednesday, September 10, 2008 11:22 AM
To: Karlsson
Cc: resiprocate-users
Subject: Re: [reSIProcate-users] How to got the header defination "h_xxx" by
the header name ?

Check out this older posting:
http://list.resiprocate.org/archive/resiprocate-devel-old/msg06074.html

Scott

On Tue, Sep 9, 2008 at 4:52 AM, Karlsson <boost.regex@xxxxxxxxx> wrote:
> Hi, I want to know, does there have a way to got the header defination
h_xxx
> by the header name ?
>
> For example, I want to got the h_Vias by "Via" string;
> got the h_From by "From" string;
>
> Thanks a lot.
> _______________________________________________
> resiprocate-users mailing list
> resiprocate-users@xxxxxxxxxxxxxxx
> List Archive: http://list.resiprocate.org/archive/resiprocate-users/
>
_______________________________________________
resiprocate-users mailing list
resiprocate-users@xxxxxxxxxxxxxxx
List Archive: http://list.resiprocate.org/archive/resiprocate-users/