{"action":"created","comment":{"url":"https://api.github.com/repos/2600hz/kazoo/pulls/comments/60779152","id":60779152,"diff_hunk":"@@ -195,21 +195,18 @@ create_phone_number(Number) ->\n reserve(Num, Options) ->\n     case ?MODULE:get(Num, Options) of\n         {'ok', Number} ->\n-            States = [?NUMBER_STATE_RESERVED, ?NUMBER_STATE_DISCOVERY, ?NUMBER_STATE_AVAILABLE],\n-            State = knm_phone_number:state(phone_number(Number)),\n-            case lists:member(State, States) of\n-                'true' ->\n-                    Routines = [fun knm_number_states:to_reserved/1\n-                                ,fun save_number/1\n-                                ,fun dry_run_or_number/1\n-                               ],\n-                    apply_number_routines(Number, Routines);\n-                'false' ->\n-                    {'error', {'invalid_state_transition', State}}\n-            end;\n-        _Other -> _Other\n+            attempt(fun do_reserve/1, [Number]);\n+        {'error', _R}=E -> E\n     end.\n \n+-spec do_reserve(knm_number()) -> knm_number_return().\n+do_reserve(Number) ->","path":"core/kazoo_number_manager/src/knm_number.erl","position":22,"original_position":22,"commit_id":"53f266afbae2fcb9133b39056f2bfe71103a2c5f","original_commit_id":"53f266afbae2fcb9133b39056f2bfe71103a2c5f","user":{"login":"fenollp","id":278727,"avatar_url":"https://avatars.githubusercontent.com/u/278727?v=3","gravatar_id":"","url":"https://api.github.com/users/fenollp","html_url":"https://github.com/fenollp","followers_url":"https://api.github.com/users/fenollp/followers","following_url":"https://api.github.com/users/fenollp/following{/other_user}","gists_url":"https://api.github.com/users/fenollp/gists{/gist_id}","starred_url":"https://api.github.com/users/fenollp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fenollp/subscriptions","organizations_url":"https://api.github.com/users/fenollp/orgs","repos_url":"https://api.github.com/users/fenollp/repos","events_url":"https://api.github.com/users/fenollp/events{/privacy}","received_events_url":"https://api.github.com/users/fenollp/received_events","type":"User","site_admin":false},"body":"Because it is done is `knm_number_states`. It's pretty much the same impl as `knm_number:move`","created_at":"2016-04-22T18:03:56Z","updated_at":"2016-04-22T18:03:56Z","html_url":"https://github.com/2600hz/kazoo/pull/1830#discussion_r60779152","pull_request_url":"https://api.github.com/repos/2600hz/kazoo/pulls/1830","_links":{"self":{"href":"https://api.github.com/repos/2600hz/kazoo/pulls/comments/60779152"},"html":{"href":"https://github.com/2600hz/kazoo/pull/1830#discussion_r60779152"},"pull_request":{"href":"https://api.github.com/repos/2600hz/kazoo/pulls/1830"}}},"pull_request":{"url":"https://api.github.com/repos/2600hz/kazoo/pulls/1830","id":67527265,"html_url":"https://github.com/2600hz/kazoo/pull/1830","diff_url":"https://github.com/2600hz/kazoo/pull/1830.diff","patch_url":"https://github.com/2600hz/kazoo/pull/1830.patch","issue_url":"https://api.github.com/repos/2600hz/kazoo/issues/1830","number":1830,"state":"open","locked":false,"title":"knm-reserve: fix phone_numbers/DID/reserve","user":{"login":"fenollp","id":278727,"avatar_url":"https://avatars.githubusercontent.com/u/278727?v=3","gravatar_id":"","url":"https://api.github.com/users/fenollp","html_url":"https://github.com/fenollp","followers_url":"https://api.github.com/users/fenollp/followers","following_url":"https://api.github.com/users/fenollp/following{/other_user}","gists_url":"https://api.github.com/users/fenollp/gists{/gist_id}","starred_url":"https://api.github.com/users/fenollp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fenollp/subscriptions","organizations_url":"https://api.github.com/users/fenollp/orgs","repos_url":"https://api.github.com/users/fenollp/repos","events_url":"https://api.github.com/users/fenollp/events{/privacy}","received_events_url":"https://api.github.com/users/fenollp/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-04-22T15:12:04Z","updated_at":"2016-04-22T18:03:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fdfcbb013481ec40e5b6978a3d1209eaa96e9e78","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/2600hz/kazoo/pulls/1830/commits","review_comments_url":"https://api.github.com/repos/2600hz/kazoo/pulls/1830/comments","review_comment_url":"https://api.github.com/repos/2600hz/kazoo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/2600hz/kazoo/issues/1830/comments","statuses_url":"https://api.github.com/repos/2600hz/kazoo/statuses/53f266afbae2fcb9133b39056f2bfe71103a2c5f","head":{"label":"2600hz:knm-reserve","ref":"knm-reserve","sha":"53f266afbae2fcb9133b39056f2bfe71103a2c5f","user":{"login":"2600hz","id":408801,"avatar_url":"https://avatars.githubusercontent.com/u/408801?v=3","gravatar_id":"","url":"https://api.github.com/users/2600hz","html_url":"https://github.com/2600hz","followers_url":"https://api.github.com/users/2600hz/followers","following_url":"https://api.github.com/users/2600hz/following{/other_user}","gists_url":"https://api.github.com/users/2600hz/gists{/gist_id}","starred_url":"https://api.github.com/users/2600hz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/2600hz/subscriptions","organizations_url":"https://api.github.com/users/2600hz/orgs","repos_url":"https://api.github.com/users/2600hz/repos","events_url":"https://api.github.com/users/2600hz/events{/privacy}","received_events_url":"https://api.github.com/users/2600hz/received_events","type":"Organization","site_admin":false},"repo":{"id":2966241,"name":"kazoo","full_name":"2600hz/kazoo","owner":{"login":"2600hz","id":408801,"avatar_url":"https://avatars.githubusercontent.com/u/408801?v=3","gravatar_id":"","url":"https://api.github.com/users/2600hz","html_url":"https://github.com/2600hz","followers_url":"https://api.github.com/users/2600hz/followers","following_url":"https://api.github.com/users/2600hz/following{/other_user}","gists_url":"https://api.github.com/users/2600hz/gists{/gist_id}","starred_url":"https://api.github.com/users/2600hz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/2600hz/subscriptions","organizations_url":"https://api.github.com/users/2600hz/orgs","repos_url":"https://api.github.com/users/2600hz/repos","events_url":"https://api.github.com/users/2600hz/events{/privacy}","received_events_url":"https://api.github.com/users/2600hz/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/2600hz/kazoo","description":"","fork":false,"url":"https://api.github.com/repos/2600hz/kazoo","forks_url":"https://api.github.com/repos/2600hz/kazoo/forks","keys_url":"https://api.github.com/repos/2600hz/kazoo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/2600hz/kazoo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/2600hz/kazoo/teams","hooks_url":"https://api.github.com/repos/2600hz/kazoo/hooks","issue_events_url":"https://api.github.com/repos/2600hz/kazoo/issues/events{/number}","events_url":"https://api.github.com/repos/2600hz/kazoo/events","assignees_url":"https://api.github.com/repos/2600hz/kazoo/assignees{/user}","branches_url":"https://api.github.com/repos/2600hz/kazoo/branches{/branch}","tags_url":"https://api.github.com/repos/2600hz/kazoo/tags","blobs_url":"https://api.github.com/repos/2600hz/kazoo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/2600hz/kazoo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/2600hz/kazoo/git/refs{/sha}","trees_url":"https://api.github.com/repos/2600hz/kazoo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/2600hz/kazoo/statuses/{sha}","languages_url":"https://api.github.com/repos/2600hz/kazoo/languages","stargazers_url":"https://api.github.com/repos/2600hz/kazoo/stargazers","contributors_url":"https://api.github.com/repos/2600hz/kazoo/contributors","subscribers_url":"https://api.github.com/repos/2600hz/kazoo/subscribers","subscription_url":"https://api.github.com/repos/2600hz/kazoo/subscription","commits_url":"https://api.github.com/repos/2600hz/kazoo/commits{/sha}","git_commits_url":"https://api.github.com/repos/2600hz/kazoo/git/commits{/sha}","comments_url":"https://api.github.com/repos/2600hz/kazoo/comments{/number}","issue_comment_url":"https://api.github.com/repos/2600hz/kazoo/issues/comments{/number}","contents_url":"https://api.github.com/repos/2600hz/kazoo/contents/{+path}","compare_url":"https://api.github.com/repos/2600hz/kazoo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/2600hz/kazoo/merges","archive_url":"https://api.github.com/repos/2600hz/kazoo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/2600hz/kazoo/downloads","issues_url":"https://api.github.com/repos/2600hz/kazoo/issues{/number}","pulls_url":"https://api.github.com/repos/2600hz/kazoo/pulls{/number}","milestones_url":"https://api.github.com/repos/2600hz/kazoo/milestones{/number}","notifications_url":"https://api.github.com/repos/2600hz/kazoo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/2600hz/kazoo/labels{/name}","releases_url":"https://api.github.com/repos/2600hz/kazoo/releases{/id}","deployments_url":"https://api.github.com/repos/2600hz/kazoo/deployments","created_at":"2011-12-12T18:08:02Z","updated_at":"2016-04-21T06:38:46Z","pushed_at":"2016-04-22T17:48:46Z","git_url":"git://github.com/2600hz/kazoo.git","ssh_url":"git@github.com:2600hz/kazoo.git","clone_url":"https://github.com/2600hz/kazoo.git","svn_url":"https://github.com/2600hz/kazoo","homepage":"","size":495214,"stargazers_count":350,"watchers_count":350,"language":"Erlang","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":169,"mirror_url":null,"open_issues_count":18,"forks":169,"open_issues":18,"watchers":350,"default_branch":"master"}},"base":{"label":"2600hz:master","ref":"master","sha":"78e88afd3095b9c84f9e552588c31a399a076b90","user":{"login":"2600hz","id":408801,"avatar_url":"https://avatars.githubusercontent.com/u/408801?v=3","gravatar_id":"","url":"https://api.github.com/users/2600hz","html_url":"https://github.com/2600hz","followers_url":"https://api.github.com/users/2600hz/followers","following_url":"https://api.github.com/users/2600hz/following{/other_user}","gists_url":"https://api.github.com/users/2600hz/gists{/gist_id}","starred_url":"https://api.github.com/users/2600hz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/2600hz/subscriptions","organizations_url":"https://api.github.com/users/2600hz/orgs","repos_url":"https://api.github.com/users/2600hz/repos","events_url":"https://api.github.com/users/2600hz/events{/privacy}","received_events_url":"https://api.github.com/users/2600hz/received_events","type":"Organization","site_admin":false},"repo":{"id":2966241,"name":"kazoo","full_name":"2600hz/kazoo","owner":{"login":"2600hz","id":408801,"avatar_url":"https://avatars.githubusercontent.com/u/408801?v=3","gravatar_id":"","url":"https://api.github.com/users/2600hz","html_url":"https://github.com/2600hz","followers_url":"https://api.github.com/users/2600hz/followers","following_url":"https://api.github.com/users/2600hz/following{/other_user}","gists_url":"https://api.github.com/users/2600hz/gists{/gist_id}","starred_url":"https://api.github.com/users/2600hz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/2600hz/subscriptions","organizations_url":"https://api.github.com/users/2600hz/orgs","repos_url":"https://api.github.com/users/2600hz/repos","events_url":"https://api.github.com/users/2600hz/events{/privacy}","received_events_url":"https://api.github.com/users/2600hz/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/2600hz/kazoo","description":"","fork":false,"url":"https://api.github.com/repos/2600hz/kazoo","forks_url":"https://api.github.com/repos/2600hz/kazoo/forks","keys_url":"https://api.github.com/repos/2600hz/kazoo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/2600hz/kazoo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/2600hz/kazoo/teams","hooks_url":"https://api.github.com/repos/2600hz/kazoo/hooks","issue_events_url":"https://api.github.com/repos/2600hz/kazoo/issues/events{/number}","events_url":"https://api.github.com/repos/2600hz/kazoo/events","assignees_url":"https://api.github.com/repos/2600hz/kazoo/assignees{/user}","branches_url":"https://api.github.com/repos/2600hz/kazoo/branches{/branch}","tags_url":"https://api.github.com/repos/2600hz/kazoo/tags","blobs_url":"https://api.github.com/repos/2600hz/kazoo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/2600hz/kazoo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/2600hz/kazoo/git/refs{/sha}","trees_url":"https://api.github.com/repos/2600hz/kazoo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/2600hz/kazoo/statuses/{sha}","languages_url":"https://api.github.com/repos/2600hz/kazoo/languages","stargazers_url":"https://api.github.com/repos/2600hz/kazoo/stargazers","contributors_url":"https://api.github.com/repos/2600hz/kazoo/contributors","subscribers_url":"https://api.github.com/repos/2600hz/kazoo/subscribers","subscription_url":"https://api.github.com/repos/2600hz/kazoo/subscription","commits_url":"https://api.github.com/repos/2600hz/kazoo/commits{/sha}","git_commits_url":"https://api.github.com/repos/2600hz/kazoo/git/commits{/sha}","comments_url":"https://api.github.com/repos/2600hz/kazoo/comments{/number}","issue_comment_url":"https://api.github.com/repos/2600hz/kazoo/issues/comments{/number}","contents_url":"https://api.github.com/repos/2600hz/kazoo/contents/{+path}","compare_url":"https://api.github.com/repos/2600hz/kazoo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/2600hz/kazoo/merges","archive_url":"https://api.github.com/repos/2600hz/kazoo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/2600hz/kazoo/downloads","issues_url":"https://api.github.com/repos/2600hz/kazoo/issues{/number}","pulls_url":"https://api.github.com/repos/2600hz/kazoo/pulls{/number}","milestones_url":"https://api.github.com/repos/2600hz/kazoo/milestones{/number}","notifications_url":"https://api.github.com/repos/2600hz/kazoo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/2600hz/kazoo/labels{/name}","releases_url":"https://api.github.com/repos/2600hz/kazoo/releases{/id}","deployments_url":"https://api.github.com/repos/2600hz/kazoo/deployments","created_at":"2011-12-12T18:08:02Z","updated_at":"2016-04-21T06:38:46Z","pushed_at":"2016-04-22T17:48:46Z","git_url":"git://github.com/2600hz/kazoo.git","ssh_url":"git@github.com:2600hz/kazoo.git","clone_url":"https://github.com/2600hz/kazoo.git","svn_url":"https://github.com/2600hz/kazoo","homepage":"","size":495214,"stargazers_count":350,"watchers_count":350,"language":"Erlang","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":169,"mirror_url":null,"open_issues_count":18,"forks":169,"open_issues":18,"watchers":350,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/2600hz/kazoo/pulls/1830"},"html":{"href":"https://github.com/2600hz/kazoo/pull/1830"},"issue":{"href":"https://api.github.com/repos/2600hz/kazoo/issues/1830"},"comments":{"href":"https://api.github.com/repos/2600hz/kazoo/issues/1830/comments"},"review_comments":{"href":"https://api.github.com/repos/2600hz/kazoo/pulls/1830/comments"},"review_comment":{"href":"https://api.github.com/repos/2600hz/kazoo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/2600hz/kazoo/pulls/1830/commits"},"statuses":{"href":"https://api.github.com/repos/2600hz/kazoo/statuses/53f266afbae2fcb9133b39056f2bfe71103a2c5f"}}}}