Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new opensips-mi task. #15

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions b2b/02.marketing/scenario.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ tasks:
port: {{ operator_port }}

- name: Place Call
type: opensips-cli
type: opensips-mi
args:
- -x
- mi
- b2b_trigger_scenario
- marketing
- customer,sip:customer@{{ caller_ip }}:{{ caller_port }}
Expand Down
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
Loading