mirror of https://github.com/sipwise/sems.git
Otherwise we're missing plenty of audio files in /usr/lib/ngcp-sems/audio/,
several plugins in /usr/lib/ngcp-sems/plug-in/, as well as a bunch of binaries:
* /usr/sbin/ngcp-sems-get-callproperties
* /usr/sbin/ngcp-sems-list-active-calls
* /usr/sbin/ngcp-sems-list-calls
* /usr/sbin/ngcp-sems-list-finished-calls
* /usr/sbin/ngcp-sems-sbc-get-activeprofile
* /usr/sbin/ngcp-sems-sbc-get-regex-map-names
* /usr/sbin/ngcp-sems-sbc-list-profiles
* /usr/sbin/ngcp-sems-sbc-load-callcontrol-modules
* /usr/sbin/ngcp-sems-sbc-load-profile
* /usr/sbin/ngcp-sems-sbc-reload-profile
* /usr/sbin/ngcp-sems-sbc-reload-profiles
* /usr/sbin/ngcp-sems-sbc-set-activeprofile
* /usr/sbin/ngcp-sems-sbc-set-regex-map
* /usr/sbin/ngcp-sems-sbc-teardown-call
* /usr/sbin/ngcp-sems-webconference-addparticipant
* /usr/sbin/ngcp-sems-webconference-roomcreate
* /usr/sbin/ngcp-sems-webconference-roominfo
This fixes a regression introduced in commit 1619876f76 (TT#101059).
Ported the python2 scripts we ship with our Debian package to python3
(AKA py3k), fixed inconsistent use of tabs and spaces in indentation
and indention in several files:
* apps/sbc/tools/sems-sbc-*
* apps/examples/db_announce/announcement.py
* apps/examples/py_sems_ex/*py
We're also not installing the *.pyc files (see
apps/ivr/Makefile.ivr_application +
apps/py_sems/Makefile.py_sems_application), they don't exist in py3k
builds and it wouldn't make any sense to ship them in Debian packages
anyway.
(real ticket number: TT#105412)
Change-Id: I44f0f76b4577501eb31fe814781f47087cfd16dd
mr11.2.1
parent
f593f91523
commit
b126b455e2
@ -1,113 +1,112 @@
|
||||
import base64,time,os,sip
|
||||
import base64, time, os, sip
|
||||
|
||||
from py_sems_log import *
|
||||
from py_sems import *
|
||||
from py_sems_lib import *
|
||||
|
||||
|
||||
class PySemsScript(PySemsDialog):
|
||||
def __init__(self):
|
||||
|
||||
debug("***** __init__ *******")
|
||||
PySemsDialog.__init__(self)
|
||||
self.initial_req = None
|
||||
self.ann = None
|
||||
sip.settracemask(0xFFFF)
|
||||
|
||||
def onInvite(self, req):
|
||||
|
||||
print("----------------- %s ----------------" % self.__class__)
|
||||
|
||||
ann_file = self.getAnnounceFile(req)
|
||||
self.ann = AmAudioFile()
|
||||
|
||||
try:
|
||||
self.ann.open(ann_file)
|
||||
|
||||
self.initial_req = AmSipRequest(req)
|
||||
debug("dlg.local_tag: %s" % self.dlg.local_tag)
|
||||
|
||||
debug("***** onInvite *******")
|
||||
(res, sdp_reply) = self.acceptAudio(req.body, req.hdrs)
|
||||
if res < 0:
|
||||
self.dlg.reply(req, 500)
|
||||
|
||||
debug("res = %s" % repr(res))
|
||||
debug("sdp_reply = %s" % sdp_reply)
|
||||
|
||||
if self.dlg.reply(req, 183, "OK", "application/sdp", sdp_reply, "") != 0:
|
||||
self.setStopped()
|
||||
except:
|
||||
self.dlg.reply(req, 500, "File not found", "", "", "")
|
||||
self.ann = None
|
||||
self.setStopped()
|
||||
raise
|
||||
|
||||
def onSessionStart(self, req):
|
||||
|
||||
debug("***** onSessionStart *******")
|
||||
PySemsDialog.onSessionStart(self, req)
|
||||
|
||||
self.localreq = AmSipRequest(req)
|
||||
self.setOutput(self.ann)
|
||||
|
||||
def onCancel(self):
|
||||
|
||||
debug("***** onCancel *******")
|
||||
|
||||
self.dlg.reply(self.initial_req, 487, "Call terminated", "", "", "")
|
||||
self.setStopped()
|
||||
|
||||
def getAnnounceFile(self, req):
|
||||
|
||||
announce_file = (
|
||||
config["announce_path"]
|
||||
+ req.domain
|
||||
+ "/"
|
||||
+ get_header_param(req.r_uri, "play")
|
||||
+ ".wav"
|
||||
)
|
||||
|
||||
debug("trying '%s'", announce_file)
|
||||
if os.path.exists(announce_file):
|
||||
return announce_file
|
||||
|
||||
announce_file = config["announce_path"] + req.user + ".wav"
|
||||
debug("trying '%s'", announce_file)
|
||||
if os.path.exists(announce_file):
|
||||
return announce_file
|
||||
|
||||
announce_file = config["announce_path"] + config["announce_file"]
|
||||
debug("using default '%s'", announce_file)
|
||||
return announce_file
|
||||
|
||||
def process(self, ev):
|
||||
|
||||
debug("*********** PySemsScript.process **************")
|
||||
if isinstance(ev, AmAudioEvent):
|
||||
if ev.event_id == AmAudioEvent.cleared:
|
||||
|
||||
debug("AmAudioEvent.cleared")
|
||||
|
||||
code = getHeader(self.localreq.hdrs, "P-Final-Reply-Code")
|
||||
reason = getHeader(self.localreq.hdrs, "P-Final-Reply-Reason")
|
||||
|
||||
if reason == "":
|
||||
reason = "OK"
|
||||
|
||||
code_i = 400
|
||||
try:
|
||||
code_i = int(code)
|
||||
if (code_i < 300) or (code_i > 699):
|
||||
debug("Invalid reply code: %d", code_i)
|
||||
except:
|
||||
debug("Invalid reply code: %s", code)
|
||||
|
||||
debug("Replying %d %s" % (code_i, reason))
|
||||
self.dlg.reply(self.localreq, code_i, reason, "", "", "")
|
||||
self.setStopped()
|
||||
return
|
||||
|
||||
def __init__(self):
|
||||
|
||||
debug("***** __init__ *******")
|
||||
PySemsDialog.__init__(self)
|
||||
self.initial_req = None
|
||||
self.ann = None
|
||||
sip.settracemask(0xFFFF)
|
||||
|
||||
def onInvite(self,req):
|
||||
|
||||
|
||||
print "----------------- %s ----------------" % self.__class__
|
||||
|
||||
ann_file = self.getAnnounceFile(req)
|
||||
self.ann = AmAudioFile()
|
||||
|
||||
try:
|
||||
self.ann.open(ann_file)
|
||||
|
||||
self.initial_req = AmSipRequest(req)
|
||||
debug("dlg.local_tag: %s" % self.dlg.local_tag)
|
||||
|
||||
debug("***** onInvite *******")
|
||||
(res,sdp_reply) = self.acceptAudio(req.body,req.hdrs)
|
||||
if res < 0:
|
||||
self.dlg.reply(req,500)
|
||||
|
||||
debug("res = %s" % repr(res))
|
||||
debug("sdp_reply = %s" % sdp_reply)
|
||||
|
||||
if self.dlg.reply(req,183,"OK","application/sdp",sdp_reply,"") <> 0:
|
||||
self.setStopped()
|
||||
except:
|
||||
self.dlg.reply(req,500,"File not found","","","")
|
||||
self.ann = None
|
||||
self.setStopped()
|
||||
raise
|
||||
|
||||
|
||||
def onSessionStart(self,req):
|
||||
|
||||
debug("***** onSessionStart *******")
|
||||
PySemsDialog.onSessionStart(self,req)
|
||||
|
||||
self.localreq = AmSipRequest(req)
|
||||
self.setOutput(self.ann)
|
||||
|
||||
|
||||
def onCancel(self):
|
||||
|
||||
debug("***** onCancel *******")
|
||||
|
||||
self.dlg.reply(self.initial_req,487,"Call terminated","","","")
|
||||
self.setStopped()
|
||||
|
||||
|
||||
def getAnnounceFile(self,req):
|
||||
|
||||
announce_file = config["announce_path"] + req.domain + "/" + get_header_param(req.r_uri, "play") + ".wav"
|
||||
|
||||
debug("trying '%s'",announce_file)
|
||||
if os.path.exists(announce_file):
|
||||
return announce_file
|
||||
|
||||
announce_file = config["announce_path"] + req.user + ".wav"
|
||||
debug("trying '%s'",announce_file)
|
||||
if os.path.exists(announce_file):
|
||||
return announce_file
|
||||
|
||||
announce_file = config["announce_path"] + config["announce_file"]
|
||||
debug("using default '%s'",announce_file)
|
||||
return announce_file
|
||||
|
||||
|
||||
def process(self,ev):
|
||||
|
||||
debug("*********** PySemsScript.process **************")
|
||||
if isinstance(ev,AmAudioEvent):
|
||||
if ev.event_id == AmAudioEvent.cleared:
|
||||
|
||||
debug("AmAudioEvent.cleared")
|
||||
|
||||
code = getHeader(self.localreq.hdrs,"P-Final-Reply-Code")
|
||||
reason = getHeader(self.localreq.hdrs,"P-Final-Reply-Reason")
|
||||
|
||||
if reason == "":
|
||||
reason = "OK"
|
||||
|
||||
code_i = 400
|
||||
try:
|
||||
code_i = int(code)
|
||||
if (code_i < 300) or (code_i>699):
|
||||
debug("Invalid reply code: %d",code_i)
|
||||
except:
|
||||
debug("Invalid reply code: %s",code)
|
||||
|
||||
debug("Replying %d %s" % (code_i, reason))
|
||||
self.dlg.reply(self.localreq, code_i, reason, "", "", "")
|
||||
self.setStopped()
|
||||
return
|
||||
|
||||
PySemsDialog.process(self,ev);
|
||||
return
|
||||
|
||||
|
||||
PySemsDialog.process(self, ev)
|
||||
return
|
||||
|
||||
@ -1,110 +1,123 @@
|
||||
import base64,time,os,sip
|
||||
import base64, time, os, sip
|
||||
|
||||
from py_sems_log import *
|
||||
from py_sems import *
|
||||
from py_sems_lib import *
|
||||
|
||||
|
||||
class MyB2ABEvent(PySemsB2ABEvent):
|
||||
def __init__(self, id):
|
||||
PySemsB2ABEvent.__init__(self,id)
|
||||
def __init__(self, id):
|
||||
PySemsB2ABEvent.__init__(self, id)
|
||||
|
||||
|
||||
class MyCalleeSession(PySemsB2ABCalleeDialog):
|
||||
def __init__(self, tag):
|
||||
debug("**** __init callee __ ****")
|
||||
AmB2ABCalleeSession.__init__(self, tag)
|
||||
self.ann=None
|
||||
#debug("**** tag = " + tag);
|
||||
|
||||
def onPyB2ABEvent(self, ev):
|
||||
debug("***************************** callee PyB2ABEvent ************************")
|
||||
if isinstance(ev, MyB2ABEvent):
|
||||
self.ann = AmAudioFile()
|
||||
self.ann.open("/tmp/test.wav")
|
||||
self.setOutput(self.ann)
|
||||
return
|
||||
|
||||
|
||||
class PySemsScript(PySemsB2ABDialog):
|
||||
def __init__(self, tag):
|
||||
debug("**** __init callee __ ****")
|
||||
AmB2ABCalleeSession.__init__(self, tag)
|
||||
self.ann = None
|
||||
# debug("**** tag = " + tag);
|
||||
|
||||
def onPyB2ABEvent(self, ev):
|
||||
debug(
|
||||
"***************************** callee PyB2ABEvent ************************"
|
||||
)
|
||||
if isinstance(ev, MyB2ABEvent):
|
||||
self.ann = AmAudioFile()
|
||||
self.ann.open("/tmp/test.wav")
|
||||
self.setOutput(self.ann)
|
||||
return
|
||||
|
||||
def __init__(self):
|
||||
|
||||
debug("***** __init__ *******")
|
||||
PySemsB2ABDialog.__init__(self)
|
||||
self.initial_user = None
|
||||
self.initial_domain = None
|
||||
self.initial_fromuri = None
|
||||
self.ann = None
|
||||
sip.settracemask(0xFFFF)
|
||||
|
||||
def onInvite(self, req):
|
||||
if len(req.user) < 2:
|
||||
self.dlg.reply(req,500,"Need a number to dial","","","")
|
||||
self.setStopped()
|
||||
return
|
||||
|
||||
ann_file = self.getAnnounceFile(req)
|
||||
self.ann = AmAudioFile()
|
||||
try:
|
||||
self.ann.open(ann_file)
|
||||
except:
|
||||
self.dlg.reply(req,500,"File not found","","","")
|
||||
self.ann = None
|
||||
self.setStopped()
|
||||
raise
|
||||
|
||||
PySemsB2ABDialog.onInvite(self,req)
|
||||
|
||||
def onSessionStart(self,req):
|
||||
self.setOutput(self.ann)
|
||||
self.initial_user = req.user
|
||||
self.initial_domain = req.domain
|
||||
self.initial_fromuri = req.from_uri
|
||||
|
||||
def getAnnounceFile(self,req):
|
||||
|
||||
announce_file = config["announce_path"] + req.domain + "/" + get_header_param(req.r_uri, "play") + ".wav"
|
||||
|
||||
debug("trying '%s'",announce_file)
|
||||
if os.path.exists(announce_file):
|
||||
return announce_file
|
||||
|
||||
announce_file = config["announce_path"] + req.user + ".wav"
|
||||
debug("trying '%s'",announce_file)
|
||||
if os.path.exists(announce_file):
|
||||
return announce_file
|
||||
|
||||
announce_file = config["announce_path"] + config["announce_file"]
|
||||
debug("using default '%s'",announce_file)
|
||||
return announce_file
|
||||
|
||||
|
||||
def process(self,ev):
|
||||
|
||||
debug("*********** PySemsScript.process **************")
|
||||
if isinstance(ev,AmAudioEvent):
|
||||
if ev.event_id == AmAudioEvent.cleared:
|
||||
debug("AmAudioEvent.cleared")
|
||||
to = self.initial_user[1:len(self.initial_user)] + \
|
||||
"@" + self.initial_domain
|
||||
debug("to is " + to)
|
||||
debug("from is "+ self.initial_fromuri)
|
||||
self.connectCallee("<sip:"+to+">", "sip:"+to, \
|
||||
self.initial_fromuri, self.initial_fromuri)
|
||||
debug("connectcallee ok")
|
||||
return
|
||||
|
||||
PySemsB2ABDialog.process(self,ev);
|
||||
return
|
||||
|
||||
def createCalleeSession(self):
|
||||
print self.dlg.local_tag
|
||||
cs = MyCalleeSession(self.dlg.local_tag)
|
||||
print cs
|
||||
return cs
|
||||
|
||||
def onDtmf(self, event, dur):
|
||||
debug("************ onDTMF: ********* " + str(event) + "," + str(dur))
|
||||
ev = MyB2ABEvent(15)
|
||||
self.relayEvent(ev)
|
||||
|
||||
|
||||
|
||||
class PySemsScript(PySemsB2ABDialog):
|
||||
def __init__(self):
|
||||
|
||||
debug("***** __init__ *******")
|
||||
PySemsB2ABDialog.__init__(self)
|
||||
self.initial_user = None
|
||||
self.initial_domain = None
|
||||
self.initial_fromuri = None
|
||||
self.ann = None
|
||||
sip.settracemask(0xFFFF)
|
||||
|
||||
def onInvite(self, req):
|
||||
if len(req.user) < 2:
|
||||
self.dlg.reply(req, 500, "Need a number to dial", "", "", "")
|
||||
self.setStopped()
|
||||
return
|
||||
|
||||
ann_file = self.getAnnounceFile(req)
|
||||
self.ann = AmAudioFile()
|
||||
try:
|
||||
self.ann.open(ann_file)
|
||||
except:
|
||||
self.dlg.reply(req, 500, "File not found", "", "", "")
|
||||
self.ann = None
|
||||
self.setStopped()
|
||||
raise
|
||||
|
||||
PySemsB2ABDialog.onInvite(self, req)
|
||||
|
||||
def onSessionStart(self, req):
|
||||
self.setOutput(self.ann)
|
||||
self.initial_user = req.user
|
||||
self.initial_domain = req.domain
|
||||
self.initial_fromuri = req.from_uri
|
||||
|
||||
def getAnnounceFile(self, req):
|
||||
|
||||
announce_file = (
|
||||
config["announce_path"]
|
||||
+ req.domain
|
||||
+ "/"
|
||||
+ get_header_param(req.r_uri, "play")
|
||||
+ ".wav"
|
||||
)
|
||||
|
||||
debug("trying '%s'", announce_file)
|
||||
if os.path.exists(announce_file):
|
||||
return announce_file
|
||||
|
||||
announce_file = config["announce_path"] + req.user + ".wav"
|
||||
debug("trying '%s'", announce_file)
|
||||
if os.path.exists(announce_file):
|
||||
return announce_file
|
||||
|
||||
announce_file = config["announce_path"] + config["announce_file"]
|
||||
debug("using default '%s'", announce_file)
|
||||
return announce_file
|
||||
|
||||
def process(self, ev):
|
||||
|
||||
debug("*********** PySemsScript.process **************")
|
||||
if isinstance(ev, AmAudioEvent):
|
||||
if ev.event_id == AmAudioEvent.cleared:
|
||||
debug("AmAudioEvent.cleared")
|
||||
to = (
|
||||
self.initial_user[1 : len(self.initial_user)]
|
||||
+ "@"
|
||||
+ self.initial_domain
|
||||
)
|
||||
debug("to is " + to)
|
||||
debug("from is " + self.initial_fromuri)
|
||||
self.connectCallee(
|
||||
"<sip:" + to + ">",
|
||||
"sip:" + to,
|
||||
self.initial_fromuri,
|
||||
self.initial_fromuri,
|
||||
)
|
||||
debug("connectcallee ok")
|
||||
return
|
||||
|
||||
PySemsB2ABDialog.process(self, ev)
|
||||
return
|
||||
|
||||
def createCalleeSession(self):
|
||||
print(self.dlg.local_tag)
|
||||
cs = MyCalleeSession(self.dlg.local_tag)
|
||||
print(cs)
|
||||
return cs
|
||||
|
||||
def onDtmf(self, event, dur):
|
||||
debug("************ onDTMF: ********* " + str(event) + "," + str(dur))
|
||||
ev = MyB2ABEvent(15)
|
||||
self.relayEvent(ev)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from xmlrpclib import *
|
||||
from xmlrpc.client import *
|
||||
s = ServerProxy('http://localhost:8090')
|
||||
print "Active calls: %d" % s.calls()
|
||||
print s.di('sbc','getActiveProfile')
|
||||
print("Active calls: %d" % s.calls())
|
||||
print(s.di('sbc','getActiveProfile'))
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
from xmlrpclib import *
|
||||
from xmlrpc.client import *
|
||||
|
||||
s = ServerProxy('http://localhost:8090')
|
||||
print s.di('sbc','getRegexMapNames')
|
||||
print(s.di('sbc','getRegexMapNames'))
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from xmlrpclib import *
|
||||
from xmlrpc.client import *
|
||||
s = ServerProxy('http://localhost:8090')
|
||||
print "Active calls: %d" % s.calls()
|
||||
print s.di('sbc','listProfiles')
|
||||
print("Active calls: %d" % s.calls())
|
||||
print(s.di('sbc','listProfiles'))
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
from xmlrpclib import *
|
||||
from xmlrpc.client import *
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print "usage: %s <semicolon separated list of plugins to load>" % sys.argv[0]
|
||||
print("usage: %s <semicolon separated list of plugins to load>" % sys.argv[0])
|
||||
sys.exit(1)
|
||||
|
||||
s = ServerProxy('http://localhost:8090')
|
||||
print "Active calls: %d" % s.calls()
|
||||
print s.di('sbc','loadCallcontrolModules',sys.argv[1])
|
||||
print("Active calls: %d" % s.calls())
|
||||
print(s.di('sbc','loadCallcontrolModules',sys.argv[1]))
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
from xmlrpclib import *
|
||||
from xmlrpc.client import *
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
print "usage: %s <profile name> <full profile path>" % sys.argv[0]
|
||||
print("usage: %s <profile name> <full profile path>" % sys.argv[0])
|
||||
sys.exit(1)
|
||||
|
||||
s = ServerProxy('http://localhost:8090')
|
||||
print "Active calls: %d" % s.calls()
|
||||
print("Active calls: %d" % s.calls())
|
||||
p ={ 'name' : sys.argv[1], 'path' : sys.argv[2] }
|
||||
print s.di('sbc','loadProfile',p)
|
||||
print(s.di('sbc','loadProfile',p))
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
from xmlrpclib import *
|
||||
from xmlrpc.client import *
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print "usage: %s <profile name>" % sys.argv[0]
|
||||
print("usage: %s <profile name>" % sys.argv[0])
|
||||
sys.exit(1)
|
||||
|
||||
s = ServerProxy('http://localhost:8090')
|
||||
print "Active calls: %d" % s.calls()
|
||||
print("Active calls: %d" % s.calls())
|
||||
p ={ 'name' : sys.argv[1] }
|
||||
print s.di('sbc','reloadProfile',p)
|
||||
print(s.di('sbc','reloadProfile',p))
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from xmlrpclib import *
|
||||
from xmlrpc.client import *
|
||||
s = ServerProxy('http://localhost:8090')
|
||||
print s.calls()
|
||||
print s.di('sbc','reloadProfiles')
|
||||
print(s.calls())
|
||||
print(s.di('sbc','reloadProfiles'))
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
from xmlrpclib import *
|
||||
from xmlrpc.client import *
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print "usage: %s <profile name>" % sys.argv[0]
|
||||
print("usage: %s <profile name>" % sys.argv[0])
|
||||
sys.exit(1)
|
||||
|
||||
s = ServerProxy('http://localhost:8090')
|
||||
print "Active calls: %d" % s.calls()
|
||||
print s.di('sbc','setActiveProfile',sys.argv[1])
|
||||
print("Active calls: %d" % s.calls())
|
||||
print(s.di('sbc','setActiveProfile',sys.argv[1]))
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
from xmlrpclib import *
|
||||
from xmlrpc.client import *
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
print "usage: %s <regex map name> <full regex map path>" % sys.argv[0]
|
||||
print("usage: %s <regex map name> <full regex map path>" % sys.argv[0])
|
||||
sys.exit(1)
|
||||
|
||||
s = ServerProxy('http://localhost:8090')
|
||||
print "Active calls: %d" % s.calls()
|
||||
print("Active calls: %d" % s.calls())
|
||||
p ={ 'name' : sys.argv[1], 'file' : sys.argv[2] }
|
||||
print s.di('sbc','setRegexMap',p)
|
||||
print(s.di('sbc','setRegexMap',p))
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
from xmlrpclib import *
|
||||
from xmlrpc.client import *
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print "usage: %s <ltag/ID of call to tear down>" % sys.argv[0]
|
||||
print("usage: %s <ltag/ID of call to tear down>" % sys.argv[0])
|
||||
sys.exit(1)
|
||||
|
||||
s = ServerProxy('http://localhost:8090')
|
||||
print "Active calls: %d" % s.calls()
|
||||
print("Active calls: %d" % s.calls())
|
||||
res = s.di('sbc', 'postControlCmd', sys.argv[1], "teardown")
|
||||
|
||||
if res[0] >= 200 and res[0] < 300:
|
||||
print "OK"
|
||||
print("OK")
|
||||
sys.exit(0)
|
||||
else:
|
||||
print "Error: %s" % str(res)
|
||||
print("Error: %s" % str(res))
|
||||
sys.exit(2)
|
||||
|
||||
Loading…
Reference in new issue