Skip to content

Commit

Permalink
Merge pull request #16 from dariusstefan/main
Browse files Browse the repository at this point in the history
Fix b2b_trigger_scenario array params
  • Loading branch information
razvancrainea authored Nov 20, 2024
2 parents a120d49 + d4197b4 commit e854ec3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion b2b/02.marketing/scenario.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ tasks:

- name: Place Call
type: opensips-mi
script: scripts/place_call.py
args:
- 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)

0 comments on commit e854ec3

Please sign in to comment.