summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-06-26 08:23:18 +0000
committerBenny Prijono <bennylp@teluu.com>2007-06-26 08:23:18 +0000
commit92940328690432692bb7e47e6d900c23d255771e (patch)
tree0ecc2cf4593f5cf62473233719c7e8e73059adcb
parent5c5a5345ea7419e15bfdc457487f66803de5b021 (diff)
Ticket #342: added configuration to control whether Allow header should be included in outgoing INVITE requests
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1390 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip/include/pjsip/sip_config.h26
-rw-r--r--pjsip/src/pjsip-ua/sip_inv.c12
-rw-r--r--pjsip/src/pjsip/sip_dialog.c7
3 files changed, 40 insertions, 5 deletions
diff --git a/pjsip/include/pjsip/sip_config.h b/pjsip/include/pjsip/sip_config.h
index 315cd830..3f1276ab 100644
--- a/pjsip/include/pjsip/sip_config.h
+++ b/pjsip/include/pjsip/sip_config.h
@@ -158,6 +158,32 @@
/**
+ * 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
* access module.
diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c
index c26c8bce..1ff497b0 100644
--- a/pjsip/src/pjsip-ua/sip_inv.c
+++ b/pjsip/src/pjsip-ua/sip_inv.c
@@ -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 */
diff --git a/pjsip/src/pjsip/sip_dialog.c b/pjsip/src/pjsip/sip_dialog.c
index ce9823cb..326696a2 100644
--- a/pjsip/src/pjsip/sip_dialog.c
+++ b/pjsip/src/pjsip/sip_dialog.c
@@ -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,