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

[#2536] Handle account calls with/without reinvite

parent badc0b72
Branches
Tags
No related merge requests found
...@@ -24,12 +24,12 @@ ...@@ -24,12 +24,12 @@
REGISTER sip:[remote_ip] SIP/2.0 REGISTER sip:[remote_ip] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch] Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch]
Max-Forward: 70 Max-Forwards: 70
From: <sip:27182@[remote_ip]:[remote_port]>;tag=[call_number] From: <sip:27182@[remote_ip]>;tag=[call_number]
To: <sip:27182@[remote_ip]:[remote_port]> To: <sip:27182@[remote_ip]>
Call-ID: REG///[call_id] Call-ID: REG///[call_id]
CSeq: 1 REGISTER CSeq: 1 REGISTER
Contact: <sip:27182@[remote_ip]:[remote_port]> Contact: <sip:27182@[local_ip]:[local_port]>
Content-Length: 0 Content-Length: 0
Expires: 300 Expires: 300
...@@ -45,11 +45,11 @@ ...@@ -45,11 +45,11 @@
REGISTER sip:[remote_ip] SIP/2.0 REGISTER sip:[remote_ip] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch] Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch]
Max-Forwards: 70 Max-Forwards: 70
From: <sip:27182@[remote_ip]:[remote_port]>;tag=[call_number] From: <sip:27182@[remote_ip]>;tag=[call_number]
To: <sip:27182@[remote_ip]:[remote_port]> To: <sip:27182@[remote_ip]>
Call-ID: REG///[call_id] Call-ID: REG///[call_id]
CSeq: 2 REGISTER CSeq: 2 REGISTER
Contact: <sip:27182@[remote_ip]:[remote_port]> Contact: <sip:27182@[local_ip]:[local_port]>
Content-Length: 0 Content-Length: 0
Expires: 300 Expires: 300
[authentication username=27182 password=1234] [authentication username=27182 password=1234]
......
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">
<!-- This program is free software; you can redistribute it and/or -->
<!-- modify it under the terms of the GNU General Public License as -->
<!-- published by the Free Software Foundation; either version 2 of the -->
<!-- License, or (at your option) any later version. -->
<!-- -->
<!-- This program is distributed in the hope that it will be useful, -->
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
<!-- GNU General Public License for more details. -->
<!-- -->
<!-- You should have received a copy of the GNU General Public License -->
<!-- along with this program; if not, write to the -->
<!-- Free Software Foundation, Inc., -->
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
<scenario name="accountcall_client">
<send retrans="500">
<![CDATA[
REGISTER sip:[remote_ip] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch]
Max-Forwards: 70
From: <sip:27182@[remote_ip]>;tag=[call_number]
To: <sip:27182@[remote_ip]>
Call-ID: REG///[call_id]
CSeq: 1 REGISTER
Contact: <sip:27182@[local_ip]:[local_port]>
Content-Length: 0
Expires: 300
]]>
</send>
<recv response="401" auth="true">
</recv>
<send retrans="500">
<![CDATA[
REGISTER sip:[remote_ip] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch]
Max-Forwards: 70
From: <sip:27182@[remote_ip]>;tag=[call_number]
To: <sip:27182@[remote_ip]>
Call-ID: REG///[call_id]
CSeq: 2 REGISTER
Contact: <sip:27182@[local_ip]:[local_port]>
Content-Length: 0
Expires: 300
[authentication username=27182 password=1234]
]]>
</send>
<recv response="200">
</recv>
<pause milliseconds="200"/>
<send retrans="500">
<![CDATA[
INVITE sip:2000@[remote_ip] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch]
From: <sip:27182@[remote_ip]>;tag=[call_number]
To: <sip:2000@[remote_ip]>
Call-ID: [call_id]
CSeq: 3 INVITE
Contact: sip:27182@[local_ip]:[local_port]
Max-Forwards: 70
Subject: Functional Test
Content-Type: application/sdp
Content-Length: [len]
v=0
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
s=-
c=IN IP[media_ip_type] [media_ip]
t=0 0
m=audio [media_port] RTP/AVP 0
a=rtpmap:0 PCMU/8000
]]>
</send>
<recv response="401" auth="true">
</recv>
<pause milliseconds="200"/>
<send>
<![CDATA[
ACK sip:27182@[remote_ip] SIP/2.0
Max-Forwards: 70
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: <sip:27182@[remote_ip]>;tag=[call_number]
To: <sip:2000@[remote_ip]>
Call-ID: [call_id]
CSeq: 4 ACK
Subject: Functional Test
Content-Length: 0
]]>
</send>
<send retrans="500">
<![CDATA[
INVITE sip:2000@[remote_ip] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch]
From: <sip:27182@:[remote_ip]>;tag=[call_number]
To: <sip:2000@[remote_ip]>
Call-ID: [call_id]
CSeq: 5 INVITE
Contact: sip:27182@[local_ip]:[local_port]
Max-Forwards: 70
Subject: Functional Test
Content-Type: application/sdp
Content-Length: [len]
[authentication username=27182 password=1234]
v=0
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
s=-
c=IN IP[media_ip_type] [media_ip]
t=0 0
m=audio [media_port] RTP/AVP 0
a=rtpmap:0 PCMU/8000
]]>
</send>
<recv response="100">
</recv>
<recv response="180">
</recv>
<recv response="200">
</recv>
<send>
<![CDATA[
ACK sip:2000@192.168.50.79 SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: <sip:27182@[remote_ip]>;tag=[call_number]
To: <sip:2000@[remote_ip]>
Call-ID: [call_id]
CSeq: 5 ACK
Contact: sip:27182@[local_ip]:[local_port]
Max-Forwards: 70
Subject: Functional Test
Content-Length: 0
]]>
</send>
<recv request="BYE">
</recv>
<send retrans="500">
<![CDATA[
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:];tag=[call_number]
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
Content-Type: application/sdp
Content-Length: [len]
v=0
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
s=-
c=IN IP[media_ip_type] [media_ip]
t=0 0
m=audio [media_port] RTP/AVP 0
a=rtpmap:0 PCMU/8000
]]>
</send>
<pause milliseconds="1000"/>
</scenario>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">
<!-- This program is free software; you can redistribute it and/or -->
<!-- modify it under the terms of the GNU General Public License as -->
<!-- published by the Free Software Foundation; either version 2 of the -->
<!-- License, or (at your option) any later version. -->
<!-- -->
<!-- This program is distributed in the hope that it will be useful, -->
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
<!-- GNU General Public License for more details. -->
<!-- -->
<!-- You should have received a copy of the GNU General Public License -->
<!-- along with this program; if not, write to the -->
<!-- Free Software Foundation, Inc., -->
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
<scenario name="accountcall_client">
<recv request="INVITE">
</recv>
<send>
<![CDATA[
SIP/2.0 180 Ringing
[last_Via:]
[last_From:]
[last_To:];tag=[call_number]
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
Content-Length: 0
]]>
</send>
<pause milliseconds="200"/>
<send retrans="500">
<![CDATA[
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:];tag=[call_number]
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
Content-Type: application/sdp
Content-Length: [len]
v=0
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
s=-
c=IN IP[media_ip_type] [media_ip]
t=0 0
m=audio [media_port] RTP/AVP 0
a=rtpmap:0 PCMU/8000
]]>
</send>
<recv request="ACK">
</recv>
<recv request="INVITE">
</recv>
<send retrans="500">
<![CDATA[
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:];tag=[call_number]
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
Content-Type: application/sdp
Content-Length: [len]
v=0
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
s=-
c=IN IP[media_ip_type] [media_ip]
t=0 0
m=audio [media_port] RTP/AVP 0
a=rtpmap:0 PCMU/8000
]]>
</send>
<recv request="ACK">
</recv>
<pause milliseconds="500"/>
<send retrans="500">
<![CDATA[
BYE sip:2000@192.168.50.79 SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: <sip:27182@[local_ip]:[local_port]>;tag=[call_number]
To: <sip:2000@192.168.50.79:[remote_port]>
Call-ID: [call_id]
CSeq: 6 BYE
Contact: sip:27182@[local_ip]:[local_port]
Max-Forwards: 70
Subject: Functional Test
Content-Length: 0
]]>
</send>
<recv response="200">
</recv>
</scenario>
...@@ -19,70 +19,55 @@ ...@@ -19,70 +19,55 @@
<scenario name="accountcall_client"> <scenario name="accountcall_client">
<send retrans="500"> <recv request="INVITE">
<![CDATA[
REGISTER sip:[remote_ip] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch]
Max-Forward: 70
From: <sip:27182@[remote_ip]:[remote_port]>;tag=[call_number]
To: <sip:27182@[remote_ip]:[remote_port]>
Call-ID: REG///[call_id]
CSeq: 1 REGISTER
Contact: <sip:27182@[remote_ip]:[remote_port]>
Content-Length: 0
Expires: 300
]]>
</send>
<recv response="401" auth="true">
</recv> </recv>
<send retrans="500"> <send>
<![CDATA[ <![CDATA[
REGISTER sip:[remote_ip] SIP/2.0 SIP/2.0 180 Ringing
Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch] [last_Via:]
Max-Forwards: 70 [last_From:]
From: <sip:27182@[remote_ip]:[remote_port]>;tag=[call_number] [last_To:];tag=[call_number]
To: <sip:27182@[remote_ip]:[remote_port]> [last_Call-ID:]
Call-ID: REG///[call_id] [last_CSeq:]
CSeq: 2 REGISTER Contact: <sip:[local_ip]:[local_port];transport=[transport]>
Contact: <sip:27182@[remote_ip]:[remote_port]>
Content-Length: 0 Content-Length: 0
Expires: 300
[authentication username=27182 password=1234]
]]> ]]>
</send> </send>
<recv response="200"> <pause milliseconds="200"/>
</recv>
<recv request="INVITE">
</recv>
<recv response="401" auth="true">
</recv>
<send> <send retrans="500">
<![CDATA[ <![CDATA[
SIP/2.0 180 Ringing SIP/2.0 200 OK
[last_Via:] [last_Via:]
[last_From:] [last_From:]
[last_To:];tag=[call_number] [last_To:];tag=[call_number]
[last_Call-ID:] [last_Call-ID:]
[last_CSeq:] [last_CSeq:]
Contact: <sip:[local_ip]:[local_port];transport=[transport]> Contact: <sip:[local_ip]:[local_port];transport=[transport]>
Content-Length: 0 Content-Type: application/sdp
Content-Length: [len]
v=0
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
s=-
c=IN IP[media_ip_type] [media_ip]
t=0 0
m=audio [media_port] RTP/AVP 0
a=rtpmap:0 PCMU/8000
]]> ]]>
</send> </send>
<pause milliseconds="200"/> <recv request="ACK">
</recv>
<recv request="INVITE">
</recv>
<send retrans="500"> <send retrans="500">
<![CDATA[ <![CDATA[
......
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">
<!-- This program is free software; you can redistribute it and/or -->
<!-- modify it under the terms of the GNU General Public License as -->
<!-- published by the Free Software Foundation; either version 2 of the -->
<!-- License, or (at your option) any later version. -->
<!-- -->
<!-- This program is distributed in the hope that it will be useful, -->
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
<!-- GNU General Public License for more details. -->
<!-- -->
<!-- You should have received a copy of the GNU General Public License -->
<!-- along with this program; if not, write to the -->
<!-- Free Software Foundation, Inc., -->
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
<scenario name="accountcall_client">
<send retrans="500">
<![CDATA[
REGISTER sip:[remote_ip] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch]
Max-Forwards: 70
From: <sip:27182@[remote_ip]>;tag=[call_number]
To: <sip:27182@[remote_ip]>
Call-ID: REG///[call_id]
CSeq: 1 REGISTER
Contact: <sip:27182@[local_ip]:[local_port]>
Content-Length: 0
Expires: 300
]]>
</send>
<recv response="401" auth="true">
</recv>
<send retrans="500">
<![CDATA[
REGISTER sip:[remote_ip] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch]
Max-Forwards: 70
From: <sip:27182@[remote_ip]>;tag=[call_number]
To: <sip:27182@[remote_ip]>
Call-ID: REG///[call_id]
CSeq: 2 REGISTER
Contact: <sip:27182@[local_ip]:[local_port]>
Content-Length: 0
Expires: 300
[authentication username=27182 password=1234]
]]>
</send>
<recv response="200">
</recv>
</scenario>
...@@ -93,6 +93,9 @@ function test_account_send_hangup { ...@@ -93,6 +93,9 @@ function test_account_send_hangup {
# wait some time to make sure client is bound # wait some time to make sure client is bound
# sleep 1; # sleep 1;
# process only one registration
sipp -sf account_uas_register.xml 192.168.50.79 -i 192.168.50.182 -p ${SERVERPORT} -l 1 -m 1
# start sipp client and send calls # start sipp client and send calls
sipp -sf account_uas_recv_peer_hungup.xml 192.168.50.79 -i 192.168.50.182 -p ${SERVERPORT} -l 1 sipp -sf account_uas_recv_peer_hungup.xml 192.168.50.79 -i 192.168.50.182 -p ${SERVERPORT} -l 1
...@@ -100,6 +103,52 @@ function test_account_send_hangup { ...@@ -100,6 +103,52 @@ function test_account_send_hangup {
# bashtrap # bashtrap
} }
function test_account_send_peer_hungup {
# start sflphoned
# /usr/lib/sflphone/sflphoned&
# wait some time to make sure sflphoned is started
# sleep 1;
# python ../tools/pysflphone/pysflphone_testdbus.py &
# wait some time to make sure client is bound
# sleep 1;
# process only one registration
sipp -sf account_uas_register.xml 192.168.50.79 -i 192.168.50.182 -p ${SERVERPORT} -l 1 -m 1
# start sipp client and send calls
sipp -sf account_uas_recv_hangup.xml 192.168.50.79 -i 192.168.50.182 -p ${SERVERPORT} -l 1
# kill every one
# bashtrap
}
function test_account_recv_hangup {
# start sflphoned
# /usr/lib/sflphone/sflphoned&
# wait some time to make sure sflphoned is started
# sleep 1;
# python ../tools/pysflphone/pysflphone_testdbus.py &
# wait some time to make sure client is bound
# sleep 1;
# process only one registration
sipp -sf account_uas_register.xml 192.168.50.79 -i 192.168.50.182 -p ${SERVERPORT} -l 1 -m 1
# start sipp client and send calls
sipp -sf account_uac_send_peer_hungup.xml 192.168.50.79 -i 192.168.50.182 -p ${SERVERPORT} -l 1
# kill every one
# bashtrap
}
function test_account_recv_peer_hungup { function test_account_recv_peer_hungup {
# start sflphoned # start sflphoned
...@@ -113,6 +162,9 @@ function test_account_recv_peer_hungup { ...@@ -113,6 +162,9 @@ function test_account_recv_peer_hungup {
# wait some time to make sure client is bound # wait some time to make sure client is bound
# sleep 1; # sleep 1;
# process only one registration
# sipp -sf account_uas_register.xml 192.168.50.79 -i 192.168.50.182 -p ${SERVERPORT} -l 1 -m 1
# start sipp client and send calls # start sipp client and send calls
sipp -sf account_uac_send_hangup.xml 192.168.50.79 -i 192.168.50.182 -p ${SERVERPORT} -l 1 sipp -sf account_uac_send_hangup.xml 192.168.50.79 -i 192.168.50.182 -p ${SERVERPORT} -l 1
...@@ -137,5 +189,7 @@ bashtrap() ...@@ -137,5 +189,7 @@ bashtrap()
# test_ip2ip_recv_peer_hungup # test_ip2ip_recv_peer_hungup
# SCENARIO X: Normal flow calls (Account) # SCENARIO X: Normal flow calls (Account)
test_account_send_hangup # test_account_send_hangup
# test_account_recv_peer_hungup # test_account_send_peer_hungup
\ No newline at end of file # test_account_recv_hangup
test_account_recv_peer_hungup
\ No newline at end of file
...@@ -113,6 +113,7 @@ class SflPhoneTests(): ...@@ -113,6 +113,7 @@ class SflPhoneTests():
# Start Glib mainloop # Start Glib mainloop
self.sflphone.start() self.sflphone.start()
def test_ip2ip_recv_peer_hungup(self): def test_ip2ip_recv_peer_hungup(self):
"""Wait for calls, answer, peer hangup""" """Wait for calls, answer, peer hangup"""
# Add callback for this test # Add callback for this test
...@@ -121,6 +122,7 @@ class SflPhoneTests(): ...@@ -121,6 +122,7 @@ class SflPhoneTests():
# Start Glib mainloop # Start Glib mainloop
self.sflphone.start() self.sflphone.start()
def test_account_send_hangup(self): def test_account_send_hangup(self):
"""Send new account call, hangup once peer answered""" """Send new account call, hangup once peer answered"""
print "test account send hangup" print "test account send hangup"
...@@ -134,37 +136,42 @@ class SflPhoneTests(): ...@@ -134,37 +136,42 @@ class SflPhoneTests():
time.sleep(0.5) time.sleep(0.5)
i = i+1 i = i+1
print "account hangup done"
del self.sflphone del self.sflphone
def test_account_recv_call_peer_hungup(self):
def test_account_send_peer_hungup(self):
"""Send new account call, hangup once peer answered"""
print "test account send hangup"
i = 0
while(i < 10):
callid = self.sflphone.Call("27182")
time.sleep(1.0)
i = i+1
del self.sflphone
def test_account_recv_hangup(self):
"""Register an account and wait for incoming calls""" """Register an account and wait for incoming calls"""
# Add callback for this test # Add callback for this test
self.sflphone.onIncomingCall_cb = acceptOnIncomingCall self.sflphone.onIncomingCall_cb = acceptOnIncomingCallHangup
# Start Glib mainloop # Start Glib mainloop
self.sflphone.start() self.sflphone.start()
def test_account_recv_peer_hungup(self):
"""Register an account and wait for incoming calls"""
# Add callback for this test
self.sflphone.onIncomingCall_cb = acceptOnIncomingCall
# def test_account_send_call_peer_hungup(self): # Start Glib mainloop
# """Register an account on a remote server and make several calls""" self.sflphone.start()
#
# self.setAccount("Account:1258495784");
# time.sleep(3)
#
# i = 0
# while(i < 50):
#
# callid = self.Call("5000")
# time.sleep(0.4)
#
# self.HangUp(callid)
# time.sleep(0.4)
#
# i = i+1
...@@ -195,6 +202,8 @@ sflphone.setFirstRegisteredAccount(); ...@@ -195,6 +202,8 @@ sflphone.setFirstRegisteredAccount();
# - Wait for incoming calls # - Wait for incoming calls
# - Answer # - Answer
# - Call is hanged up by calle # - Call is hanged up by calle
testsuite.test_account_send_hangup() # testsuite.test_account_send_hangup()
# testsuite.test_account_recv_call_peer_hungup() # testsuite.test_account_send_peer_hungup()
# testsuite.test_account_recv_hangup()
testsuite.test_account_recv_peer_hungup()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment