r2950 - in trunk: libminisip/include/libminisip/sip
libminisip/source libminisip/source/ipprovider
libminisip/source/sip libmutil/include/libmutil
minisip/minisip/gui/gtkgui minisip/minisip/gui/textui
erik at minisip.org
erik at minisip.org
Thu Nov 23 18:41:31 CET 2006
Author: erik
Date: 2006-11-23 18:41:31 +0100 (Thu, 23 Nov 2006)
New Revision: 2950
Modified:
trunk/libminisip/include/libminisip/sip/DefaultDialogHandler.h
trunk/libminisip/include/libminisip/sip/Sip.h
trunk/libminisip/include/libminisip/sip/SipSoftPhoneConfiguration.h
trunk/libminisip/source/Minisip.cxx
trunk/libminisip/source/ipprovider/SimpleIp6Provider.cxx
trunk/libminisip/source/ipprovider/SimpleIpProvider.cxx
trunk/libminisip/source/sip/DefaultDialogHandler.cxx
trunk/libminisip/source/sip/Sip.cxx
trunk/libminisip/source/sip/SipDialogVoip.cxx
trunk/libminisip/source/sip/SipSoftPhoneConfiguration.cxx
trunk/libmutil/include/libmutil/CommandString.h
trunk/minisip/minisip/gui/gtkgui/SettingsDialog.cxx
trunk/minisip/minisip/gui/textui/MinisipTextUI.cxx
Log:
Last commit should have contained the following code (and not only
libmsips).
* The "Sip" contained logic for how to make calls. This moves
that code to the DefaultDialogHandler where it belongs. Now
the applications SIP-behavour is implemented in the default
handler, and in the state machines that handler registers to
the SIP stack. This feels much better.
I made the default handler inherit from both "SipSMCommandReceiver" and
"CommandReceiver". This is so that we can move the code in
"Sip::handleCommandResp" to the default handler and in the long run
phase out the "Sip" class.
- Made CommandReceiver and SipSMCommandReceiver inherit virtually
from MOBject so that we have a single MObject in the
SipDefaultHandler classes.
MObject
^ ^
/ \
CommandReceiver SipSMCommandReceiver
^ ^
\ /
SipDefaultHandler
* Both the online configuration and the "Sip-SIM" projects
are a bit held back by the way we handle configuration data.
This is a step towards handling configuration data in a better
way. I think that making a configuration subsystem could be
a good idea. (you could tell the config system to load/mount a
specific config file/sim card/online account, and query it for
settings)
This commit contains small changes that will make this way of
managing the information easier.
Modified: trunk/libminisip/include/libminisip/sip/DefaultDialogHandler.h
===================================================================
--- trunk/libminisip/include/libminisip/sip/DefaultDialogHandler.h 2006-11-23 17:21:51 UTC (rev 2949)
+++ trunk/libminisip/include/libminisip/sip/DefaultDialogHandler.h 2006-11-23 17:41:31 UTC (rev 2950)
@@ -46,7 +46,7 @@
* If even the DefaultDialogHandler cannot handle the command, it will be
* discarded.
*/
-class LIBMINISIP_API DefaultDialogHandler : public /*SipDialog*/ SipSMCommandReceiver{
+class LIBMINISIP_API DefaultDialogHandler : public SipDefaultHandler {
public:
/**
@@ -66,6 +66,12 @@
virtual std::string getName();
virtual bool handleCommand(const SipSMCommand &command);
+
+ void handleCommand(std::string subsystem, const CommandString &cmd);
+
+ CommandString handleCommandResp(std::string subsystem, const CommandString &cmd);
+
+
private:
minilist<ConfMember> connectList;
Modified: trunk/libminisip/include/libminisip/sip/Sip.h
===================================================================
--- trunk/libminisip/include/libminisip/sip/Sip.h 2006-11-23 17:21:51 UTC (rev 2949)
+++ trunk/libminisip/include/libminisip/sip/Sip.h 2006-11-23 17:41:31 UTC (rev 2950)
@@ -41,7 +41,7 @@
class SipSoftPhoneConfiguration;
class MediaHandler;
-class LIBMINISIP_API Sip: public Runnable, public CommandReceiver{
+class LIBMINISIP_API Sip: public Runnable{
public:
Sip(MRef<SipSoftPhoneConfiguration*> phoneconfig,
@@ -85,10 +85,6 @@
void setMediaHandler( MRef<MediaHandler *> mediaHandler );
- void handleCommand(std::string subsystem, const CommandString &cmd);
-
- CommandString handleCommandResp(std::string subsystem, const CommandString &cmd);
-
private:
MRef<SipStack *> sipstack;
MRef<SipSoftPhoneConfiguration*> phoneconfig;
Modified: trunk/libminisip/include/libminisip/sip/SipSoftPhoneConfiguration.h
===================================================================
--- trunk/libminisip/include/libminisip/sip/SipSoftPhoneConfiguration.h 2006-11-23 17:21:51 UTC (rev 2949)
+++ trunk/libminisip/include/libminisip/sip/SipSoftPhoneConfiguration.h 2006-11-23 17:41:31 UTC (rev 2950)
@@ -82,15 +82,10 @@
*/
void saveDefault( MRef<ConfBackend *> backend );
- MRef<SipStackConfig *> inherited; //inherited.sipIdentity is the default sip identity.
+ MRef<SipStackConfig *> sipStackConfig; //inherited.sipIdentity is the default sip identity.
+ MRef<SipStack*> sipStack;
- //SipDialogSecurityConfig securityConfig;
-
-
- //Configuration only the phone has and not every call
- MRef<Sip *> sip;
-// SipIdentity pstnIdentity;
MRef<SipIdentity *> pstnIdentity;
MRef<SipIdentity *> defaultIdentity;
Modified: trunk/libminisip/source/Minisip.cxx
===================================================================
--- trunk/libminisip/source/Minisip.cxx 2006-11-23 17:21:51 UTC (rev 2949)
+++ trunk/libminisip/source/Minisip.cxx 2006-11-23 17:41:31 UTC (rev 2950)
@@ -192,7 +192,7 @@
cerr << "Creating SipSoftPhoneConfiguration"<< endl;
#endif
phoneConf = new SipSoftPhoneConfiguration();
- phoneConf->sip=NULL;
+ //phoneConf->sip=NULL;
#ifdef MINISIP_AUTOCALL
if (argc==3){
@@ -201,9 +201,8 @@
#endif
#ifdef DEBUG_OUTPUT
- mout << BOLD << "init 1/9: Creating timeout provider" << PLAIN << end;
+ mout << BOLD << "init 1/9: Creating contact database" << PLAIN << end;
#endif
-// timeoutprovider = new TimeoutProvider<string,MRef<StateMachine<SipSMCommand,string>*> >;
/* Create the global contacts database */
ContactDb *contactDb = new ContactDb();
@@ -262,7 +261,7 @@
messageRouter=NULL;
- phoneConf->sip = NULL;
+ //phoneConf->sip = NULL;
phoneConf = NULL;
mediaHandler = NULL;
confMessageRouter->setGui(NULL);
@@ -275,11 +274,11 @@
int Minisip::startSip() {
int ret = 1;
-
+
#ifdef DEBUG_OUTPUT
cerr << "Thread 2 running - doing initParseConfig"<< endl;
#endif
-
+
if( initParseConfig() < 0 ){
merr << "Minisip::startSip::initParseConfig - fatal error" << end;
return -1;
@@ -288,7 +287,6 @@
try{
messageRouter = new MessageRouter();
confMessageRouter = new ConfMessageRouter();
-// phoneConf->timeoutProvider = timeoutprovider;
#ifdef DEBUG_OUTPUT
mout << BOLD << "init 4/9: Creating IP provider" << PLAIN << end;
@@ -296,22 +294,22 @@
MRef<IpProvider *> ipProvider = IpProvider::create( phoneConf );
MRef<IpProvider *> ip6Provider;
ip6Provider = IpProvider::create( phoneConf, true );
-//#ifdef DEBUG_OUTPUT
-// mout << BOLD << "init 5/9: Creating SIP transport layer" << PLAIN << end;
-//#endif
+ //#ifdef DEBUG_OUTPUT
+ // mout << BOLD << "init 5/9: Creating SIP transport layer" << PLAIN << end;
+ //#endif
string localIpString;
string externalContactIP;
// FIXME: This should be done more often
localIpString = externalContactIP = ipProvider->getExternalIp();
-
- MRef<UDPSocket*> udpSocket = new UDPSocket( phoneConf->inherited->localUdpPort );
-
- phoneConf->inherited->localUdpPort = ipProvider->getExternalPort( udpSocket );
- phoneConf->inherited->localIpString = externalContactIP;
- phoneConf->inherited->externalContactIP = externalContactIP;
+
+ MRef<UDPSocket*> udpSocket = new UDPSocket( phoneConf->sipStackConfig->localUdpPort );
+
+ phoneConf->sipStackConfig->localUdpPort = ipProvider->getExternalPort( udpSocket );
+ phoneConf->sipStackConfig->localIpString = externalContactIP;
+ phoneConf->sipStackConfig->externalContactIP = externalContactIP;
if( ip6Provider )
- phoneConf->inherited->localIp6String = ip6Provider->getExternalIp();
+ phoneConf->sipStackConfig->localIp6String = ip6Provider->getExternalIp();
udpSocket=NULL;
#ifdef DEBUG_OUTPUT
@@ -320,7 +318,7 @@
mediaHandler = new MediaHandler( phoneConf, ipProvider );
confMessageRouter->setMediaHandler( mediaHandler );
messageRouter->addSubsystem("media",*mediaHandler);
- mediaHandler->setMessageRouterCallback(*messageRouter);
+ mediaHandler->setMessageRouterCallback(*messageRouter);
if( consoleDbg ){
consoleDbg->setMediaHandler( mediaHandler );
@@ -328,8 +326,8 @@
Session::registry = *mediaHandler;
/* Hack: precompute a KeyAgreementDH */
- // Session::precomputedKa = new KeyAgreementDH( phoneConf->securityConfig.cert,
- // phoneConf->securityConfig.cert_db, DH_GROUP_OAKLEY5 );
+ // Session::precomputedKa = new KeyAgreementDH( phoneConf->securityConfig.cert,
+ // phoneConf->securityConfig.cert_db, DH_GROUP_OAKLEY5 );
#ifdef DEBUG_OUTPUT
mout << BOLD << "init 6/9: Creating MSip SIP stack" << PLAIN << end;
@@ -337,32 +335,33 @@
MRef<SipSim*> sim = phoneConf->defaultIdentity->getSim();
if (sim){
- phoneConf->inherited->cert = sim->getCertificateChain();
- phoneConf->inherited->cert_db = sim->getCAs();
+ phoneConf->sipStackConfig->cert = sim->getCertificateChain();
+ phoneConf->sipStackConfig->cert_db = sim->getCAs();
}
//save Sip object in Minisip::sip ...
this->sip=new Sip(phoneConf,mediaHandler);
//sip->init();
- phoneConf->sip = sip;
+// phoneConf->sip = sip;
+ phoneConf->sipStack = sip->getSipStack();
sip->getSipStack()->setCallback(*messageRouter);
//sip->getSipStack()->setConfCallback(*confMessageRouter);
//TODO: Send the callback to the conference dialog
//instead.
- //messageRouter->setSip(sip);
- messageRouter->addSubsystem("sip",*sip);
+ //messageRouter->addSubsystem("sip",*sip);
+ messageRouter->addSubsystem("sip",*sip->getSipStack());
confMessageRouter->setSip(sip);
#ifdef ZRTP_SUPPORT
- ZrtpHostBridgeMinisip::initialize(sip->getSipStack()->getTimeoutProvider());
+ ZrtpHostBridgeMinisip::initialize(sip->getSipStack()->getTimeoutProvider());
#endif
/* Load the plugins at this stage */
-// int32_t pluginCount = MPlugin::loadFromDirectory( PLUGINS_PATH );
+ // int32_t pluginCount = MPlugin::loadFromDirectory( PLUGINS_PATH );
-// cerr << "Loaded " << pluginCount << " plugins from " << PLUGINS_PATH << endl;
+ // cerr << "Loaded " << pluginCount << " plugins from " << PLUGINS_PATH << endl;
#ifdef DEBUG_OUTPUT
mout << BOLD << "init 7/9: Connecting GUI to SIP logic" << PLAIN << end;
@@ -372,34 +371,34 @@
messageRouter->addSubsystem("gui",*gui);
confMessageRouter->setGui(gui);
-
-/*
- mdbg << "Starting presence server"<< end;
- CommandString subscribeserver("", SipCommandString::start_presence_server);
- SipSMCommand sipcmdss(subscribeserver, SipSMCommand::remote, SipSMCommand::TU);
- sip->handleCommand(sipcmdss);
-*/
-/*
- cerr << "Minisip: starting presence client for johan at bilien.org"<< endl;
-
- CommandString subscribe("", SipCommandString::start_presence_client,"johan at bilien.org");
- SipSMCommand sipcmd2(subscribe, SipSMCommand::remote, SipSMCommand::TU);
- sip->getSipStack()->handleCommand(sipcmd2);
-*/
-
+ /*
+ mdbg << "Starting presence server"<< end;
+ CommandString subscribeserver("", SipCommandString::start_presence_server);
+ SipSMCommand sipcmdss(subscribeserver, SipSMCommand::remote, SipSMCommand::TU);
+ sip->handleCommand(sipcmdss);
+ */
+
+ /*
+ cerr << "Minisip: starting presence client for johan at bilien.org"<< endl;
+
+ CommandString subscribe("", SipCommandString::start_presence_client,"johan at bilien.org");
+ SipSMCommand sipcmd2(subscribe, SipSMCommand::remote, SipSMCommand::TU);
+ sip->getSipStack()->handleCommand(sipcmd2);
+ */
+
gui->setCallback(*messageRouter);
gui->setConfCallback(*confMessageRouter);
-
+
sip->start(); //run as a thread ...
-// sleep(5);
-
-// CommandString pupd("", SipCommandString::remote_presence_update,"someone at ssvl.kth.se","online","Working hard");
-// gui->handleCommand(pupd);
+ // sleep(5);
+ // CommandString pupd("", SipCommandString::remote_presence_update,"someone at ssvl.kth.se","online","Working hard");
+ // gui->handleCommand(pupd);
+
//sip->run();
}
-
+
catch(exception &exc){
//FIXME: Display message in GUI
merr << "Minisip caught an exception. Quitting."<< end;
@@ -434,7 +433,6 @@
}
string ret = phoneConf->load( confBackend );
-
done = true;
retGlobal = 1; //for now, we finished ok ... check the return string
if (ret.length()>0){
@@ -473,7 +471,7 @@
void Minisip::startDebugger(){
cerr << "startDebugger" << endl;
- consoleDbg = MRef<ConsoleDebugger*>(new ConsoleDebugger(phoneConf->sip->getSipStack()));
+ consoleDbg = MRef<ConsoleDebugger*>(new ConsoleDebugger(phoneConf->sipStack));
MRef<Thread *> consoleDbgThread = consoleDbg->start();
}
@@ -486,3 +484,5 @@
consoleDbg = NULL;
}
}
+
+
Modified: trunk/libminisip/source/ipprovider/SimpleIp6Provider.cxx
===================================================================
--- trunk/libminisip/source/ipprovider/SimpleIp6Provider.cxx 2006-11-23 17:21:51 UTC (rev 2949)
+++ trunk/libminisip/source/ipprovider/SimpleIp6Provider.cxx 2006-11-23 17:41:31 UTC (rev 2950)
@@ -35,7 +35,7 @@
bool use_ipv6 = true;
Scope curScope = INVALID;
- localIp = config->inherited->localIpString;
+ localIp = config->sipStackConfig->localIpString;
mdbg << "SimpleIP6Provider: localIp = " << localIp << endl;
Modified: trunk/libminisip/source/ipprovider/SimpleIpProvider.cxx
===================================================================
--- trunk/libminisip/source/ipprovider/SimpleIpProvider.cxx 2006-11-23 17:21:51 UTC (rev 2949)
+++ trunk/libminisip/source/ipprovider/SimpleIpProvider.cxx 2006-11-23 17:41:31 UTC (rev 2950)
@@ -40,7 +40,7 @@
unsigned i; //index
vector<string> ifaces = NetworkFunctions::getAllInterfaces();
- localIp = config->inherited->localIpString;
+ localIp = config->sipStackConfig->localIpString;
#ifdef DEBUG_OUTPUT
cerr << "SimpleIPProvider: localIp = " << localIp << endl;
#endif
Modified: trunk/libminisip/source/sip/DefaultDialogHandler.cxx
===================================================================
--- trunk/libminisip/source/sip/DefaultDialogHandler.cxx 2006-11-23 17:21:51 UTC (rev 2949)
+++ trunk/libminisip/source/sip/DefaultDialogHandler.cxx 2006-11-23 17:41:31 UTC (rev 2950)
@@ -40,6 +40,7 @@
#include<libmsip/SipCommandString.h>
#include<libmutil/massert.h>
+#include<libminisip/sip/SipDialogVoipClient.h>
#include<libminisip/sip/SipDialogVoipServer.h>
#include<libminisip/sip/SipDialogVoipServer100rel.h>
#include<libminisip/sip/SipDialogConfVoip.h>
@@ -516,6 +517,126 @@
}
}
+void DefaultDialogHandler::handleCommand(string subsystem, const CommandString &cmd){
+ assert(subsystem=="sip");
+ merr << "DefaultDialogHandler::handleCommand(subsystem,cmd): Can not handle: "<< cmd.getString() << end;
+}
+
+CommandString DefaultDialogHandler::handleCommandResp(string subsystem, const CommandString &cmd){
+ assert(subsystem=="sip");
+ assert(cmd.getOp()=="invite");//TODO: no assert, return error message instead
+
+ string user = cmd.getParam();
+ bool gotAtSign;
+// SipDialogSecurityConfig securityConfig;
+#ifdef ENABLE_TS
+ ts.save( INVITE_START );
+#endif
+// securityConfig = phoneconf->securityConfig;
+
+ int startAddr=0;
+ if (user.substr(0,4)=="sip:")
+ startAddr = 4;
+
+ if (user.substr(0,5)=="sips:")
+ startAddr = 5;
+
+ bool onlydigits=true;
+ MRef<SipIdentity *> id;
+
+ for (unsigned i=0; i<user.length(); i++)
+ if (user[i]<'0' || user[i]>'9')
+ onlydigits=false;
+
+ id = ( onlydigits && phoneconf->usePSTNProxy )?
+ phoneconf->pstnIdentity:
+ phoneconf->defaultIdentity;
+
+ if( !id ){
+ merr << "ERROR: could not determine what local identity to use" << endl;
+ }
+
+// securityConfig.useIdentity( id );
+
+ gotAtSign = ( user.find("@", startAddr) != string::npos );
+
+#if 0
+ // Uri check not compatible with IPv6
+ if (user.find(":", startAddr)!=string::npos){
+ string proxy;
+ string port;
+ uint32_t i=startAddr;
+ while (user[i]!='@')
+ if (user[i]==':'){
+ //return "malformed";
+ return CommandString("malformed","");;
+ }else
+ i++;
+ i++;
+ while (user[i]!=':')
+ proxy = proxy + user[i++];
+ i++;
+ while (i<user.size())
+ if (user[i]<'0' || user[i]>'9'){
+ //return "malformed";
+ return CommandString("malformed","");
+ }else
+ port = port + user[i++];
+
+
+ }
+#endif
+
+ if( !gotAtSign && id ){
+ id->lock();
+ user += "@" + id->getSipUri().getIp();
+ id->unlock();
+ }
+
+#ifdef DEBUG_OUTPUT
+ cerr << "Before new mediaSession" << endl;
+#endif
+ MRef<Session *> mediaSession =
+ mediaHandler->createSession( /*securityConfig*/ id );
+#ifdef DEBUG_OUTPUT
+ cerr << "After new mediaSession" << endl;
+#endif
+
+ MRef<SipDialog*> voipCall = new SipDialogVoipClient(sipStack, id, phoneconf, mediaSession);
+
+#ifdef DEBUG_OUTPUT
+ cerr << "Before addDialog" << endl;
+#endif
+ /*dialogContainer*/sipStack->addDialog(voipCall);
+#ifdef DEBUG_OUTPUT
+ cerr << "After addDialog" << endl;
+#endif
+ CommandString inv(voipCall->getCallId(), SipCommandString::invite, user);
+#ifdef ENABLE_TS
+ ts.save( TMP );
+#endif
+
+ SipSMCommand c(SipSMCommand(inv, SipSMCommand::dialog_layer, SipSMCommand::dialog_layer)); //TODO: send directly to dialog instead
+
+#ifdef DEBUG_OUTPUT
+ cerr << "Before handleCommand" << endl;
+#endif
+ sipStack->handleCommand(c);
+#ifdef DEBUG_OUTPUT
+ cerr << "After handleCommand" << endl;
+#endif
+
+ mediaSession->setCallId( voipCall->getCallId() );
+
+ string cid = voipCall->getCallId();
+
+ CommandString ret(cid,"invite_started");
+ return ret;
+}
+
+
+
+
#ifdef P2T_SUPPORT
void DefaultDialogHandler::inviteP2Treceived(const SipSMCommand &command){
//type casting
Modified: trunk/libminisip/source/sip/Sip.cxx
===================================================================
--- trunk/libminisip/source/sip/Sip.cxx 2006-11-23 17:21:51 UTC (rev 2949)
+++ trunk/libminisip/source/sip/Sip.cxx 2006-11-23 17:41:31 UTC (rev 2950)
@@ -61,11 +61,12 @@
this->phoneconfig = pconfig;
this->mediaHandler = mediaHandler;
- MRef<SipStackConfig *> stackConfig = new SipStackConfig();
- // Deep copy
- **stackConfig = **(pconfig->inherited);
+ MRef<SipStackConfig *> stackConfig /*= new SipStackConfig()*/;
+// // Deep copy
+// **stackConfig = **(pconfig->inherited);
+ stackConfig = pconfig->sipStackConfig;
- sipstack = new SipStack(stackConfig);
+ sipstack = new SipStack(stackConfig); //FIXME: stackConfig is not set yet!
MRef<DefaultDialogHandler*> defaultDialogHandler =
new DefaultDialogHandler(sipstack,
@@ -93,123 +94,6 @@
Sip::~Sip(){
}
-void Sip::handleCommand(string subsystem, const CommandString &cmd){
- assert(subsystem=="sip");
- sipstack->handleCommand(cmd);
-}
-
-CommandString Sip::handleCommandResp(string subsystem, const CommandString &cmd){
- assert(subsystem=="sip");
- assert(cmd.getOp()=="invite");//TODO: no assert, return error message instead
-
- string user = cmd.getParam();
- bool gotAtSign;
-// SipDialogSecurityConfig securityConfig;
-#ifdef ENABLE_TS
- ts.save( INVITE_START );
-#endif
-// securityConfig = phoneconfig->securityConfig;
-
- int startAddr=0;
- if (user.substr(0,4)=="sip:")
- startAddr = 4;
-
- if (user.substr(0,5)=="sips:")
- startAddr = 5;
-
- bool onlydigits=true;
- MRef<SipIdentity *> id;
-
- for (unsigned i=0; i<user.length(); i++)
- if (user[i]<'0' || user[i]>'9')
- onlydigits=false;
-
- id = ( onlydigits && phoneconfig->usePSTNProxy )?
- phoneconfig->pstnIdentity:
- phoneconfig->defaultIdentity;
-
- if( !id ){
- merr << "ERROR: could not determine what local identity to use" << endl;
- }
-
-// securityConfig.useIdentity( id );
-
- gotAtSign = ( user.find("@", startAddr) != string::npos );
-
-#if 0
- // Uri check not compatible with IPv6
- if (user.find(":", startAddr)!=string::npos){
- string proxy;
- string port;
- uint32_t i=startAddr;
- while (user[i]!='@')
- if (user[i]==':'){
- //return "malformed";
- return CommandString("malformed","");;
- }else
- i++;
- i++;
- while (user[i]!=':')
- proxy = proxy + user[i++];
- i++;
- while (i<user.size())
- if (user[i]<'0' || user[i]>'9'){
- //return "malformed";
- return CommandString("malformed","");
- }else
- port = port + user[i++];
-
-
- }
-#endif
-
- if( !gotAtSign && id ){
- id->lock();
- user += "@" + id->getSipUri().getIp();
- id->unlock();
- }
-
-#ifdef DEBUG_OUTPUT
- cerr << "Before new mediaSession" << endl;
-#endif
- MRef<Session *> mediaSession =
- mediaHandler->createSession( /*securityConfig*/ id );
-#ifdef DEBUG_OUTPUT
- cerr << "After new mediaSession" << endl;
-#endif
-
- MRef<SipDialog*> voipCall( new SipDialogVoipClient(sipstack, id, phoneconfig, mediaSession));
-
-#ifdef DEBUG_OUTPUT
- cerr << "Before addDialog" << endl;
-#endif
- /*dialogContainer*/sipstack->addDialog(voipCall);
-#ifdef DEBUG_OUTPUT
- cerr << "After addDialog" << endl;
-#endif
- CommandString inv(voipCall->getCallId(), SipCommandString::invite, user);
-#ifdef ENABLE_TS
- ts.save( TMP );
-#endif
-
- SipSMCommand c(SipSMCommand(inv, SipSMCommand::dialog_layer, SipSMCommand::dialog_layer)); //TODO: send directly to dialog instead
-
-#ifdef DEBUG_OUTPUT
- cerr << "Before handleCommand" << endl;
-#endif
- sipstack->handleCommand(c);
-#ifdef DEBUG_OUTPUT
- cerr << "After handleCommand" << endl;
-#endif
-
- mediaSession->setCallId( voipCall->getCallId() );
-
- string cid = voipCall->getCallId();
-
- CommandString ret(cid,"invite_started");
- return ret;
-}
-
string Sip::confjoin(string &user, minilist<ConfMember> *conflist, string confId){
// SipDialogSecurityConfig securityConfig;
#ifdef ENABLE_TS
@@ -411,7 +295,6 @@
thread->join();
}
-
void Sip::run(){
try{
Modified: trunk/libminisip/source/sip/SipDialogVoip.cxx
===================================================================
--- trunk/libminisip/source/sip/SipDialogVoip.cxx 2006-11-23 17:21:51 UTC (rev 2949)
+++ trunk/libminisip/source/sip/SipDialogVoip.cxx 2006-11-23 17:41:31 UTC (rev 2950)
@@ -449,7 +449,7 @@
string uri = getReferredUri(lastRefer);
CommandString invite("",SipCommandString::invite, uri);
- CommandString resp = phoneconf->sip->handleCommandResp("sip",invite);
+ CommandString resp = phoneconf->sipStack->handleCommandResp("sip",invite);
string newCallId=resp.getDestinationId();
/* Send the new callId to the GUI */
Modified: trunk/libminisip/source/sip/SipSoftPhoneConfiguration.cxx
===================================================================
--- trunk/libminisip/source/sip/SipSoftPhoneConfiguration.cxx 2006-11-23 17:21:51 UTC (rev 2949)
+++ trunk/libminisip/source/sip/SipSoftPhoneConfiguration.cxx 2006-11-23 17:41:31 UTC (rev 2950)
@@ -69,7 +69,7 @@
SipSoftPhoneConfiguration::SipSoftPhoneConfiguration():
//securityConfig(),
- sip(NULL),
+ //sip(NULL),
useSTUN(false),
stunServerPort(0),
findStunServerFromSipUri(false),
@@ -85,7 +85,7 @@
ringtone(""),
p2tGroupListServerPort(0)
{
- inherited = new SipStackConfig;
+ sipStackConfig = new SipStackConfig;
}
SipSoftPhoneConfiguration::~SipSoftPhoneConfiguration(){
@@ -98,11 +98,11 @@
//Set the version of the file ...
backend->save( "version", CONFIG_FILE_VERSION_REQUIRED );
- backend->save( "local_udp_port", inherited->localUdpPort );
- backend->save( "local_tcp_port", inherited->localTcpPort );
- backend->save( "local_tls_port", inherited->localTlsPort );
- backend->save( "auto_answer", inherited->autoAnswer?"yes":"no");
- backend->save( "instance_id", inherited->instanceId);
+ backend->save( "local_udp_port", sipStackConfig->localUdpPort );
+ backend->save( "local_tcp_port", sipStackConfig->localTcpPort );
+ backend->save( "local_tls_port", sipStackConfig->localTlsPort );
+ backend->save( "auto_answer", sipStackConfig->autoAnswer?"yes":"no");
+ backend->save( "instance_id", sipStackConfig->instanceId);
//securityConfig.save( backend );
@@ -678,7 +678,7 @@
}
if (backend->loadString(accountPath + "default_account","")=="yes"){
- //inherited->sipIdentity = ident;
+ //sipStackConfig->sipIdentity = ident;
defaultIdentity=ident;
}
@@ -766,17 +766,17 @@
ringtone = backend->loadString("ringtone","");
- inherited->localUdpPort = backend->loadInt("local_udp_port",5060);
- inherited->externalContactUdpPort = inherited->localUdpPort; //?
- inherited->localTcpPort = backend->loadInt("local_tcp_port",5060);
- inherited->localTlsPort = backend->loadInt("local_tls_port",5061);
- inherited->autoAnswer = backend->loadString("auto_answer", "no") == "yes";
- inherited->instanceId = backend->loadString("instance_id");
+ sipStackConfig->localUdpPort = backend->loadInt("local_udp_port",5060);
+ sipStackConfig->externalContactUdpPort = sipStackConfig->localUdpPort; //?
+ sipStackConfig->localTcpPort = backend->loadInt("local_tcp_port",5060);
+ sipStackConfig->localTlsPort = backend->loadInt("local_tls_port",5061);
+ sipStackConfig->autoAnswer = backend->loadString("auto_answer", "no") == "yes";
+ sipStackConfig->instanceId = backend->loadString("instance_id");
- if( inherited->instanceId.empty() ){
+ if( sipStackConfig->instanceId.empty() ){
MRef<Uuid*> uuid = Uuid::create();
- inherited->instanceId = "\"<urn:uuid:" + uuid->toString() + ">\"";
+ sipStackConfig->instanceId = "\"<urn:uuid:" + uuid->toString() + ">\"";
}
//securityConfig.load( backend ); //TODO: EEEE Load security per identity
Modified: trunk/libmutil/include/libmutil/CommandString.h
===================================================================
--- trunk/libmutil/include/libmutil/CommandString.h 2006-11-23 17:21:51 UTC (rev 2949)
+++ trunk/libmutil/include/libmutil/CommandString.h 2006-11-23 17:41:31 UTC (rev 2950)
@@ -31,7 +31,7 @@
#include<string>
#include<map>
-class LIBMUTIL_API CommandString : public MObject{
+class LIBMUTIL_API CommandString : public virtual MObject{
public:
CommandString();
Modified: trunk/minisip/minisip/gui/gtkgui/SettingsDialog.cxx
===================================================================
--- trunk/minisip/minisip/gui/gtkgui/SettingsDialog.cxx 2006-11-23 17:21:51 UTC (rev 2949)
+++ trunk/minisip/minisip/gui/gtkgui/SettingsDialog.cxx 2006-11-23 17:41:31 UTC (rev 2950)
@@ -752,9 +752,9 @@
networkInterfacesEntry->set_text( preferredIfaceIP );
}
- udpSpin->set_value( config->inherited->localUdpPort );
- tcpSpin->set_value( config->inherited->localTcpPort );
- tlsSpin->set_value( config->inherited->localTlsPort );
+ udpSpin->set_value( config->sipStack->getStackConfig()->localUdpPort );
+ tcpSpin->set_value( config->sipStack->getStackConfig()->localTcpPort );
+ tlsSpin->set_value( config->sipStack->getStackConfig()->localTlsPort );
tcpCheck->set_active( config->tcp_server );
tlsCheck->set_active( config->tls_server );
@@ -793,9 +793,9 @@
config->networkInterfaceName = ifaceSel;
}
- config->inherited->localUdpPort = udpSpin->get_value_as_int();
- config->inherited->localTcpPort = tcpSpin->get_value_as_int();
- config->inherited->localTlsPort = tlsSpin->get_value_as_int();
+ config->sipStack->getStackConfig()->localUdpPort = udpSpin->get_value_as_int();
+ config->sipStack->getStackConfig()->localTcpPort = tcpSpin->get_value_as_int();
+ config->sipStack->getStackConfig()->localTlsPort = tlsSpin->get_value_as_int();
config->tcp_server = tcpCheck->get_active();
config->tls_server = tlsCheck->get_active();
Modified: trunk/minisip/minisip/gui/textui/MinisipTextUI.cxx
===================================================================
--- trunk/minisip/minisip/gui/textui/MinisipTextUI.cxx 2006-11-23 17:21:51 UTC (rev 2949)
+++ trunk/minisip/minisip/gui/textui/MinisipTextUI.cxx 2006-11-23 17:41:31 UTC (rev 2950)
@@ -597,7 +597,7 @@
showMem();
break;
case '+':
- displayMessage( config->sip->getSipStack()->getStackStatusDebugString() );
+ displayMessage( config->sipStack->getStackStatusDebugString() );
break;
}
}
@@ -665,13 +665,13 @@
#ifdef DEBUG_OUTPUT
if (command == "show packets"){
- config->sip->getSipStack()->setDebugPrintPackets(true);
+ config->sipStack->setDebugPrintPackets(true);
displayMessage("SIP messages will be displayed on the screen", blue);
handled=true;
}
if (command == "hide packets"){
- config->sip->getSipStack()->setDebugPrintPackets(false);
+ config->sipStack->setDebugPrintPackets(false);
displayMessage("SIP messages will NOT be displayed on the screen", blue);
handled=true;
}
More information about the Minisip-devel
mailing list