Asterisk-channel

From 탱이의 잡동사니
Jump to: navigation, search

Overview

Asterisk channel 명령어 정리

help

channel 명령어 help

myworld*CLI> help channel
    channel originate Originate a call
    channel redirect Redirect a call
    channel request hangup Request a hangup on a given channel

originate

입력한 tech/data 로 발신을 한다. 발신이후, 콜을 지정된 application 혹은 extension 으로 전달한다.

pchero*CLI> help channel originate
  There are two ways to use this command. A call can be originated between a
channel and a specific application, or between a channel and an extension in
the dialplan. This is similar to call files or the manager originate action.
Calls originated with this command are given a timeout of 30 seconds.

Usage1: channel originate <tech/data> application <appname> [appdata]
  This will originate a call between the specified channel tech/data and the
given application. Arguments to the application are optional. If the given
arguments to the application include spaces, all of the arguments to the
application need to be placed in quotation marks.

Usage2: channel originate <tech/data> extension [exten@][context]
  This will originate a call between the specified channel tech/data and the
given extension. If no context is specified, the 'default' context will be
used. If no extension is given, the 's' extension will be used.
channel originate <tech/data> application <appname> [appdata]
channel originate <tech/data> extension [exten@][context]

Queue redirect

sip/200-test-1 로 발신을 해서, Camp200 이라는 큐로 넘기는 예제이다.

pchero*CLI> channel originate sip/200-test-1 application Queue Camp200
[2015-11-11 11:21:37.031]     -- Launching Queue(Camp200) on SIP/200-test-1-00000018
[2015-11-11 11:21:37.032]     -- Started music on hold, class 'default', on SIP/200-test-1-00000018

Originate to existing channel

이미 존재하는 채널에 대한 발신(콜 당겨오기)를 하기 위해서는 조금 다르게 접근해야 한다.

다음은 이미 존재하는 채널(SIP/503-pcherosoftphone503-1-000004fe)에 대해서 208 Extension 을 이용해서 발신을 하는 예제이다.

명령어 실행 후, 먼저 208 extension 으로 발신이 되고, ANSWER 이후, ANSWER 된 Channel 이 "SIP/503-pcherosoftphone503-1-000004fe" 로 redirect 된다.

pchero*CLI> channel originate Local/208@DialPresence extension SIP/503-pcherosoftphone503-1-000004fe@QueueCherryPick
[2016-09-27 12:02:59.308] NOTICE[25892]: func_math.c:424 crement_function_read: The value is now: 1999
[2016-09-27 12:02:59.309] WARNING[25892]: chan_sip.c:19479 func_header_read: This function can only be used on SIP channels.
[2016-09-27 12:02:59.309] WARNING[25892]: chan_sip.c:19479 func_header_read: This function can only be used on SIP channels.
[2016-09-27 12:02:59.321] NOTICE[25893]: func_math.c:424 crement_function_read: The value is now: 1999
[2016-09-27 12:02:59.322] NOTICE[25893]: Ext. 208-pcherosoftphone208-1:4 @ DialLine: 1474970579.5005-DialLine(1474970579.5005@Local/208-pcherosoftphone208-1@DialLine-c034;2)

redirect

pchero*CLI> help channel redirect
Usage: channel redirect <channel> <[[context,]exten,]priority>
    Redirect an active channel to a specified extension.

request hangup

입력한 channel_id 콜을 종료한다.

pchero*CLI> help channel request hangup
Usage: channel request hangup <channel>|<all>
       Request that a channel be hung up. The hangup takes effect
       the next time the driver reads or writes from the channel.
       If 'all' is specified instead of a channel name, all channels
       will see the hangup request.
channel request hangup <channel_id>

중요한 것은 입력되는 파라미터가 call-id 가 아닌, channel-id 라는 것이다.