Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
2c83d92a
Commit
2c83d92a
authored
14 years ago
by
Alexandre Savard
Browse files
Options
Downloads
Patches
Plain Diff
[#4123] Update outgoing IP2IP sip call unit test
parent
9196c0fb
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
sflphone-common/test/siptest.cpp
+39
-9
39 additions, 9 deletions
sflphone-common/test/siptest.cpp
with
39 additions
and
9 deletions
sflphone-common/test/siptest.cpp
+
39
−
9
View file @
2c83d92a
...
@@ -76,8 +76,9 @@ void SIPTest::tearDown()
...
@@ -76,8 +76,9 @@ void SIPTest::tearDown()
// in order to stop any currently running threads
// in order to stop any currently running threads
std
::
cout
<<
"SIPTest: Clean all remaining sipp instances"
<<
std
::
endl
;
std
::
cout
<<
"SIPTest: Clean all remaining sipp instances"
<<
std
::
endl
;
system
(
"killall sipp"
);
int
ret
=
system
(
"killall sipp"
);
if
(
!
ret
)
std
::
cout
<<
"SIPTest: Error from system call, killall sipp"
<<
std
::
endl
;
}
}
...
@@ -86,7 +87,7 @@ void SIPTest::testSimpleOutgoingIpCall ()
...
@@ -86,7 +87,7 @@ void SIPTest::testSimpleOutgoingIpCall ()
pthread_t
thethread
;
pthread_t
thethread
;
void
*
status
;
void
*
status
;
// command to be executed by the thread
// command to be executed by the thread
, user agent server waiting for a call
std
::
string
command
(
"sipp -sn uas -i 127.0.0.1 -p 5062 -m 1"
);
std
::
string
command
(
"sipp -sn uas -i 127.0.0.1 -p 5062 -m 1"
);
int
rc
=
pthread_create
(
&
thethread
,
NULL
,
sippThread
,
(
void
*
)(
&
command
));
int
rc
=
pthread_create
(
&
thethread
,
NULL
,
sippThread
,
(
void
*
)(
&
command
));
...
@@ -147,7 +148,7 @@ void SIPTest::testSimpleIncomingIpCall ()
...
@@ -147,7 +148,7 @@ void SIPTest::testSimpleIncomingIpCall ()
pthread_t
thethread
;
pthread_t
thethread
;
void
*
status
;
void
*
status
;
// command to be executed by the thread
// 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
command
(
"sipp -sn uac 127.0.0.1 -i 127.0.0.1 -p 5062 -m 1"
);
int
rc
=
pthread_create
(
&
thethread
,
NULL
,
sippThread
,
(
void
*
)(
&
command
));
int
rc
=
pthread_create
(
&
thethread
,
NULL
,
sippThread
,
(
void
*
)(
&
command
));
...
@@ -155,23 +156,53 @@ void SIPTest::testSimpleIncomingIpCall ()
...
@@ -155,23 +156,53 @@ void SIPTest::testSimpleIncomingIpCall ()
std
::
cout
<<
"SIPTest: ERROR; return code from pthread_create()"
<<
std
::
endl
;
std
::
cout
<<
"SIPTest: ERROR; return code from pthread_create()"
<<
std
::
endl
;
}
}
// sleep a while to make sure that sipp insdtance is initialized and sflphoned received
// sleep a while to make sure that sipp insdtance is initialized and sflphoned received
// the incoming invite.
// the incoming invite.
sleep
(
2
);
sleep
(
2
);
// gtrab call id from sipvoiplink
SIPVoIPLink
*
siplink
=
SIPVoIPLink
::
instance
(
""
);
SIPVoIPLink
*
siplink
=
SIPVoIPLink
::
instance
(
""
);
CPPUNIT_ASSERT
(
siplink
->
_callMap
.
size
()
==
1
);
CPPUNIT_ASSERT
(
siplink
->
_callMap
.
size
()
==
1
);
CallMap
::
iterator
iterCallId
=
siplink
->
_callMap
.
begin
();
CallMap
::
iterator
iterCallId
=
siplink
->
_callMap
.
begin
();
std
::
string
testcallid
=
iterCallId
->
first
;
// TODO: hmmm, should IP2IP call be stored in call list....
// TODO: hmmm, should IP2IP call be stored in call list....
CPPUNIT_ASSERT
(
Manager
::
instance
().
getCallList
().
size
()
==
0
);
CPPUNIT_ASSERT
(
Manager
::
instance
().
getCallList
().
size
()
==
0
);
std
::
string
testcallid
=
iterCallId
->
first
;
// Answer this call
CPPUNIT_ASSERT
(
Manager
::
instance
().
answerCall
(
testcallid
));
CPPUNIT_ASSERT
(
Manager
::
instance
().
answerCall
(
testcallid
));
sleep
(
2
);
// This is useless since manager is not aware of incoming IP2IP sip calls
/*
sleep(1);
std::map<std::string, std::string>::iterator iterCallDetails;
std::map<std::string, std::string> callDetails = Manager::instance().getCallDetails (testcallid);
iterCallDetails = callDetails.find("ACCOUNTID");
std::cout << "---------------------- " << iterCallDetails->second << std::endl;
// CPPUNIT_ASSERT((iterCallDetails != callDetails.end()) && (iterCallDetails->second == ""));
iterCallDetails = callDetails.find("PEER_NUMBER");
std::cout << "--------------------- " << iterCallDetails->second << std::endl;
// CPPUNIT_ASSERT((iterCallDetails != callDetails.end()) && (iterCallDetails->second == "<sip:test@127.0.0.1:5062>"));
iterCallDetails = callDetails.find("PEER_NAME");
std::cout << "--------------------- " << iterCallDetails->second << std::endl;
// CPPUNIT_ASSERT((iterCallDetails != callDetails.end()) && (iterCallDetails->second == ""));
iterCallDetails = callDetails.find("DISPLAY_NAME");
std::cout << "-------------------- " << iterCallDetails->second << std::endl;
// CPPUNIT_ASSERT((iterCallDetails != callDetails.end()) && (iterCallDetails->second == ""));
iterCallDetails = callDetails.find("CALL_STATE");
std::cout << "-------------------- " << iterCallDetails->second << std::endl;
// CPPUNIT_ASSERT((iterCallDetails != callDetails.end()) && (iterCallDetails->second == "CURRENT"));
iterCallDetails = callDetails.find("CALL_TYPE");
std::cout << "-------------------- " << iterCallDetails->second << std::endl;
// CPPUNIT_ASSERT((iterCallDetails != callDetails.end()) && (iterCallDetails->second == "1"));
*/
sleep
(
1
);
rc
=
pthread_join
(
thethread
,
&
status
);
rc
=
pthread_join
(
thethread
,
&
status
);
if
(
rc
)
{
if
(
rc
)
{
...
@@ -179,5 +210,4 @@ void SIPTest::testSimpleIncomingIpCall ()
...
@@ -179,5 +210,4 @@ void SIPTest::testSimpleIncomingIpCall ()
}
}
else
else
std
::
cout
<<
"SIPTest: completed join with thread"
<<
std
::
endl
;
std
::
cout
<<
"SIPTest: completed join with thread"
<<
std
::
endl
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment