def _send_raw_to_freeswitch_cli(self, cmd): con = ESLconnection(self.conf['fs_esl_ip'], self.conf['fs_esl_port'], self.conf['fs_esl_pass']) if con.connected(): con.api(cmd) return True return False
def makeCall(self, destination): con = ESLconnection(self.conf['fs_esl_ip'], self.conf['fs_esl_port'], self.conf['fs_esl_pass']) if con.connected(): con.api( str("originate {origination_call_id_name=%s,origination" "_caller_id_number=%s}sofia/internal/%s@%s:" "5060 &echo" % (self.user, self.user, destination, self.other_ip))) else: raise Exception("ESL Connection Failed")
def makeCall(self, destination): username = subscriber.get_username_from_imsi(self.user) con = ESLconnection(self.conf['fs_esl_ip'], self.conf['fs_esl_port'], self.conf['fs_esl_pass']) if con.connected(): con.api( str("originate {origination_call_id_name=%s,origination" "_caller_id_number=%s}sofia/internal/%s@%s:%s" "5062 &echo" % (username, username, destination, self.other_ip))) else: raise Exception("ESL Connection Failed")
def get_sip_connected(self): try: _sip_connected = [] con = ESLconnection("127.0.0.1", "8021", "ClueCon") e = con.api("show registrations") reg = e.getBody() lines = reg.split('\n') for line in lines[1:]: vals = line.split(',') if len(vals) < 10: return _sip_connected _sip_connected.append([vals[0]]) except Exception as ex: api_log.info('Exception: %s' % ex)