{"action":"created","comment":{"url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/pulls/comments/189792672","pull_request_review_id":122036629,"id":189792672,"diff_hunk":"@@ -0,0 +1,52 @@\n+# -*- coding: utf-8 -*-\n+##############################################################################\n+#\n+#    Copyright (C) 2018 Compassion CH (http://www.compassion.ch)\n+#    @author: Stephane Eicher <seicher@compassion.ch>\n+#\n+#    The licence is in the file __manifest__.py\n+#\n+##############################################################################\n+import logging\n+\n+from odoo import models, api, _\n+from odoo.exceptions import UserError\n+\n+_logger = logging.getLogger(__name__)\n+\n+\n+class ResUser(models.Model):\n+    _inherit = 'res.users'\n+\n+    @api.model\n+    def asterisk_connect(self, log=True):\n+        for ast_user in self:\n+\n+            user, ast_server, ast_manager = \\\n+                self.env['asterisk.server']._connect_to_asterisk()\n+\n+            channel = '%s/%s' % (ast_user.asterisk_chan_type, user.resource)\n+\n+            _prefix = '*31' if log else '*32'\n+            extension = _prefix + ast_user.internal_number\n+\n+            try:\n+                ast_manager.Originate(\n+                    channel,\n+                    context='default',\n+                    extension=extension,\n+                    priority=1,\n+                    timeout=unicode(ast_server.wait_time * 1000),\n+                    caller_id=ast_user.internal_number,\n+                    account=ast_user.cdraccount)\n+            except Exception, e:\n+                _logger.error(\n+                    \"Error in the Originate request to Asterisk server %s\",\n+                    ast_server.ip_address)\n+                _logger.error(\n+                    \"Here are the details of the error: '%s'\", unicode(e))\n+                raise UserError(","path":"hr_switzerland/models/res_users.py","position":48,"original_position":48,"commit_id":"9a8a0ab27e7570a773c608f587087f5ea75e6d21","original_commit_id":"9a8a0ab27e7570a773c608f587087f5ea75e6d21","user":{"login":"ecino","id":8435180,"avatar_url":"https://avatars0.githubusercontent.com/u/8435180?v=4","gravatar_id":"","url":"https://api.github.com/users/ecino","html_url":"https://github.com/ecino","followers_url":"https://api.github.com/users/ecino/followers","following_url":"https://api.github.com/users/ecino/following{/other_user}","gists_url":"https://api.github.com/users/ecino/gists{/gist_id}","starred_url":"https://api.github.com/users/ecino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ecino/subscriptions","organizations_url":"https://api.github.com/users/ecino/orgs","repos_url":"https://api.github.com/users/ecino/repos","events_url":"https://api.github.com/users/ecino/events{/privacy}","received_events_url":"https://api.github.com/users/ecino/received_events","type":"User","site_admin":false},"body":"I'm not sure that we should raise the error? It means the user won't be able to check in or check out in case of error. I think it's okay if the asterisk logon/logoff fails. What do you think? Or maybe here we could use a small toast message if we inherit from this module that I looked for some time : [OCA/web_notify](https://github.com/OCA/web/tree/10.0/web_notify)","created_at":"2018-05-22T06:52:28Z","updated_at":"2018-05-22T06:52:38Z","html_url":"https://github.com/CompassionCH/compassion-switzerland/pull/460#discussion_r189792672","pull_request_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/pulls/460","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/CompassionCH/compassion-switzerland/pulls/comments/189792672"},"html":{"href":"https://github.com/CompassionCH/compassion-switzerland/pull/460#discussion_r189792672"},"pull_request":{"href":"https://api.github.com/repos/CompassionCH/compassion-switzerland/pulls/460"}}},"pull_request":{"url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/pulls/460","id":188646041,"html_url":"https://github.com/CompassionCH/compassion-switzerland/pull/460","diff_url":"https://github.com/CompassionCH/compassion-switzerland/pull/460.diff","patch_url":"https://github.com/CompassionCH/compassion-switzerland/pull/460.patch","issue_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/issues/460","number":460,"state":"open","locked":false,"title":"CO-1695 [ADD] Module asterisk_autolog","user":{"login":"eicher31","id":8927872,"avatar_url":"https://avatars0.githubusercontent.com/u/8927872?v=4","gravatar_id":"","url":"https://api.github.com/users/eicher31","html_url":"https://github.com/eicher31","followers_url":"https://api.github.com/users/eicher31/followers","following_url":"https://api.github.com/users/eicher31/following{/other_user}","gists_url":"https://api.github.com/users/eicher31/gists{/gist_id}","starred_url":"https://api.github.com/users/eicher31/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eicher31/subscriptions","organizations_url":"https://api.github.com/users/eicher31/orgs","repos_url":"https://api.github.com/users/eicher31/repos","events_url":"https://api.github.com/users/eicher31/events{/privacy}","received_events_url":"https://api.github.com/users/eicher31/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-05-17T07:30:36Z","updated_at":"2018-05-22T06:52:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"02621679bd30425b27b669060475eefd0c57f3c4","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/pulls/460/commits","review_comments_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/pulls/460/comments","review_comment_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/issues/460/comments","statuses_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/statuses/9a8a0ab27e7570a773c608f587087f5ea75e6d21","head":{"label":"eicher31:10.0","ref":"10.0","sha":"9a8a0ab27e7570a773c608f587087f5ea75e6d21","user":{"login":"eicher31","id":8927872,"avatar_url":"https://avatars0.githubusercontent.com/u/8927872?v=4","gravatar_id":"","url":"https://api.github.com/users/eicher31","html_url":"https://github.com/eicher31","followers_url":"https://api.github.com/users/eicher31/followers","following_url":"https://api.github.com/users/eicher31/following{/other_user}","gists_url":"https://api.github.com/users/eicher31/gists{/gist_id}","starred_url":"https://api.github.com/users/eicher31/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eicher31/subscriptions","organizations_url":"https://api.github.com/users/eicher31/orgs","repos_url":"https://api.github.com/users/eicher31/repos","events_url":"https://api.github.com/users/eicher31/events{/privacy}","received_events_url":"https://api.github.com/users/eicher31/received_events","type":"User","site_admin":false},"repo":{"id":132108978,"name":"compassion-switzerland","full_name":"eicher31/compassion-switzerland","owner":{"login":"eicher31","id":8927872,"avatar_url":"https://avatars0.githubusercontent.com/u/8927872?v=4","gravatar_id":"","url":"https://api.github.com/users/eicher31","html_url":"https://github.com/eicher31","followers_url":"https://api.github.com/users/eicher31/followers","following_url":"https://api.github.com/users/eicher31/following{/other_user}","gists_url":"https://api.github.com/users/eicher31/gists{/gist_id}","starred_url":"https://api.github.com/users/eicher31/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eicher31/subscriptions","organizations_url":"https://api.github.com/users/eicher31/orgs","repos_url":"https://api.github.com/users/eicher31/repos","events_url":"https://api.github.com/users/eicher31/events{/privacy}","received_events_url":"https://api.github.com/users/eicher31/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/eicher31/compassion-switzerland","description":"Odoo modules specific for Compassion Switzerland","fork":true,"url":"https://api.github.com/repos/eicher31/compassion-switzerland","forks_url":"https://api.github.com/repos/eicher31/compassion-switzerland/forks","keys_url":"https://api.github.com/repos/eicher31/compassion-switzerland/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eicher31/compassion-switzerland/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eicher31/compassion-switzerland/teams","hooks_url":"https://api.github.com/repos/eicher31/compassion-switzerland/hooks","issue_events_url":"https://api.github.com/repos/eicher31/compassion-switzerland/issues/events{/number}","events_url":"https://api.github.com/repos/eicher31/compassion-switzerland/events","assignees_url":"https://api.github.com/repos/eicher31/compassion-switzerland/assignees{/user}","branches_url":"https://api.github.com/repos/eicher31/compassion-switzerland/branches{/branch}","tags_url":"https://api.github.com/repos/eicher31/compassion-switzerland/tags","blobs_url":"https://api.github.com/repos/eicher31/compassion-switzerland/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eicher31/compassion-switzerland/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eicher31/compassion-switzerland/git/refs{/sha}","trees_url":"https://api.github.com/repos/eicher31/compassion-switzerland/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eicher31/compassion-switzerland/statuses/{sha}","languages_url":"https://api.github.com/repos/eicher31/compassion-switzerland/languages","stargazers_url":"https://api.github.com/repos/eicher31/compassion-switzerland/stargazers","contributors_url":"https://api.github.com/repos/eicher31/compassion-switzerland/contributors","subscribers_url":"https://api.github.com/repos/eicher31/compassion-switzerland/subscribers","subscription_url":"https://api.github.com/repos/eicher31/compassion-switzerland/subscription","commits_url":"https://api.github.com/repos/eicher31/compassion-switzerland/commits{/sha}","git_commits_url":"https://api.github.com/repos/eicher31/compassion-switzerland/git/commits{/sha}","comments_url":"https://api.github.com/repos/eicher31/compassion-switzerland/comments{/number}","issue_comment_url":"https://api.github.com/repos/eicher31/compassion-switzerland/issues/comments{/number}","contents_url":"https://api.github.com/repos/eicher31/compassion-switzerland/contents/{+path}","compare_url":"https://api.github.com/repos/eicher31/compassion-switzerland/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eicher31/compassion-switzerland/merges","archive_url":"https://api.github.com/repos/eicher31/compassion-switzerland/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eicher31/compassion-switzerland/downloads","issues_url":"https://api.github.com/repos/eicher31/compassion-switzerland/issues{/number}","pulls_url":"https://api.github.com/repos/eicher31/compassion-switzerland/pulls{/number}","milestones_url":"https://api.github.com/repos/eicher31/compassion-switzerland/milestones{/number}","notifications_url":"https://api.github.com/repos/eicher31/compassion-switzerland/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eicher31/compassion-switzerland/labels{/name}","releases_url":"https://api.github.com/repos/eicher31/compassion-switzerland/releases{/id}","deployments_url":"https://api.github.com/repos/eicher31/compassion-switzerland/deployments","created_at":"2018-05-04T08:04:35Z","updated_at":"2018-05-18T11:30:21Z","pushed_at":"2018-05-18T11:30:19Z","git_url":"git://github.com/eicher31/compassion-switzerland.git","ssh_url":"git@github.com:eicher31/compassion-switzerland.git","clone_url":"https://github.com/eicher31/compassion-switzerland.git","svn_url":"https://github.com/eicher31/compassion-switzerland","homepage":"","size":14967,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"10.0"}},"base":{"label":"CompassionCH:devel","ref":"devel","sha":"b2f0f0052c2c0955e0d09e73d6e0600e056ac9a6","user":{"login":"CompassionCH","id":8435213,"avatar_url":"https://avatars1.githubusercontent.com/u/8435213?v=4","gravatar_id":"","url":"https://api.github.com/users/CompassionCH","html_url":"https://github.com/CompassionCH","followers_url":"https://api.github.com/users/CompassionCH/followers","following_url":"https://api.github.com/users/CompassionCH/following{/other_user}","gists_url":"https://api.github.com/users/CompassionCH/gists{/gist_id}","starred_url":"https://api.github.com/users/CompassionCH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CompassionCH/subscriptions","organizations_url":"https://api.github.com/users/CompassionCH/orgs","repos_url":"https://api.github.com/users/CompassionCH/repos","events_url":"https://api.github.com/users/CompassionCH/events{/privacy}","received_events_url":"https://api.github.com/users/CompassionCH/received_events","type":"Organization","site_admin":false},"repo":{"id":31906068,"name":"compassion-switzerland","full_name":"CompassionCH/compassion-switzerland","owner":{"login":"CompassionCH","id":8435213,"avatar_url":"https://avatars1.githubusercontent.com/u/8435213?v=4","gravatar_id":"","url":"https://api.github.com/users/CompassionCH","html_url":"https://github.com/CompassionCH","followers_url":"https://api.github.com/users/CompassionCH/followers","following_url":"https://api.github.com/users/CompassionCH/following{/other_user}","gists_url":"https://api.github.com/users/CompassionCH/gists{/gist_id}","starred_url":"https://api.github.com/users/CompassionCH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CompassionCH/subscriptions","organizations_url":"https://api.github.com/users/CompassionCH/orgs","repos_url":"https://api.github.com/users/CompassionCH/repos","events_url":"https://api.github.com/users/CompassionCH/events{/privacy}","received_events_url":"https://api.github.com/users/CompassionCH/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CompassionCH/compassion-switzerland","description":"Odoo modules specific for Compassion Switzerland","fork":false,"url":"https://api.github.com/repos/CompassionCH/compassion-switzerland","forks_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/forks","keys_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/teams","hooks_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/hooks","issue_events_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/issues/events{/number}","events_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/events","assignees_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/assignees{/user}","branches_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/branches{/branch}","tags_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/tags","blobs_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/git/refs{/sha}","trees_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/statuses/{sha}","languages_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/languages","stargazers_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/stargazers","contributors_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/contributors","subscribers_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/subscribers","subscription_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/subscription","commits_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/commits{/sha}","git_commits_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/git/commits{/sha}","comments_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/comments{/number}","issue_comment_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/issues/comments{/number}","contents_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/contents/{+path}","compare_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/merges","archive_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/downloads","issues_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/issues{/number}","pulls_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/pulls{/number}","milestones_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/milestones{/number}","notifications_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/labels{/name}","releases_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/releases{/id}","deployments_url":"https://api.github.com/repos/CompassionCH/compassion-switzerland/deployments","created_at":"2015-03-09T15:24:10Z","updated_at":"2018-05-18T10:35:43Z","pushed_at":"2018-05-18T11:30:20Z","git_url":"git://github.com/CompassionCH/compassion-switzerland.git","ssh_url":"git@github.com:CompassionCH/compassion-switzerland.git","clone_url":"https://github.com/CompassionCH/compassion-switzerland.git","svn_url":"https://github.com/CompassionCH/compassion-switzerland","homepage":"","size":15468,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0"},"forks":17,"open_issues":2,"watchers":2,"default_branch":"10.0"}},"_links":{"self":{"href":"https://api.github.com/repos/CompassionCH/compassion-switzerland/pulls/460"},"html":{"href":"https://github.com/CompassionCH/compassion-switzerland/pull/460"},"issue":{"href":"https://api.github.com/repos/CompassionCH/compassion-switzerland/issues/460"},"comments":{"href":"https://api.github.com/repos/CompassionCH/compassion-switzerland/issues/460/comments"},"review_comments":{"href":"https://api.github.com/repos/CompassionCH/compassion-switzerland/pulls/460/comments"},"review_comment":{"href":"https://api.github.com/repos/CompassionCH/compassion-switzerland/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CompassionCH/compassion-switzerland/pulls/460/commits"},"statuses":{"href":"https://api.github.com/repos/CompassionCH/compassion-switzerland/statuses/9a8a0ab27e7570a773c608f587087f5ea75e6d21"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"ecino"}}