{"id":3173,"date":"2014-05-06T17:53:16","date_gmt":"2014-05-06T08:53:16","guid":{"rendered":"http:\/\/pchero21.com\/?p=3173"},"modified":"2014-05-06T17:53:16","modified_gmt":"2014-05-06T08:53:16","slug":"freeswitch-enable-python-script","status":"publish","type":"post","link":"http:\/\/pchero21.com\/?p=3173","title":{"rendered":"[Freeswitch] Enable python script."},"content":{"rendered":"<p><strong>Freeswitch-python module install &amp; configuration<br \/>\n<\/strong><\/p>\n<p>Debian Linux\/Freeswitch source \uc124\uce58 \uae30\uc900\uc73c\ub85c \uc124\uba85\ud55c\ub2e4.<\/p>\n<p>Freeswitch Python \ubaa8\ub4c8\uc778 mod_pythom \uc744 \uc124\uce58\ud574\uc57c \ud55c\ub2e4.<br \/>\nSource Directory \ub85c \uc774\ub3d9\ud558\uc790.<\/p>\n<blockquote><p>$ cd \/usr\/local\/src\/freeswitch.git<\/p><\/blockquote>\n<p>Freeswitch \ub294 \uc124\uce58\uc2dc \ubaa8\ub4e0 \ubaa8\ub4c8\uc744 \ucef4\ud30c\uc77c\ud558\uc9c0 \uc54a\ub294\ub2e4. \uc544\ubb34\ub7f0 \ucd94\uac00 \uc124\uc815\uc774 \uc5c6\ub2e4\uba74 \uae30\ubcf8 \ubaa8\ub4c8\ub9cc\uc744 \uc124\uce58\ud55c\ub2e4.<br \/>\n\ub530\ub77c\uc11c, \ub2e4\ub978 \ucd94\uac00 \ubaa8\ub4c8\ub4e4\uc774 \ud544\uc694\ud558\ub2e4\uba74 \ubcc4\ub3c4\uc758 \uc124\uc815 \ud6c4, \ub2e4\uc2dc \ucef4\ud30c\uc77c\uc744 \uc9c4\ud589\ud574 \uc8fc\uc5b4\uc57c \ud55c\ub2e4.<br \/>\n\uc815\ud655\ud788\ub294 \ucef4\ud30c\uc77c \uc2dc, Source \ub514\ub809\ud1a0\ub9ac \ub0b4\uc758 modules.conf \ud30c\uc77c\uc744 \ucc38\uc870\ud558\uc5ec \ucef4\ud30c\uc77c\uc744 \ud574\uc57c\ud558\ub294 \ubaa8\ub4c8\ub4e4\uc744 \ud655\uc778\ud55c \ub2e4\uc74c\uc5d0 \ucef4\ud30c\uc77c\uc744 \uc9c4\ud589\ud55c\ub2e4.<br \/>\n\ub530\ub77c\uc11c, modules.conf \ud30c\uc77c\uc744 \uc218\uc815\ud558\uba74 \ucd94\uac00\uc801\uc778 \ubaa8\ub4c8 \uc124\uce58\uac00 \uac00\ub2a5\ud558\ub2e4.<br \/>\npython module compile \uc744 \ud65c\uc131\ud654 \uc2dc\ud0a4\uae30 \uc704\ud574\uc11c modules.conf \ud30c\uc77c\uc744 \uc218\uc815\ud55c\ub2e4.<\/p>\n<blockquote><p>$ vi modules.conf<\/p><\/blockquote>\n<p>mod_python \ubd80\ubd84\uc744 \ucc3e\uc544\uc11c \uc8fc\uc11d \ud574\uc81c\ud55c\ub2e4.<\/p>\n<blockquote><p>#languages\/mod_python<br \/>\nlanguages\/mod_python<\/p><\/blockquote>\n<p>make &amp; make install.<\/p>\n<blockquote><p>$ make &amp;&amp; make install<\/p><\/blockquote>\n<p>python-freeswitch \ubaa8\ub4c8\uc774 \uc81c\ub300\ub85c \uc124\uce58\ub418\uc5c8\ub294\uc9c0 \ud655\uc778\ud574\uc57c \ud55c\ub2e4.<br \/>\n\uc544\ub798\uc758 \uc608\uc81c\ucc98\ub7fc python \uc2dc\uc791\ud6c4, \uc804\uccb4 \ubaa8\ub4c8 \uac80\uc0c9\uc5d0\uc11c freeswitch \ubaa8\ub4c8\uc774 \ud655\uc778\ub418\uc5b4\uc57c \ud55c\ub2e4.<br \/>\n\ub9cc\uc57d \ud655\uc778\ub418\uc9c0 \uc54a\uc73c\uba74 \uc218\ub3d9\uc73c\ub85c freeswitch \ubaa8\ub4c8\uc744 \uc62e\uaca8 \uc8fc\uc5b4\uc57c \ud55c\ub2e4.<\/p>\n<pre class=\"brush:shell\">pchero@MyDebian:\/etc$ python\nPython 2.7.3 (default, Mar 13 2014, 11:03:55) \n[GCC 4.7.2] on linux2\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n&gt;&gt;&gt;\n&gt;&gt;&gt; help('modules')\n\nANSI                _codecs_iso2022     fdpexpect           pyatspi\nArgImagePlugin      _codecs_jp          feedparser          pyclbr\nBaseHTTPServer      _codecs_kr          filecmp             pycurl\nBastion             _codecs_tw          fileinput           pydoc\nBdfFontFile         _collections        fnmatch             pydoc_data\nBeautifulSoup       _csv                formatter           pyexpat\nBeautifulSoupTests  _ctypes             fpconst             pygtk\nBmpImagePlugin      _ctypes_test        fpectl              pynotify\nBufrStubImagePlugin _curses             fpformat            quopri\nCDROM               _curses_panel       fractions           random\nCGIHTTPServer       _dbus_bindings      freeswitch          re\nCanvas              _dbus_glib_bindings ftplib              readline\nConfigParser        _elementtree        functools           reportbug\nContainerIO         _functools          future_builtins     reportlab\n...<\/pre>\n<p>\ub9cc\uc57d \ud655\uc778\ub418\uc9c0 \uc54a\ub294\ub2e4\uba74 \uc218\ub3d9\uc73c\ub85c freeswitch \ubaa8\ub4c8\uc744 \uc124\uce58\ud574 \uc8fc\uc5b4\uc57c \ud55c\ub2e4.<br \/>\n\uc544\ub798\uc758 \uc608\uc81c\ub294 Debian Linux\/Python2.7 \uc124\uce58 \uae30\uc900\uc774\ub2e4.<br \/>\n\ub9ac\ub205\uc2a4 \ubc30\ud3ec\ud310\/Python \ubc84\uc804\uc5d0 \ub530\ub77c \ubaa8\ub4c8 \uc124\uce58 \ub514\ub809\ud1a0\ub9ac\uac00 \ub2ec\ub77c\uc9c0\ubbc0\ub85c \uc8fc\uc758\ud558\uc790.<\/p>\n<pre class=\"brush:shell\">pchero@MyDebian:\/usr\/local\/src\/freeswitch.git\/src\/mod\/languages\/mod_python$ pwd\n\/usr\/local\/src\/freeswitch.git\/src\/mod\/languages\/mod_python\n\npchero@MyDebian:\/usr\/local\/src\/freeswitch.git\/src\/mod\/languages\/mod_python$ sudo cp .\/freeswitch.py \/usr\/lib\/python2.7\/dist-packages\/\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Python \uc5d0\uc11c freeswitch \ubaa8\ub4c8\uc744 \ud655\uc778\ud588\ub2e4\uba74, \uc774\uc81c\ub294 Freeswitch \uc5d0\uc11c Python \ubaa8\ub4c8\uc774 \uc0ac\uc6a9\uac00\ub2a5\ud55c\uc9c0 \ud655\uc778\ud574\uc57c \ud55c\ub2e4.<\/p>\n<p>modules.conf.xml \ud30c\uc77c\uc5d0\uc11c \ub9e4\ubc88 \uc790\ub3d9\uc73c\ub85c mod_python module \uc744 load \ud558\ub3c4\ub85d \uc124\uc815\ud574\uc8fc\uc790.<br \/>\n&lt;load_module=&#8221;mod_python&#8221;&gt; \ubd80\ubd84\uc744 \uc8fc\uc11d \ud574\uc81c\ud558\uac70\ub098 \ucd94\uac00\ud574\uc8fc\uc790.<\/p>\n<pre class=\"brush:shell\">    &lt;!-- Languages --&gt;\n    &lt;!-- &lt;load module=\"mod_spidermonkey\"\/&gt; --&gt;\n    &lt;load module=\"mod_v8\"\/&gt;\n    &lt;!-- &lt;load module=\"mod_perl\"\/&gt; --&gt;\n    &lt;load module=\"mod_python\"\/&gt;\n    &lt;!-- &lt;load module=\"mod_java\"\/&gt; --&gt;\n    &lt;load module=\"mod_lua\"\/&gt;\n<\/pre>\n<p>freeswitch cli(fs_cli) \uc5d0\uc11c mod_python \ubaa8\ub4c8\uc744 load \ud558\uace0, \uc815\uc0c1\uc801\uc73c\ub85c load \ub418\uc5c8\ub294\uc9c0 \ud655\uc778\ud558\uc790.<\/p>\n<blockquote><p>freeswitch@192.168.200.10@internal&gt; load mod_python<br \/>\n+OK Reloading XML<\/p>\n<p>freeswitch@192.168.200.10@internal&gt; module_exists mod_python<br \/>\ntrue<\/p><\/blockquote>\n<p><strong>Using python script on freeswitch.<\/strong><\/p>\n<p>\uc774\uc81c \uc2e4\uc81c\ub85c sample python script \ub97c \uc791\uc131 \ubc0f \uc0ac\uc6a9\ud574 \ubcf4\uc790. mod_python \uc18c\uc2a4 \ub514\ub809\ud1a0\ub9ac\uc5d0\ub294 \ud6cc\ub96d\ud55c \uc608\uc81c \uc2a4\ud06c\ub9bd\ud2b8\uac00 \uc788\ub2e4. \uc0ac\uc6a9\ud558\ub3c4\ub85d \ud558\uc790.<\/p>\n<blockquote><p>cp \/usr\/local\/src\/freeswitch.git\/src\/mod\/languages\/mod_python\/python_example.py \/usr\/lib\/pymodules\/python2.7<\/p><\/blockquote>\n<p>\ub9c8\uc9c0\ub9c9\uc73c\ub85c \uc2e4\uc81c Dialplan \ub0b4\uc5d0\uc11c python \ubaa8\ub4c8\uc744 \ud638\ucd9c\ud558\ub3c4\ub85d \uc124\uc815\ud574\uc57c \ud55c\ub2e4.<\/p>\n<pre class=\"brush:shell\">&lt;include&gt;\n  &lt;extension name=\"python_test\"&gt;\n    &lt;condition field=\"destination_number\" expression=\"^(5555555)$\"&gt;\n      &lt;!--\n      If you're hosting multiple domains you will want to set the\n      target_domain on these calls so they hit the proper domain after you\n      transfer the caller into the default context. \n      \n      $${domain} is the default domain set from vars.xml but you can set it\n      to any domain you have setup in your user directory.\n\n      --&gt;\n      &lt;action application=\"info\"\/&gt;\n      &lt;action application=\"python\" data=\"python_example\"\/&gt;\n      &lt;!--&lt;action application=\"set\" data=\"domain_name=$${domain}\"\/&gt;--&gt;\n      &lt;!-- This example maps the DID 5551212 to ring 1000 in the default context --&gt;\n      &lt;!--&lt;action application=\"transfer\" data=\"1000 XML default\"\/&gt;--&gt;\n    &lt;\/condition&gt;\n  &lt;\/extension&gt;\n&lt;\/include&gt;\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\ucc38\uc870 : <a title=\"https:\/\/wiki.freeswitch.org\/wiki\/Mod_python#Sample_Python_Scripts\" href=\"https:\/\/wiki.freeswitch.org\/wiki\/Mod_python#Sample_Python_Scripts\" target=\"_blank\">https:\/\/wiki.freeswitch.org\/wiki\/Mod_python#Sample_Python_Scripts<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Freeswitch-python module install &amp; configuration Debian Linux\/Freeswitch source \uc124\uce58 \uae30\uc900\uc73c\ub85c \uc124\uba85\ud55c\ub2e4. Freeswitch Python \ubaa8\ub4c8\uc778 mod_pythom \uc744 \uc124\uce58\ud574\uc57c \ud55c\ub2e4. Source Directory \ub85c \uc774\ub3d9\ud558\uc790. $ cd \/usr\/local\/src\/freeswitch.git Freeswitch \ub294 \uc124\uce58\uc2dc \ubaa8\ub4e0 \ubaa8\ub4c8\uc744 \ucef4\ud30c\uc77c\ud558\uc9c0 \uc54a\ub294\ub2e4. \uc544\ubb34\ub7f0 \ucd94\uac00 \uc124\uc815\uc774 \uc5c6\ub2e4\uba74 \uae30\ubcf8 \ubaa8\ub4c8\ub9cc\uc744 \uc124\uce58\ud55c\ub2e4. \ub530\ub77c\uc11c, &hellip; <a href=\"http:\/\/pchero21.com\/?p=3173\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[15],"tags":[179,313],"_links":{"self":[{"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/posts\/3173"}],"collection":[{"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/pchero21.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3173"}],"version-history":[{"count":0,"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/posts\/3173\/revisions"}],"wp:attachment":[{"href":"http:\/\/pchero21.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pchero21.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3173"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pchero21.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}