Skip to content
Snippets Groups Projects
Commit 54187dd7 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#4233]

parent b1f6ef09
Branches
Tags
No related merge requests found
......@@ -11,7 +11,7 @@ accounts:
hostname:
id: IP2IP
interface: default
mailbox: 97
mailbox:
password:
port: 5060
publishAddr:
......@@ -54,7 +54,7 @@ preferences:
historyMaxCalls: 20
md5Hash: false
notifyMails: false
order: Account:1285624877/Account:1285265589/Account:1285257971/Account:1285253592/Account:1285252571/Account:1285251984/Account:1285251811/Account:1285251597/Account:1285192081/Account:1285184087/Account:1285182355/
order:
portNum: 5060
registrationExpire: 180
searchBarDisplay: true
......
......@@ -248,17 +248,19 @@ void SIPTest::testTwoOutgoingIpCall ()
std::cout << "SIPTest: completed join with thread" << std::endl;
}
/*
void SIPTest::testTwoIncomingIpCall ()
{
pthread_t thethread;
pthread_t firstCallThread, secondCallThread;
void *status;
// the first call is supposed to be put on hold when answering teh second incoming call
std::string firstCallCommand("sipp -sf sippxml/test_2.xml 127.0.0.1 -i 127.0.0.1 -p 5064 -m 1");
// command to be executed by the thread, user agent client which initiate a call and hangup
std::string command("sipp -sn uac 127.0.0.1 -i 127.0.0.1 -p 5062 -m 1");
std::string secondCallCommand("sipp -sn uac 127.0.0.1 -i 127.0.0.1 -p 5062 -m 1 -d 1000");
int rc = pthread_create(&thethread, NULL, sippThread, (void *)(&command));
int rc = pthread_create(&firstCallThread, NULL, sippThread, (void *)(&firstCallCommand));
if (rc) {
std::cout << "SIPTest: ERROR; return code from pthread_create()" << std::endl;
}
......@@ -269,26 +271,49 @@ void SIPTest::testTwoIncomingIpCall ()
sleep(2);
// gtrab call id from sipvoiplink
SIPVoIPLink *siplink = SIPVoIPLink::instance ("");
SIPVoIPLink *sipLink = SIPVoIPLink::instance ("");
CPPUNIT_ASSERT(siplink->_callMap.size() == 1);
CallMap::iterator iterCallId = siplink->_callMap.begin();
std::string testcallid = iterCallId->first;
// TODO: hmmm, should IP2IP call be stored in call list....
CPPUNIT_ASSERT(Manager::instance().getCallList().size() == 0);
CPPUNIT_ASSERT(sipLink->_callMap.size() == 1);
CallMap::iterator iterCallId = sipLink->_callMap.begin();
std::string firstCallID = iterCallId->first;
// Answer this call
CPPUNIT_ASSERT(Manager::instance().answerCall(testcallid));
CPPUNIT_ASSERT(Manager::instance().answerCall(firstCallID));
sleep(1);
rc = pthread_create(&secondCallThread, NULL, sippThread, (void *)(&secondCallCommand));
if(rc) {
std::cout << "SIPTest: Error; return code from pthread_create()" << std::endl;
}
sleep(1);
rc = pthread_join(thethread, &status);
CPPUNIT_ASSERT(sipLink->_callMap.size() == 2);
iterCallId = sipLink->_callMap.begin();
if(iterCallId->first == firstCallID)
iterCallId++;
std::string secondCallID = iterCallId->first;
CPPUNIT_ASSERT(Manager::instance().answerCall(secondCallID));
rc = pthread_join(firstCallThread, &status);
if (rc) {
std::cout << "SIPTest: ERROR; return code from pthread_join(): " << rc << std::endl;
}
else
std::cout << "SIPTest: completed join with thread" << std::endl;
std::cout << "SIPTest: completed join with thread 1" << std::endl;
rc = pthread_join(secondCallThread, &status);
if (rc) {
std::cout << "SIPTest: ERROR; return code from pthread_join(): " << rc << std::endl;
}
*/
else
std::cout << "SIPTest: completed join with thread 2" << std::endl;
std::cout << "---------------------------" << std::endl;
}
......@@ -53,9 +53,10 @@ class SIPTest : public CppUnit::TestCase {
* Use cppunit library macros to add unit test the factory
*/
CPPUNIT_TEST_SUITE( SIPTest );
CPPUNIT_TEST ( testSimpleOutgoingIpCall );
CPPUNIT_TEST ( testSimpleIncomingIpCall );
CPPUNIT_TEST( testTwoOutgoingIpCall );
// CPPUNIT_TEST ( testSimpleOutgoingIpCall );
// CPPUNIT_TEST ( testSimpleIncomingIpCall );
// CPPUNIT_TEST ( testTwoOutgoingIpCall );
CPPUNIT_TEST ( testTwoIncomingIpCall );
CPPUNIT_TEST_SUITE_END();
public:
......@@ -80,6 +81,8 @@ class SIPTest : public CppUnit::TestCase {
void testTwoOutgoingIpCall(void);
void testTwoIncomingIpCall(void);
private:
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment