Was this page helpful?

DP: Hangup Handlers

    Hangup handlers 這是在 Asterisk 11 才有支援的新功能,這可應用在,當通話結束後,執行某些指定的程序,這不像傳統的 h extension,而 Hangup handler 只要一個 channel 結束,指定的程序就會被執行,不管通話是來自 transfer、parking 等不同方式均適用。

    範例一:

    [hangup_handler]
    exten => my_handler,1,NoOp()
    same => n,Verbose(Execute your normal 'h' extension logic here)
    same => n,Return()
    
    [context_1]
    exten => 123,1,NoOp()
    same => n,Set(CHANNEL(hangup_handler_push)=hangup_handler,my_handler,1)
    same => n,Verbose(do stuff)
    
    [context_2]
    exten => 123,1,NoOp()
    same => n,Set(CHANNEL(hangup_handler_push)=hangup_handler,my_handler,1)
    same => n,Verbose(do stuff)
    

    範例二:

    一旦通話結束後,會按順序執行 hdlr3 -> hdlr2 -> hdlr1 程序

    ; Some dialplan extension
    same => n,Set(CHANNEL(hangup_handler_push)=hdlr3,s,1(args));
    same => n,Set(CHANNEL(hangup_handler_push)=hdlr2,s,1(args));
    same => n,Set(CHANNEL(hangup_handler_push)=hdlr1,s,1(args));
    ; Continuing in some dialplan extension
     
    [hdlr1]
    exten => s,1,Verbose(0, Executed First)
    same => n,Return()
     
    [hdlr2]
    exten => s,1,Verbose(0, Executed Second)
    same => n,Return()
     
    [hdlr3]
    exten => s,1,Verbose(0, Executed Third)
    same => n,Return() 
    Was this page helpful?
    標籤 (Edit tags)
    • No tags
    您必須 登入 才能發佈評論。
    Powered by MindTouch Core