[asterisk-scf-commits] asterisk-scf/release/sip.git branch "master" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Thu Jan 12 10:26:55 CST 2012
branch "master" has been updated
via 71d0f466053836c6ffec7a257f4560213a97637a (commit)
from 6095c35ec25ed1b6ac407a8514a266c40b6aa829 (commit)
Summary of changes:
src/PJSIPSessionModule.cpp | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
- Log -----------------------------------------------------------------
commit 71d0f466053836c6ffec7a257f4560213a97637a
Author: Mark Michelson <mmichelson at digium.com>
Date: Thu Jan 12 10:26:28 2012 -0600
Don't overstep our authority in the PJSIPSessionModule.
The PJSIPSessionModule and the PJSIPRegistrarModule share priority, so
it's random which could be called into first by PJSIP. In a test case, a REGISTER
was responded to with a 405 because the PJSIPSessionModule was called into first.
It didn't know about REGISTER, so it responded with a 405.
Modules should only handle methods they know about. If it's a method that they do
not know about, then they should let PJSIP move on to a new one.
It may be wise to create an incredibly low-priority module to catch anything that
higher-priority modules do not catch so that a 405 can be sent in those cases. It
should not be done by any application-priority modules though.
diff --git a/src/PJSIPSessionModule.cpp b/src/PJSIPSessionModule.cpp
index 7a9476e..79a58a5 100644
--- a/src/PJSIPSessionModule.cpp
+++ b/src/PJSIPSessionModule.cpp
@@ -1326,10 +1326,12 @@ void PJSIPSessionModule::handleInfo(pjsip_inv_session *inv, pjsip_rx_data *rdata
pj_bool_t PJSIPSessionModule::on_rx_request(pjsip_rx_data *rdata)
{
pjsip_dialog *dlg = pjsip_rdata_get_dlg(rdata);
+ pj_bool_t ret;
switch (rdata->msg_info.msg->line.req.method.id)
{
case PJSIP_ACK_METHOD:
- return PJ_FALSE;
+ ret = PJ_FALSE;
+ break;
case PJSIP_INVITE_METHOD:
if (dlg == NULL)
{
@@ -1339,6 +1341,7 @@ pj_bool_t PJSIPSessionModule::on_rx_request(pjsip_rx_data *rdata)
{
lg(Warning) << "on_rx_request called back in mid-dialog?";
}
+ ret = PJ_TRUE;
break;
case PJSIP_OTHER_METHOD:
pj_str_t info;
@@ -1347,20 +1350,23 @@ pj_bool_t PJSIPSessionModule::on_rx_request(pjsip_rx_data *rdata)
{
// We are essentially stopping the pjsip code from sending a 500 here, but this will actually be handled
// within the transaction code
+ ret = PJ_TRUE;
break;
}
//PJSIP has no knowledge of the INFO method, so we do a straight string comparison dot dot dot
else if (dlg && !pj_strcmp(&rdata->msg_info.msg->line.req.method.name, &info))
{
// Like with REFER, we actually handle this in the transaction code.
+ ret = PJ_TRUE;
break;
- }
+ }
default:
- pjsip_endpt_respond_stateless(mEndpoint, rdata, 405, NULL, NULL, NULL);
- break;
+ // This method may be handled by a different PJSIP module we've registered. We can't handle it.
+ ret = PJ_FALSE;
+ break;
}
- return PJ_TRUE;
+ return ret;
}
/* The following four member functions are all stubbed out because they
-----------------------------------------------------------------------
--
asterisk-scf/release/sip.git
More information about the asterisk-scf-commits
mailing list