enables signalling only transparent b2bua.

Use it like this:

void MyCCDialog::onInvite(const AmSipRequest& req) {
  if(dlg.reply(req,100,"Session Progress") != 0){
    throw AmSession::Exception(500,"could not reply");
  }
  number = "2"; // well, where you want to call

  invite_req = req;
  dlg.updateStatus(req);
  recvd_req.insert(make_pair(req.cseq,req));

  connectCallee(number + " <sip:" + number+ MyCCFactory::ConnectSuffix + ">",
        "sip:"+number+MyCCFactory::ConnectSuffix, true);
  sip_relay_only = true;
}




git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@490 8eb893ce-cfd4-0310-b710-fb5ebe64c474
sayer/1.4-spce2.6
Stefan Sayer 19 years ago
parent ba935bbe62
commit 6bca563ef2

@ -94,16 +94,21 @@ void AmB2BSession::onB2BEvent(B2BEvent* ev)
if(reply_ev->forward){
map<int,AmSipRequest>::iterator t_req = recvd_req.find(reply_ev->reply.cseq);
relaySip(t_req->second,reply_ev->reply);
if (t_req != recvd_req.end()) {
relaySip(t_req->second,reply_ev->reply);
if(reply_ev->reply.code >= 200){
if( (t_req->second.method == "INVITE") &&
(reply_ev->reply.code == 487)){
terminateLeg();
}
recvd_req.erase(t_req);
if(reply_ev->reply.code >= 200){
if( (t_req->second.method == "INVITE") &&
(reply_ev->reply.code == 487)){
terminateLeg();
}
recvd_req.erase(t_req);
}
} else {
ERROR("Request with CSeq %u not found in recvd_req.\n",
reply_ev->reply.cseq);
}
}
}
@ -140,7 +145,6 @@ void AmB2BSession::onSipReply(const AmSipReply& reply)
DBG("onSipReply: %i %s (fwd=%i)\n",reply.code,reply.reason.c_str(),fwd);
if(fwd) {
AmSipReply n_reply = reply;
n_reply.cseq = t->second.cseq;
@ -249,9 +253,11 @@ void AmB2BCallerSession::onB2BEvent(B2BEvent* ev)
else if(reply.code < 300){
callee_status = Connected;
sip_relay_only = true;
reinviteCaller(reply);
if (!sip_relay_only) {
sip_relay_only = true;
reinviteCaller(reply);
}
}
else {
//DBG("received %i from other leg: other_id=%s; reply.local_tag=%s\n",
@ -295,7 +301,8 @@ void AmB2BCallerSession::onSessionStart(const AmSipRequest& req)
}
void AmB2BCallerSession::connectCallee(const string& remote_party,
const string& remote_uri)
const string& remote_uri,
bool relayed_invite)
{
if(callee_status != None)
terminateOtherLeg();
@ -305,6 +312,8 @@ void AmB2BCallerSession::connectCallee(const string& remote_party,
ev->content_type = "application/sdp"; // FIXME
ev->body = invite_req.body;
ev->hdrs = invite_req.hdrs;
ev->relayed_invite = relayed_invite;
ev->r_cseq = invite_req.cseq;
relayEvent(ev);
callee_status = NoReply;
@ -350,6 +359,10 @@ void AmB2BCalleeSession::onB2BEvent(B2BEvent* ev)
dlg.remote_party = co_ev->remote_party;
dlg.remote_uri = co_ev->remote_uri;
if (co_ev->relayed_invite) {
relayed_req[dlg.cseq] = AmSipTransaction("INVITE", co_ev->r_cseq);
}
dlg.sendRequest("INVITE",co_ev->content_type,co_ev->body,co_ev->hdrs);
return;

@ -87,6 +87,9 @@ struct B2BConnectEvent: public B2BEvent
string content_type;
string body;
string hdrs;
bool relayed_invite;
unsigned int r_cseq;
B2BConnectEvent(const string& remote_party,
const string& remote_uri)
@ -179,12 +182,15 @@ class AmB2BCallerSession: public AmB2BSession
// Callee Status
CalleeStatus callee_status;
void relayEvent(AmEvent* ev);
virtual void createCalleeSession();
int reinviteCaller(const AmSipReply& callee_reply);
protected:
AmSipRequest invite_req;
virtual void createCalleeSession();
void relayEvent(AmEvent* ev);
public:
AmB2BCallerSession();
@ -193,7 +199,8 @@ class AmB2BCallerSession: public AmB2BSession
virtual AmB2BCalleeSession* newCalleeSession();
void connectCallee(const string& remote_party,
const string& remote_uri);
const string& remote_uri,
bool relayed_invite = false);
const AmSipRequest& getOriginalRequest() { return invite_req; }

Loading…
Cancel
Save