< Previous by Date | Date Index | Next by Date > |
< Previous in Thread | Thread Index | Next in Thread > |
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/
Attachment:
Untitled.jpg
Description: JPEG image