From da57d49fb0eb127ea17a8150db1ed46675f5c64a Mon Sep 17 00:00:00 2001 From: Alexandre Savard <alexandresavard@alexandresavard-desktop.(none)> Date: Tue, 9 Mar 2010 17:23:59 -0500 Subject: [PATCH] [#2536] Handle account calls with/without reinvite --- sippxml/account_uac_send_hangup.xml | 14 +- sippxml/account_uac_send_peer_hungup.xml | 196 +++++++++++++++++++++++ sippxml/account_uas_recv_hangup.xml | 121 ++++++++++++++ sippxml/account_uas_recv_peer_hungup.xml | 75 ++++----- sippxml/account_uas_register.xml | 63 ++++++++ sippxml/testsuiteuac.sh | 58 ++++++- tools/pysflphone/pysflphone_testdbus.py | 53 +++--- 7 files changed, 504 insertions(+), 76 deletions(-) create mode 100644 sippxml/account_uac_send_peer_hungup.xml create mode 100644 sippxml/account_uas_recv_hangup.xml create mode 100644 sippxml/account_uas_register.xml diff --git a/sippxml/account_uac_send_hangup.xml b/sippxml/account_uac_send_hangup.xml index b07251cb21..7a35a65df0 100644 --- a/sippxml/account_uac_send_hangup.xml +++ b/sippxml/account_uac_send_hangup.xml @@ -24,12 +24,12 @@ 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]> + 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@[remote_ip]:[remote_port]> + Contact: <sip:27182@[local_ip]:[local_port]> Content-Length: 0 Expires: 300 @@ -45,11 +45,11 @@ 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]:[remote_port]>;tag=[call_number] - To: <sip:27182@[remote_ip]:[remote_port]> + From: <sip:27182@[remote_ip]>;tag=[call_number] + To: <sip:27182@[remote_ip]> Call-ID: REG///[call_id] CSeq: 2 REGISTER - Contact: <sip:27182@[remote_ip]:[remote_port]> + Contact: <sip:27182@[local_ip]:[local_port]> Content-Length: 0 Expires: 300 [authentication username=27182 password=1234] diff --git a/sippxml/account_uac_send_peer_hungup.xml b/sippxml/account_uac_send_peer_hungup.xml new file mode 100644 index 0000000000..c79e2f348a --- /dev/null +++ b/sippxml/account_uac_send_peer_hungup.xml @@ -0,0 +1,196 @@ +<?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> diff --git a/sippxml/account_uas_recv_hangup.xml b/sippxml/account_uas_recv_hangup.xml new file mode 100644 index 0000000000..101e6f4c97 --- /dev/null +++ b/sippxml/account_uas_recv_hangup.xml @@ -0,0 +1,121 @@ +<?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> diff --git a/sippxml/account_uas_recv_peer_hungup.xml b/sippxml/account_uas_recv_peer_hungup.xml index cfa9acb151..e1a0562bf2 100644 --- a/sippxml/account_uas_recv_peer_hungup.xml +++ b/sippxml/account_uas_recv_peer_hungup.xml @@ -19,54 +19,9 @@ <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-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> - - <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]:[remote_port]>;tag=[call_number] - To: <sip:27182@[remote_ip]:[remote_port]> - Call-ID: REG///[call_id] - CSeq: 2 REGISTER - Contact: <sip:27182@[remote_ip]:[remote_port]> - Content-Length: 0 - Expires: 300 - [authentication username=27182 password=1234] - - ]]> - </send> - - <recv response="200"> - </recv> - - <recv request="INVITE"> </recv> - <recv response="401" auth="true"> - </recv> - <send> <![CDATA[ @@ -111,6 +66,36 @@ <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> + <recv request="BYE"> </recv> diff --git a/sippxml/account_uas_register.xml b/sippxml/account_uas_register.xml new file mode 100644 index 0000000000..e4ebb81227 --- /dev/null +++ b/sippxml/account_uas_register.xml @@ -0,0 +1,63 @@ +<?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> diff --git a/sippxml/testsuiteuac.sh b/sippxml/testsuiteuac.sh index c63983c1e0..42a45db683 100644 --- a/sippxml/testsuiteuac.sh +++ b/sippxml/testsuiteuac.sh @@ -93,6 +93,9 @@ function test_account_send_hangup { # 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_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 { # 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 { # start sflphoned @@ -113,6 +162,9 @@ function test_account_recv_peer_hungup { # 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_hangup.xml 192.168.50.79 -i 192.168.50.182 -p ${SERVERPORT} -l 1 @@ -137,5 +189,7 @@ bashtrap() # test_ip2ip_recv_peer_hungup # SCENARIO X: Normal flow calls (Account) -test_account_send_hangup -# test_account_recv_peer_hungup \ No newline at end of file +# test_account_send_hangup +# test_account_send_peer_hungup +# test_account_recv_hangup +test_account_recv_peer_hungup \ No newline at end of file diff --git a/tools/pysflphone/pysflphone_testdbus.py b/tools/pysflphone/pysflphone_testdbus.py index 563b683456..733fbf5bf3 100644 --- a/tools/pysflphone/pysflphone_testdbus.py +++ b/tools/pysflphone/pysflphone_testdbus.py @@ -113,6 +113,7 @@ class SflPhoneTests(): # Start Glib mainloop self.sflphone.start() + def test_ip2ip_recv_peer_hungup(self): """Wait for calls, answer, peer hangup""" # Add callback for this test @@ -121,6 +122,7 @@ class SflPhoneTests(): # Start Glib mainloop self.sflphone.start() + def test_account_send_hangup(self): """Send new account call, hangup once peer answered""" print "test account send hangup" @@ -134,37 +136,42 @@ class SflPhoneTests(): time.sleep(0.5) i = i+1 - print "account hangup done" 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""" # Add callback for this test - self.sflphone.onIncomingCall_cb = acceptOnIncomingCall + self.sflphone.onIncomingCall_cb = acceptOnIncomingCallHangup # Start Glib mainloop self.sflphone.start() - -# def test_account_send_call_peer_hungup(self): -# """Register an account on a remote server and make several calls""" -# -# 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 + 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 + + # Start Glib mainloop + self.sflphone.start() @@ -195,6 +202,8 @@ sflphone.setFirstRegisteredAccount(); # - Wait for incoming calls # - Answer # - Call is hanged up by calle -testsuite.test_account_send_hangup() -# testsuite.test_account_recv_call_peer_hungup() +# testsuite.test_account_send_hangup() +# testsuite.test_account_send_peer_hungup() +# testsuite.test_account_recv_hangup() +testsuite.test_account_recv_peer_hungup() -- GitLab