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

* #28358: sip: move addContactHeader into separate function

parent 42fac4e4
......@@ -1034,6 +1034,17 @@ void stopRtpIfCurrent(const std::string &id, SIPCall &call)
#endif
}
}
void addContactHeader(const SIPAccount &account, pjsip_tx_data *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);
}
}
void
......@@ -1077,14 +1088,7 @@ SIPVoIPLink::hangup(const std::string& id, int reason)
if (pjsip_inv_end_session(inv, status, NULL, &tdata) != PJ_SUCCESS || !tdata)
return;
// add contact header
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(*account, 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