enables IVR in b2bua to set the From in the callee leg

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

@ -28,6 +28,8 @@
#include "IvrUAC.h"
#include "Ivr.h"
#include "AmSessionContainer.h"
#include "AmConfigReader.h"
#include "AmConfig.h"
#include "log.h"
@ -760,3 +762,43 @@ void IvrDialog::process(AmEvent* event)
return;
}
void IvrDialog::connectCallee(const string& remote_party, const string& remote_uri,
const string& from_party, const string& from_uri) {
b2b_callee_from_party = from_party;
b2b_callee_from_uri = from_uri;
AmB2BCallerSession::connectCallee(remote_party, remote_uri);
}
void IvrDialog::createCalleeSession()
{
AmB2BCalleeSession* callee_session = new AmB2BCalleeSession(this);
AmSipDialog& callee_dlg = callee_session->dlg;
other_id = AmSession::getNewId();
callee_dlg.local_tag = other_id;
callee_dlg.callid = AmSession::getNewId() + "@" + AmConfig::LocalIP;
// this will be overwritten by ConnectLeg event
callee_dlg.remote_party = dlg.local_party;
callee_dlg.remote_uri = dlg.local_uri;
if (b2b_callee_from_party.empty() && b2b_callee_from_uri.empty()) {
// default: use the original To as From in the callee leg
callee_dlg.local_party = dlg.remote_party;
callee_dlg.local_uri = dlg.remote_uri;
} else {
// if given as parameters, use these
callee_dlg.local_party = b2b_callee_from_party;
callee_dlg.local_uri = b2b_callee_from_uri;
}
DBG("Created B2BUA callee leg, From: %s\n",
callee_dlg.local_party.c_str());
callee_session->start();
AmSessionContainer* sess_cont = AmSessionContainer::instance();
sess_cont->addSession(other_id,callee_session);
}

@ -122,6 +122,10 @@ class IvrDialog : public AmB2BCallerSession
void process(AmEvent* event);
string b2b_callee_from_party;
string b2b_callee_from_uri;
void createCalleeSession();
public:
AmDynInvoke* user_timer;
AmPlaylist playlist;
@ -146,6 +150,10 @@ public:
void onSipRequest(const AmSipRequest& r);
void onRtpTimeout();
void connectCallee(const string& remote_party, const string& remote_uri,
const string& from_party, const string& from_uri);
};
#endif

@ -312,7 +312,7 @@ static PyObject* IvrDialogBase_b2b_connectCallee(IvrDialogBase* self, PyObject*
{
assert(self->p_dlg);
string remote_party, remote_uri;
string remote_party, remote_uri, local_party, local_uri;
PyObject* py_o;
@ -322,16 +322,20 @@ static PyObject* IvrDialogBase_b2b_connectCallee(IvrDialogBase* self, PyObject*
remote_uri = self->p_dlg->getOriginalRequest().r_uri;
} else {
DBG("args != Py_None\n");
char* rp = 0; char* ru = 0;
if(!PyArg_ParseTuple(args,"ss",&rp, &ru))
char* rp = 0; char* ru = 0; char* lp = 0; char* lu = 0;
if(!PyArg_ParseTuple(args,"ss|ss",&rp, &ru, &lp, &lu))
return NULL;
else {
remote_party = string(rp);
remote_uri = string(ru);
if (lp && lu) {
local_party = string(lp);
local_uri = string(lu);
}
}
}
self->p_dlg->connectCallee(remote_party, remote_uri);
self->p_dlg->connectCallee(remote_party, remote_uri, local_party, local_uri);
Py_INCREF(Py_None);
return Py_None;

@ -159,9 +159,26 @@ class IvrDialogBase:
B2BMode = False
# call given party as (new) callee
# if remote_party and remote_uri are empty (None),
# we will connect to the callee of the initial caller request
def connectCallee(self,remote_party,remote_uri):
# local_party and local_uri are optional:
# if not present, the From of caller leg will be used
# for the From of the callee leg.
# Another options is connectCallee(None), then the callee
# of the initial caller request is connected
#
# remote_party and local_party will be used as To/From headers.
# remote_uri and local_uri is only provided for the application.
#
# Examples:
# self.connectCallee(None)
# # connect To of caller leg with From of caller leg
#
# self.connectCallee('<sip:conference@serverip>', 'sip:conference@serverip')
# # connect conference@serverip with From of caller leg
#
# self.connectCallee('<sip:otheruser@domain>', 'sip:otheruser@domain',\
# 'FunkyApp <sip:funkyapp@domain>', 'sip:funkyapp@domain')
# # connect otheruser@domain from funkyapp.
def connectCallee(self,remote_party,remote_uri,local_party,local_uri):
pass
# terminate the callee's call

Loading…
Cancel
Save