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

[#3014] New test for Call Refuse

parent 851c1b8b
No related branches found
No related tags found
No related merge requests found
......@@ -95,6 +95,4 @@
<recv response="200">
</recv>
<pause milliseconds="1000"/>
</scenario>
......@@ -89,6 +89,4 @@
]]>
</send>
<pause milliseconds="1000"/>
</scenario>
......@@ -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
......@@ -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()
......@@ -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")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment