Hi,
Attached are two patches:
The first moves the OPTIONS handling from AmSipDispatcher to AmSessionFactory,
so the application writers can customize it.
The second one exposes the first VIA header in via1 member of AmSipMsg.
If you think someone else besides me would find them useful, please apply
them!
br
Szo
diff -ruw -x.svn sems-orig//core/AmApi.cpp sems-new//core/AmApi.cpp
--- sems-orig//core/AmApi.cpp 2011-01-31 16:26:08.000000000 +0100
+++ sems-new//core/AmApi.cpp 2011-02-18 13:59:04.000000000 +0100
@@ -76,6 +76,26 @@
void AmSessionFactory::onOoDRequest(const AmSipRequest& req)
{
+ if(req.method == "OPTIONS"){
+
+ // Basic OPTIONS support
+ if (!AmConfig::OptionsSessionLimit ||
+ (AmSession::getSessionNum() < AmConfig::OptionsSessionLimit)) {
+ AmSipDialog::reply_error(req, 200, "OK");
+ } else {
+ // return error code if near to overload
+ AmSipDialog::reply_error(req,
+ AmConfig::OptionsSessionLimitErrCode,
+ AmConfig::OptionsSessionLimitErrReason);
+ }
+ return;
+
+ }
+
ERROR("sorry, we don't support beginning a new session with "
"a '%s' message\n", req.method.c_str());
diff -ruw -x.svn sems-orig//core/AmApi.h sems-new//core/AmApi.h
--- sems-orig//core/AmApi.h 2011-01-31 16:26:08.000000000 +0100
+++ sems-new//core/AmApi.h 2011-02-18 13:59:04.000000000 +0100
@@ -182,7 +182,7 @@
/**
* Method to receive any out-of-dialog request
- * other than INVITE, REFER and OPTIONS
+ * other than INVITE and REFER
*
* Warning:
* This method should not make any expensive
diff -ruw -x.svn sems-orig//core/AmSipDispatcher.cpp sems-new//core/AmSipDispatcher.cpp
--- sems-orig//core/AmSipDispatcher.cpp 2011-01-31 16:26:08.000000000 +0100
+++ sems-new//core/AmSipDispatcher.cpp 2011-02-18 13:59:04.000000000 +0100
@@ -93,21 +93,7 @@
AmSessionContainer::instance()->startSessionUAS(req);
}
- else if(req.method == "OPTIONS"){
-
- // Basic OPTIONS support
- if (!AmConfig::OptionsSessionLimit ||
- (AmSession::getSessionNum() < AmConfig::OptionsSessionLimit)) {
- AmSipDialog::reply_error(req, 200, "OK");
- } else {
- // return error code if near to overload
- AmSipDialog::reply_error(req,
- AmConfig::OptionsSessionLimitErrCode,
- AmConfig::OptionsSessionLimitErrReason);
- }
- return;
-
- } else if( (req.method == "CANCEL") ||
+ else if( (req.method == "CANCEL") ||
(req.method == "BYE") ){
// CANCEL/BYE of a (here) non-existing dialog
diff -ruw -x.svn sems-orig//core/AmSipMsg.h sems-new//core/AmSipMsg.h
--- sems-orig//core/AmSipMsg.h 2011-01-31 16:26:08.000000000 +0100
+++ sems-new//core/AmSipMsg.h 2011-02-18 13:59:04.000000000 +0100
@@ -16,6 +16,7 @@
string contact;
string content_type;
+ string via1;
string hdrs;
string body;
unsigned int cseq;
diff -ruw -x.svn sems-orig//core/SipCtrlInterface.cpp sems-new//core/SipCtrlInterface.cpp
--- sems-orig//core/SipCtrlInterface.cpp 2011-01-31 16:26:08.000000000 +0100
+++ sems-new//core/SipCtrlInterface.cpp 2011-02-18 13:59:04.000000000 +0100
@@ -450,6 +450,8 @@
+ c2stlstr((*it)->value) + CRLF;
}
}
+
+ req.via1 = c2stlstr(msg->via1->value);
}
inline bool SipCtrlInterface::sip_msg2am_reply(sip_msg *msg, AmSipReply &reply)
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev