asterisk 呼叫文件(.call)简单说明

Asterisk /var/spool/asterisk/outgoing下面 的后缀名为 ".call"的文件,这样的文件是自动去执行拨号。。如建立 text.call 文件,必须放在 "/var/spool/asterisk/outgoing"下面,然后系统会自动去执行。当然如果里面的参数不正常,将不会去执行。
参数说明:


Channel: <channel>
         The channel upon which to initiate the call.  ..................我理解为什么什么通道,就是给哪个号码发起呼叫,想当于 DIAL()..
Callerid: <callerid>        The caller ID to be used for the call..................... 显示的号码,或名称
WaitTime: <number>        Number of seconds the system waits for the call to be answered. If not specified, defaults to 45              seconds................等待回答的时间,在这时间,如果没有回答,就进行下一轮呼叫,没有指定,默认为45秒
MaxRetries: <number>          Maximum number of dial retries (if an attempt fails because the device is busy or not reachable). If not specified, defaults to 0 (only one attempt is made). ..............最大失败后重试数.如设置为2
RetryTime: <number>        Number of seconds to wait until the next dial attempt. If not specified, defaults to 300 seconds. .........等待的秒数直到下一次拨号尝试。 如果没有指定,默认为300秒。
Account: <account>         The account code for the CDR.......计费方面的东东。。
Context: <context>        The destination context. ......指定拨号方案
Extension: <exten>        The destination extension, in which dialplan execution begins if the device is answered. ....额。报号方案中的开始执行的地,如x.a 100,上面拨号方案相关
Priority: <priority>         The destination priority. If not specified, defaults to 1. ............目标优先级。 如果没有指定,默认为1
Setvar: <var=value>      Setvar: lets you set one or more channel variables..............设置一个或多个通道变量
Archive: <yes|no>           By default, call files are deleted immediately upon execution. If Archive: yes is set, they are copied into        /var/spool/asterisk/outgoing_done/ instead. Asterisk adds a line to the call file which describes the result:.......................是否存档。因为.call文件执行后会被删除,所以我们有必要这里选择存档,选择yes后,原理我们建立的.call文件会呗村在 “/var/spool/asterisk/outgoing_done/”目录下

简单实例:  首先建立一个简单的拨号规则:    

  1. [jh]  
  2. exten => 10,1,Answer()  
  3. exten => 10,n,Dial(SIP/8100)  
  4. exten => 10,n,Hangup()

然后我们在 “/var/spool/asterisk/outgoing/” 目录下建立 一个 text.call 文件 (文件名不重要),代码如下:  

  1. channel: SIP/8111               //呼叫8111  
  2. Callerid: <haozi>               //来电名称haozi  
  3. MaxRetries: 2                   //未接执行2次  
  4. RetryTime: 60                   //60秒后发起下次呼叫  
  5. WaitTime: 30                    //应答时间为30s 也就是响铃时间  
  6. Context: jh                    //指定拨号规则  
  7. Extension: 10                //对应拨号规则中的10  
  8. Archive:yes                //存档  
  9. Setvar:<var=1>            //意思就是设置变量值为1,在context可以使用该变量的值

保存后,asterisk 后立即执行jh拨号规则发起呼叫。

 

实际应用:(自动拨号接通后交给队列处理)

拨号方案:

[from-trunk-customer]
;exten=>1111,1,AgentCallbackLogin(||${CALLERID(num)}@from-trunk-customer)
;exten=>1110,1,AgentCallbackLogin(||l)

exten => *789,1,NooP(${EXTEN})
exten => *789,n,AgentLogin()

exten => queue1, 1, Answer
exten => queue1, n, mixmonitor(/record/${STRFTIME(${EPOCH},,%Y%m%d)}/${STRFTIME(${EPOCH},,%Y%m%d%H%M%S)}_${CALLERID(num)}_${EXTEN:0}.wav,bv(4)V(4)W(4))
exten => queue1, n, Ringing
exten => queue1, n, Queue(MyQueue)
exten => queue1, n, Hungup

 

test.call:

channel: SIP/siptest/015003265727
Callerid: <10016>             
MaxRetries: 2                 
RetryTime: 60                
WaitTime: 30                   
Context: from-trunk-customer                 
Extension: queue1               
Archive:yes                
Setvar:<var=1>

你可能感兴趣的:(File,System,extension,archive)