FXO Callee Answer Detection


I am building an application that monitors calls going to other offices.

When we need to monitor calls going to a remote office, we divert that call to main office. This is done at our toll free platform by Sprint

Call comes in on Line 1, Play Message that call may be monitored
Dial remote office on line two, bridge call and use chanspy to monitor call

If remote office doesn’t answer, we need to hangup line 2, and dial a different office.

Problem is I cannot accurately detect Answer on POTS line.

FXO is normaly set to answer right away, on first ring whether call is actually awnswered or not. I tried to use callprogress=yes but it doesnt work reliably

My proposed solution is to allow FXO line to anwer immediately like it wants to. Then continue to listen for ringing, If line rings 6 times, drop that call and try second number.

I am trying to make sense of the source code to see the best way to accomplish this.

Any help or ideas appreciated.