def getReloadGateway(): """Reload sofia's gateway""" logger.info("getRelaodGateway") logger.info("get sofia profile") sofia_profiles = SipProfile.objects.all() if sofia_profiles: logger.info("%s sofia profiles" % len(sofia_profiles)) else: logger.error("No sofia profile found! Unable to reload.") for sp in sofia_profiles: logger.info("Reload sofia profile : %s" % sp.name) fs_cmd("bgapi sofia profile " + sp.name + " rescan reloadxml") logger.info("getReloadGateway() done")
def getReloadGateway(request): """Reload sofia's gateway""" logger.info("getRelaodGateway") logger.info("get sofia profile") sofia_profiles = SipProfile.objects.all() if sofia_profiles: logger.info("%s sofia profiles" % len(sofia_profiles)) messages.info(request, """Get sofia profile : %s sofia profiles""" % len(sofia_profiles)) else: logger.error("No sofia profile found! Unable to reload.") messages.error(request, """Get sofia profile : No sofia profile found! Unable to reload.""") for sp in sofia_profiles: logger.info("Reload sofia profile : %s" % sp.name) messages.info(request, """Reload sofia profile : %s""" % sp.name) fs = fs_cmd("bgapi sofia profile " + sp.name + " rescan reloadxml") #messages.info(request, "%s" % fs) logger.info("getReloadGateway() done")
def get_fs_connections(): """ Get all available ESL connections. """ logger.info("get_fs_connections()") voipswitchs = VoipSwitch.objects.all() if voipswitchs: logger.info("%s voipswitch's config" % len(voipswitchs)) else: logger.error("""No voip switch config found! Unable to connect to freeswitch.""") for vs in voipswitchs: logger.info("creating ESL connection : %s / %s / %s" % (str(vs.esl_listen_ip), vs.esl_listen_port, vs.esl_password)) yield ESL.ESLconnection(str(vs.esl_listen_ip), str(vs.esl_listen_port), str(vs.esl_password)) logger.info("get_fs_connections() done")