Bodyless INFO messages can be handled generically. Return code of generic

transactions can be picked from Yate message.


git-svn-id: http://voip.null.ro/svn/yate@1362 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2007-06-11 17:34:50 +00:00
parent eef115a648
commit 5fc5d97040

View file

@ -1359,6 +1359,8 @@ bool YateSIPEndPoint::incoming(SIPEvent* e, SIPTransaction* t)
t->setResponse(481); t->setResponse(481);
} }
else if (t->getMethod() == "INFO") { else if (t->getMethod() == "INFO") {
if (!t->initialMessage()->body)
return generic(e,t);
YateSIPConnection* conn = plugin.findCall(t->getCallID(),true); YateSIPConnection* conn = plugin.findCall(t->getCallID(),true);
if (conn) { if (conn) {
conn->doInfo(t); conn->doInfo(t);
@ -1546,7 +1548,10 @@ bool YateSIPEndPoint::generic(SIPEvent* e, SIPTransaction* t)
String meth(t->getMethod()); String meth(t->getMethod());
meth.toLower(); meth.toLower();
String user; String user;
if (s_cfg.getBoolValue("methods",meth,true)) { const String* auth = s_cfg.getKey("methods",meth);
if (!auth)
return false;
if (auth->toBoolean(true)) {
int age = t->authUser(user); int age = t->authUser(user);
DDebug(&plugin,DebugAll,"User '%s' age %d",user.c_str(),age); DDebug(&plugin,DebugAll,"User '%s' age %d",user.c_str(),age);
if ((age < 0) || (age > 10)) { if ((age < 0) || (age > 10)) {
@ -1577,8 +1582,20 @@ bool YateSIPEndPoint::generic(SIPEvent* e, SIPTransaction* t)
m.addParam("xsip_dlgtag",t->getDialogTag()); m.addParam("xsip_dlgtag",t->getDialogTag());
copySipHeaders(m,*message); copySipHeaders(m,*message);
int code = 0;
if (Engine::dispatch(m)) { if (Engine::dispatch(m)) {
t->setResponse(m.getIntValue("code",200)); const String* ret = m.getParam("code");
if (!ret)
ret = &m.retValue();
code = ret->toInteger(200);
}
else {
code = m.getIntValue("code",0);
if (code < 300)
code = 0;
}
if ((code >= 200) && (code < 700)) {
t->setResponse(code);
return true; return true;
} }
return false; return false;