There are 2 different ways to do what you're asking:
1) In the CallListener.originated() callback, do the play and collect operation. You may also have to invoke suspend() here.
- Set an EJB timer for a timeout
- Wait for your media listener to be invoked or the timer to expire
- If 1 was pressed, invoke "call.allow()"
- If the timer expired, invoke "call.drop()"
2) Configure your snap-in as a calling party application for A.
- Your app may then be invoked on both the A leg and the B leg
- If on the B leg, perform the above steps from the callIntercepted callback
My recommendation would be the first mechanism. Let us know how it goes!