OK, here is what I did, and it almost seems to sort of work…
[from-pstn-custom]
exten => 6035551234,1,Goto(6035553456,1)
exten => 6035553456,1,Answer()
same => n,GotoIf($["${CALLERID(name)}" = “Private”]?nocid)
same => n,Goto(cid)
same => n(nocid),Zapateller()
same => n(cid),Noop()
I don’t know why the “same => n,Goto(cid)” and the “same => n(cid),Noop()” are needed, but it wouldn’t work without it.
If someone calls on 603-555-3456, it executes the script from that point. If someone calls on 603-555-1234, it jumps to 603-555-3456 and executes the script.
If the caller’s Caller ID shows up as “Private”, he gets a SIT and then the call connection continues. Otherwise, call connection continues without the SIT. So far so good.
Of course people’s blocked caller ID shows up as a lot of things besides “Private”; sometimes “Out of Area”, sometimes “Unavailable”, etc. So, I revised the above code like this:
[from-pstn-custom]
exten => 6035551234,1,Goto(6035553456,1)
exten => 6035553456,1,Answer()
same => n,GotoIf($["${CALLERID(name)}" = “800 Service”]?nocid)
same => n,GotoIf($["${CALLERID(name)}" = “Out of Area”]?nocid)
same => n,GotoIf($["${CALLERID(name)}" = “Out_of_Area”]?nocid)
same => n,GotoIf($["${CALLERID(name)}" = “Private”]?nocid)
same => n,GotoIf($["${CALLERID(name)}" = “TOLL-FREE”]?nocid)
same => n,GotoIf($["${CALLERID(name)}" = “Unavailable”]?nocid)
same => n,GotoIf($["${CALLERID(name)}" = “unknown”]?nocid)
same => n,Goto(cid)
same => n(nocid),Zapateller()
same => n(cid),Noop()
Doesn’t work. I call in and get nothing, or sometimes I get the SIT followed by call termination.
If ‘GotoIf($["${CALLERID(name)}" = “800 Service”]’ evaluates as false, isn’t the script just supposed to execute the next statement in line, and continue until it finds one it matches, or falls thru to the “Goto(cid)” statement? Doesn’t appear to work that way.
I also tried this:
exten => nocid,1,Zapateller()
same => n,Return
exten => 6035551234,1,Goto(6035553456,1)
exten => 6035553456,1,Answer()
same => n,GosubIf($["${CALLERID(name)}" = “800 Service”]?nocid,1)
same => n,GosubIf($["${CALLERID(name)}" = “Out of Area”]?nocid,1)
same => n,GosubIf($["${CALLERID(name)}" = “Out_of_Area”]?nocid,1)
same => n,GosubIf($["${CALLERID(name)}" = “Private”]?nocid,1)
same => n,GosubIf($["${CALLERID(name)}" = “TOLL-FREE”]?nocid,1)
same => n,GosubIf($["${CALLERID(name)}" = “Unavailable”]?nocid,1)
same => n,GosubIf($["${CALLERID(name)}" = “unknown”]?nocid,1)
Same effect… either a SIT then hangup, or just a hangup. As with the GotoIF version, if “Private” is the only one there, it works, but if more than one GosubIf is there, it does not work.