- some more small fixes.

- added cseq checking.
- added pending INVITE checking.


git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@1841 8eb893ce-cfd4-0310-b710-fb5ebe64c474
sayer/1.4-spce2.6
Raphael Coeffic 16 years ago
parent 50c8c03298
commit 1695507989

@ -177,9 +177,6 @@ ifeq ($(OS), macosx)
CPPFLAGS += -I /opt/local/include
LDFLAGS += -L/opt/local/lib
endif
exclude_core_modules += binrpcctrl
exclude_app_modules += ivr
else
ifeq ($(OS), solaris)
LDFLAGS+= -fPIC -ldl -lsocket -lnsl -lpthread

@ -130,7 +130,7 @@ EXEC_ACTION_START(DLGAcceptInviteAction) {
ERROR("%i %s\n",e.code,e.reason.c_str());
sess->setStopped();
AmSipDialog::reply_error(*sc_sess->last_req.get(),e.code,e.reason);
sess->dlg.reply(*sc_sess->last_req.get(),e.code,e.reason);
}
} EXEC_ACTION_END;

@ -41,7 +41,7 @@ void GWSession::onSessionStart(const AmSipRequest& req) {
}catch(const AmSession::Exception& e){
ERROR("%i %s\n",e.code,e.reason.c_str());
setStopped();
AmSipDialog::reply_error(req,e.code,e.reason);
dlg.reply(req,e.code,e.reason);
return;
}
DBG("GWSession::onSessionStart Setting Audio\n");

@ -54,8 +54,6 @@ static PyObject* IvrSipDialog_new(PyTypeObject *type, PyObject *args, PyObject *
def_IvrSipDialog_GETTER(IvrSipDialog_getuser, user)
def_IvrSipDialog_GETTER(IvrSipDialog_getdomain, domain)
def_IvrSipDialog_GETTER(IvrSipDialog_getsip_ip, sip_ip)
def_IvrSipDialog_GETTER(IvrSipDialog_getsip_port, sip_port)
def_IvrSipDialog_GETTER(IvrSipDialog_getlocal_uri, local_uri)
def_IvrSipDialog_GETTER(IvrSipDialog_getremote_uri, remote_uri)
def_IvrSipDialog_GETTER(IvrSipDialog_getcontact_uri, contact_uri)
@ -96,8 +94,6 @@ IvrSipDialog_getcseq(IvrSipDialog *self, void *closure)
static PyGetSetDef IvrSipDialog_getset[] = {
{"user", (getter)IvrSipDialog_getuser, NULL, "local user", NULL},
{"domain", (getter)IvrSipDialog_getdomain, NULL, "local domain", NULL},
{"sip_ip", (getter)IvrSipDialog_getsip_ip, NULL, "destination IP of first received message", NULL},
{"sip_port", (getter)IvrSipDialog_getsip_port, NULL, "optional: SIP port", NULL},
{"local_uri", (getter)IvrSipDialog_getlocal_uri, NULL, "local uri", NULL},
{"remote_uri", (getter)IvrSipDialog_getremote_uri, (setter)IvrSipDialog_setremote_uri, "remote uri", NULL},
{"contact_uri", (getter)IvrSipDialog_getcontact_uri, NULL, "pre-calculated contact uri", NULL},

@ -114,8 +114,6 @@ IvrSipRequest_dealloc(IvrSipRequest* self)
def_IvrSipRequest_GETTER(IvrSipRequest_getmethod, method)
def_IvrSipRequest_GETTER(IvrSipRequest_getuser, user)
def_IvrSipRequest_GETTER(IvrSipRequest_getdomain, domain)
def_IvrSipRequest_GETTER(IvrSipRequest_getdstip, dstip)
def_IvrSipRequest_GETTER(IvrSipRequest_getport, port)
def_IvrSipRequest_GETTER(IvrSipRequest_getr_uri, r_uri)
def_IvrSipRequest_GETTER(IvrSipRequest_getfrom_uri, from_uri)
def_IvrSipRequest_GETTER(IvrSipRequest_getfrom, from)
@ -160,8 +158,6 @@ static PyGetSetDef IvrSipRequest_getset[] = {
{"method", (getter)IvrSipRequest_getmethod, NULL, "method", NULL},
{"user", (getter)IvrSipRequest_getuser, NULL, "local user", NULL},
{"domain", (getter)IvrSipRequest_getdomain, NULL, "local domain", NULL},
{"dstip", (getter)IvrSipRequest_getdstip, NULL, "dstip", NULL},
{"port", (getter)IvrSipRequest_getport, NULL, "port", NULL},
{"r_uri", (getter)IvrSipRequest_getr_uri, NULL, "port", NULL},
{"from_uri", (getter)IvrSipRequest_getfrom_uri, NULL, "port", NULL},

@ -67,7 +67,6 @@ SIPRegistration::SIPRegistration(const string& handle,
req.cmd = "sems";
req.user = info.user;
req.method = "REGISTER";
req.dstip = AmConfig::LocalIP;
req.r_uri = "sip:"+info.domain;
req.from = info.name+" <sip:"+info.user+"@"+info.domain+">";
req.from_uri = "sip:"+info.user+"@"+info.domain;
@ -79,10 +78,6 @@ SIPRegistration::SIPRegistration(const string& handle,
// clear dlg.callid? ->reregister?
dlg.updateStatusFromLocalRequest(req);
dlg.sip_ip = AmConfig::LocalSIPIP;
if (AmConfig::LocalSIPPort)
dlg.sip_port = int2str(AmConfig::LocalSIPPort);
dlg.cseq = 50;
}

@ -852,7 +852,7 @@ void AmSession::onInvite(const AmSipRequest& req)
ERROR("%i %s\n",e.code,e.reason.c_str());
setStopped();
AmSipDialog::reply_error(req,e.code,e.reason);
dlg.reply(req,e.code,e.reason);
}
}

@ -41,9 +41,9 @@ const char* AmSipDialog::status2str[4] = {
AmSipDialog::AmSipDialog(AmSipDialogEventHandler* h)
: status(Disconnected),cseq(10),hdl(h),
outbound_proxy(AmConfig::OutboundProxy),
force_outbound_proxy(AmConfig::ForceOutboundProxy)
: status(Disconnected),cseq(10),hdl(h),pending_invites(0),
outbound_proxy(AmConfig::OutboundProxy),
force_outbound_proxy(AmConfig::ForceOutboundProxy)
{
}
@ -75,11 +75,21 @@ void AmSipDialog::updateStatus(const AmSipRequest& req)
return;
}
// Sanity checks
if (req.cseq <= r_cseq){
reply_error(req,500,"Server Internal Error");
return;
}
if ((req.method == "INVITE") && pending_invites) {
reply_error(req,500,"Server Internal Error",
"Retry-After: " + int2str(get_random() % 10) + CRLF);
}
else {
pending_invites++;
}
r_cseq = req.cseq;
if(uas_trans.find(req.cseq) == uas_trans.end()){
@ -190,12 +200,15 @@ int AmSipDialog::updateStatusReply(const AmSipRequest& req, unsigned int code)
req.method.c_str(),t.method.c_str());
uas_trans.erase(t_it);
if(t.method == "INVITE")
pending_invites--;
}
return 0;
}
void AmSipDialog::updateStatus(const AmSipReply& reply/*, bool do_200_ack*/)
void AmSipDialog::updateStatus(const AmSipReply& reply)
{
TransMap::iterator t_it = uac_trans.find(reply.cseq);
if(t_it == uac_trans.end()){

@ -110,6 +110,8 @@ class AmSipDialog
TransMap uas_trans;
TransMap uac_trans;
unsigned int pending_invites;
AmSipDialogEventHandler* hdl;

Loading…
Cancel
Save