{ "info": { "author": "\u00cdtalo Rossi", "author_email": "italorossib@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5" ], "description": "GreenSWITCH: FreeSWITCH Event Socket Protocol\n=============================================\n\n.. image:: https://travis-ci.org/EvoluxBR/greenswitch.svg?branch=master\n :target: https://travis-ci.org/EvoluxBR/greenswitch\n\n.. image:: https://img.shields.io/pypi/v/greenswitch.svg\n :target: https://pypi.python.org/pypi/greenswitch\n\n.. image:: https://img.shields.io/pypi/dm/greenswitch.svg\n :target: https://pypi.python.org/pypi/greenswitch\n\nBattle proven FreeSWITCH Event Socket Protocol client implementation with Gevent.\n\nThis is an implementation of FreeSWITCH Event Socket Protocol using Gevent\nGreenlets. It is already in production and processing hundreds of calls per day.\n\nFull Python3 support!\n\nInbound Socket Mode\n===================\n\n.. code-block:: python\n\n >>> import greenswitch\n >>> fs = greenswitch.InboundESL(host='127.0.0.1', port=8021, password='ClueCon')\n >>> fs.connect()\n >>> r = fs.send('api list_users')\n >>> print r.data\n\n\nCurrently only Inbound Socket is implemented, support for outbound socket should\nbe done soon.\n\n\nOutbound Socket Mode\n====================\n\nOutbound is implemented with sync and async support. The main idea is to create\nan Application that will be called passing an OutboundSession as argument.\nThis OutboundSession represents a call that is handled by the ESL connection.\nBasic functions are implemented already:\n\n - playback\n - play_and_get_digits\n - hangup\n - park\n - uuid_kill\n - answer\n - sleep\n\nWith current api, it's easy to mix sync and async actions, for example:\nplay_and_get_digits method will return the pressed DTMF digits in a block mode,\nthat means as soon as you call that method in your Python code the execution\nflow will block and wait for the application to end only returning to the next\nline after ending the application. But after getting digits, if you need to consume\nan external system, like posting this to an external API you can leave the caller\nhearing MOH while the API call is being done, you can call the playback method\nwith block=False, playback('my_moh.wav', block=False), after your API end we need\nto tell FreeSWITCH to stop playing the file and give us back the call control,\nfor that we can use uuid_kill method.\n\nExample of Outbound Socket Mode:\n\n.. code-block:: python\n\n '''\n \u00a0 \u00a0Add a extension on your dialplan to bound the outbound socket on FS channel\n as example below\n\n \n \n : async full\"/>\n \n \n\n Or see the complete doc on https://freeswitch.org/confluence/display/FREESWITCH/mod_event_socket\n \u00a0 \u00a0'''\n import gevent\n import greenswitch\n\n import logging\n logging.basicConfig(level=logging.DEBUG)\n\n\n class MyApplication(object):\n def __init__(self, session):\n self.session = session\n\n def run(self):\n \"\"\"\n Main function that is called when a call comes in.\n \"\"\"\n try:\n self.handle_call()\n except:\n logging.exception('Exception raised when handling call')\n self.session.stop()\n\n def handle_call(self):\n # We want to receive events related to this call\n # They are also needed to know when an application is done running\n # for example playback\n self.session.myevents()\n print(\"myevents\")\n # Send me all the events related to this call even if the call is already\n # hangup\n self.session.linger()\n print(\"linger\")\n self.session.answer()\n print(\"answer\")\n gevent.sleep(1)\n print(\"sleep\")\n # Now block until the end of the file. pass block=False to\n # return immediately.\n self.session.playback('ivr/ivr-welcome')\n print(\"welcome\")\n # blocks until the caller presses a digit, see response_timeout and take\n # the audio length in consideration when choosing this number\n digit = self.session.play_and_get_digits('1', '1', '3', '5000', '#',\n 'conference/conf-pin.wav',\n 'invalid.wav',\n 'test', '\\d', '1000', \"''\",\n block=True, response_timeout=5)\n print(\"User typed: %s\" % digit)\n # Start music on hold in background without blocking code execution\n # block=False makes the playback function return immediately.\n self.session.playback('local_stream://default', block=False)\n print(\"moh\")\n # Now we can do a long task, for example, processing a payment,\n # consuming an APIs or even some database query to find our customer :)\n gevent.sleep(5)\n print(\"sleep 5\")\n # We finished processing, stop the music on hold and do whatever you want\n # Note uuid_break is a general API and requires full permission\n self.session.uuid_break()\n print(\"break\")\n # Bye caller\n self.session.hangup()\n print(\"hangup\")\n # Close the socket so freeswitch can leave us alone\n self.session.stop()\n\n server = greenswitch.OutboundESLServer(bind_address='0.0.0.0',\n bind_port=5000,\n application=MyApplication,\n max_connections=5)\n server.listen()\n\n\nEnjoy!\n\nFeedbacks always welcome.\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/evoluxbr/greenswitch", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "greenswitch", "package_url": "https://pypi.org/project/greenswitch/", "platform": "", "project_url": "https://pypi.org/project/greenswitch/", "project_urls": { "Homepage": "https://github.com/evoluxbr/greenswitch" }, "release_url": "https://pypi.org/project/greenswitch/0.0.9/", "requires_dist": null, "requires_python": "", "summary": "Battle proven FreeSWITCH Event Socket Protocol client implementation with Gevent.", "version": "0.0.9" }, "last_serial": 4612252, "releases": { "0.0.1": [], "0.0.2": [ { "comment_text": "", "digests": { "md5": "3f6545203aea46904b25d1491e0be9b9", "sha256": "18d2ba00de6550ea665c5287190ff25dc1334a083c450300214e009e83c34434" }, "downloads": -1, "filename": "greenswitch-0.0.2.tar.gz", "has_sig": false, "md5_digest": "3f6545203aea46904b25d1491e0be9b9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4041, "upload_time": "2016-02-28T22:55:05", "url": "https://files.pythonhosted.org/packages/4e/4f/e86d609ad0e84b21cd7cc267bde02c342f9cf1ed25842db94b6b89554f6e/greenswitch-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "372faae89a54c3b5b9b2e682762e6bb1", "sha256": "564a19ebd6455582044741d52c46b5dc41c107e36b306fd67b5e76396ed2f4c6" }, "downloads": -1, "filename": "greenswitch-0.0.3.tar.gz", "has_sig": false, "md5_digest": "372faae89a54c3b5b9b2e682762e6bb1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4141, "upload_time": "2016-02-29T00:00:58", "url": "https://files.pythonhosted.org/packages/a1/dd/dceeafa49a611751eae80ba7cd2b4b5df79b000b42d914874004dbf99127/greenswitch-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "56ae00a27085e8f3d272c8ebb77fc2c7", "sha256": "5e2efccaee5eca2c091f184d622b28a0a7c84daa29c0d8631a415d13a5cc2cec" }, "downloads": -1, "filename": "greenswitch-0.0.4.tar.gz", "has_sig": false, "md5_digest": "56ae00a27085e8f3d272c8ebb77fc2c7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4116, "upload_time": "2016-04-11T19:28:32", "url": "https://files.pythonhosted.org/packages/49/67/317472b9d94f511384bf579cf45b52f21b4a5535ac7a750169840ce1a611/greenswitch-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "a6a35493a273a26c47930e4fa8b8e1fa", "sha256": "2379936f748af397ab62d4d4c6201c30fae16696d6a999947b89d844506960c6" }, "downloads": -1, "filename": "greenswitch-0.0.5.tar.gz", "has_sig": false, "md5_digest": "a6a35493a273a26c47930e4fa8b8e1fa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4166, "upload_time": "2016-06-15T13:30:24", "url": "https://files.pythonhosted.org/packages/62/79/562b18f44d45db5bb2a13d27425b93620c7b602fec6bd545ec7624b33178/greenswitch-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "cecf81ec82832f095da2b1618faf5ba6", "sha256": "a0535cc9e457c976200596831669ed3ed8400678c084afe9dbe0efaf0716aa45" }, "downloads": -1, "filename": "greenswitch-0.0.6.tar.gz", "has_sig": false, "md5_digest": "cecf81ec82832f095da2b1618faf5ba6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4214, "upload_time": "2016-11-05T23:34:48", "url": "https://files.pythonhosted.org/packages/b0/ae/bb4a709db40c4d454edbac98a25511905e1b0fb6f34bd2df05c5d876776e/greenswitch-0.0.6.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "4202117e3a3c5321160dd9c307eac2d1", "sha256": "a5b72b259ed7f89d545eecf9d5ca519dd6750d18f25ca2b2907616e3c5e2b527" }, "downloads": -1, "filename": "greenswitch-0.0.7.tar.gz", "has_sig": false, "md5_digest": "4202117e3a3c5321160dd9c307eac2d1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4278, "upload_time": "2016-12-09T12:26:38", "url": "https://files.pythonhosted.org/packages/7a/40/e6baf26c33bc67cf5c6aaa6be92cad82c793586171e2ba62bff24d5665cc/greenswitch-0.0.7.tar.gz" } ], "0.0.8": [ { "comment_text": "", "digests": { "md5": "10d645f03b064bca9ed571366f241daa", "sha256": "1ffe2ccb1a73e9e2d3ada67b1646b7c60c1bccf85ec031ad16530d92cbfce703" }, "downloads": -1, "filename": "greenswitch-0.0.8.tar.gz", "has_sig": false, "md5_digest": "10d645f03b064bca9ed571366f241daa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4309, "upload_time": "2016-12-29T13:17:53", "url": "https://files.pythonhosted.org/packages/f8/e5/b2071b18f83c6cad30d6c3c1003acb5f4fe9206a464698280ebc32c7be4c/greenswitch-0.0.8.tar.gz" } ], "0.0.9": [ { "comment_text": "", "digests": { "md5": "bcf41819bcd3e5f6da05b1614f448dd3", "sha256": "61775a776112962405f4c208e4e646e87162cabc1b9da12d0110be3826673a6e" }, "downloads": -1, "filename": "greenswitch-0.0.9.tar.gz", "has_sig": false, "md5_digest": "bcf41819bcd3e5f6da05b1614f448dd3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11280, "upload_time": "2018-12-18T13:38:13", "url": "https://files.pythonhosted.org/packages/d0/73/e0d0971cca3e9f5130642d1edff50d1f41a7b1902b0739f200da3b1770a8/greenswitch-0.0.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "bcf41819bcd3e5f6da05b1614f448dd3", "sha256": "61775a776112962405f4c208e4e646e87162cabc1b9da12d0110be3826673a6e" }, "downloads": -1, "filename": "greenswitch-0.0.9.tar.gz", "has_sig": false, "md5_digest": "bcf41819bcd3e5f6da05b1614f448dd3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11280, "upload_time": "2018-12-18T13:38:13", "url": "https://files.pythonhosted.org/packages/d0/73/e0d0971cca3e9f5130642d1edff50d1f41a7b1902b0739f200da3b1770a8/greenswitch-0.0.9.tar.gz" } ] }