{"id":3066,"date":"2014-03-24T18:19:18","date_gmt":"2014-03-24T09:19:18","guid":{"rendered":"http:\/\/pchero21.com\/?p=3066"},"modified":"2014-03-24T18:19:18","modified_gmt":"2014-03-24T09:19:18","slug":"asterisk-manager-interfaceami","status":"publish","type":"post","link":"http:\/\/pchero21.com\/?p=3066","title":{"rendered":"[Asterisk] Asterisk Manager Interface(AMI)"},"content":{"rendered":"<p><strong>AMI<\/strong><\/p>\n<p>Asterisk Manager Interface(AMI)\ub294 Asterisk \uc5d0\uc11c \uc81c\uacf5\ud558\ub294 System monitoring\/Management interface \uc774\ub2e4. \uc989, \uc774\ubca4\ud2b8 \ubaa8\ub2c8\ud130\ub9c1\uacfc \uba85\ub839 \uc804\ub2ec\uc744 \uc704\ud55c Interface \ub780 \ub73b\uc774\ub2e4.<\/p>\n<p><strong>AMI \uac04\ub2e8 \uc124\uc815<\/strong><\/p>\n<p>\uae30\ubcf8\uc801\uc73c\ub85c AMI\ub294 disable \ub85c \ub418\uc5b4 \uc788\ub2e4.<br \/>\nAMI\ub97c \ud65c\uc131\ud654 \ud558\uae30 \uc704\ud574\uc11c\ub294 \/etc\/asterisk\/manager.conf \ud30c\uc77c \uc218\uc815\uc774 \ud544\uc694\ud558\ub2e4.<br \/>\n\/etc\/asterisk\/manager.conf\u00a0\ud30c\uc77c\uc744 \ud1b5\ud574\uc11c AMI \uc811\uc18d\uc5d0 \uad00\ud55c \uc124\uc815\uc744 \ud574\uc8fc\uace0, \/etc\/asterisk\/manager.d \ub514\ub809\ud1a0\ub9ac \ubc11\uc5d0 \uac01\uac01\uc758 \uc811\uc18d\uc5d0 \ub300\ud55c \uacc4\uc815\uc744 \uc124\uc815\ud574\uc900\ub2e4.<\/p>\n<p>\uc608\uc81c\ub85c hello \ub77c\ub294 \uacc4\uc815\uc5d0 world \ub77c\ub294 \ud328\uc2a4\uc6cc\ub4dc\ub97c \uac00\uc9c4 \uacc4\uc815\uc744 \ucd94\uac00\ud574\ubcf4\uc790.<\/p>\n<pre class=\"brush:shell\">;\n; Turn on the AMI and ask it to only accept connections from localhost\n;\n; By default asterisk will listen on localhost only.\n[general]\nenabled = yes\nwebenabled = yes\nport = 5038\nbindaddr = 192.168.200.10\n\n; No access is allowed by default.\n; To set a password, create a file in \/etc\/asterisk\/manager.d\n; use creative permission games to allow other serivces to create their own\n; files\n#include \"manager.d\/*.conf\"<\/pre>\n<p>\uadf8\ub9ac\uace0 \/etc\/asterisk\/manager.d \ub514\ub809\ud1a0\ub9ac \ubc11\uc5d0 hello.conf \ub77c\ub294 \ud30c\uc77c\uc744 \ud558\ub098 \ucd94\uac00\ud558\uc790.<\/p>\n<pre class=\"brush:shell\">pchero@MyDebian:\/etc\/asterisk\/manager.d$ cat hello.conf\n\n; ami configure file for [hello]\n[hello]\nsecret = world\nread = all\nwrite = all<\/pre>\n<p>\uc774\ub85c\uc368, AMI \ub85c \uc811\uadfc\uc774 \uac00\ub2a5\ud55c hello \ub77c\ub294 \uacc4\uc815\uc774 \uc0dd\uc131\ub418\uc5c8\ub2e4. \uc8fc\uc758\ud560 \uc810\uc740 \uc544\uc9c1 TLS\/SSL \uc124\uc815\uc774 \uc548\ub418\uc5b4\uc788\uae30 \ub54c\ubb38\uc5d0 \ubcf4\uc548\uc5d0 \ub9e4\uc6b0 \ucde8\uc57d\ud558\ub2e4\ub294 \uc810\uc774\ub2e4.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>AMI \uc811\uc18d \ud14c\uc2a4\ud2b8<\/strong><\/p>\n<p>\uc774\uc81c AMI\uc5d0 \uc811\uc18d\ud574\ubcf4\uc790. Asterisk\ub294 \uc5ec\ub7ec\uac00\uc9c0 AMI \uc811\uc18d \ubc29\ubc95\uc744 \uc81c\uacf5\ud558\ub294\ub370&#8230; \uba3c\uc800 telnet \ubd80\ud130 \uc811\uc18d\ud574\ubcf4\uc790.<\/p>\n<pre class=\"brush:shell\">pchero@MyGalaxy:~$ telnet 192.168.200.10 5038\nTrying 192.168.200.10...\nConnected to 192.168.200.10.\nEscape character is '^]'.\nAsterisk Call Manager\/1.1\nAction: Login\nUsername: hello\nSecret: world\n\nResponse: Success\nMessage: Authentication accepted\n\nEvent: FullyBooted\nPrivilege: system,all\nStatus: Fully Booted\n\nAction: Ping\n\nResponse: Success\nPing: Pong\nTimestamp: 1395059659.619558\n\nAction: Logoff\n\nResponse: Goodbye\nMessage: Thanks for all the fish.\n\nConnection closed by foreign host.\npchero@MyGalaxy:~$<\/pre>\n<p>\uc774\ubc88\uc5d0\ub294 HTTP \ub97c \ud1b5\ud55c \uc811\uc18d\uc744 \ud574\ubcf4\uc790.<\/p>\n<pre class=\"brush:shell\">pchero@MyGalaxy:~$ wget \"http:\/\/192.168.200.10:8088\/rawman?action=login&amp;username=hello&amp;secret=world\" --save-cookies cookies.txt -O -\n--2014-03-17 13:36:55--  http:\/\/192.168.200.10:8088\/rawman?action=login&amp;username=hello&amp;secret=world\nConnecting to 192.168.200.10:8088... connected.\nHTTP request sent, awaiting response... 200 OK\nLength: 55 [text\/plain]\nSaving to: \u2018STDOUT\u2019\n\n0% [                                                                                                                                              ] 0           --.-K\/s              Response: Success\nMessage: Authentication accepted\n\n100%[=============================================================================================================================================&gt;] 55          --.-K\/s   in 0s\n\n2014-03-17 13:36:55 (6.75 MB\/s) - written to stdout [55\/55]\n\npchero@MyGalaxy:~$ wget \"http:\/\/192.168.200.10:8088\/rawman?action=ping\" --load-cookies cookies.txt -O -\n--2014-03-17 13:37:35--  http:\/\/192.168.200.10:8088\/rawman?action=ping\nConnecting to 192.168.200.10:8088... connected.\nHTTP request sent, awaiting response... 200 OK\nLength: 63 [text\/plain]\nSaving to: \u2018STDOUT\u2019\n\n0% [                                                                                                                                              ] 0           --.-K\/s              Response: Success\nPing: Pong\nTimestamp: 1395059855.098176\n\n100%[=============================================================================================================================================&gt;] 63          --.-K\/s   in 0s\n\n2014-03-17 13:37:35 (6.22 MB\/s) - written to stdout [63\/63]\n\npchero@MyGalaxy:~$ wget \"http:\/\/192.168.200.10:8088\/rawman?action=logoff\" --lo\n--load-cookies=    --local-encoding=\npchero@MyGalaxy:~$ wget \"http:\/\/192.168.200.10:8088\/rawman?action=logoff\" --load-cookies cookies.txt -O -\n--2014-03-17 13:38:07--  http:\/\/192.168.200.10:8088\/rawman?action=logoff\nConnecting to 192.168.200.10:8088... connected.\nHTTP request sent, awaiting response... 200 OK\nLength: 56 [text\/plain]\nSaving to: \u2018STDOUT\u2019\n\n0% [                                                                                                                                              ] 0           --.-K\/s              Response: Goodbye\nMessage: Thanks for all the fish.\n\n100%[=============================================================================================================================================&gt;] 56          --.-K\/s   in 0s\n\n2014-03-17 13:38:07 (6.51 MB\/s) - written to stdout [56\/56]<\/pre>\n<p>&nbsp;<\/p>\n<h3><strong>AMI Protocol<\/strong><\/h3>\n<p>AMI \uc5d0\ub294 \ub450\uac00\uc9c0 \uc885\ub958\uc758 \uba54\uc2dc\uc9c0\uac00 \uc788\ub2e4. Manager event \uc640 manager Action \uc774\ub2e4.<\/p>\n<p>Manager Event\ub294 \ub2e8\ubc29\ud5a5 \uba54\uc2dc\uc9c0 \uc804\uc1a1\uc774\uba70, \uba54\uc2dc\uc9c0\ub294 Asterisk \uc5d0\uc11c AMI client\ub85c \uc804\uc1a1\ub41c\ub2e4. \uc8fc\ub85c Asterisk\uc5d0\uc11c \uc77c\uc5b4\ub09c \ub0b4\uc6a9\uc744 \uc811\uc18d\uc911\uc778 AMI client\ub85c Notice \ud558\uae30 \uc704\ud574 \uc0ac\uc6a9\ud55c\ub2e4.<\/p>\n<p>Manager Action\uc740 \uc591\ubc29\ud5a5 \uba54\uc2dc\uc9c0 \uc804\uc1a1\uc774\uba70, AMI client \uc5d0\uc11c Asterisk\ub85c \uc694\uccad \uba54\uc2dc\uc9c0\ub97c \ubcf4\ub0b4\uace0, Asterisk\ub294 \ucc98\ub9ac \uacb0\uacfc\uc640 \uc751\ub2f5\uba54\uc2dc\uc9c0\ub97c \ubcf4\ub0b4\ub294 \ubc29\uc2dd\uc73c\ub85c \ud1b5\uc2e0\ud55c\ub2e4.<\/p>\n<p>&nbsp;<\/p>\n<h3>Message Encoding<\/h3>\n<p>\ubaa8\ub4e0 AMI message\ub4e4(manager event, manager action, manager action response)\uc740 \uac19\uc740 \ubc29\uc2dd\uc73c\ub85c \uc778\ucf54\ub529\ub41c\ub2e4. \ubaa8\ub4e0 \uba54\uc2dc\uc9c0\ub4e4\uc740 text-based \uc774\uace0, Carriage return \uacfc Line-feed \uae30\ud638\ub85c \ub05d\ub9fa\uc74c\ub41c\ub2e4. \uba54\uc2dc\uc9c0 \ub9c8\uc9c0\ub9c9\uc740 \uacf5\ubc31 \ub77c\uc778\uc73c\ub85c \ub05d\uc774\ub09c\ub2e4.<\/p>\n<pre class=\"brush:shell\">Header1: This is the first header&lt;CR&gt;&lt;LF&gt;\nHeader2: This is the second header&lt;CR&gt;&lt;LF&gt;\nHeader3: This is the last header of this message&lt;CR&gt;&lt;LF&gt;\n&lt;CR&gt;&lt;LF&gt;<\/pre>\n<p><strong>Events<\/strong><\/p>\n<p>\ubaa8\ub4e0 Manager event \ub294 \ud56d\uc0c1 Event header \uc640 Privilege header \ub97c \ud3ec\ud568\ud55c\ub2e4. Event header \uc5d0\ub294 \ud574\ub2f9 event\uc758 \uc774\ub984\uc774, Privilege header \uc5d0\ub294 \ud574\ub2f9 event \uc758 \uad8c\ud55c \ub808\ubca8\uc815\ubcf4\uac00 \ud45c\uc2dc\ub41c\ub2e4. \ub2e4\ub978 \ud5e4\ub354\ub4e4\uc740 \ud574\ub2f9 event \uc758 \ub0b4\uc6a9\uc5d0\ub9de\ub294\u00a0 \ub0b4\uc6a9\ub4e4\uc774 \ud45c\uc2dc\ub41c\ub2e4.<\/p>\n<pre class=\"brush:shell\">Event: Hangup\nPrivilege: call,all\nChannel: SIP\/0004F2060EB4-00000000\nUniqueid: 1283174108.0\nCallerIDNum: 2565551212\nCallerIDName: Russell Bryant\nCause: 16\nCause-txt: Normal Clearing<\/pre>\n<p><strong>Action<\/strong><\/p>\n<p>\ubaa8\ub4e0 manager action \uba54\uc2dc\uc9c0\ub4e4\uc740 \ubc18\ub4dc\uc2dc Action header \ub97c \ud3ec\ud568\ud574\uc57c \ud55c\ub2e4. Action header \ub294 \uc774 \uba54\uc2dc\uc9c0\uac00 \uc5b4\ub5a4 \uba85\ub839\uc5d0 \ub300\ud55c \uba54\uc2dc\uc9c0\uc778\uc9c0\ub97c \ub098\ud0c0\ub0b8\ub2e4. \uadf8 \uc678 \ub2e4\ub978 header \ub4e4\uc740 Action header \uc2e4\ud589\uc744 \uc704\ud55c \uc778\uc790\uac12\ub4e4\ub85c \uad6c\uc131\ub41c\ub2e4. \uc0c1\uc138 header \ub0b4\uc6a9\ub4e4\uc744 \ud655\uc778\ud558\uace0\uc790 \ud55c\ub2e4\uba74 Asterisk CLI \ucc3d\uc5d0\uc11c manager show command &lt;Action&gt; \uc744 \uc785\ub825\ud558\uba74 \ud655\uc778\uc774 \uac00\ub2a5\ud558\ub2e4. \uc804\uccb4 Action list \ud655\uc778\uc740 manager show commands \uba85\ub839\uc73c\ub85c \ud655\uc778\uc774 \uac00\ub2a5\ud558\ub2e4.<\/p>\n<pre class=\"brush:shell\">MyFBSD*CLI&gt; manager show command ping\n[Syntax]\nAction: Ping\n[ActionID:] &lt;value&gt;\n\n[Synopsis]\nKeepalive command.\n\n[Description]\nA 'Ping' action will ellicit a 'Pong' response. Used to keep the manager\nconnection open.\n\n[Arguments]\nActionID\nActionID for this transaction. Will be returned.\n\n[See Also]\nNot available<\/pre>\n<p>Manager action \uba54\uc2dc\uc9c0\uc5d0 \ub300\ud55c \uc751\ub2f5 \uc911 \uc81c\uc77c \ub9c8\uc9c0\ub9c9\uc5d0 \uc624\ub294 \uba54\uc2dc\uc9c0\ub294 Response header \ub97c \uac00\uc9c0\uace0 \uc788\ub2e4. \uc774 Response header \ub97c \ud1b5\ud574\uc11c manager action \uba85\ub839\uc758 \uc131\uacf5 \uc5ec\ubd80\uc640 \uc2e4\ud328\ud588\uc744 \uacbd\uc6b0 \uc2e4\ud328\ud55c \uc0ac\uc720\ub4f1\uc744 \ud655\uc778\ud560 \uc218 \uc788\ub2e4.<\/p>\n<pre class=\"brush:shell\">Action: Login\nUsername: russell\nSecret: russell\n\nResponse: Success\nMessage: Authentication accepted<\/pre>\n<p><strong>Call originating<\/strong><\/p>\n<p>AMI \ub97c \ud1b5\ud574\uc11c \ucf5c\uc744 \uc0dd\uc131\ud574\ubcf4\uc790.<\/p>\n<pre class=\"brush:shell\">Action: Originate\nChannel: Sip\/0000FFFF0001\nApplication: Playback\nData: demo-congrats\n\nResponse: Success\nMessage: Originate successfully queued<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>AMI Asterisk Manager Interface(AMI)\ub294 Asterisk \uc5d0\uc11c \uc81c\uacf5\ud558\ub294 System monitoring\/Management interface \uc774\ub2e4. \uc989, \uc774\ubca4\ud2b8 \ubaa8\ub2c8\ud130\ub9c1\uacfc \uba85\ub839 \uc804\ub2ec\uc744 \uc704\ud55c Interface \ub780 \ub73b\uc774\ub2e4. AMI \uac04\ub2e8 \uc124\uc815 \uae30\ubcf8\uc801\uc73c\ub85c AMI\ub294 disable \ub85c \ub418\uc5b4 \uc788\ub2e4. AMI\ub97c \ud65c\uc131\ud654 \ud558\uae30 \uc704\ud574\uc11c\ub294 \/etc\/asterisk\/manager.conf \ud30c\uc77c \uc218\uc815\uc774 \ud544\uc694\ud558\ub2e4. \/etc\/asterisk\/manager.conf\u00a0\ud30c\uc77c\uc744 \ud1b5\ud574\uc11c AMI &hellip; <a href=\"http:\/\/pchero21.com\/?p=3066\">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":[94,103,104],"_links":{"self":[{"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/posts\/3066"}],"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=3066"}],"version-history":[{"count":0,"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/posts\/3066\/revisions"}],"wp:attachment":[{"href":"http:\/\/pchero21.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3066"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pchero21.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3066"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pchero21.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3066"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}