[Freeswitch-users] Hello from Scotland - Python - error importing module

Steven Brown steven.brown at justfone.com
Thu Jan 24 05:06:24 PST 2008


Hi,

I've previously had a lot of Windows based SIP/IVR expreience with a variety of technologies but am now looking at alternative architectures for some forthcoming projects so have been doing some evaluation on platforms for producing some IVR type solutions initially for inhouse hosting but longer term to scale possibly on Amazon EC2.

I'm also interested in contributing to the project if I settle on Freeswitch.

Initially speed of development / application tuning for new proof of concepts is critical and the combination of Freeswitch / Python seems to fit the bill (not withstanding my lack of significant experience with either)

To test this out I have set up a box running CentOS 5, built Freeswitch (with mod python) and configured the switch.

Freeswitch works great for SIP calls between wifi handsets, so far so good and a very painless set up, impressive !

Dialplan is modified as below,


    <extension name="500">
      <condition field="destination_number" expression="^500$">
        <action application="python" data="test.py"/>
      </condition>
    </extension>

test.py as below (borrowed from WIKI)

from freeswitch import *

def handler(uuid):
    session = PySession(uuid)
    session.answer()
    console_log("INFO", "Hello, world\n")
    session.hangup("1")

is in python2.5/site-packages as is freeswitch.py

however an incoming call to 500 generates the following

2008-01-22 21:46:12 [DEBUG] mod_dialplan_xml.c:273 dialplan_hunt() sofia/default/1001 at 192.168.0.12:5060 State Change CS_RING -> CS_EXECUTE
2008-01-22 21:46:12 [DEBUG] switch_core_session.c:643 switch_core_session_signal_state_change() Kill sofia/default/1001 at 192.168.0.12:5060 [BREAK]
2008-01-22 21:46:12 [DEBUG] switch_core_state_machine.c:413 switch_core_session_run() sofia/default/1001 at 192.168.0.12:5060 Running State Change CS_EXECUTE
2008-01-22 21:46:12 [DEBUG] switch_core_state_machine.c:452 switch_core_session_run() (sofia/default/1001 at 192.168.0.12:5060) State EXECUTE
2008-01-22 21:46:12 [DEBUG] mod_sofia.c:185 sofia_on_execute() sofia/default/1001 at 192.168.0.12:5060 SOFIA EXECUTE
2008-01-22 21:46:12 [DEBUG] switch_core_state_machine.c:130 switch_core_standard_on_execute() Standard EXECUTE
2008-01-22 21:46:12 [DEBUG] switch_core_state_machine.c:144 switch_core_standard_on_execute() sofia/default/1001 at 192.168.0.12:5060 Execute python(test.py)
2008-01-22 21:46:12 [NOTICE] mod_python.c:86 eval_some_python() Invoking py module: test.py
2008-01-22 21:46:12 [ERR] mod_python.c:106 eval_some_python() Error importing module
2008-01-22 21:46:12 [DEBUG] mod_python.c:180 eval_some_python() Threadstate mod_python.c swap-out!
2008-01-22 21:46:12 [NOTICE] switch_core_state_machine.c:201 switch_core_standard_on_execute() Hangup sofia/default/1001 at 192.168.0.12:5060 [CS_EXECUTE] [NORMAL_CLEARING]

This suggests to me that the the dialplan is working correctly and we are trying to execute  test.py, which from playing with file names I am fairly happy it is finding test.py , but beyond that I'm pretty well stuck for tonight.

Any one got any thoughts as to where I might be going wrong.

Many Thanks

Steve






-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20080124/38512945/attachment-0002.html 


More information about the FreeSWITCH-users mailing list