I found a way to do it. Just in case if somebody is interested:
su_home_t home[1] = { SU_HOME_INIT(home) };
sip_unknown_t* unknown_headers = NULL;
sip_unknown_t* prev = NULL;
std::vector<std::string, std::string>::const_iterator it =
custom_headers.begin();
for(; it != custom_headers.end(); ++it)
{
sip_unknown_t* current = sip_unknown_format(home, "%s: %s",
it->first.c_str(), it->second.c_str());
if (unknown_headers == NULL)
unknown_headers = current;
current->un_next = NULL;
if (prev != NULL)
prev->un_next = current;
prev = current;
}
nua_invite( nh,
SIPTAG_UNKNOWN(unknown_headers),
TAG_END());
su_home_deinit(home);
-----Original Message-----
From: Huang, Kun-Yao
Sent: Wednesday, August 15, 2012 12:30 PM
To: '[email protected]'
Subject: Can I use SIPTAG_UNKNOWN_STR with nua_set_hparam?
The following approach works, the unknown header (header: value) is actually in
the INVITE message:
1.
nua_handle(nua, NULL, SIPTAG_TO(blah), SIPTAG_UNKNOWN_STR("unknown: value"),
TAG_END()); nua_invite(handle, SOATAG_USER_SDP_STR(sdp), TAG_END());
2.
nua_handle(nua, NULL, SIPTAG_TO(blah), TAG_END()); nua_invite(handle, ),
SOATAG_USER_SDP_STR(sdp), SIPTAG_UNKNOWN_STR("unknown: value"), TAG_END());
But setting unknown header with nua_set_hparams() doesn't seem to be working.
The INVITE message was sent without the header:
nua_handle(nua, NULL, SIPTAG_TO(blah), TAG_END()); nua_set_hparams(handle,
SIPTAG_UNKNOWN_STR("unknown: value"), TAG_END()); nua_invite(handle,
SOATAG_USER_SDP_STR(sdp), TAG_END());
Is this behavior intended? If it is, I need to set multiple unknown headers in
runt time so is there another way to do it?
I am using version version 1.12.11 on Windows 7 64 bit.
Regards,
Kun-Yao Huang
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Sofia-sip-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel