ANSWER Usage: ANSWER Asser t s answer . Answer s channel i f not al r eady i n answer st at e. RETURNS: - 1 on channel f ai l ur e 0 i f successf ul CHANNEL STATUS Usage: CHANNEL STATUS [ <channel name>] Ret ur ns t he st at us of t he speci f i ed or connect ed channel . I f no channel name i s gi ven i t r et ur ns t he st at us of t he cur r ent channel . RETURNS: 0 Channel i s down and avai l abl e 1 Channel i s down, but r eser ved 2 Channel i s of f hook 3 Di gi t s ( or equi val ent ) have been di al ed 4 Li ne i s r i ngi ng 5 Remot e end i s r i ngi ng 6 Li ne i s up 7 Li ne i s busy DATABASE DEL Usage: DATABASE DEL <f ami l y> <key> Removes dat abase key/ val ue. Del et es an ent r y i n t he Ast er i sk dat abase f or a gi ven f ami l y and key. RETURNS: 1 i f successf ul 0 ot her wi se DATABASE DELTREE Usage: DATABASE DELTREE <f ami l y> [ keyt r ee] Removes dat abase keyt r ee/ val ue. Del et es a f ami l y or speci f i c keyt r ee wi t hi n a f ami l y i n t he Ast er i sk dat abase. RETURNS: 1 i f successf ul Asterisk Gateway Interface (AGI) 0 ot her wi se DATABASE GET Usage: DATABASE GET <f ami l y> <key> Get s dat abase val ue. Ret r i eves an ent r y i n t he Ast er i sk dat abase f or a gi ven f ami l y and key. RETURNS: 0 i f <key> i s not set 1 i f <key> i s set and r et ur ns t he var i abl e i n par ent hesi s exampl e r et ur n code: 200 r esul t =1 ( t est var i abl e) DATABASE PUT Usage: DATABASE PUT <f ami l y> <key> <val ue> Adds/ updat es dat abase val ue. Adds or updat es an ent r y i n t he Ast er i sk dat abase f or a gi ven f ami l y, key, and val ue. RETURNS: 1 i f successf ul 0 ot her wi se EXEC Usage: EXEC <appl i cat i on> <opt i ons> Execut es a gi ven appl i cat i on. Execut es <appl i cat i on> wi t h gi ven <opt i ons>. RETURNS: What ever t he appl i cat i on r et ur ns successf ul l y - 2 on f ai l ur e t o f i nd appl i cat i on GET DATA Usage: GET DATA <f i l e t o be st r eamed> [ t i meout ] [ max di gi t s] Get s dat a on a channel . St r eam t he gi ven f i l e, and r ecei ve DTMF dat a. t he channel at t he ot her end. RETURNS: Di gi t s r ecei ved f r om t he channel at t he ot her end. GET VARIABLE Usage: GET VARI ABLE <var i abl ename> Get s a channel var i abl e. RETURNS: 0 i f <var i abl ename> i s not set 1 i f <var i abl ename> i s set and r et ur ns t he var i abl e i n par ent hesi s exampl e r et ur n code: 200 r esul t =1 ( t est var i abl e) Asterisk Gateway Interface (AGI) HANGUP Usage: HANGUP [ <channel name>] Hangs up t he cur r ent or speci f i ed channel . I f no channel name i s gi ven, hangs up t he cur r ent channel RETURNS: 1 on success - 1 on f ai l ur e NOOP Usage: NOOP Does not hi ng. RETURNS: 0 - al ways RECEIVE CHAR Usage: RECEI VE CHAR <t i meout > Recei ves t ext f r om channel s suppor t i ng i t . Recei ves a char act er of t ext on a channel . Speci f y t i meout t o be t he maxi mum t i me t o wai t f or i nput i n mi l l i seconds, or 0 f or i nf i ni t e. Most channel s do not suppor t t he r ecept i on of t ext . RETURNS: ASCI I numer i cal val ue of t he char act er i f one i s r ecei ved 0 i f t he channel does not suppor t t ext r ecept i on - 1 onl y on er r or / hangup. RECORD FILE Usage: RECORD FI LE <f i l ename> <f or mat > <escape di gi t s> <t i meout > [ of f set sampl es] [ BEEP] [ s=si l ence] Recor ds t o a gi ven f i l e. Recor d t o a f i l e unt i l a gi ven DTMF di gi t i n t he sequence i s r ecei ved. The f or mat wi l l speci f y what ki nd of f i l e wi l l be r ecor ded. The t i meout i s t he maxi mum r ecor d t i me i n mi l l i seconds, or - 1 f or no t i meout . " of f set sampl es" i s opt i onal , and i f pr ovi ded wi l l seek t o t he of f set wi t hout exceedi ng t he end of t he f i l e. " si l ence" i s t he number of seconds of si l ence al l owed bef or e t he f unct i on r et ur ns despi t e t he l ack of DTMF di gi t s or r eachi ng t i meout . The " si l ence" val ue must be pr eceded by " s=" and i s opt i onal . RETURNS: - 1 on hangup or er r or SAY DIGITS Usage: SAY DI GI TS <number > <escape di gi t s> Asterisk Gateway Interface (AGI) Say a gi ven di gi t st r i ng, r et ur ni ng ear l y i f any of t he gi ven DTMF di gi t s ar e r ecei ved on t he channel . RETURNS: 0 i f pl ayback compl et es wi t hout a di gi t bei ng pr essed ASCI I numer i cal val ue of t he di gi t i f one was pr essed - 1 on er r or / hangup SAY NUMBER Usage: SAY NUMBER <number > <escape di gi t s> Say a gi ven number , r et ur ni ng ear l y i f any of t he gi ven DTMF di gi t s ar e r ecei ved on t he channel . RETURNS: 0 i f pl ayback compl et es wi t hout a di gi t bei ng pr essed ASCI I numer i cal val ue of t he di gi t i f one was pr essed - 1 on er r or / hangup SAY PHONETIC Usage: SAY PHONETI C <st r i ng> <escape di gi t s> Say a gi ven char act er st r i ng wi t h phonet i cs, r et ur ni ng ear l y i f any of t he gi ven DTMF di gi t s ar e r ecei ved on t he channel . RETURNS: 0 i f pl ayback compl et es wi t hout a di gi t bei ng pr essed ASCI I numer i cal val ue of t he di gi t i f one was pr essed - 1 on er r or / hangup SAY TIME Usage: SAY TI ME <t i me> <escape di gi t s> Say a gi ven t i me, r et ur ni ng ear l y i f any of t he gi ven DTMF di gi t s ar e r ecei ved on t he channel . <t i me> i s t he number of seconds el apsed si nce 00: 00: 00 J anuar y 1, 1970, Coor di nat ed Uni ver sal Ti me ( UTC) . RETURNS: 0 i f pl ayback compl et es wi t hout a di gi t bei ng pr essed ASCI I numer i cal val ue of t he di gi t i f one was pr essed - 1 on er r or / hangup SEND IMAGE Usage: SEND I MAGE <i mage> Sends t he gi ven i mage on a channel . Most channel s do not suppor t t he t r ansmi ssi on of i mages. I mage names shoul d not i ncl ude ext ensi ons. RETURNS: 0 i f i mage i s sent or i f t he channel does not suppor t i mage t r ansmi ssi on - 1 onl y on er r or / hangup Asterisk Gateway Interface (AGI) SEND TEXT Usage: SEND TEXT " <t ext t o send>" Sends t he gi ven t ext on a channel . Most channel s do not suppor t t he t r ansmi ssi on of t ext . Text consi st i ng of gr eat er t han one wor d shoul d be pl aced i n quot es si nce t he command onl y accept s a si ngl e ar gument . RETURNS: 0 i f t ext i s sent , or i f t he channel does not suppor t t ext t r ansmi ssi on - 1 onl y on er r or / hangup SET AUTOHANGUP Usage: SET AUTOHANGUP <t i me> Aut ohangup channel i n some t i me. Cause t he channel t o aut omat i cal l y hangup at <t i me> seconds i n t he f ut ur e. Of cour se i t can be hungup bef or e t hen as wel l . Set t i ng t o 0 wi l l cause t he aut ohangup f eat ur e t o be di sabl ed on t hi s channel . RETURNS: 0 - al ways SET CALLERID Usage: SET CALLERI D <number > Changes t he cal l er i d of t he cur r ent channel . RETURNS: 1 - al ways SET CONTEXT Usage: SET CONTEXT <desi r ed cont ext > Set s t he cont ext f or cont i nuat i on upon exi t i ng t he appl i cat i on. RETURNS: 0 - al ways SET EXTENSION Usage: SET EXTENSI ON <new ext ensi on> Changes t he ext ensi on f or cont i nuat i on upon exi t i ng t he appl i cat i on. RETURNS: 0 - al ways SET MUSIC Usage: SET MUSI C ON <on| of f > <cl ass> Enabl es/ Di sabl es t he musi c on hol d gener at or . I f <cl ass> i s not Asterisk Gateway Interface (AGI) speci f i ed t hen t he def aul t musi c on hol d cl ass wi l l be used. RETURNS: 0 - al ways SET PRIORITY Usage: SET PRI ORI TY <num> Changes t he pr i or i t y f or cont i nuat i on upon exi t i ng t he appl i cat i on. RETURNS: 0 - al ways SET VARIABLE Usage: SET VARI ABLE <var i abl ename> <val ue> Set s a channel var i abl e. RETURNS: 1 - al ways STREAM FILE Usage: STREAM FI LE <f i l ename> <escape di gi t s> [ sampl e of f set ] Sends audi o f i l e on channel . Send t he gi ven f i l e, al l owi ng pl ayback t o be i nt er r upt ed by t he gi ven di gi t s, i f any. Use doubl e quot es f or t he di gi t s i f you wi sh none t o be per mi t t ed. I f sampl e of f set i s pr ovi ded t hen t he audi o wi l l seek t o sampl e of f set bef or e pl ay st ar t s. Remember , t he f i l e ext ensi on must not be i ncl uded i n t he f i l ename. RETURNS: 0 i f pl ayback compl et es wi t hout a di gi t bei ng pr essed ASCI I numer i cal val ue of t he di gi t i f one was pr essed - 1 on er r or or i f t he channel was di sconnect ed TDD MODE Usage: TDD MODE <on| of f > Enabl e/ Di sabl e TDD t r ansmi ssi on/ r ecept i on on a channel . RETURNS: 1 i f successf ul 0 i f channel i s not TDD- capabl e VERBOSE Usage: VERBOSE <message> <l evel > Logs a message t o t he ast er i sk ver bose l og. Sends <message> t o t he consol e vi a ver bose message syst em. <l evel > i s t he t he ver bose l evel ( 1- 4) RETURNS: 1 - al ways Asterisk Gateway Interface (AGI) http://gundy.org/asterisk/agi.html[23/09/2010 10:38:16 a.m.] WAIT FOR DIGIT Usage: WAI T FOR DI GI T <t i meout > Wai t s f or a di gi t t o be pr essed. Wai t s up t o ' t i meout ' mi l l i seconds f or channel t o r ecei ve a DTMF di gi t . Use - 1 f or t he t i meout val ue i f you desi r e t he cal l t o bl ock i ndef i ni t el y. RETURNS: ASCI I numer i cal val ue of t he di gi t i f one i s r ecei ved - 1 on channel f ai l ur e 0 i f no di gi t i s r ecei ved i n t he t i meout