add<br><br>def fsapi(session, stream, env, args):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stream.write(&quot;baz&quot;)<br><br><br>see:<br><a href="http://svn.freeswitch.org/svn/freeswitch/trunk/src/mod/languages/mod_python/python_example.py">http://svn.freeswitch.org/svn/freeswitch/trunk/src/mod/languages/mod_python/python_example.py</a><br>
<br>could make a good addition to the wiki<br><br><br><br><br><div class="gmail_quote">On Wed, Jan 21, 2009 at 4:40 PM, Brian Deacon <span dir="ltr">&lt;<a href="mailto:bdeacon@highergear.com">bdeacon@highergear.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Greetings,<br>
<br>
Couldn&#39;t find anything on the wiki or in the mail archives. &nbsp;(Let me<br>
know where you think a good home for this info might be on the wiki and<br>
I&#39;d be more than happy to write something up in there.)<br>
<br>
I&#39;m guessing I haven&#39;t done everything necessary to enable python on my<br>
machine. &nbsp;I have python-2.4.3 and python-devel 2.4.3-21 installed on the<br>
FS machine.<br>
<br>
Per the instructions, I uncommented the mod_python line from<br>
modules.conf and rebuilt my freeswitch instance. &nbsp;Vanilla functionality<br>
is working. &nbsp;I set PYTHONPATH to /usr/local/freeswitch/python before<br>
restarting the mod_python-enabled freeswitch (via modules.conf.xml)<br>
<br>
# echo $PYTHONPATH<br>
/usr/local/freeswitch/python<br>
<br>
# grep mod_python \<br>
&gt; /usr/local/freeswitch/conf/autoload_configs/modules.conf.xml<br>
 &nbsp; &nbsp;&lt;load module=&quot;mod_python&quot;/&gt;<br>
<br>
# ls $PYTHONPATH<br>
bar.py &nbsp;bar.pyc<br>
<br>
# cat $PYTHONPATH/bar.py<br>
stream.write(&quot;baz&quot;)<br>
<br>
<br>
The relevant entry in conf/dialplan/default.xml:<br>
 &nbsp; &nbsp;&lt;extension name=&quot;Test_Simple_Python&quot;&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&lt;condition field=&quot;destination_number&quot; expression=&quot;^1235$&quot;&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;action application=&quot;set&quot; data=&quot;foo=${python(bar)}&quot; /&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;action application=&quot;bridge&quot;<br>
data=&quot;{group_confirm_file=vm-hello,group_confirm_key=4,call_timeout=60}<br>
sofia/internal/1000,sofia/internal/1002&quot; /&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&lt;/condition&gt;<br>
 &nbsp; &nbsp;&lt;/extension&gt;<br>
<br>
(The bridge action is only there because it seemed unhappy unless it was<br>
going to actually try to do something.)<br>
<br>
The following output shows up in fs_cli when I dial 1235:<br>
<br>
<br>
&gt; 2009-01-21 15:20:14 [DEBUG] switch_core_state_machine.c:152 switch_core_standard_on_execute() sofia/internal/<a href="mailto:1000@10.48.5.207">1000@10.48.5.207</a> Execute set(foo=${python(bar)})<br>
&gt; 2009-01-21 15:20:14 [NOTICE] mod_python.c:107 eval_some_python() Invoking py module: bar<br>
&gt; 2009-01-21 15:20:14 [ERR] mod_python.c:121 eval_some_python() Error importing module<br>
&gt; 2009-01-21 15:20:14 [DEBUG] switch_core_session.c:1254 switch_core_session_execute_application() sofia/internal/<a href="mailto:1000@10.48.5.207">1000@10.48.5.207</a> Expanded String set(foo=)<br>
&gt; 2009-01-21 15:20:14 [DEBUG] mod_dptools.c:699 set_function() sofia/internal/<a href="mailto:1000@10.48.5.207">1000@10.48.5.207</a> SET [foo]=[UNDEF]<br>
<br>
<br>
So I&#39;m guessing something dumb on my part. &nbsp;But there are so many dumb things I&#39;m capable of doing... &nbsp;:)<br>
<br>
TIA,<br>
Brian<br>
<br>
<br>
_______________________________________________<br>
Freeswitch-users mailing list<br>
<a href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>
<br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br><a href="http://iax:guest@conference.freeswitch.org/888">iax:guest@conference.freeswitch.org/888</a><br>
<a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>pstn:213-799-1400<br>