Closed k4ml closed 7 years ago
Hey @k4ml thanks for reporting :+1:
If you changed away from the default password then yes that is likely the problem since I don't think we expose a password
flag to the cli.
A flag can be added to the existing click options and the value from the flag should be passed to the get_originator
call.
The underlying function is switchy.apps.call_gen.get_originator()
.
If it still doesn't work with the default password double check your event_socket.conf
. Sometimes the ACL needs to be changed.
So I hardcoded the auth parameter:-
orig = switchy.get_originator(
hosts,
rate=int(rate) if rate else None,
limit=int(limit) if limit else None,
max_offered=int(max_offered) if max_offered else None,
duration=int(duration) if duration else None,
auto_duration=True if not duration else False,
auth='mypass',
)
I noticed that connect()
being called thrice. The first and second it correctly use mypass but on the third time, it using default password, causing run
to fail.
@k4ml thanks for the feedback. I'll look into this.
@k4ml yep absolutely a bug! Thanks for catching and reporting. I'm working through a fix :)
The problem is that each switchy.observe.Client
which is created isn't forwarded the correct auth
parameter.
@k4ml can you give #61 a try just to make sure I didn't miss anything? Thanks!
@tgoodlet The password parameter work. Thanks !
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.
Hey @k4ml thanks again for reporting it's probably another bug. I've created #62 to follow up on this.
When running command:-
I got error:-
I assumed this is because I need password to connect to the ESL port. Connecting through
fs_cli -p <password>
is fine.