Skip to content

Commit

Permalink
Merge pull request #19 from dariusstefan/3.5
Browse files Browse the repository at this point in the history
3.5
  • Loading branch information
razvancrainea authored Nov 21, 2024
2 parents 9ecf231 + 057c435 commit 5eca8c0
Show file tree
Hide file tree
Showing 57 changed files with 492 additions and 164 deletions.
6 changes: 2 additions & 4 deletions b2b/02.marketing/scenario.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@ tasks:
port: {{ operator_port }}

- name: Place Call
type: opensips-cli
type: opensips-mi
script: scripts/place_call.py
args:
- -x
- mi
- b2b_trigger_scenario
- marketing
- customer,sip:customer@{{ caller_ip }}:{{ caller_port }}
- media,sip:announcement@{{ media_ip }}:{{ media_port }}
Expand Down
24 changes: 24 additions & 0 deletions b2b/02.marketing/scripts/place_call.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from opensips.mi import OpenSIPSMI, OpenSIPSMIException
import sys
import os

mi_type = os.getenv('MI_TYPE', 'http')
mi_ip = os.getenv('MI_IP', '127.0.0.1')
mi_port = os.getenv('MI_PORT', '8888')

if mi_type == 'http':
handler = OpenSIPSMI(conn='http', url='http://{}:{}/mi'.format(mi_ip, mi_port))
elif mi_type == 'datagram':
handler = OpenSIPSMI(conn='datagram', datagram_ip=mi_ip, datagram_port=mi_port)
else:
sys.exit(1)

if len(sys.argv) < 5:
sys.exit(1)

try:
handler.execute("b2b_trigger_scenario",
[sys.argv[1], sys.argv[2], sys.argv[3], [sys.argv[4]]])
except OpenSIPSMIException as e:
print(e)
sys.exit(1)
2 changes: 1 addition & 1 deletion b2b/17.refer-unattended-uac-mi/scenario.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ tasks:
wait: 0.5

- name: MI transfer
type: opensips-cli
type: opensips-mi
script: scripts/transfer.py
args: sip:transfer@{{ transfer_ip }}:{{ transfer_port }} 1
require:
Expand Down
18 changes: 14 additions & 4 deletions b2b/17.refer-unattended-uac-mi/scripts/transfer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
from opensipscli import cli
from opensips.mi import OpenSIPSMI
import sys
import os

handler = cli.OpenSIPSCLI()
mi_type = os.getenv('MI_TYPE', 'http')
mi_ip = os.getenv('MI_IP', '127.0.0.1')
mi_port = os.getenv('MI_PORT', '8888')

if mi_type == 'http':
handler = OpenSIPSMI(conn='http', url='http://{}:{}/mi'.format(mi_ip, mi_port))
elif mi_type == 'datagram':
handler = OpenSIPSMI(conn='datagram', datagram_ip=mi_ip, datagram_port=mi_port)
else:
sys.exit(1)

if len(sys.argv) < 3:
print("Usage: {} URI entity".format(sys.argv[0]))
Expand All @@ -11,9 +21,9 @@
entity = sys.argv[2]
prov_media_uri = sys.argv[3] if len(sys.argv) > 3 else None

dialogs = handler.mi("b2b_list")
dialogs = handler.execute("b2b_list")
logic = dialogs['Tuples'][0]['key'] # we are only interested in the first dialog
params = {'dialog_id':logic, 'new_uri':uri, 'flag':entity}
if prov_media_uri:
params['prov_media_uri'] = prov_media_uri
handler.mi("b2b_bridge", params)
handler.execute("b2b_bridge", params)
2 changes: 1 addition & 1 deletion b2b/18.refer-unattended-uas-mi/scenario.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ tasks:
wait: 0.5

- name: MI transfer
type: opensips-cli
type: opensips-mi
script: scripts/transfer.py
args: sip:transfer@{{ transfer_ip }}:{{ transfer_port }} 0
require:
Expand Down
18 changes: 14 additions & 4 deletions b2b/18.refer-unattended-uas-mi/scripts/transfer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
from opensipscli import cli
from opensips.mi import OpenSIPSMI
import sys
import os

handler = cli.OpenSIPSCLI()
mi_type = os.getenv('MI_TYPE', 'http')
mi_ip = os.getenv('MI_IP', '127.0.0.1')
mi_port = os.getenv('MI_PORT', '8888')

if mi_type == 'http':
handler = OpenSIPSMI(conn='http', url='http://{}:{}/mi'.format(mi_ip, mi_port))
elif mi_type == 'datagram':
handler = OpenSIPSMI(conn='datagram', datagram_ip=mi_ip, datagram_port=mi_port)
else:
sys.exit(1)

if len(sys.argv) < 3:
print("Usage: {} URI entity".format(sys.argv[0]))
Expand All @@ -11,9 +21,9 @@
entity = sys.argv[2]
prov_media_uri = sys.argv[3] if len(sys.argv) > 3 else None

dialogs = handler.mi("b2b_list")
dialogs = handler.execute("b2b_list")
logic = dialogs['Tuples'][0]['key'] # we are only interested in the first dialog
params = {'dialog_id':logic, 'new_uri':uri, 'flag':entity}
if prov_media_uri:
params['prov_media_uri'] = prov_media_uri
handler.mi("b2b_bridge", params)
handler.execute("b2b_bridge", params)
2 changes: 1 addition & 1 deletion b2b/19.refer-unattended-uac-prov-mi/scenario.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ tasks:
wait: 0.5

- name: MI transfer
type: opensips-cli
type: opensips-mi
script: scripts/transfer.py
args:
- sip:transfer@{{ transfer_ip }}:{{ transfer_port }}
Expand Down
18 changes: 14 additions & 4 deletions b2b/19.refer-unattended-uac-prov-mi/scripts/transfer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
from opensipscli import cli
from opensips.mi import OpenSIPSMI
import sys
import os

handler = cli.OpenSIPSCLI()
mi_type = os.getenv('MI_TYPE', 'http')
mi_ip = os.getenv('MI_IP', '127.0.0.1')
mi_port = os.getenv('MI_PORT', '8888')

if mi_type == 'http':
handler = OpenSIPSMI(conn='http', url='http://{}:{}/mi'.format(mi_ip, mi_port))
elif mi_type == 'datagram':
handler = OpenSIPSMI(conn='datagram', datagram_ip=mi_ip, datagram_port=mi_port)
else:
sys.exit(1)

if len(sys.argv) < 3:
print("Usage: {} URI entity".format(sys.argv[0]))
Expand All @@ -11,9 +21,9 @@
entity = sys.argv[2]
prov_media_uri = sys.argv[3] if len(sys.argv) > 3 else None

dialogs = handler.mi("b2b_list")
dialogs = handler.execute("b2b_list")
logic = dialogs['Tuples'][0]['key'] # we are only interested in the first dialog
params = {'dialog_id':logic, 'new_uri':uri, 'flag':entity}
if prov_media_uri:
params['prov_media_uri'] = prov_media_uri
handler.mi("b2b_bridge", params)
handler.execute("b2b_bridge", params)
2 changes: 1 addition & 1 deletion b2b/20.refer-unattended-uas-prov-mi/scenario.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ tasks:
wait: 0.5

- name: MI transfer
type: opensips-cli
type: opensips-mi
script: scripts/transfer.py
args:
- sip:transfer@{{ transfer_ip }}:{{ transfer_port }}
Expand Down
18 changes: 14 additions & 4 deletions b2b/20.refer-unattended-uas-prov-mi/scripts/transfer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
from opensipscli import cli
from opensips.mi import OpenSIPSMI
import sys
import os

handler = cli.OpenSIPSCLI()
mi_type = os.getenv('MI_TYPE', 'http')
mi_ip = os.getenv('MI_IP', '127.0.0.1')
mi_port = os.getenv('MI_PORT', '8888')

if mi_type == 'http':
handler = OpenSIPSMI(conn='http', url='http://{}:{}/mi'.format(mi_ip, mi_port))
elif mi_type == 'datagram':
handler = OpenSIPSMI(conn='datagram', datagram_ip=mi_ip, datagram_port=mi_port)
else:
sys.exit(1)

if len(sys.argv) < 3:
print("Usage: {} URI entity".format(sys.argv[0]))
Expand All @@ -11,9 +21,9 @@
entity = sys.argv[2]
prov_media_uri = sys.argv[3] if len(sys.argv) > 3 else None

dialogs = handler.mi("b2b_list")
dialogs = handler.execute("b2b_list")
logic = dialogs['Tuples'][0]['key'] # we are only interested in the first dialog
params = {'dialog_id':logic, 'new_uri':uri, 'flag':entity}
if prov_media_uri:
params['prov_media_uri'] = prov_media_uri
handler.mi("b2b_bridge", params)
handler.execute("b2b_bridge", params)
2 changes: 2 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ defaults:
domain: {{ opensips_ip }}
opensips-cli:
mi_ip: {{ opensips_ip }}
opensips-mi:
mi_ip: {{ opensips_ip }}
opensips:
ip: {{ opensips_ip }}
image: opensips/opensips:sipssert{% if opensips_version is defined %}-{{ opensips_version }}{% endif %}
Expand Down
4 changes: 2 additions & 2 deletions dialog/01.dialog/scenario.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ tasks:
wait: 0.5

- name: MI check active
type: opensips-cli
type: opensips-mi
script: scripts/check-dialog.py
args: active
require:
Expand All @@ -53,7 +53,7 @@ tasks:

# dialog should be deleted after SIPP finishes
- name: MI check deleted
type: opensips-cli
type: opensips-mi
script: scripts/check-dialog.py
args: deleted
require: SIPP UAC
Expand Down
20 changes: 15 additions & 5 deletions dialog/01.dialog/scripts/check-dialog.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,32 @@
from opensipscli import cli
from opensips.mi import OpenSIPSMI
import sys
import os

handler = cli.OpenSIPSCLI()
mi_type = os.getenv('MI_TYPE', 'http')
mi_ip = os.getenv('MI_IP', '127.0.0.1')
mi_port = os.getenv('MI_PORT', '8888')

if mi_type == 'http':
handler = OpenSIPSMI(conn='http', url='http://{}:{}/mi'.format(mi_ip, mi_port))
elif mi_type == 'datagram':
handler = OpenSIPSMI(conn='datagram', datagram_ip=mi_ip, datagram_port=mi_port)
else:
sys.exit(1)

if len(sys.argv) < 1:
sys.exit(-1)

dialogs = handler.mi("dlg_list")['Dialogs']
dialogs = handler.execute("dlg_list")['Dialogs']
if sys.argv[1] == "active":
out = handler.mi("get_statistics", {"statistics" : ["active_dialogs"]})
out = handler.execute("get_statistics", {"statistics" : ["active_dialogs"]})
if out["dialog:active_dialogs"] != 1:
print("Active dialogs: {}".format(out["dialog:active_dialogs"]))
sys.exit(11)
if len(dialogs) != 1:
print("Number of dialogs: {}".format(len(dialogs)))
sys.exit(12)
elif sys.argv[1] == "deleted":
out = handler.mi("get_statistics", {"statistics" : ["dialog:"]})
out = handler.execute("get_statistics", {"statistics" : ["dialog:"]})
if out["dialog:active_dialogs"] != 0:
print("Active dialogs: {}".format(out["dialog:active_dialogs"]))
sys.exit(21)
Expand Down
4 changes: 2 additions & 2 deletions dialog/02.pinging/scenario.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ tasks:
wait: 0.5

- name: MI check active
type: opensips-cli
type: opensips-mi
script: scripts/check-dialog.py
args: active
require:
Expand All @@ -53,7 +53,7 @@ tasks:

# dialog should be deleted after SIPP finishes
- name: MI check deleted
type: opensips-cli
type: opensips-mi
script: scripts/check-dialog.py
args: deleted
require: SIPP UAC
Expand Down
20 changes: 15 additions & 5 deletions dialog/02.pinging/scripts/check-dialog.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,32 @@
from opensipscli import cli
from opensips.mi import OpenSIPSMI
import sys
import os

handler = cli.OpenSIPSCLI()
mi_type = os.getenv('MI_TYPE', 'http')
mi_ip = os.getenv('MI_IP', '127.0.0.1')
mi_port = os.getenv('MI_PORT', '8888')

if mi_type == 'http':
handler = OpenSIPSMI(conn='http', url='http://{}:{}/mi'.format(mi_ip, mi_port))
elif mi_type == 'datagram':
handler = OpenSIPSMI(conn='datagram', datagram_ip=mi_ip, datagram_port=mi_port)
else:
sys.exit(1)

if len(sys.argv) < 1:
sys.exit(-1)

dialogs = handler.mi("dlg_list")['Dialogs']
dialogs = handler.execute("dlg_list")['Dialogs']
if sys.argv[1] == "active":
out = handler.mi("get_statistics", {"statistics" : ["active_dialogs"]})
out = handler.execute("get_statistics", {"statistics" : ["active_dialogs"]})
if out["dialog:active_dialogs"] != 1:
print("Active dialogs: {}".format(out["dialog:active_dialogs"]))
sys.exit(11)
if len(dialogs) != 1:
print("Number of dialogs: {}".format(len(dialogs)))
sys.exit(12)
elif sys.argv[1] == "deleted":
out = handler.mi("get_statistics", {"statistics" : ["dialog:"]})
out = handler.execute("get_statistics", {"statistics" : ["dialog:"]})
if out["dialog:active_dialogs"] != 0:
print("Active dialogs: {}".format(out["dialog:active_dialogs"]))
sys.exit(21)
Expand Down
4 changes: 2 additions & 2 deletions dialog/03.reinvite-pinging/scenario.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ tasks:
wait: 0.5

- name: MI check active
type: opensips-cli
type: opensips-mi
script: scripts/check-dialog.py
args: active
require:
Expand All @@ -53,7 +53,7 @@ tasks:

# dialog should be deleted after SIPP finishes
- name: MI check deleted
type: opensips-cli
type: opensips-mi
script: scripts/check-dialog.py
args: deleted
require: SIPP UAC
Expand Down
20 changes: 15 additions & 5 deletions dialog/03.reinvite-pinging/scripts/check-dialog.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,32 @@
from opensipscli import cli
from opensips.mi import OpenSIPSMI
import sys
import os

handler = cli.OpenSIPSCLI()
mi_type = os.getenv('MI_TYPE', 'http')
mi_ip = os.getenv('MI_IP', '127.0.0.1')
mi_port = os.getenv('MI_PORT', '8888')

if mi_type == 'http':
handler = OpenSIPSMI(conn='http', url='http://{}:{}/mi'.format(mi_ip, mi_port))
elif mi_type == 'datagram':
handler = OpenSIPSMI(conn='datagram', datagram_ip=mi_ip, datagram_port=mi_port)
else:
sys.exit(1)

if len(sys.argv) < 1:
sys.exit(-1)

dialogs = handler.mi("dlg_list")['Dialogs']
dialogs = handler.execute("dlg_list")['Dialogs']
if sys.argv[1] == "active":
out = handler.mi("get_statistics", {"statistics" : ["active_dialogs"]})
out = handler.execute("get_statistics", {"statistics" : ["active_dialogs"]})
if out["dialog:active_dialogs"] != 1:
print("Active dialogs: {}".format(out["dialog:active_dialogs"]))
sys.exit(11)
if len(dialogs) != 1:
print("Number of dialogs: {}".format(len(dialogs)))
sys.exit(12)
elif sys.argv[1] == "deleted":
out = handler.mi("get_statistics", {"statistics" : ["dialog:"]})
out = handler.execute("get_statistics", {"statistics" : ["dialog:"]})
if out["dialog:active_dialogs"] != 0:
print("Active dialogs: {}".format(out["dialog:active_dialogs"]))
sys.exit(21)
Expand Down
4 changes: 2 additions & 2 deletions dialog/04.expire/scenario.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ tasks:
wait: 0.5

- name: MI check active
type: opensips-cli
type: opensips-mi
script: scripts/check-dialog.py
args: active
require:
Expand All @@ -52,7 +52,7 @@ tasks:

# dialog should be deleted after SIPP finishes
- name: MI check deleted
type: opensips-cli
type: opensips-mi
script: scripts/check-dialog.py
args: deleted
require:
Expand Down
Loading

0 comments on commit 5eca8c0

Please sign in to comment.