mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00

Automated using the following commands: $ mv src/{dring,jami} $ git grep -l src/dring | xargs sed -i 's,src/dring,src/jami,g' $ git grep -l '#include "dring/' | \ xargs sed -i 's,#include "dring/,#include "jami/,g' $ git grep -l 'dring.h' | xargs sed -i 's,dring.h,jami.h,g' And finally, $ git grep -l 'dring' | xargs sed -i 's,dring,jami,g' $ files=$(find -name '*dring*' | sort) $ for f in $files; do mkdir -p "$(dirname "$f")"; \ mv "$f" "$(echo $f | sed 's/dring/jami/g')"; done To resolve a bad renaming favorably: $ git grep -l -i AlsaCarjami | \ xargs sed -i -E 's/([Aa])lsaCarjami/\1lsaCardRingtone/g' The above renaming command is not perfect, so some hand-tuning was required to complete it. * src/manager.cpp (Manager::ManagerPimpl::retrieveConfigPath): Preserve the dring.yml configuration file name, until we add something to migrate (rename) it to jami.yml. * man/dring.pod: Delete. * bin/dbus/jamid.pod: Move to ... * man/jamid.pod: here. * bin/dbus/meson.build (jamid_targets): Normalize man section to the pre-existing 1 and adjust accordingly. * src/jami/def.h (dring_EXPORTS): Rename to ... (jami_EXPORTS): ... this. change-Id: I9828be6da9c711ab2f22c4d1b9539fea89d7b6fb
388 lines
8.7 KiB
Python
388 lines
8.7 KiB
Python
#!/usr/bin/env python
|
|
import signal
|
|
|
|
import time
|
|
import sys
|
|
|
|
import getopt
|
|
import gtk
|
|
|
|
from threading import Thread
|
|
from threading import Event
|
|
|
|
print "Import SFLphone"
|
|
from sflphonectrlsimple import SflPhoneCtrlSimple
|
|
|
|
# Define remote IP address constant
|
|
REMOTEADDR_lo="127.0.0.1:5062"
|
|
REMOTEADDR_lo2="127.0.0.1:5064"
|
|
REMOTEADDR_lo3="127.0.0.1:5066"
|
|
|
|
# Defines phone numbers
|
|
PHONE1="27182"
|
|
PHONE2="31416"
|
|
PHONE3="14142"
|
|
|
|
|
|
# Define function callback to emulate UA behavior on
|
|
# receiving a call (peer hangup))
|
|
def acceptOnIncomingCall(sflphone):
|
|
|
|
sflphone.Accept(sflphone.currentCallId)
|
|
|
|
|
|
# Define function callback to emulate UA behavior on
|
|
# receiving a call and hanging up
|
|
def acceptOnIncomingCallHangup(sflphone):
|
|
|
|
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):
|
|
print "Create test instance"
|
|
self.sflphone = sfl
|
|
|
|
def test_get_allaccounts_methods(self):
|
|
|
|
for account in self.getAllAccounts():
|
|
print " " + account
|
|
|
|
for account in self.getAllRegisteredAccounts():
|
|
print " " + account
|
|
|
|
for account in self.getAllSipAccounts():
|
|
print " " + account
|
|
|
|
def test_create_account(self):
|
|
"""Create a new sip account"""
|
|
|
|
CONFIG_ACCOUNT_TYPE = "Account.type"
|
|
CONFIG_ACCOUNT_ALIAS = "Account.alias"
|
|
HOSTNAME = "hostname"
|
|
USERNAME = "username"
|
|
PASSWORD = "password"
|
|
|
|
accDetails = {CONFIG_ACCOUNT_TYPE:"SIP", CONFIG_ACCOUNT_ALIAS:"testsuiteaccount",
|
|
HOSTNAME:"192.168.50.79", USERNAME:"31416",
|
|
PASSWORD:"1234"}
|
|
|
|
|
|
accountID = self.sflphone.addAccount(accDetails)
|
|
print "New Account ID " + accountID
|
|
|
|
return accountID
|
|
|
|
|
|
def test_remove_account(self, accountID):
|
|
"""Remove test account"""
|
|
|
|
self.sflphone.removeAccount(accountID)
|
|
print "Account with ID " + accountID + " removed"
|
|
|
|
|
|
# SCENARIO 1 Test 1
|
|
def test_ip2ip_send_hangup(self):
|
|
"""Make a call to a server (sipp) on port 5062"""
|
|
i = 0
|
|
while(i < 500):
|
|
|
|
callid = self.sflphone.Call("sip:test@" + REMOTEADDR_lo)
|
|
time.sleep(0.5)
|
|
|
|
self.sflphone.HangUp(callid)
|
|
time.sleep(0.5)
|
|
|
|
i = i+1
|
|
|
|
self.sflphone.unregister()
|
|
del self.sflphone
|
|
|
|
|
|
# SCENARIO 1 Test 2
|
|
def test_ip2ip_send_peer_hungup(self):
|
|
"""Make a call to a server (sipp) on port 5062"""
|
|
i = 0
|
|
while(i < 10):
|
|
|
|
callid = self.sflphone.Call("sip:test@" + REMOTEADDR_lo)
|
|
time.sleep(1.0)
|
|
|
|
i = i+1
|
|
|
|
del self.sflphone
|
|
|
|
|
|
# SCENARIO 1 Test 3
|
|
def test_ip2ip_recv_hangup(self):
|
|
"""Wait for calls, answer then hangup"""
|
|
|
|
# Add callback for this test
|
|
self.sflphone.onIncomingCall_cb = acceptOnIncomingCallHangup
|
|
|
|
# Start Glib mainloop
|
|
self.sflphone.start()
|
|
|
|
|
|
|
|
|
|
# SCENARIO 1 Test 4
|
|
def test_ip2ip_recv_peer_hungup(self):
|
|
"""Wait for calls, answer, peer hangup"""
|
|
|
|
# Add callback for this test
|
|
self.sflphone.onIncomingCall_cb = acceptOnIncomingCall
|
|
|
|
# Start Glib mainloop
|
|
self.sflphone.start()
|
|
|
|
|
|
# SCENARIO 2 Test 1
|
|
def test_account_send_hangup(self):
|
|
"""Send new account call, hangup once peer answered"""
|
|
|
|
i = 0
|
|
while(i < 10):
|
|
|
|
callid = self.sflphone.Call(PHONE1)
|
|
time.sleep(0.2)
|
|
|
|
self.sflphone.HangUp(callid)
|
|
time.sleep(0.2)
|
|
|
|
i = i+1
|
|
|
|
# del self.sflphone
|
|
|
|
|
|
# SCENARIO 2 Test 2
|
|
def test_account_send_peer_hungup(self):
|
|
"""Send new account call, hangup once peer answered"""
|
|
|
|
i = 0
|
|
while(i < 10):
|
|
|
|
callid = self.sflphone.Call(PHONE1)
|
|
time.sleep(1.0)
|
|
|
|
i = i+1
|
|
|
|
del self.sflphone
|
|
|
|
|
|
# SCENARIO 2 Test 3
|
|
def test_account_recv_hangup(self):
|
|
"""Register an account and wait for incoming calls"""
|
|
|
|
# Add callback for this test
|
|
self.sflphone.onIncomingCall_cb = acceptOnIncomingCallHangup
|
|
|
|
# Start Glib mainloop
|
|
self.sflphone.start()
|
|
|
|
|
|
# SCENARIO 2 Test 4
|
|
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()
|
|
|
|
|
|
# SCENARIO 3 Test 1
|
|
def test_ip2ip_send_hold_offhold(self):
|
|
"""Send new call, hold this call, offhold, hangup"""
|
|
i = 0
|
|
while(i < 10):
|
|
|
|
callid = self.sflphone.Call("sip:test@" + REMOTEADDR_lo)
|
|
time.sleep(0.5)
|
|
|
|
self.sflphone.Hold(callid)
|
|
time.sleep(0.5)
|
|
|
|
self.sflphone.UnHold(callid)
|
|
time.sleep(0.5)
|
|
|
|
self.sflphone.HangUp(callid)
|
|
time.sleep(0.5)
|
|
|
|
i = i+1
|
|
|
|
del self.sflphone
|
|
|
|
|
|
# SCENARIO 4 Test 1
|
|
def test_account_send_transfer(self):
|
|
"""Send new calls, transfer it to a new instance"""
|
|
|
|
i = 0
|
|
while(i < 1):
|
|
|
|
callid = self.sflphone.Call(PHONE1)
|
|
time.sleep(1.0)
|
|
|
|
self.sflphone.Transfer(callid,PHONE3)
|
|
# self.sflphone.HangUp(callid)
|
|
# time.sleep(1.0)
|
|
|
|
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()
|
|
|
|
|
|
# SCENARIO 6 Test 1
|
|
def test_mult_ip2ip_send_hangup(self):
|
|
"""Make a first call to a sipp server (5062) and a second to sipp server (5064)"""
|
|
i = 0
|
|
while(i < 500):
|
|
|
|
callid1 = self.sflphone.Call("sip:test@" + REMOTEADDR_lo)
|
|
time.sleep(0.1)
|
|
|
|
callid2 = self.sflphone.Call("sip:test@" + REMOTEADDR_lo2)
|
|
time.sleep(0.1)
|
|
|
|
callid3 = self.sflphone.Call("sip:test@" + REMOTEADDR_lo3)
|
|
time.sleep(0.1)
|
|
|
|
self.sflphone.HangUp(callid1)
|
|
time.sleep(0.1)
|
|
|
|
self.sflphone.HangUp(callid2)
|
|
time.sleep(0.1)
|
|
|
|
self.sflphone.HangUp(callid3)
|
|
time.sleep(0.1)
|
|
|
|
i = i+1
|
|
|
|
del self.sflphone
|
|
|
|
|
|
# SCENARIO 6 Test 2
|
|
def test_mult_ip2ip_send_hangup(self):
|
|
"""Receive multiple calls peer hangup"""
|
|
|
|
# Add callback for this test
|
|
self.sflphone.onIncomingCall_cb = acceptOnIncomingCall
|
|
|
|
# Start Glib mainloop
|
|
self.sflphone.start()
|
|
|
|
del self.sflphone
|
|
|
|
|
|
|
|
# Open sflphone and connect to sflphoned through dbus
|
|
sflphone = SflPhoneCtrlSimple(True)
|
|
|
|
# Init test suite
|
|
testsuite = SflPhoneTests(sflphone)
|
|
|
|
# Register the first account available, should be the test account
|
|
sflphone.setFirstRegisteredAccount();
|
|
|
|
|
|
# ============================ Test Suite ============================
|
|
|
|
|
|
|
|
# SCENARIO 1: IP2IP Normal flow calls
|
|
|
|
# Test 1: - Send an IP2IP call
|
|
# - Hangup
|
|
# testsuite.test_ip2ip_send_hangup()
|
|
|
|
# Test 2: - Send an IP2IP call
|
|
# - Peer Hangup
|
|
# testsuite.test_ip2ip_send_peer_hungup()
|
|
|
|
# Test 3: - Receive an IP2IP call
|
|
# - Hangup
|
|
testsuite.test_ip2ip_recv_hangup()
|
|
|
|
# Test 4: - Receive an IP2IP call
|
|
# - Peer Hangup
|
|
# testsuite.test_ip2ip_recv_peer_hungup()
|
|
|
|
|
|
|
|
# SCENARIO 2: ACCOUNT Normal flow calls
|
|
|
|
# Test 1: - Send an ACCOUNT call
|
|
# - Hangup
|
|
# testsuite.test_account_send_hangup()
|
|
|
|
# Test 2: - Send an ACCOUNT call
|
|
# - Peer Hangup
|
|
# testsuite.test_account_send_peer_hungup()
|
|
|
|
# Test 3: - Receive an ACCOUNT call
|
|
# - Hangup
|
|
# testsuite.test_account_recv_hangup()
|
|
|
|
# Test 4: - Receive an ACCOUNT call
|
|
# - Peer Hangup
|
|
# testsuite.test_account_recv_peer_hungup()
|
|
|
|
|
|
|
|
# SCENARIO 3: IP2IP Call, HOLD/OFFHOLD
|
|
|
|
# Test 1: - Send an IP2IP call
|
|
# - Put this call on HOLD
|
|
# - Off HOLD this call
|
|
# - Hangup
|
|
# testsuite.test_ip2ip_send_hold_offhold()
|
|
|
|
|
|
|
|
# SCENARIO 4: IP2IP Call, HOLD/OFFHOLD
|
|
|
|
# Test 1: - Send an IP2IP call
|
|
# - 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()
|
|
|
|
|
|
|
|
# SCENARIO 6: Multiple simultaneous calls
|
|
|
|
# Test 1: - Send multiple simultaneous IP2IP call
|
|
# - Hangup
|
|
# testsuite.test_mult_ip2ip_send_hangup()
|
|
|
|
# Test 2: - Receive simultaneous IP2IP call
|
|
# - Hangup
|
|
# testsuite.test_mult_ip2ip_send_hangup()
|