diff --git a/Makefile.defs b/Makefile.defs index b58a04c2..d4569065 100644 --- a/Makefile.defs +++ b/Makefile.defs @@ -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 diff --git a/apps/dsm/mods/mod_dlg/ModDlg.cpp b/apps/dsm/mods/mod_dlg/ModDlg.cpp index aaa9061c..d2f8769e 100644 --- a/apps/dsm/mods/mod_dlg/ModDlg.cpp +++ b/apps/dsm/mods/mod_dlg/ModDlg.cpp @@ -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; diff --git a/apps/gateway/GWSession.cpp b/apps/gateway/GWSession.cpp index e9468395..3524d0a4 100644 --- a/apps/gateway/GWSession.cpp +++ b/apps/gateway/GWSession.cpp @@ -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"); diff --git a/apps/ivr/IvrSipDialog.cpp b/apps/ivr/IvrSipDialog.cpp index 23913231..0144e4f7 100644 --- a/apps/ivr/IvrSipDialog.cpp +++ b/apps/ivr/IvrSipDialog.cpp @@ -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}, diff --git a/apps/ivr/IvrSipRequest.cpp b/apps/ivr/IvrSipRequest.cpp index b9c0e2db..b22af973 100644 --- a/apps/ivr/IvrSipRequest.cpp +++ b/apps/ivr/IvrSipRequest.cpp @@ -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}, diff --git a/apps/registrar_client/SIPRegistrarClient.cpp b/apps/registrar_client/SIPRegistrarClient.cpp index 7afabb37..1a298859 100644 --- a/apps/registrar_client/SIPRegistrarClient.cpp +++ b/apps/registrar_client/SIPRegistrarClient.cpp @@ -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+" "; 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; } diff --git a/core/AmSession.cpp b/core/AmSession.cpp index 41563f49..84a08f8d 100644 --- a/core/AmSession.cpp +++ b/core/AmSession.cpp @@ -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); } } diff --git a/core/AmSipDialog.cpp b/core/AmSipDialog.cpp index 2de8dc06..782d6e51 100644 --- a/core/AmSipDialog.cpp +++ b/core/AmSipDialog.cpp @@ -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()){ diff --git a/core/AmSipDialog.h b/core/AmSipDialog.h index bc80b797..64d20568 100644 --- a/core/AmSipDialog.h +++ b/core/AmSipDialog.h @@ -110,6 +110,8 @@ class AmSipDialog TransMap uas_trans; TransMap uac_trans; + + unsigned int pending_invites; AmSipDialogEventHandler* hdl;