Commit ced6c682 authored by Alexandre Savard's avatar Alexandre Savard

#9621: Implement conference functional tests

parent 00126a36
......@@ -59,11 +59,15 @@ class SflPhoneCtrl(Thread):
onCallCurrent_cb
onCallBusy_cb
onCallFailure_cb
onConferenceCreated_cb
"""
# list of active calls (known by the client)
activeCalls = {}
# list of active conferences
activeConferences = {}
def __init__(self, name=sys.argv[0]):
Thread.__init__(self)
......@@ -74,6 +78,7 @@ class SflPhoneCtrl(Thread):
self.name = name
self.currentCallId = ""
self.currentConfId = ""
self.isStop = False
......@@ -145,6 +150,7 @@ class SflPhoneCtrl(Thread):
print "Adding Incoming call method"
proxy_callmgr.connect_to_signal('incomingCall', self.onIncomingCall)
proxy_callmgr.connect_to_signal('callStateChanged', self.onCallStateChanged)
proxy_callmgr.connect_to_signal('conferenceCreated', self.onConferenceCreated)
except dbus.DBusException, e:
print e
......@@ -171,7 +177,7 @@ class SflPhoneCtrl(Thread):
def onIncomingCall_cb(self):
pass
def onCallHangup_cb(self):
def onCallHangup_cb(self, callId):
pass
def onCallRinging_cb(self):
......@@ -202,7 +208,7 @@ class SflPhoneCtrl(Thread):
def onCallHangUp(self, callid):
""" Remove callid from call list """
self.onCallHangup_cb()
self.onCallHangup_cb(callid)
self.currentCallId = ""
del self.activeCalls[callid]
......@@ -274,6 +280,12 @@ class SflPhoneCtrl(Thread):
else:
print "unknown state"
def onConferenceCreated_cb(self):
pass
def onConferenceCreated(self, confId):
self.currentConfId = confId
self.onConferenceCreated_cb()
#
# Account management
......@@ -545,9 +557,6 @@ class SflPhoneCtrl(Thread):
for call in self.activeCalls:
print "\t" + call
#
# Action
#
def Call(self, dest):
"""Start a call and return a CallID
......@@ -636,12 +645,6 @@ class SflPhoneCtrl(Thread):
def Hold(self, callid):
"""Hold a call identified by a CallID"""
# if not self.account:
# self.setFirstRegisteredAccount()
# if not self.isAccountRegistered():
# raise SflPhoneError("Can't hold a call without a registered account")
if callid is None or callid == "":
raise SflPhoneError("Invalid callID")
......@@ -651,12 +654,6 @@ class SflPhoneCtrl(Thread):
def UnHold(self, callid):
"""Unhold an incoming call identified by a CallID"""
# if not self.account:
# self.setFirstRegisteredAccount()
# if not self.isAccountRegistered():
# raise SflPhoneError("Can't unhold a call without a registered account")
if callid is None or callid == "":
raise SflPhoneError("Invalid callID")
......@@ -679,13 +676,30 @@ class SflPhoneCtrl(Thread):
callid = m.hexdigest()
return callid
def createConference(self, call1Id, call2Id):
""" Create a conference given the two call ids """
self.callmanager.joinParticipant(call1Id, call2Id)
def hangupConference(self, confId):
""" Hang up each call for this conference """
self.callmanager.hangUpConference(confId)
def run(self):
"""Processing method for this thread"""
context = self.loop.get_context()
context = self.loop.get_context()
while True:
context.iteration(True)
if self.isStop:
print "++++++++++++++++++++++++++++++++++++++++"
print "++++++++++++++++++++++++++++++++++++++++"
print "++++++++++++++++++++++++++++++++++++++++"
print "++++++++++++++++++++++++++++++++++++++++"
return
#!/usr/bin/env python
#
# Copyright (C) 2009 by the Free Software Foundation, Inc.
# Copyright (C) 2012 by the Free Software Foundation, Inc.
#
# Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
......@@ -22,7 +24,7 @@ class SippWrapper:
""" Wrapper taht allow for managing sipp command line easily """
def __init__(self):
self.commandLine = "sipp"
self.commandLine = "./sipp"
self.remoteServer = ""
self.remotePort = ""
self.localInterface = ""
......@@ -41,9 +43,11 @@ class SippWrapper:
self.enableTraceRtt = False
self.enableTraceLogs = False
def buildCommandLine(self):
def buildCommandLine(self, port):
""" Fill the command line arguments based on specified parameters """
self.localPort = str(port)
if not self.remotePort and not self.remoteServer:
self.isUserAgentClient = False
elif self.remotePort and not self.remoteServer:
......@@ -106,9 +110,8 @@ class SippWrapper:
def launch(self):
""" Launch the sipp instance using the specified arguments """
self.buildCommandLine()
print self.commandLine
return os.system(self.commandLine)
return os.system(self.commandLine + " 2>&1 > /dev/null")
class SippScreenStatParser:
......
<?xml version="1.0" encoding="ISO-8859-2" ?>
<!-- Use with CSV file struct like: 3000;192.168.1.106;[authentication username=3000 password=3000];
(user part of uri, server address, auth tag in each line)
-->
<scenario name="register_client">
<send retrans="500">
<![CDATA[
REGISTER sip:127.0.0.1 SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: <sip:300@127.0.0.1>;tag=[call_number]
To: <sip:400@127.0.0.1>
Call-ID: [call_id]
CSeq: [cseq] REGISTER
Contact: sip:300@[local_ip]:[local_port]
Max-Forwards: 10
Expires: 120
User-Agent: SIPp/Win32
Content-Length: 0
]]>
</send>
<!-- asterisk -->
<recv response="200">
<!--
<action>
<ereg regexp=".*" search_in="hdr" header="Contact:" check_it="true" assign_to="1" />
</action>
-->
</recv>
<!--
<recv request="INVITE" crlf="true">
</recv>
<send>
<![CDATA[
SIP/2.0 180 Ringing
[last_Via:]
[last_From:]
[last_To:];tag=[pid]SIPpTag01[call_number]
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
Content-Length: 0
]]>
</send>
<send retrans="500">
<![CDATA[
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:];tag=[pid]SIPpTag01[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"
optional="true"
rtd="true"
crlf="true">
</recv>
<recv request="BYE">
</recv>
<send>
<![CDATA[
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:]
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
Content-Length: 0
]]>
</send>
<timewait milliseconds="4000"/>
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
-->
</scenario>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment