Was this page helpful?

DP: Call Screening 範例



    • 原文連結: http://moo.net/code/callscreen.html
    •  設計的描述:
      I wanted a telephone number a certain person could call and I would have the option to accept or reject their call. If I rejected the call they would hear a recording like I had traveled outside of my cellular service area (like that happens anymore!). I googled how to do this and found all sorts of outdated rubbish....


    ;8005551212 Test # For Call Screening
    ;First, we answer.
    exten => 8005551212,1,Answer
    ;Next we pass them along to our SIP Trunk.  Tell it to ring for 20 secons, r=ring for calling party, g=return here when called party hangs up, M=macro
    exten => 8005551212,2,Dial(SIP/[email protected]|20|rgM(testscreen))
    ;Now that they're back, check our variable "ACTION" to see what happened.
    exten => 8005551212,3,GotoIf($["${ACTION}" == "0"] ?10) ;Nobody (or voicemail) answerd, not in service.
    exten => 8005551212,4,GotoIf($["${ACTION}" == "1"] ?11) ;Call was answered, all is well.  Hang up.
    exten => 8005551212,5,GotoIf($["${ACTION}" == "2"] ?10) ;You were rejected, no in service.
    ;Anything else, and hang up.
    exten => 8005551212,6,Hangup
    exten => 8005551212,10,MP3Player(/home/asterisk/not_in_service.mp3)
    exten => 8005551212,11,Hangup
    exten => s,1,SetGlobalVar(ACTION=0) ;Default, nobody answered or no key was pressed (voicemail presses no keys).
    exten => s,2,Playback(followme/no-recording.wav)  ;Says: You have an incomming call
    exten => s,3,Read(ACCEPT|followme/options|1) ;Says: Press 1 to accept, 2 to reject
    exten => s,4,Gotoif($[${ACCEPT} = 1] ?50) ; Connect
    exten => s,5,Gotoif($[${ACCEPT} = 2] ?30) ; Reject
    exten => s,30,Set(MACRO_RESULT=CONTINUE)
    exten => s,31,SetGlobalVar(ACTION=2) ; Rejected
    exten => s,32,Goto(51)
    exten => s,50,SetGlobalVar(ACTION=1) ; Connected and conversed.
    exten => s,51,NoOp
    exten => h,1,NoOp
    Was this page helpful?
    標籤 (Edit tags)
    • No tags
    您必須 登入 才能發佈評論。
    Powered by MindTouch Core