Asteriskを用いたPBXサーバーの開発

Posted by rhoboro on 2021-02-22

最近Asteriskを触っているのでこれまでの理解をまとめておく。 このページはUbuntu 20.04を想定している。

ドキュメント

Asteriskのインストールと起動

rhoboro/asterisk-dockerリポジトリでDockerイメージを作ったのでDockerfileを見れば必要な情報は大体わかるはず。 また、使いたい機能によってはインストール時に選択する必要がある。(あとでできるのかもしれないが、調べていない)

Dockerfileでは下記コマンドでフォアグラウンドで起動しているが、Docker以外の環境ではsystemctlでデーモンとして起動しておくのが良さそう。

# フォアグラウンドでAsteriskを起動
$ asterisk -vvvvvgc

その他自分がよく使うコマンドはこの辺り。

# Asterisk CLIの起動
$ asterisk -vvvvvr

# 再起動
$ asterisk -rx 'core restart now'

# 停止(systemctl)
$ sudo systemctl stop asterisk.service
# 起動(systemctl)
$ sudo systemctl start asterisk.service
# 再起動(systemctl)
$ sudo systemctl restart asterisk.service
# ステータス確認(systemctl)
$ sudo systemctl status asterisk.service
# CLIコマンド一覧を表示
*CLI> core show help

Asteriskの設定は基本的にconfファイルで行い、反映は再起動やリロードコマンドの実行が必要。 ただし、DBからユーザー設定などを読み込んでくれるAsterisk Realtime機能もある。

CLIでのログについて

CLIではリアルタイムで様々なログを表示できる。 つぎのコマンドは一例なので core show help で気になる機能のログを表示できないか確認するのが良い。

# SIPのログを表示
*CLI> sip set logger on

# PJSIPのログを表示
*CLI> pjsip set logger on

# AGIのログを表示
*CLI> agi set debug on

# ログレベルを更新
*CLI> logger set level DEBUG on

Asteriskを用いたPBXサーバーで利用できるもの

Asteriskは発着信時の挙動を次のようなextensions.confに記載して制御する。

[from-internal]
exten = 100,1,Answer()
same = n,Wait(1)
same = n,Playback(hello-world)
same = n,Hangup()

ここで、AnswerやWaitはDialplan Applicationsと呼ばれるもの。 Asteriskはこのように各処理をアプリケーションとして用意することで拡張性を高めている。 extensions.confではこれらのDialplan Applicationsを組み合わせながら処理をカスタマイズしていく。

また、Dialplan Applicationsと似た機能にDialplan Functionsがある。 両者の違いはAsterisk Dialplan Functionsに下記のように書かれている。 ここでchannelとは「呼」や「コール」とも呼ばれる概念で、1つの通話と1つのchannelは1:1で紐づいている。

Compared to Dialplan Applications:

Dialplan Functions tend to be geared towards manipulating channel data and
attributes as well as providing general tools for manipulating data in
variables and expressions, whether they are channel related or not.

Dialplan Applications tend to take over the channel and provide more
complex features to the channel.

extensions.conf だけでは静的な処理しかできないため、動的にAsteriskを制御する方法としてAGI、ARI、AMIが用意されている。

AGI

AGI(Asterisk Gateway Interface)はextensions.confからスクリプトを呼び出せる機能のこと。 スクリプトを用意する代わりにTCPサーバーを立てておくFastAGIもある。

AGIではAGI Commandsの実行が可能。 また、このコマンドのうち、GET FULL VARIABLEコマンドでDialplan Functionsを、EXECコマンドでDialplan Applicationsを利用できる。

整理しておくとAGIではAGIコマンド、Dialplan Applications、Dialplan Functionsの利用ができる。 これらはそれぞれ下記のコマンドで利用可能なものを確認できる。

agi show commands
# 利用可能なAGIコマンドの一覧
*CLI> agi show commands
d02-pbx202a*CLI> agi show commands
 Dead                        Command   Description
   No                         answer   Answer channel
  Yes                 asyncagi break   Interrupts Async AGI
   No                 channel status   Returns status of the connected channel.
  Yes                   database del   Removes database key/value
  Yes               database deltree   Removes database keytree/value
  Yes                   database get   Gets database value
  Yes                   database put   Adds/updates database value
  Yes                           exec   Executes a given Application
   No                       get data   Prompts for DTMF on a channel
  Yes              get full variable   Evaluates a channel expression
   No                     get option   Stream file, prompt for DTMF, with timeout.
  Yes                   get variable   Gets a channel variable.
   No                         hangup   Hangup a channel.
  Yes                           noop   Does nothing.
   No                   receive char   Receives one character from channels supporting it.
   No                   receive text   Receives text from channels supporting it.
   No                    record file   Records to a given file.
   No                      say alpha   Says a given character string.
   No                     say digits   Says a given digit string.
   No                     say number   Says a given number.
   No                   say phonetic   Says a given character string with phonetics.
   No                       say date   Says a given date.
   No                       say time   Says a given time.
   No                   say datetime   Says a given time as specified by the format given.
   No                     send image   Sends images to channels supporting it.
   No                      send text   Sends text to channels supporting it.
   No                 set autohangup   Autohangup channel in some time.
   No                   set callerid   Sets callerid for the current channel.
   No                    set context   Sets channel context.
   No                  set extension   Changes channel extension.
   No                      set music   Enable/Disable Music on hold generator
   No                   set priority   Set channel dialplan priority.
  Yes                   set variable   Sets a channel variable.
   No                    stream file   Sends audio file on channel.
   No            control stream file   Sends audio file on channel and allows the listener to control the stream.
   No                       tdd mode   Toggles TDD mode (for the deaf).
  Yes                        verbose   Logs a message to the asterisk verbose log.
   No                 wait for digit   Waits for a digit to be pressed.
   No                  speech create   Creates a speech object.
   No                     speech set   Sets a speech engine setting.
  Yes                 speech destroy   Destroys a speech object.
   No            speech load grammar   Loads a grammar.
  Yes          speech unload grammar   Unloads a grammar.
   No        speech activate grammar   Activates a grammar.
   No      speech deactivate grammar   Deactivates a grammar.
   No               speech recognize   Recognizes speech.
   No                          gosub   Cause the channel to execute the specified dialplan subroutine.
core show Functions
# 利用可能なDialplan Functionsの一覧
*CLI> 
Installed Custom Functions:
--------------------------------------------------------------------------------
AES_DECRYPT           AES_DECRYPT(key,string)              Decrypt a string encoded in base64 with AES given a 16 character key.
AES_ENCRYPT           AES_ENCRYPT(key,string)              Encrypt a string with AES given a 16 character key.
AGC                   AGC(channeldirection)                Apply automatic gain control to audio on a channel.
AGENT                 AGENT(AgentId[:item])                Gets information about an Agent
AMI_CLIENT            AMI_CLIENT(loginname,field)          Checks attributes of manager accounts
ARRAY                 ARRAY(var1[,var2[,...][,varN]])      Allows setting multiple variables at once.
AST_CONFIG            AST_CONFIG(config_file,category,var  Retrieve a variable from a configuration file.
AST_SORCERY           AST_SORCERY(module_name,object_type  Get a field from a sorcery object
BASE64_DECODE         BASE64_DECODE(string)                Decode a base64 string.
BASE64_ENCODE         BASE64_ENCODE(string)                Encode a string in base64.
BLACKLIST             BLACKLIST()                          Check if the callerid is on the blacklist.
CALENDAR_BUSY         CALENDAR_BUSY(calendar)              Determine if the calendar is marked busy at this time.
CALENDAR_EVENT        CALENDAR_EVENT(field)                Get calendar event notification data from a notification call.
CALENDAR_QUERY        CALENDAR_QUERY(calendar[,start[,end  Query a calendar server and store the data on a channel
CALENDAR_QUERY_RESUL  CALENDAR_QUERY_RESULT(id,field[,ent  Retrieve data from a previously run CALENDAR_QUERY() call
CALENDAR_WRITE        CALENDAR_WRITE(calendar,field[,...]  Write an event to a calendar
CALLCOMPLETION        CALLCOMPLETION(option)               Get or set a call completion configuration parameter for a channel.
CALLERID              CALLERID(datatype[,CID])             Gets or sets Caller*ID data on the channel.
CALLERPRES            CALLERPRES()                         Gets or sets Caller*ID presentation on the channel.
CDR                   CDR(name[,options])                  Gets or sets a CDR variable.
CDR_PROP              CDR_PROP(name)                       Set a property on a channel's CDR.
CHANNEL               CHANNEL(item)                        Gets/sets various pieces of information about the channel.
CHANNELS              CHANNELS([regular_expression])       Gets the list of channels, optionally filtering by a regular expression.
CONFBRIDGE            CONFBRIDGE(type,option)              Set a custom dynamic bridge, user, or menu profile on a channel for the ConfBridge application using the same options available in confbridge.conf.
CONFBRIDGE_INFO       CONFBRIDGE_INFO(type,conf)           Get information about a ConfBridge conference.
CONNECTEDLINE         CONNECTEDLINE(datatype[,i])          Gets or sets Connected Line data on the channel.
CSV_QUOTE             CSV_QUOTE(string)                    Quotes a given string for use in a CSV file, escaping embedded quotes as necessary
CURL                  CURL(url[,post-data])                Retrieve content from a remote web or ftp server
CURLOPT               CURLOPT(<option>)                    Set options for use with the CURL() function
CUT                   CUT(varname,char-delim,range-spec)   Slices and dices strings, based upon a named delimiter.
DB                    DB(family/key)                       Read from or write to the Asterisk database.
DB_DELETE             DB_DELETE(family/key)                Return a value from the database and delete it.
DB_EXISTS             DB_EXISTS(family/key)                Check to see if a key exists in the Asterisk database.
DB_KEYS               DB_KEYS([prefix])                    Obtain a list of keys within the Asterisk database.
DEC                   DEC(variable)                        Decrements the value of a variable, while returning the updated value to the dialplan
DENOISE               DENOISE(channeldirection)            Apply noise reduction to audio on a channel.
DEVICE_STATE          DEVICE_STATE(device)                 Get or Set a device state.
DIALGROUP             DIALGROUP(group[,op])                Manages a group of users for dialing.
DIALPLAN_EXISTS       DIALPLAN_EXISTS(context[,extension[  Checks the existence of a dialplan target.
DUNDILOOKUP           DUNDILOOKUP(number[,context[,option  Do a DUNDi lookup of a phone number.
DUNDIQUERY            DUNDIQUERY(number[,context[,options  Initiate a DUNDi query.
DUNDIRESULT           DUNDIRESULT(id[,resultnum])          Retrieve results from a DUNDIQUERY.
ENUMLOOKUP            ENUMLOOKUP(number[,method-type[,opt  General or specific querying of NAPTR records for ENUM or ENUM-like DNS pointers.
ENUMQUERY             ENUMQUERY(number[,method-type[,zone  Initiate an ENUM query.
ENUMRESULT            ENUMRESULT(id,resultnum)             Retrieve results from a ENUMQUERY.
ENV                   ENV(varname)                         Gets or sets the environment variable specified.
EVAL                  EVAL(variable)                       Evaluate stored variables
EXCEPTION             EXCEPTION(field)                     Retrieve the details of the current dialplan exception.
EXISTS                EXISTS(data)                         Test the existence of a value.
EXTENSION_STATE       EXTENSION_STATE(extension[@context]  Get an extension's state.
FAXOPT                FAXOPT(item)                         Gets/sets various pieces of information about a fax session.
FEATURE               FEATURE(option_name)                 Get or set a feature option on a channel.
FEATUREMAP            FEATUREMAP(feature_name)             Get or set a feature map to a given value on a specific channel.
FIELDNUM              FIELDNUM(varname,delim,value)        Return the 1-based offset of a field in a list
FIELDQTY              FIELDQTY(varname,delim)              Count the fields with an arbitrary delimiter
FILE                  FILE(filename[,offset[,length[,opti  Read or write text file.
FILE_COUNT_LINE       FILE_COUNT_LINE(filename[,format])   Obtains the number of lines of a text file.
FILE_FORMAT           FILE_FORMAT(filename)                Return the newline format of a text file.
FILTER                FILTER(allowed-chars,string)         Filter the string to include only the allowed characters
FRAME_TRACE           FRAME_TRACE(filter list type)        View internal ast_frames as they are read and written on a channel.
GLOBAL                GLOBAL(varname)                      Gets or sets the global variable specified.
GROUP                 GROUP([category])                    Gets or sets the channel group.
GROUP_COUNT           GROUP_COUNT([groupname][@category])  Counts the number of channels in the specified group.
GROUP_LIST            GROUP_LIST()                         Gets a list of the groups set on a channel.
GROUP_MATCH_COUNT     GROUP_MATCH_COUNT(groupmatch[@categ  Counts the number of channels in the groups matching the specified pattern.
HANGUPCAUSE           HANGUPCAUSE(channel,type)            Gets per-channel hangupcause information from the channel.
HANGUPCAUSE_KEYS      HANGUPCAUSE_KEYS()                   Gets the list of channels for which hangup causes are available.
HASH                  HASH(hashname[,hashkey])             Implementation of a dialplan associative array
HASHKEYS              HASHKEYS(hashname)                   Retrieve the keys of the HASH() function.
HINT                  HINT(extension[@context][,options])  Get the devices set for a dialplan hint.
HOLD_INTERCEPT        HOLD_INTERCEPT(action)               Intercepts hold frames on a channel and raises an event instead of passing the frame on
IAXPEER               IAXPEER(peername[,item])             Gets IAX peer information.
IAXVAR                IAXVAR(varname)                      Sets or retrieves a remote variable.
ICONV                 ICONV(in-charset,out-charset,string  Converts charsets of strings.
IF                    IF(expresion?[true][:false])         Check for an expresion.
IFMODULE              IFMODULE(modulename.so)              Checks if an Asterisk module is loaded in memory.
IFTIME                IFTIME(timespec?[true][:false])      Temporal Conditional.
IMPORT                IMPORT(channel,variable)             Retrieve the value of a variable from another channel.
INC                   INC(variable)                        Increments the value of a variable, while returning the updated value to the dialplan
ISNULL                ISNULL(data)                         Check if a value is NULL.
JABBER_RECEIVE        JABBER_RECEIVE(account,jid[,timeout  Reads XMPP messages.
JABBER_STATUS         JABBER_STATUS(account,jid)           Retrieves a buddy's status.
JACK_HOOK             JACK_HOOK(<mode>,[options])          Enable a jack hook on a channel
JITTERBUFFER          JITTERBUFFER(jitterbuffer type)      Add a Jitterbuffer to the Read side of the channel. This dejitters the audio stream before it reaches the Asterisk core. This is a write only function.
KEYPADHASH            KEYPADHASH(string)                   Hash the letters in string into equivalent keypad numbers.
LEN                   LEN(string)                          Return the length of the string given.
LISTFILTER            LISTFILTER(varname,delim,value)      Remove an item from a list, by name.
LOCAL                 LOCAL(varname)                       Manage variables local to the gosub stack frame.
LOCAL_PEEK            LOCAL_PEEK(n,varname)                Retrieve variables hidden by the local gosub stack frame.
LOCK                  LOCK(lockname)                       Attempt to obtain a named mutex.
MAILBOX_EXISTS        MAILBOX_EXISTS(mailbox[@context])    Tell if a mailbox is configured.
MASTER_CHANNEL        MASTER_CHANNEL()                     Gets or sets variables on the master channel
MATH                  MATH(expression[,type])              Performs Mathematical Functions.
MD5                   MD5(data)                            Computes an MD5 digest.
MESSAGE               MESSAGE(argument)                    Create a message or read fields from a message.
MESSAGE_DATA          MESSAGE_DATA(argument)               Read or write custom data attached to a message.
MINIVMACCOUNT         MINIVMACCOUNT(account:item)          Gets MiniVoicemail account information.
MINIVMCOUNTER         MINIVMCOUNTER(account:name[:operand  Reads or sets counters for MiniVoicemail message.
MIXMONITOR            MIXMONITOR(id,key)                   Retrieve data pertaining to specific instances of MixMonitor on a channel.
MUTEAUDIO             MUTEAUDIO(direction)                 Muting audio streams in the channel
ODBC                  ODBC(property[,argument])            Controls ODBC transaction properties.
ODBC_ANTISOLICIT      ODBC_ANTISOLICIT(<callerid>)         Check if a specified callerid is contained in the known solicitors database
ODBC_FETCH            ODBC_FETCH(result-id)                Fetch a row from a multirow query.
ODBC_PRESENCE         ODBC_PRESENCE(<arg1>[...[,<argN>]])  Runs the referenced query with the specified arguments
ODBC_SQL              ODBC_SQL(<arg1>[...[,<argN>]])       Runs the referenced query with the specified arguments
PARK_GET_CHANNEL      PARK_GET_CHANNEL(parking_space,park  Get the channel name of an occupied parking space in a parking lot.
PASSTHRU              PASSTHRU([string])                   Pass the given argument back as a value.
PERIODIC_HOOK         PERIODIC_HOOK(context,extension,int  Execute a periodic dialplan hook into the audio of a call.
PITCH_SHIFT           PITCH_SHIFT(channel direction)       Pitch shift both tx and rx audio streams on a channel.
PJSIP_AOR             PJSIP_AOR(name,field)                Get information about a PJSIP AOR
PJSIP_CONTACT         PJSIP_CONTACT(name,field)            Get information about a PJSIP contact
PJSIP_DIAL_CONTACTS   PJSIP_DIAL_CONTACTS(endpoint[,aor[,  Return a dial string for dialing all contacts on an AOR.
PJSIP_DTMF_MODE       PJSIP_DTMF_MODE()                    Get or change the DTMF mode for a SIP call.
PJSIP_ENDPOINT        PJSIP_ENDPOINT(name,field)           Get information about a PJSIP endpoint
PJSIP_HEADER          PJSIP_HEADER(action,name[,number])   Gets headers from an inbound PJSIP channel. Adds, updates or removes the specified SIP header from an outbound PJSIP channel.
PJSIP_MEDIA_OFFER     PJSIP_MEDIA_OFFER(media)             Media and codec offerings to be set on an outbound SIP channel prior to dialing.
PJSIP_MOH_PASSTHROUG  PJSIP_MOH_PASSTHROUGH()              Get or change the on-hold behavior for a SIP call.
PJSIP_PARSE_URI       PJSIP_PARSE_URI(uri,type)            Parse an uri and return a type part of the URI.
PJSIP_SEND_SESSION_R  PJSIP_SEND_SESSION_REFRESH([update_  W/O: Initiate a session refresh via an UPDATE or re-INVITE on an established media session
POP                   POP(varname[,delimiter])             Removes and returns the last item off of a variable containing delimited text
PP_EACH_EXTENSION     PP_EACH_EXTENSION(mac,template_file  Execute specified template for each extension.
PP_EACH_USER          PP_EACH_USER(string,exclude_mac)     Generate a string for each phoneprov user.
PRESENCE_STATE        PRESENCE_STATE(provider,field[,opti  Get or Set a presence state.
PUSH                  PUSH(varname[,delimiter])            Appends one or more values to the end of a variable containing delimited text
QUEUE_EXISTS          QUEUE_EXISTS([queuename])            Check if a named queue exists on this server
QUEUE_GET_CHANNEL     QUEUE_GET_CHANNEL(queuename[,positi  Return caller at the specified position in a queue.
QUEUE_MEMBER          QUEUE_MEMBER([queuename],option[,in  Provides a count of queue members based on the provided criteria, or updates a queue member's settings.
QUEUE_MEMBER_COUNT    QUEUE_MEMBER_COUNT(queuename)        Count number of members answering a queue.
QUEUE_MEMBER_LIST     QUEUE_MEMBER_LIST(queuename)         Returns a list of interfaces on a queue.
QUEUE_MEMBER_PENALTY  QUEUE_MEMBER_PENALTY(queuename,inte  Gets or sets queue members penalty.
QUEUE_VARIABLES       QUEUE_VARIABLES(queuename)           Return Queue information in variables.
QUEUE_WAITING_COUNT   QUEUE_WAITING_COUNT([queuename])     Count number of calls currently waiting in a queue.
QUOTE                 QUOTE(string)                        Quotes a given string, escaping embedded quotes as necessary
RAND                  RAND([min][,max])                    Choose a random number in a range.
REALTIME              REALTIME(family,fieldmatch[,matchva  RealTime Read/Write Functions.
REALTIME_DESTROY      REALTIME_DESTROY(family,fieldmatch[  RealTime Destroy Function.
REALTIME_FIELD        REALTIME_FIELD(family,fieldmatch,ma  RealTime query function.
REALTIME_HASH         REALTIME_HASH(family,fieldmatch,mat  RealTime query function.
REALTIME_STORE        REALTIME_STORE(family,field1,fieldN  RealTime Store Function.
REDIRECTING           REDIRECTING(datatype[,i])            Gets or sets Redirecting data on the channel.
REGEX                 REGEX("regular expression" string)   Check string against a regular expression.
REPLACE               REPLACE(varname,find-chars[,replace  Replace a set of characters in a given string with another character.
SET                   SET(varname[=value])                 SET assigns a value to a channel variable.
SHA1                  SHA1(data)                           Computes a SHA1 digest.
SHARED                SHARED(varname[,channel])            Gets or sets the shared variable specified.
SHELL                 SHELL(command)                       Executes a command using the system shell and captures its output.
SHIFT                 SHIFT(varname[,delimiter])           Removes and returns the first item off of a variable containing delimited text
SMDI_MSG              SMDI_MSG(message_id,component)       Retrieve details about an SMDI message.
SMDI_MSG_RETRIEVE     SMDI_MSG_RETRIEVE(smdi port,search   Retrieve an SMDI message.
SORT                  SORT(key1:val1[,key2:val2[,...]])    Sorts a list of key/vals into a list of keys, based upon the vals.
SPEECH                SPEECH(argument)                     Gets information about speech recognition results.
SPEECH_ENGINE         SPEECH_ENGINE(name)                  Get or change a speech engine specific attribute.
SPEECH_GRAMMAR        SPEECH_GRAMMAR([nbest_number/]resul  Gets the matched grammar of a result if available.
SPEECH_RESULTS_TYPE   SPEECH_RESULTS_TYPE()                Sets the type of results that will be returned.
SPEECH_SCORE          SPEECH_SCORE([nbest_number/]result_  Gets the confidence score of a result.
SPEECH_TEXT           SPEECH_TEXT([nbest_number/]result_n  Gets the recognized text of a result.
SPRINTF               SPRINTF(format,arg1[,arg2[,...][,ar  Format a variable according to a format string.
SQL_ESC               SQL_ESC(string)                      Escapes single ticks for use in SQL statements.
SRVQUERY              SRVQUERY(service)                    Initiate an SRV query.
SRVRESULT             SRVRESULT(id,resultnum)              Retrieve results from an SRVQUERY.
STACK_PEEK            STACK_PEEK(n,which[,suppress])       View info about the location which called Gosub
STAT                  STAT(flag,filename)                  Does a check on the specified file.
STRFTIME              STRFTIME([epoch][,timezone[,format]  Returns the current date/time in the specified format.
STRPTIME              STRPTIME(datetime,timezone,format)   Returns the epoch of the arbitrary date/time string structured as described by the format.
STRREPLACE            STRREPLACE(varname,find-string[,rep  Replace instances of a substring within a string with another string.
SYSINFO               SYSINFO(parameter)                   Returns system information specified by parameter.
TALK_DETECT           TALK_DETECT(action)                  Raises notifications when Asterisk detects silence or talking on a channel.
TESTTIME              TESTTIME(date,time[,zone])           Sets a time to be used with the channel to test logical conditions.
TIMEOUT               TIMEOUT(timeouttype)                 Gets or sets timeouts on the channel. Timeout values are in seconds.
TOLOWER               TOLOWER(string)                      Convert string to all lowercase letters.
TOUPPER               TOUPPER(string)                      Convert string to all uppercase letters.
TRYLOCK               TRYLOCK(lockname)                    Attempt to obtain a named mutex.
TXTCIDNAME            TXTCIDNAME(number[,zone-suffix])     TXTCIDNAME looks up a caller name via DNS.
UNLOCK                UNLOCK(lockname)                     Unlocks a named mutex.
UNSHIFT               UNSHIFT(varname[,delimiter])         Inserts one or more values to the beginning of a variable containing delimited text
URIDECODE             URIDECODE(data)                      Decodes a URI-encoded string according to RFC 2396.
URIENCODE             URIENCODE(data)                      Encodes a string to URI-safe encoding according to RFC 2396.
VALID_EXTEN           VALID_EXTEN([context],extension[,pr  Determine whether an extension exists or not.
VERSION               VERSION([info])                      Return the Version info for this Asterisk.
VMCOUNT               VMCOUNT(vmbox[,folder])              Count the voicemails in a specified mailbox.
VM_INFO               VM_INFO(mailbox[@context],attribute  Returns the selected attribute from a mailbox.
VOLUME                VOLUME(direction[,options])          Set the TX or RX volume of a channel.
182 custom functions installed.
core show applications
# 利用可能なDialplan Applicationsの一覧
*CLI> core show applications
d02-pbx202a*CLI> core show applications
    -= Registered Asterisk Applications =-
        AddQueueMember: Dynamically adds queue members.
              ADSIProg: Load Asterisk ADSI Scripts into phone
                AELSub: Launch subroutine built with AEL
            AgentLogin: Login an agent.
          AgentRequest: Request an agent to connect with the channel.
                   AGI: Executes an AGI compliant application.
         AlarmReceiver: Provide support for receiving alarm reports from a burglar or fire alarm panel.
                   AMD: Attempt to detect answering machines.
                Answer: Answer a channel if ringing.
      AttendedTransfer: Attended transfer to the extension provided and TRANSFER_CONTEXT
          Authenticate: Authenticate a user
            BackGround: Play an audio file while waiting for digits of an extension to go to.
      BackgroundDetect: Background a file with talk detect.
         BlindTransfer: Blind transfer channel(s) to the extension and context provided
                Bridge: Bridge two channels.
             BridgeAdd: Join a bridge that contains the specified channel.
            BridgeWait: Put a call into the holding bridge.
                  Busy: Indicate the Busy condition.
  CallCompletionCancel: Cancel call completion service
  CallCompletionRequest: Request call completion service for previous call
       CELGenUserEvent: Generates a CEL User Defined Event.
         ChangeMonitor: Change monitoring filename of a channel.
           ChanIsAvail: Check channel availability
       ChannelRedirect: Redirects given channel to a dialplan target
               ChanSpy: Listen to a channel, and optionally whisper into it.
             ClearHash: Clear the keys from a specified hashname.
            ConfBridge: Conference bridge application.
            Congestion: Indicate the Congestion condition.
         ContinueWhile: Restart a While loop.
       ControlPlayback: Play a file with fast forward and rewind.
             DAHDIScan: Scan DAHDI channels to monitor calls.
              DateTime: Says a specified time in a custom format.
             DBdeltree: Delete a family or keytree from the asterisk database.
               DeadAGI: Executes AGI on a hungup channel.
                  Dial: Attempt to connect to another device or endpoint and bridge the call.
               Dictate: Virtual Dictation Machine.
             Directory: Provide directory of voicemail extensions.
                  DISA: Direct Inward System Access.
              DumpChan: Dump Info About The Calling Channel.
                  EAGI: Executes an EAGI compliant application.
                  Echo: Echo media, DTMF back to the calling party
              EndWhile: End a while loop.
                  Exec: Executes dialplan application.
                ExecIf: Executes dialplan application, conditionally.
            ExecIfTime: Conditional application execution based on the current time.
             ExitWhile: End a While loop.
              ExtenSpy: Listen to a channel, and optionally whisper into it.
           ExternalIVR: Interfaces with an external IVR application.
              Festival: Say text to the user.
              FollowMe: Find-Me/Follow-Me application.
               ForkCDR: Forks the current Call Data Record for this channel.
              GetCPEID: Get ADSI CPE ID.
                 Gosub: Jump to label, saving return address.
               GosubIf: Conditionally jump to label, saving return address.
                  Goto: Jump to a particular priority, extension, or context.
                GotoIf: Conditional goto.
            GotoIfTime: Conditional Goto based on the current time.
                Hangup: Hang up the calling channel.
      HangupCauseClear: Clears hangup cause information from the channel that is available through HANGUPCAUSE.
         IAX2Provision: Provision a calling IAXy with a given template.
                  ICES: Encode and stream using 'ices'.
             ImportVar: Import a variable from a channel into a new variable.
            Incomplete: Returns AST_PBX_INCOMPLETE value.
            JabberJoin: Join a chat room
           JabberLeave: Leave a chat room
            JabberSend: Sends an XMPP message to a buddy.
       JabberSendGroup: Send a Jabber Message to a specified chat room
          JabberStatus: Retrieve the status of a jabber list member
                  JACK: Jack Audio Connection Kit
                   Log: Send arbitrary text to a selected log level.
                 Macro: Macro Implementation.
        MacroExclusive: Exclusive Macro Implementation.
             MacroExit: Exit from Macro.
               MacroIf: Conditional Macro implementation.
         MailboxExists: Check to see if Voicemail mailbox exists.
           MessageSend: Send a text message.
             Milliwatt: Generate a Constant 1004Hz tone at 0dbm (mu-law).
         MinivmAccMess: Record account specific messages.
          MinivmDelete: Delete Mini-Voicemail voicemail messages.
           MinivmGreet: Play Mini-Voicemail prompts.
             MinivmMWI: Send Message Waiting Notification to subscriber(s) of mailbox.
          MinivmNotify: Notify voicemail owner about new messages.
          MinivmRecord: Receive Mini-Voicemail and forward via e-mail.
            MixMonitor: Record a call and mix the audio during the recording.  Use of StopMixMonitor is required to guarantee the audio file is available for processing during dialplan execution.
               Monitor: Monitor a channel.
             Morsecode: Plays morse code.
             MP3Player: Play an MP3 file or M3U playlist file or stream.
                  MSet: Set channel variable(s) or function value(s).
           MusicOnHold: Play Music On Hold indefinitely.
                NBScat: Play an NBS local stream.
                 NoCDR: Tell Asterisk to not maintain a CDR for this channel.
                  NoOp: Do Nothing (No Operation).
           ODBC_Commit: Commits a currently open database transaction.
         ODBC_Rollback: Rollback a currently open database transaction.
            ODBCFinish: Clear the resultset of a sucessful multirow query.
             Originate: Originate a call.
               OSPAuth: OSP Authentication.
             OSPFinish: Report OSP entry.
             OSPLookup: Lookup destination by OSP.
               OSPNext: Lookup next destination by OSP.
                  Page: Page series of phones
                  Park: Park yourself.
       ParkAndAnnounce: Park and Announce.
            ParkedCall: Retrieve a parked call.
          PauseMonitor: Pause monitoring of a channel.
      PauseQueueMember: Pauses a queue member.
                Pickup: Directed extension call pickup.
            PickupChan: Pickup a ringing channel.
              Playback: Play a file.
             PlayTones: Play a tone list.
        PrivacyManager: Require phone number to be entered, if no CallerID sent
            Proceeding: Indicate proceeding.
              Progress: Indicate progress.
                 Queue: Queue a call for a call queue.
              QueueLog: Writes to the queue_log file.
           QueueUpdate: Writes to the queue_log file for OutBound calls and updates Realtime Data. Is used at h extension to be able to have all the parameters.
        RaiseException: Handle an exceptional condition.
                  Read: Read a variable.
             ReadExten: Read an extension into a variable.
            ReceiveFAX: Receive a FAX and save as a TIFF/F file.
                Record: Record to a file.
     RemoveQueueMember: Dynamically removes queue members.
              ResetCDR: Resets the Call Data Record.
             RetryDial: Place a call, retrying on failure allowing an optional exit extension.
                Return: Return from gosub routine.
               Ringing: Indicate ringing tone.
              SayAlpha: Say Alpha.
          SayAlphaCase: Say Alpha.
             SayDigits: Say Digits.
             SayNumber: Say Number.
           SayPhonetic: Say Phonetic.
           SayUnixTime: Says a specified time in a custom format.
              SendDTMF: Sends arbitrary DTMF digits
               SendFAX: Sends a specified TIFF/F file as a FAX.
             SendImage: Sends an image file.
              SendText: Send a Text Message on a channel.
               SendURL: Send a URL.
                   Set: Set channel variable or function value.
           SetAMAFlags: Set the AMA Flags.
                   SMS: Communicates with SMS service centres and SMS capable analogue phones.
            SoftHangup: Hangs up the requested channel.
  SpeechActivateGrammar: Activate a grammar.
      SpeechBackground: Play a sound file and wait for speech to be recognized.
          SpeechCreate: Create a Speech Structure.
  SpeechDeactivateGrammar: Deactivate a grammar.
         SpeechDestroy: End speech recognition.
     SpeechLoadGrammar: Load a grammar.
  SpeechProcessingSound: Change background processing sound.
           SpeechStart: Start recognizing voice in the audio stream.
   SpeechUnloadGrammar: Unload a grammar.
              StackPop: Remove one address from gosub stack.
      StartMusicOnHold: Play Music On Hold.
                Stasis: Invoke an external Stasis application.
        StopMixMonitor: Stop recording a call through MixMonitor, and free the recording's file handle.
           StopMonitor: Stop monitoring a channel.
       StopMusicOnHold: Stop playing Music On Hold.
         StopPlayTones: Stop playing a tone list.
            StreamEcho: Echo media, up to 'N' streams of a type, and DTMF back to the calling party
                System: Execute a system command.
            TestClient: Execute Interface Test Client.
            TestServer: Execute Interface Test Server.
              Transfer: Transfer caller to remote extension.
               TryExec: Executes dialplan application, always returning.
             TrySystem: Try executing a system command.
        UnpauseMonitor: Unpause monitoring of a channel.
    UnpauseQueueMember: Unpauses a queue member.
             UserEvent: Send an arbitrary user-defined event to parties interested in a channel (AMI users and relevant res_stasis applications).
               Verbose: Send arbitrary text to verbose output.
        VMAuthenticate: Authenticate with Voicemail passwords.
             VMSayName: Play the name of a voicemail user
             VoiceMail: Leave a Voicemail message.
         VoiceMailMain: Check Voicemail messages.
      VoiceMailPlayMsg: Play a single voice mail msg from a mailbox by msg id.
                  Wait: Waits for some time.
             WaitDigit: Waits for a digit to be entered.
             WaitExten: Waits for an extension to be entered.
          WaitForNoise: Waits for a specified amount of noise.
           WaitForRing: Wait for Ring Application.
        WaitForSilence: Waits for a specified amount of silence.
             WaitUntil: Wait (sleep) until the current time is the given epoch.
                 While: Start a while loop.
            Zapateller: Block telemarketers with SIT.
    -= 182 Applications Registered =-

ARI

AII(Asterisk REST Interface)はAstersiskで稼働するRESTfulなweb APIサーバー。

まだ触っておらず、詳しくないので省略。

AMI

AMI(Asterisk Manager Interface)はAstersiskを管理、監視するための機能のこと。 TCPやHTTPでAsterisk内サーバーにアクセスし、そこからManagerEventを送信してもらったり、ManagerEventを送信できる。 例えば、AGIではREGISTERに関するイベントなどは取れないが、AMIならそれらも検知できる。

まだ触っておらず、詳しくないので省略。

tags: Docker, Asterisk