Ticket #342: added configuration to control whether Allow header should be included in outgoing INVITE requests
git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@1390 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
parent
5b918afe47
commit
95673f3e72
3 changed files with 40 additions and 5 deletions
|
@ -157,6 +157,32 @@
|
|||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Send Allow header in dialog establishing requests?
|
||||
* RFC 3261 Allow header SHOULD be included in dialog establishing
|
||||
* requests to inform remote agent about which SIP requests are
|
||||
* allowed within dialog.
|
||||
*
|
||||
* Note that there is also an undocumented variable defined in sip_dialog.c
|
||||
* to control whether Allow header should be included. The default value
|
||||
* of this variable is PJSIP_INCLUDE_ALLOW_HDR_IN_DLG.
|
||||
* To change PJSIP behavior during run-time, application can use the
|
||||
* following construct:
|
||||
*
|
||||
\verbatim
|
||||
extern pj_bool_t pjsip_include_allow_hdr_in_dlg;
|
||||
|
||||
// do not transmit Allow header
|
||||
pjsip_include_allow_hdr_in_dlg = PJ_FALSE;
|
||||
\endverbatim
|
||||
*
|
||||
* Default is 1 (Yes)
|
||||
*/
|
||||
#ifndef PJSIP_INCLUDE_ALLOW_HDR_IN_DLG
|
||||
# define PJSIP_INCLUDE_ALLOW_HDR_IN_DLG 1
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Allow SIP modules removal or insertions during operation?
|
||||
* If yes, then locking will be employed when endpoint need to
|
||||
|
|
|
@ -113,6 +113,8 @@ struct tsx_inv_data
|
|||
pj_bool_t sdp_done;
|
||||
};
|
||||
|
||||
/* Config */
|
||||
extern pj_bool_t pjsip_include_allow_hdr_in_dlg;
|
||||
|
||||
/*
|
||||
* Module load()
|
||||
|
@ -1153,10 +1155,12 @@ PJ_DEF(pj_status_t) pjsip_inv_invite( pjsip_inv_session *inv,
|
|||
}
|
||||
|
||||
/* Add Allow header. */
|
||||
hdr = pjsip_endpt_get_capability(inv->dlg->endpt, PJSIP_H_ALLOW, NULL);
|
||||
if (hdr) {
|
||||
pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)
|
||||
pjsip_hdr_shallow_clone(tdata->pool, hdr));
|
||||
if (pjsip_include_allow_hdr_in_dlg) {
|
||||
hdr = pjsip_endpt_get_capability(inv->dlg->endpt, PJSIP_H_ALLOW, NULL);
|
||||
if (hdr) {
|
||||
pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)
|
||||
pjsip_hdr_shallow_clone(tdata->pool, hdr));
|
||||
}
|
||||
}
|
||||
|
||||
/* Add Supported header */
|
||||
|
|
|
@ -39,6 +39,10 @@
|
|||
|
||||
long pjsip_dlg_lock_tls_id;
|
||||
|
||||
/* Config */
|
||||
pj_bool_t pjsip_include_allow_hdr_in_dlg = PJSIP_INCLUDE_ALLOW_HDR_IN_DLG;
|
||||
|
||||
|
||||
PJ_DEF(pj_bool_t) pjsip_method_creates_dialog(const pjsip_method *m)
|
||||
{
|
||||
const pjsip_method subscribe = { PJSIP_OTHER_METHOD, {"SUBSCRIBE", 9}};
|
||||
|
@ -1196,7 +1200,8 @@ static void dlg_beautify_response(pjsip_dialog *dlg,
|
|||
}
|
||||
|
||||
/* Add Allow header in 2xx and 405 response. */
|
||||
if ((st_class==2 || st_code==405) &&
|
||||
if (((st_class==2 && pjsip_include_allow_hdr_in_dlg)
|
||||
|| st_code==405) &&
|
||||
pjsip_msg_find_hdr(tdata->msg, PJSIP_H_ALLOW, NULL)==NULL)
|
||||
{
|
||||
c_hdr = pjsip_endpt_get_capability(dlg->endpt,
|
||||
|
|
Loading…
Reference in a new issue