refer optionally with expires

some fix with CRLF on refer-to
some fix with content_type on announce_transfer

based on patch by Balint Kovacs



git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@1388 8eb893ce-cfd4-0310-b710-fb5ebe64c474
sayer/1.4-spce2.6
Stefan Sayer 17 years ago
parent f5fcaeabc3
commit 9b4bba32d7

@ -143,8 +143,7 @@ void AnnounceTransferDialog::onSipRequest(const AmSipRequest& req)
if (getHeader(req.hdrs,"Event") != "refer")
throw AmSession::Exception(481, "Subscription does not exist");
if ((strip_header_params(getHeader(req.hdrs,"Content-Type"))
!= "message/sipfrag"))
if ((strip_header_params(req.content_type) != "message/sipfrag"))
throw AmSession::Exception(415, "Unsupported Media Type");
string sipfrag_sline = req.body.substr(8, req.body.find("\n") - 8);

@ -449,11 +449,16 @@ int AmSipDialog::update(const string& hdrs)
}
}
int AmSipDialog::refer(const string& refer_to)
int AmSipDialog::refer(const string& refer_to,
int expires)
{
switch(status){
case Connected:
return sendRequest("REFER", "", "", "Refer-To: "+refer_to);
case Connected: {
string hdrs = "Refer-To: " + refer_to + CRLF;
if (expires>0)
hdrs+= "Expires: " + int2str(expires) + CRLF;
return sendRequest("REFER", "", "", hdrs);
}
case Disconnecting:
case Pending:
DBG("refer(): we are not yet connected."
@ -478,7 +483,7 @@ int AmSipDialog::transfer(const string& target)
AmSipDialog tmp_d(*this);
tmp_d.setRoute("");
tmp_d.contact_uri = "Contact: <" + tmp_d.remote_uri + ">\n";
tmp_d.contact_uri = "Contact: <" + tmp_d.remote_uri + ">" CRLF;
tmp_d.remote_uri = target;
string r_set;
@ -655,7 +660,7 @@ void AmSipDialog::setRoute(const string& n_route)
string::size_type comma_pos;
comma_pos = m_route.find(',');
//route += "Route: " + m_route.substr(0,comma_pos) + "\n";
//route += "Route: " + m_route.substr(0,comma_pos) + "\r\n";
route.push_back(m_route.substr(0,comma_pos));
if(comma_pos != string::npos)

@ -176,7 +176,8 @@ class AmSipDialog
int invite(const string& hdrs,
const string& content_type,
const string& body);
int refer(const string& refer_to);
int refer(const string& refer_to,
int expires = -1);
int transfer(const string& target);
int drop();

Loading…
Cancel
Save