Implementing my own PrivacyManager: Handling Callee Input

The PrivacyManager in Asterisk is great. Unfortunately it doesn’t seem to do exactly what I want, so I’m implementing it in my own FastAGI Perl script.

The call is answered, etc, and then I have the caller record their name. This is played back to the callee via a M() flag in the Dial() command (macro).

The Macro does its thing all nice. However, the thing I’m confused about is what to do after I get the response from the callee.

If they dial 1, the call is connected. If they dial 3, the call is connected and I want to update my database to “whitelist” that number.

If they dial 2, the caller is either told to go away or to leave a voicemail. If they dial 4, the caller is told to go away and never call again, and blacklisted in my database.

I want the database to be my MySQL db, not the astdb.

The problem is:
[li]If they select 2 or 4, I “Set(SCREENING_CHOICE|g)” – but then do I call “hangup()” to hangup on the callee? What would send the callee away while keeping the caller on the line?[/li]
[li]Once they select and SCREENING_CHOICE is set globally, I don’t seem to get this response back when I call “GET VARIABLE” later on. Maybe I’m wrong, but I haven’t seen it.[/li]
[li]The voip wiki page on cmd Dial has an example dialplan for an answering machine with screening. However, in that context, I can’t figure out where the callee is hung up on.[/li][/ol]
Anyone got any pointers?

Can you post the relevant parts of your extensions.conf file? I understand what you are trying to do, but I’d need to see what you already have done to be much help.