transparent 100rel mode for SBC app

- add reliable_1xx REL100_IGNORED, where all rel100 stuff is ignored
 - set B2B sessions as reliable_1xx=REL100_IGNORED
 - translate RAck Cseq
 -   for this: adds rack_method and rack_cseq to sip request (should possibly be reworked to use some dynamic field)
 - relay Rseq (if exist)
sayer/1.4-spce2.6
Stefan Sayer 16 years ago
parent ec5fb74b45
commit 88789eb124

@ -25,8 +25,6 @@
/*
SBC - feature-wishlist
- SDP filter (reconstructed SDP)
- accounting (MySQL DB, cassandra DB)
- RTP forwarding mode (bridging)
- RTP transcoding mode (bridging)
@ -166,6 +164,7 @@ SBCDialog::SBCDialog(const SBCCallProfile& call_profile) // AmDynInvoke* user_ti
call_profile(call_profile)
{
set_sip_relay_only(false);
dlg.reliable_1xx = REL100_IGNORED;
}
@ -680,7 +679,9 @@ SBCCalleeSession::SBCCalleeSession(const AmB2BCallerSession* caller,
const SBCCallProfile& call_profile)
: auth(NULL),
call_profile(call_profile),
AmB2BCalleeSession(caller) {
AmB2BCalleeSession(caller)
{
dlg.reliable_1xx = REL100_IGNORED;
}
SBCCalleeSession::~SBCCalleeSession() {

@ -29,6 +29,7 @@
#include "AmConfig.h"
#include "ampi/MonitoringAPI.h"
#include "AmSipHeaders.h"
#include "AmUtils.h"
#include <assert.h>
@ -381,7 +382,29 @@ void AmB2BSession::relaySip(const AmSipRequest& req)
{
if (req.method != "ACK") {
relayed_req[dlg.cseq] = AmSipTransaction(req.method,req.cseq,req.tt);
dlg.sendRequest(req.method,req.content_type, req.body, req.hdrs, SIP_FLAGS_VERBATIM);
const string* hdrs = &req.hdrs;
string m_hdrs;
// translate RAck for PRACK
if (req.method == SIP_METH_PRACK && req.rseq) {
TransMap::iterator t;
for (t=relayed_req.begin(); t != relayed_req.end(); t++) {
if (t->second.cseq == req.rack_cseq) {
m_hdrs = req.hdrs +
SIP_HDR_COLSP(SIP_HDR_RACK) + int2str(req.rseq) +
" " + int2str(t->first) + " " + req.rack_method + CRLF;
hdrs = &m_hdrs;
break;
}
}
if (t==relayed_req.end()) {
WARN("Transaction with CSeq %d not found for translating RAck cseq\n",
req.rack_cseq);
}
}
dlg.sendRequest(req.method, req.content_type, req.body, *hdrs, SIP_FLAGS_VERBATIM);
// todo: relay error event back if sending fails
if ((req.method == SIP_METH_INVITE ||
@ -419,9 +442,18 @@ void AmB2BSession::relaySip(const AmSipRequest& req)
void AmB2BSession::relaySip(const AmSipRequest& orig, const AmSipReply& reply)
{
const string* hdrs = &reply.hdrs;
string m_hdrs;
if (reply.rseq != 0) {
m_hdrs = reply.hdrs +
SIP_HDR_COLSP(SIP_HDR_RSEQ) + int2str(reply.rseq) + CRLF;
hdrs = &m_hdrs;
}
dlg.reply(orig,reply.code,reply.reason,
reply.content_type,
reply.body,reply.hdrs,SIP_FLAGS_VERBATIM);
reply.body, *hdrs,SIP_FLAGS_VERBATIM);
if ((orig.method == SIP_METH_INVITE ||
orig.method == SIP_METH_UPDATE) &&

@ -140,6 +140,9 @@ void AmSipDialog::updateStatus(const AmSipRequest& req)
int AmSipDialog::rel100OnRequestIn(const AmSipRequest& req)
{
if (reliable_1xx == REL100_IGNORED)
return 1;
/* activate the 100rel, if needed */
if (req.method == SIP_METH_INVITE) {
switch(reliable_1xx) {
@ -373,6 +376,9 @@ void AmSipDialog::updateStatus(const AmSipReply& reply)
int AmSipDialog::rel100OnReplyIn(const AmSipReply &reply)
{
if (reliable_1xx == REL100_IGNORED)
return 1;
if (status!=Pending && status!=Connected)
return 1;
@ -450,6 +456,9 @@ void AmSipDialog::uasTimeout(AmSipTimeoutEvent* to_ev)
void AmSipDialog::rel100OnTimeout(const AmSipRequest &req,
const AmSipReply &rpl)
{
if (reliable_1xx == REL100_IGNORED)
return;
INFO("reply <%s> timed out (not PRACKed).\n", rpl.print().c_str());
if (100 < rpl.code && rpl.code < 200 && reliable_1xx == REL100_REQUIRE &&
rseq == rpl.rseq && rpl.method == SIP_METH_INVITE) {
@ -551,6 +560,9 @@ int AmSipDialog::reply(const AmSipRequest& req,
void AmSipDialog::rel100OnReplyOut(const AmSipRequest &req, unsigned int code,
string &hdrs)
{
if (reliable_1xx == REL100_IGNORED)
return;
if (req.method == SIP_METH_INVITE) {
if (100 < code && code < 200) {
switch (reliable_1xx) {

@ -186,6 +186,8 @@ class AmSipDialog
REL100_REQUIRE,
//REL100_PREFERED, //TODO
#define REL100_REQUIRE AmSipDialog::REL100_REQUIRE
REL100_IGNORED,
#define REL100_IGNORED AmSipDialog::REL100_IGNORED
REL100_MAX
#define REL100_MAX AmSipDialog::REL100_MAX
};

@ -70,6 +70,9 @@ class AmSipRequest : public _AmSipMsgInDlg
string from_tag;
string to_tag;
string rack_method;
unsigned int rack_cseq;
AmSipRequest() : _AmSipMsgInDlg() { }
~AmSipRequest() { }

@ -436,8 +436,11 @@ inline void SipCtrlInterface::sip_msg2am_request(const sip_msg *msg,
req.cseq = get_cseq(msg)->num;
req.body = c2stlstr(msg->body);
if (msg->rack)
if (msg->rack) {
req.rseq = get_rack(msg)->rseq;
req.rack_method = c2stlstr(get_rack(msg)->method_str);
req.rack_cseq = get_rack(msg)->cseq;
}
if (msg->content_type)
req.content_type = c2stlstr(msg->content_type->value);

@ -193,6 +193,12 @@ Warning: Changing response codes, especially between different response
code classes, can seriously mess up everything. Use with caution
and only if you know what you are doing!
Reliable 1xx (PRACK)
--------------------
Reliable 1xx (PRACK) extension (3262) is supported in a transparent mode,
i.e. the RSeq header is relayed and RAck CSeq is translated properly.
Session Timer configuration
---------------------------
If SIP Session Timers are enabled for a profile, the session timers values
@ -283,3 +289,4 @@ x maximum call duration timer
- fallback profile
- add headers
- bridging between interfaces
- rel1xx in non-transparent mode

Loading…
Cancel
Save