{ "info": { "author": "Andre Sencioles Vitorio Oliveira", "author_email": "andre@bcp.net.br", "bugtrack_url": null, "classifiers": [ "Natural Language :: English", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Operating System :: POSIX :: BSD", "Operating System :: POSIX :: Linux", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: Implementation :: CPython" ], "description": "=======\nlibyate\n=======\n\nPython library for developing Yate external applications\n\n\nSample script application:\n--------------------------\n\n* extmodule.conf\n\n.. sourcecode:: cfg\n\n [scripts]\n sample.py=-d\n\n\n* sample.py\n\n.. sourcecode:: python\n\n #!/usr/bin/env python\n \"\"\"\n Sample application to test libyate\n \"\"\"\n\n import logging\n import optparse\n\n import libyate.extmodule\n\n\n class MyApp(libyate.extmodule.Script):\n def start(self):\n # Query engine version\n self.set_local('engine.version')\n\n # Send a message to the engine\n self.message(name='myapp.test', id='somerandomid',\n kvp={'testing': True,\n 'done': '75%',\n 'path': '/bin:/usr/bin'},\n callback=self.reply)\n\n from time import sleep\n sleep(1)\n self.unwatch('engine.timer')\n\n def call_route(self, msg):\n self.logger.info('Handling \"call.route\": {0!r}'.format(msg))\n\n # Just reply with processed = False\n return msg.reply()\n\n def reply(self, msg):\n self.logger.info('Got reply for \"{0}\"'.format(msg.id))\n\n def timer(self, msg):\n self.logger.info('Some periodic routine')\n\n\n if __name__ == '__main__':\n parser = optparse.OptionParser()\n parser.add_option('-d', '--debug', action='store_true', default=False,\n help='increase logging verbosity')\n parser.add_option('-q', '--quiet', action='store_true', default=False,\n help='reduce the logging verbosity')\n options, _ = parser.parse_args()\n\n log_format = \\\n '%(asctime)s <%(name)s[%(threadName)s]:%(levelname)s> %(message)s'\n\n logging.basicConfig(**{\n 'level': (logging.DEBUG if options.debug else\n logging.WARN if options.quiet else\n logging.INFO),\n 'format': log_format,\n })\n\n app = MyApp(name='sample.py', trackparam='libyate_sample', restart=False)\n app.install(app.call_route, 'call.route', 50)\n app.watch(app.timer, 'engine.timer')\n app.main()\n\n\n* Output:\n\n::\n\n 2015-03-03 18:17:32,374 Setting handler tracking parameter\n 2015-03-03 18:17:32,374 Setting parameter \"trackparam\" to: libyate_sample\n 2015-03-03 18:17:32,375 Setting module restart parameter\n 2015-03-03 18:17:32,375 Setting parameter \"restart\" to: false\n 2015-03-03 18:17:32,375 Installing handler for \"call.route\"\n 2015-03-03 18:17:32,375 Installing watcher for \"engine.timer\"\n 2015-03-03 18:17:32,375 Starting module threads\n 2015-03-03 18:17:32,375 Started input\n 2015-03-03 18:17:32,376 Started output\n 2015-03-03 18:17:32,376 Started main loop\n 2015-03-03 18:17:32,376 Dumping the startup queue into the output queue\n 2015-03-03 18:17:32,376 Executing user startup code\n 2015-03-03 18:17:32,376 Querying parameter \"engine.version\"\n 2015-03-03 18:17:32,377 Sending message to the engine: libyate.engine.Message('somerandomid', datetime.datetime(2015, 3, 3, 21, 17, 32, 376746), 'myapp.test', None, libyate.type.OrderedDict((('path', '/bin:/usr/bin'), ('testing', True), ('done', '75%'))))\n 2015-03-03 18:17:32,377 Sending 38 bytes: '%%>setlocal:trackparam:libyate_sample\\n'\n 2015-03-03 18:17:32,378 Sending 26 bytes: '%%>setlocal:restart:false\\n'\n 2015-03-03 18:17:32,378 Sending 27 bytes: '%%>install:50:call.route::\\n'\n 2015-03-03 18:17:32,378 Sending 22 bytes: '%%>watch:engine.timer\\n'\n 2015-03-03 18:17:32,378 Sending 28 bytes: '%%>setlocal:engine.version:\\n'\n 2015-03-03 18:17:32,378 Sending 90 bytes: '%%>message:somerandomid:1425417452:myapp.test::path=/bin%z/usr/bin:testing=true:done=75%%\\n'\n 2015-03-03 18:17:32,378 Received 43 bytes: '%% Received command: libyate.engine.SetLocalReply('trackparam', 'libyate_sample', True)\n 2015-03-03 18:17:32,380 Parameter \"trackparam\" set to: libyate_sample\n 2015-03-03 18:17:32,383 Received 31 bytes: '%% Received 30 bytes: '%% Received 27 bytes: '%% Received 38 bytes: '%% Received command: libyate.engine.SetLocalReply('restart', 'false', True)\n 2015-03-03 18:17:32,388 Received 85 bytes: '%% Parameter \"restart\" set to: false\n 2015-03-03 18:17:32,389 Received command: libyate.engine.InstallReply(50, 'call.route', True)\n 2015-03-03 18:17:32,389 Received command: libyate.engine.WatchReply('engine.timer', True)\n 2015-03-03 18:17:32,390 Installed handler for \"call.route\"\n 2015-03-03 18:17:32,390 Received command: libyate.engine.SetLocalReply('engine.version', '5.4.0', True)\n 2015-03-03 18:17:32,391 Installed watcher for \"engine.timer\"\n 2015-03-03 18:17:32,391 Parameter \"engine.version\" set to: 5.4.0\n 2015-03-03 18:17:32,391 Received command: libyate.engine.MessageReply('somerandomid', False, 'myapp.test', None, libyate.type.OrderedDict((('path', '/bin:/usr/bin'), ('testing', 'true'), ('done', '75%'))))\n 2015-03-03 18:17:32,392 Handler: >\n 2015-03-03 18:17:32,392 Got reply for \"somerandomid\"\n 2015-03-03 18:17:32,392 Result: None\n 2015-03-03 18:17:33,018 Received 589 bytes: '%% Received command: libyate.engine.MessageReply(None, False, 'engine.timer', None, libyate.type.OrderedDict((('time', '1425417453'), ('nodename', 'hades'), ('handlers', 'subscription:90,zlibcompress:90,socks:90,openssl:90,mux:90,javascript:90,callfork:90,conf:90,dumb:90,enumroute:90,gvoice:90,pbx:90,iax:90,jingle:90,mgcpgw:90,mrcp:90,monitoring:90,park:90,queues:90,sipfeatures:90,users:90,snmpagent:90,fileinfo:90,filetransfer:90,stun:90,analog:90,sig:90,jbfeatures:90,jabber:90,sigtransport:90,mgcpca:90,ciscosm:90,analogdetect:90,tonedetect:90,tone:90,yrtp:90,analyzer:90,wave:90,sip:90,presence:90,queuesnotify:90,register:90,regfile:100'))))\n 2015-03-03 18:17:33,053 Handler: >\n 2015-03-03 18:17:33,053 Some periodic routine\n 2015-03-03 18:17:33,053 Result: None\n 2015-03-03 18:17:33,382 Removing watcher for \"engine.timer\"\n 2015-03-03 18:17:33,383 Entering main loop\n 2015-03-03 18:17:33,417 Sending 24 bytes: '%%>unwatch:engine.timer\\n'\n 2015-03-03 18:17:33,422 Received 29 bytes: '%% Received command: libyate.engine.UnWatchReply('engine.timer', True)\n 2015-03-03 18:17:33,452 Removed watcher for \"engine.timer\"\n 2015-03-03 18:17:49,969 Stopping input\n 2015-03-03 18:17:49,969 Stopping module\n 2015-03-03 18:17:49,970 Stopping module\n 2015-03-03 18:17:50,012 Stopping module\n 2015-03-03 18:17:50,024 Waiting for threads\n\n\nSample socket client application:\n---------------------------------\n\n* extmodule.conf\n\n.. sourcecode:: cfg\n\n [listener sample]\n type=unix\n path=/tmp/sample.sock\n\n\n* sample.py\n\n.. sourcecode:: python\n\n #!/usr/bin/env python\n \"\"\"\n Sample application to test libyate\n \"\"\"\n\n import logging\n import optparse\n\n import libyate.extmodule\n\n\n class MyApp(libyate.extmodule.SocketClient):\n def start(self):\n # Send message to the engine\n self.output('Starting sample.py')\n\n # Query engine version\n self.set_local('engine.version')\n\n # Send a message to the engine\n self.message(name='myapp.test', id='somerandomid',\n kvp={'testing': True,\n 'done': '75%',\n 'path': '/bin:/usr/bin'},\n callback=self.reply)\n\n from time import sleep\n sleep(1)\n self.unwatch('engine.timer')\n\n def call_route(self, msg):\n self.logger.info('Handling \"call.route\": {0!r}'.format(msg))\n\n # Just reply with processed = False\n return msg.reply()\n\n def reply(self, msg):\n self.logger.info('Got reply for \"{0}\"'.format(msg.id))\n\n def timer(self, msg):\n self.logger.info('Some periodic routine')\n\n\n if __name__ == '__main__':\n parser = optparse.OptionParser(\n 'usage: %prog [options] [port]')\n parser.add_option('-d', '--debug', action='store_true', default=False,\n help='increase logging verbosity')\n parser.add_option('-q', '--quiet', action='store_true', default=False,\n help='reduce the logging verbosity')\n\n options, args = parser.parse_args()\n\n if len(args) < 1:\n parser.error('either a host or a path must be specified')\n\n log_format = \\\n '%(asctime)s <%(name)s[%(threadName)s]:%(levelname)s> %(message)s'\n\n logging.basicConfig(**{\n 'level': (logging.DEBUG if options.debug else\n logging.WARN if options.quiet else\n logging.INFO),\n 'format': log_format,\n })\n\n app = MyApp('global', *args, name='sample.py', trackparam='libyate_sample',\n restart=False)\n app.install(app.call_route, 'call.route', 50)\n app.watch(app.timer, 'engine.timer')\n app.main()\n\n\n* Expected output:\n\n::\n\n $ python sample_client.py -d 127.0.0.1 5555\n 2015-03-03 18:30:35,476 Setting handler tracking parameter\n 2015-03-03 18:30:35,476 Setting parameter \"trackparam\" to: libyate_sample\n 2015-03-03 18:30:35,477 Setting module restart parameter\n 2015-03-03 18:30:35,477 Setting parameter \"restart\" to: false\n 2015-03-03 18:30:35,477 Connecting as \"global\"\n 2015-03-03 18:30:35,478 Installing handler for \"call.route\"\n 2015-03-03 18:30:35,478 Installing watcher for \"engine.timer\"\n 2015-03-03 18:30:35,478 Starting module threads\n 2015-03-03 18:30:35,479 Started input\n 2015-03-03 18:30:35,479 Started output\n 2015-03-03 18:30:35,479 Sending 20 bytes: '%%>connect:global::\\n'\n 2015-03-03 18:30:35,479 Started main loop\n 2015-03-03 18:30:35,479 Dumping the startup queue into the output queue\n 2015-03-03 18:30:35,480 Executing user startup code\n 2015-03-03 18:30:35,480 Sending output: Starting sample.py\n 2015-03-03 18:30:35,480 Querying parameter \"engine.version\"\n 2015-03-03 18:30:35,481 Sending message to the engine: libyate.engine.Message('somerandomid', datetime.datetime(2015, 3, 3, 21, 30, 35, 480296), 'myapp.test', None, libyate.type.OrderedDict((('path', '/bin:/usr/bin'), ('testing', True), ('done', '75%'))))\n 2015-03-03 18:30:35,481 Sending 38 bytes: '%%>setlocal:trackparam:libyate_sample\\n'\n 2015-03-03 18:30:35,481 Sending 26 bytes: '%%>setlocal:restart:false\\n'\n 2015-03-03 18:30:35,481 Sending 27 bytes: '%%>install:50:call.route::\\n'\n 2015-03-03 18:30:35,482 Sending 22 bytes: '%%>watch:engine.timer\\n'\n 2015-03-03 18:30:35,482 Sending 29 bytes: '%%>output:Starting sample.py\\n'\n 2015-03-03 18:30:35,482 Sending 28 bytes: '%%>setlocal:engine.version:\\n'\n 2015-03-03 18:30:35,482 Sending 90 bytes: '%%>message:somerandomid:1425418235:myapp.test::path=/bin%z/usr/bin:testing=true:done=75%%\\n'\n 2015-03-03 18:30:35,484 Received 42 bytes: '%% Received 127 bytes: '\\n%% Received command: libyate.engine.SetLocalReply('trackparam', 'libyate_sample', True)\n 2015-03-03 18:30:35,489 Parameter \"trackparam\" set to: libyate_sample\n 2015-03-03 18:30:35,490 Received 84 bytes: '%% Received command: libyate.engine.SetLocalReply('restart', 'false', True)\n 2015-03-03 18:30:35,490 Received 1 bytes: '\\n'\n 2015-03-03 18:30:35,490 Parameter \"restart\" set to: false\n 2015-03-03 18:30:35,491 Received command: libyate.engine.InstallReply(50, 'call.route', True)\n 2015-03-03 18:30:35,491 Installed handler for \"call.route\"\n 2015-03-03 18:30:35,492 Received command: libyate.engine.WatchReply('engine.timer', True)\n 2015-03-03 18:30:35,492 Installed watcher for \"engine.timer\"\n 2015-03-03 18:30:35,492 Received command: libyate.engine.SetLocalReply('engine.version', '5.4.0', True)\n 2015-03-03 18:30:35,492 Parameter \"engine.version\" set to: 5.4.0\n 2015-03-03 18:30:35,493 Received command: libyate.engine.MessageReply('somerandomid', False, 'myapp.test', None, libyate.type.OrderedDict((('path', '/bin:/usr/bin'), ('testing', 'true'), ('done', '75%'))))\n 2015-03-03 18:30:35,493 Handler: >\n 2015-03-03 18:30:35,493 Got reply for \"somerandomid\"\n 2015-03-03 18:30:35,493 Result: None\n 2015-03-03 18:30:36,001 Received 589 bytes: '%% Received command: libyate.engine.MessageReply(None, False, 'engine.timer', None, libyate.type.OrderedDict((('time', '1425418236'), ('nodename', 'hades'), ('handlers', 'subscription:90,zlibcompress:90,socks:90,openssl:90,mux:90,javascript:90,callfork:90,conf:90,dumb:90,enumroute:90,gvoice:90,pbx:90,iax:90,jingle:90,mgcpgw:90,mrcp:90,monitoring:90,park:90,queues:90,sipfeatures:90,users:90,snmpagent:90,fileinfo:90,filetransfer:90,stun:90,analog:90,sig:90,jbfeatures:90,jabber:90,sigtransport:90,mgcpca:90,ciscosm:90,analogdetect:90,tonedetect:90,tone:90,yrtp:90,analyzer:90,wave:90,sip:90,presence:90,queuesnotify:90,register:90,regfile:100'))))\n 2015-03-03 18:30:36,048 Handler: >\n 2015-03-03 18:30:36,048 Some periodic routine\n 2015-03-03 18:30:36,049 Result: None\n 2015-03-03 18:30:36,484 Removing watcher for \"engine.timer\"\n 2015-03-03 18:30:36,484 Entering main loop\n 2015-03-03 18:30:36,520 Sending 24 bytes: '%%>unwatch:engine.timer\\n'\n 2015-03-03 18:30:36,525 Received 29 bytes: '%% Received command: libyate.engine.UnWatchReply('engine.timer', True)\n 2015-03-03 18:30:36,551 Removed watcher for \"engine.timer\"\n ^C2015-03-03 18:30:41,455 Stopping module\n 2015-03-03 18:30:41,455 Stopping input\n 2015-03-03 18:30:41,455 Stopping module\n 2015-03-03 18:30:41,467 Stopping module\n 2015-03-03 18:30:41,510 Waiting for threads\n\n\nLicensing:\n----------\n\nLicensed under ISC license:\n\n Copyright (c) 2013 Andre Sencioles Vitorio Oliveira \n\n Permission to use, copy, modify, and distribute this software for any\n purpose with or without fee is hereby granted, provided that the above\n copyright notice and this permission notice appear in all copies.\n\n THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.", "description_content_type": null, "docs_url": null, "download_url": null, "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://bitbucket.org/asenci/libyate", "keywords": "yate", "license": "ISC License", "maintainer": null, "maintainer_email": null, "name": "libyate", "package_url": "https://pypi.org/project/libyate/", "platform": "any", "project_url": "https://pypi.org/project/libyate/", "project_urls": { "Homepage": "http://bitbucket.org/asenci/libyate" }, "release_url": "https://pypi.org/project/libyate/1.0/", "requires_dist": null, "requires_python": null, "summary": "Python library for developing Yate external applications", "version": "1.0" }, "last_serial": 1592086, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "fc47ef6a7c6d1aea917fc8c618634583", "sha256": "2b754b8580a9d2bb75d26046bab08d090fb85919d1e741e340e891f48d9320d8" }, "downloads": -1, "filename": "libyate-0.1.tar.gz", "has_sig": false, "md5_digest": "fc47ef6a7c6d1aea917fc8c618634583", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4941, "upload_time": "2014-07-02T18:23:41", "url": "https://files.pythonhosted.org/packages/7b/be/c20de77ad4b47a71259402fd780f8ef232464f56e783aecbd1c11e8c2492/libyate-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "4bfebee37dd1b31a31e7e90277b0ca4f", "sha256": "53f5c51c1c8be869b2549e6a540b490504296717768e6e18bf094e9a866dfcbc" }, "downloads": -1, "filename": "libyate-0.2.tar.gz", "has_sig": false, "md5_digest": "4bfebee37dd1b31a31e7e90277b0ca4f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5433, "upload_time": "2014-07-02T18:24:46", "url": "https://files.pythonhosted.org/packages/82/68/2e99dfdc32184b16a58baa64f84c532361a59d4510d941e4f7d0d3b02a1a/libyate-0.2.tar.gz" } ], "1.0": [ { "comment_text": "", "digests": { "md5": "74fdacad567b1005dba028179c99c439", "sha256": "8a943f58736e00c26f667fc20a08610b64426339227e69a694d67d5b6105579e" }, "downloads": -1, "filename": "libyate-1.0-py2-none-any.whl", "has_sig": false, "md5_digest": "74fdacad567b1005dba028179c99c439", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 24796, "upload_time": "2015-06-15T01:38:04", "url": "https://files.pythonhosted.org/packages/c0/ab/32d773d001aacae247b4a5d85a2a2c440096d0b890fd068f0a8fb2a12a30/libyate-1.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "586e3811a96563853f9a701561954963", "sha256": "b7ac6a08760765a77dc278b91a6debd0164d0376eb770e560cf0f68058120e06" }, "downloads": -1, "filename": "libyate-1.0.tar.gz", "has_sig": false, "md5_digest": "586e3811a96563853f9a701561954963", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18567, "upload_time": "2015-06-15T01:38:08", "url": "https://files.pythonhosted.org/packages/86/14/b304afa93ce57577427a8877d705f3e9a83e72846e83f7ea30af7328452f/libyate-1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "74fdacad567b1005dba028179c99c439", "sha256": "8a943f58736e00c26f667fc20a08610b64426339227e69a694d67d5b6105579e" }, "downloads": -1, "filename": "libyate-1.0-py2-none-any.whl", "has_sig": false, "md5_digest": "74fdacad567b1005dba028179c99c439", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 24796, "upload_time": "2015-06-15T01:38:04", "url": "https://files.pythonhosted.org/packages/c0/ab/32d773d001aacae247b4a5d85a2a2c440096d0b890fd068f0a8fb2a12a30/libyate-1.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "586e3811a96563853f9a701561954963", "sha256": "b7ac6a08760765a77dc278b91a6debd0164d0376eb770e560cf0f68058120e06" }, "downloads": -1, "filename": "libyate-1.0.tar.gz", "has_sig": false, "md5_digest": "586e3811a96563853f9a701561954963", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18567, "upload_time": "2015-06-15T01:38:08", "url": "https://files.pythonhosted.org/packages/86/14/b304afa93ce57577427a8877d705f3e9a83e72846e83f7ea30af7328452f/libyate-1.0.tar.gz" } ] }