sangoma / switchy

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

No apps have been loaded error #43

Closed spicyramen closed 7 years ago

spicyramen commented 7 years ago

I'm using the tutorial: https://switchy.readthedocs.io/en/latest/callgen.html

Trying to generate a call, but keep getting "No apps have been loaded" error.

>>> from switchy import get_originator
>>> originator = get_originator(['104.236.160.2'])
>>> originator
<Originator: active-calls=0 state=INITIAL total-originated-sessions=0 rate=30 limit=1 max-offered=inf duration=0>
>>> originator.originate_cmd
[None]
>>> originator.count_calls
<bound method SlavePool.fast_count of <switchy.distribute.SlavePool object at 0x10703fa50>>
>>> originator.state
'INITIAL'
>>> originator.rate = 50
>>> originator.limit = 1000
>>> originator.pool.clients[0].set_orig_cmd(dest_url='99914081112222',profile='external',app_name='park',proxy='99914081112222@104.236.160.2:5060',)
>>> originator.originate_cmd
['originate {{sip_h_X-switchy_originating_session={uuid_str},sip_h_X-switchy_app={app_id},originator_codec=PCMU,switchy_app={app_id},originate_timeout=60,ignore_display_updates=true,origination_uuid={uuid_str},origination_caller_id_number=1112223333,origination_caller_id_name=Mr_Switchy,absolute_codec_string=}}sofia/external/99914081112222;fs_path=sip:99914081112222@104.236.160.2:5060 &park()']
>>> originator.start()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/gogasca/Documents/OpenSource/Development/Python/switchyenv/lib/python2.7/site-packages/switchy/apps/call_gen.py", line 477, in start
    raise utils.ConfigurationError("No apps have been loaded")
switchy.utils.ConfigurationError: No apps have been loaded
goodboy commented 7 years ago

@spicyramen Ahh shoot. Thanks for catching this :)

Yeah so the docs needs to be updated to mention that you need to explicitly load an app using Originator.load_app() (this was changed somewhat recently). Depending on what you're trying to accomplish you'll most likely want to load the Bert app for stress testing. If you're looking to use the originator as an auto-dialer then you'll probably want something custom. If it's the latter I can get the example auto-dialer more polished up for use.

So what you'll need it something like:

from switchy import get_originator
from switchy.apps.bert import Bert
originator = get_originator(['104.236.160.2'])
originator.load_app(Bert)
# .. other config steps ..
originator.start()

Let me know if that works for you and I'll try to update the docs by end of day.

spicyramen commented 7 years ago

Worked now. Thank you

goodboy commented 7 years ago

@spicyramen If you find anything else let us know we'd appreciate the feedback :)