Commit f5417983 authored by Tristan Matthews's avatar Tristan Matthews
Browse files

Merge branch 'master' into cpp11

parents 3615b995 d4ddf067
......@@ -232,6 +232,17 @@ void updateSDPFromSTUN(SIPCall &call, SIPAccount &account, const SipTransport &t
}
}
void
addContactHeader(const std::string &contactStr, pjsip_tx_data *tdata)
{
pj_str_t pjContact = pj_str((char*) contactStr.c_str());
pjsip_contact_hdr *contact = pjsip_contact_hdr_create(tdata->pool);
contact->uri = pjsip_parse_uri(tdata->pool, pjContact.ptr,
pjContact.slen, PJSIP_PARSE_URI_AS_NAMEADDR);
pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*) contact);
}
pj_bool_t transaction_request_cb(pjsip_rx_data *rdata)
{
......@@ -466,6 +477,10 @@ pj_bool_t transaction_request_cb(pjsip_rx_data *rdata)
return PJ_FALSE;
}
// contactStr must stay in scope as long as tdata
const std::string contactStr(account->getContactHeader());
addContactHeader(contactStr, tdata);
if (pjsip_inv_send_msg(call->inv, tdata) != PJ_SUCCESS) {
ERROR("Could not send msg for invite");
delete call;
......@@ -1077,14 +1092,9 @@ SIPVoIPLink::hangup(const std::string& id, int reason)
if (pjsip_inv_end_session(inv, status, NULL, &tdata) != PJ_SUCCESS || !tdata)
return;
// add contact header
// contactStr must stay in scope as long as tdata
const std::string contactStr(account->getContactHeader());
pj_str_t pjContact = pj_str((char*) contactStr.c_str());
pjsip_contact_hdr *contact = pjsip_contact_hdr_create(tdata->pool);
contact->uri = pjsip_parse_uri(tdata->pool, pjContact.ptr,
pjContact.slen, PJSIP_PARSE_URI_AS_NAMEADDR);
pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*) contact);
addContactHeader(contactStr, tdata);
if (pjsip_inv_send_msg(inv, tdata) != PJ_SUCCESS)
return;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment