diff --git a/sippxml/ip2ip_uac_send_hangup.xml b/sippxml/ip2ip_uac_send_hangup.xml index 49cc63fca06e2cd1f2a40f1f65929de436da7d6b..8b801eb49438bb553a448f28e2c410f86c34a234 100644 --- a/sippxml/ip2ip_uac_send_hangup.xml +++ b/sippxml/ip2ip_uac_send_hangup.xml @@ -95,6 +95,4 @@ <recv response="200"> </recv> - <pause milliseconds="1000"/> - </scenario> diff --git a/sippxml/ip2ip_uac_send_peer_hungup.xml b/sippxml/ip2ip_uac_send_peer_hungup.xml index 4e811e38262f10680417f9415e960e33585b26ee..048b0d8a062521288ed6afc5c21934a2232dd30a 100644 --- a/sippxml/ip2ip_uac_send_peer_hungup.xml +++ b/sippxml/ip2ip_uac_send_peer_hungup.xml @@ -89,6 +89,4 @@ ]]> </send> - <pause milliseconds="1000"/> - </scenario> diff --git a/sippxml/testsuiteuac.sh b/sippxml/testsuiteuac.sh index 1ed0db416504d9abc8288a3a56e8b848d0e46263..9e993dfeb80926a0b7131add92bc4d657ab89726 100644 --- a/sippxml/testsuiteuac.sh +++ b/sippxml/testsuiteuac.sh @@ -62,29 +62,7 @@ function test_ip2ip_recv_hangup { # sleep 1; # start sipp client and send calls - sipp -sf ip2ip_uac_send_peer_hungup.xml ${REMOTEADDR_lo} -i ${LOCALIP_lo} -p ${LOCALPORT} -l 1 -m 10 - - # kill every one - # bashtrap -} - - -# SCENARIO 1 Test 4 -function test_ip2ip_recv_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; - - # start sipp client and send calls - sipp -sf ip2ip_uac_send_hangup.xml ${REMOTEADDR_lo} -i ${LOCALIP_lo} -p ${LOCALPORT} -l 1 -m 10 + sipp -sf ip2ip_uac_send_peer_hungup.xmlip2ip_uac_send_hangup.xml ${REMOTEADDR_lo} -i ${LOCALIP_lo} -p ${LOCALPORT} -l 1 -m 10 # kill every one # bashtrap @@ -230,6 +208,26 @@ function test_account_send_transfer { } +# SCENARIO 5 Test 1 +function test_ip2ip_send_refused { + + # start sflphoned + # /usr/lib/sflphone/sflphoned& + + # start sipp server to receive calls from sflphone and then hangup + sipp -sf ip2ip_uac_send_refused.xml ${REMOTEADDR_lo} -s ${REMOTEADDR_lo} -i ${LOCALIP_lo} -p ${LOCALPORT} -l 1 + + # wait some time to make sure sflphoned is started + # sleep 1; + + # run python client and script to make calls + # python ../tools/pysflphone/pysflphone_testdbus.py & + + # kill every one + bashtrap +} + + # function called if CTRL-C detected bashtrap() { @@ -288,7 +286,7 @@ bashtrap() # - Put this call on HOLD # - Off HOLD this call # - Hangup -test_ip2ip_send_hold_offhold +# test_ip2ip_send_hold_offhold @@ -297,4 +295,11 @@ test_ip2ip_send_hold_offhold # Test 1: - Send an IP2IP call # - Transfer this call to another sipp instance # - Hangup -# test_account_send_transfer \ No newline at end of file +# test_account_send_transfer + + +#SCENARIO 5: Refuse call (IP2IP) + +# Test 1: - Receive a call +# - Refuse (hangup without answer) +test_ip2ip_send_refused \ No newline at end of file diff --git a/tools/pysflphone/pysflphone_testdbus.py b/tools/pysflphone/pysflphone_testdbus.py index a1c909c531fb3a2b73306c59466039e26bbcefb1..933f8736c9ab8e57183006a92069910119ff66d2 100644 --- a/tools/pysflphone/pysflphone_testdbus.py +++ b/tools/pysflphone/pysflphone_testdbus.py @@ -21,21 +21,29 @@ PHONE1="27182" PHONE2="31416" PHONE3="14142" + # Define function callback to emulate UA behavior on -# recieving a call +# recieving a call (peer hangup)) def acceptOnIncomingCall(sflphone): - time.sleep(0.2) + sflphone.Accept(sflphone.currentCallId) + # Define function callback to emulate UA behavior on # receiving a call and hanging up def acceptOnIncomingCallHangup(sflphone): - time.sleep(0.2) - sflphone.Accept(sflphone.currentCallId) - time.sleep(0.5) + + sflphone.Accept(sflphone.currentCallId) sflphone.HangUp(sflphone.currentCallId) +# Define function callback to emulate UA behavior on +# refusing a call +def refuseOnIncomingCall(sflphone): + # time.sleep(0.5) + sflphone.Refuse(sflphone.currentCallId) + + class SflPhoneTests(): def __init__(self, sfl): @@ -230,6 +238,17 @@ class SflPhoneTests(): i = i+1 + # SCENARIO 5 Test 1 + def test_ip2ip_recv_refuse(self): + """Receive an incoming IP2IP call, refuse it""" + + # Add callback for this test + self.sflphone.onIncomingCall_cb = refuseOnIncomingCall + + # Start Glib mainloop + self.sflphone.start() + + # Open sflphone and connect to sflphoned through dbus sflphone = SflPhoneCtrlSimple(True) @@ -291,7 +310,7 @@ sflphone.setFirstRegisteredAccount(); # - Put this call on HOLD # - Off HOLD this call # - Hangup -testsuite.test_ip2ip_send_hold_offhold() +# testsuite.test_ip2ip_send_hold_offhold() @@ -301,3 +320,11 @@ testsuite.test_ip2ip_send_hold_offhold() # - Transfer this call to another sipp instance # - Hangup # testsuite.test_account_send_transfer() + + + +# SCENARIO 5: IP2IP Call, Refuse + +# Test 1: - Receive an incoming call +# - Hangup without answer +testsuite.test_ip2ip_recv_refuse() diff --git a/tools/pysflphone/sflphonectrlsimple.py b/tools/pysflphone/sflphonectrlsimple.py index a19d4ab0901f4b28fb2081d3f68fc58a5419b2e1..df298ce7911367b78f6c29274ea926326ea400f9 100755 --- a/tools/pysflphone/sflphonectrlsimple.py +++ b/tools/pysflphone/sflphonectrlsimple.py @@ -534,11 +534,11 @@ class SflPhoneCtrlSimple(Thread): def Refuse(self, callid): """Refuse an incoming call identified by a CallID""" - if not self.account: - self.setFirstRegisteredAccount() + # if not self.account: + # self.setFirstRegisteredAccount() - if not self.isAccountRegistered(): - raise SflPhoneError("Can't refuse a call without a registered account") + # if not self.isAccountRegistered(): + # raise SflPhoneError("Can't refuse a call without a registered account") if callid is None or callid == "": raise SflPhoneError("Invalid callID")