sangoma / switchy

async FreeSWITCH cluster control
https://switchy.readthedocs.io/en/latest/
Mozilla Public License 2.0
69 stars 18 forks source link

Can't provide password to service api #62

Closed goodboy closed 7 years ago

goodboy commented 7 years ago

Taken from follow up in #60 - thanks to @k4ml for reporting.

Running service still failed. How do we pass auth from Service ?

Traceback (most recent call last):
File "sw.py", line 13, in <module>
s = Service(['127.0.0.1'])
File "/home/kamal/callsec/switchy/switchy/serve.py", line 23, in __init__
self.pool.evals('listener.connect()')
File "/home/kamal/callsec/switchy/switchy/distribute.py", line 64, in evals
return [eval(expr, self.attrs(item), kwargs) for item in self._slaves]
File "/home/kamal/callsec/switchy/switchy/distribute.py", line 64, in <listcomp>
return [eval(expr, self.attrs(item), kwargs) for item in self._slaves]
File "<string>", line 1, in <module>
File "/home/kamal/callsec/switchy/switchy/observe.py", line 296, in connect
con.connect()
File "/home/kamal/callsec/switchy/switchy/connection.py", line 162, in connect
"accepting esl connections.".format(host, port))
switchy.connection.ConnectionError: Failed to connect to server at '127.0.0.1:8021'
Please check that FreeSWITCH is running and accepting esl connections.

Running this code:


from switchy import Service, event_callback

class Proxier(object): """Proxy all inbound calls to the destination specified in the SIP Request-URI. """ @event_callback('CHANNEL_PARK') def on_park(self, sess): if sess.is_inbound(): print(sess)

s = Service(['127.0.0.1']) s.apps.load_app(router, app_id='default') s.run()


> I have checked, it work if I change password to ClueCon.
goodboy commented 7 years ago

@k4ml please give #63 a try and let me know if it suits your needs.

Feel free to try out the new switchy serve command as well:

switchy serve '127.0.0.1' --password supersecret94 --app Proxier

Thanks again!