mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-07 22:02:12 +08:00
* #28358: sip: move addContactHeader into separate function
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user