Tropo is part of CiscoLearn More

Rejecting a Call

Rejecting a call is absolutely straightforward (though it only works with the voice network - there's no way to reject a text message). Usually you'll want to reject calls based on the callerID; here's how to handle it:

var callerID = currentCall.callerID;
if (callerID == "4155550100" || callerID == "9165550100") {
    reject();
    }
else {
    say("Hi friend!");
    }
callerID = $currentCall.callerID
if (callerID == "4155550100" || callerID == "9165550100")
    reject
else
    say "Hi friend!"
end
<?php
 $callerID = $currentCall->callerID;
 if ($callerID == "4155550100" || $callerID == "9165550100") {
     reject();
 } else {
     say("Hi friend!");
 }
?>
callerID = currentCall.callerID
if (callerID == "4155550100" or callerID == "9165550100") :
    reject()
else :
    say("Hi friend!")
callerID = currentCall.callerID
if (callerID == "4155550100" || callerID == "9165550100") {
    reject()
    }
else {
    say("Hi friend!")
    }

Rejected calls will receive a busy signal. Rejected SIP calls will get a 486 Busy Here response.

You can also combine this with transfer, so your mother-in-law gets sent to a voicemail but your crazy ex (or exes in our example - popularity has a price) gets a busy signal:

var callerID = currentCall.callerID;
if (callerID == "4155550100" || callerID == "9165550100") {
    reject();
    }
if (callerID == "4075550100") {
    transfer("+13217105094");
    }
else {
    say("Hi friend!");
    }
callerID = $currentCall.callerID
if (callerID == "4155550100" || callerID == "9165550100")
    reject
elsif (callerID == "4075550100")
    transfer "+13217105094"
else
    say "Hi friend!"
end
<?php
 $callerID = $currentCall->callerID;
 if ($callerID == "4155550100" || $callerID == "9165550100") {
     reject();
 } elseif ($callerID == "4075550100") {
    transfer("+13217105094");
 } else {
     say("Hi friend!");
 }
?>
callerID = currentCall.callerID
if (callerID == "4155550100" or callerID == "9165550100") :
    reject()
elif (callerID == "4075550100") :
    transfer("+13217105094")
else :
    say("Hi friend!")
callerID = currentCall.callerID
if (callerID == "4155550100" || callerID == "9165550100") {
    reject()
    }
if (callerID == "4075550100") {
    transfer("+13217105094")
    }
else {
    say("Hi friend!")
    }