Yes you are absolutelly right, maybe I might be looking at the wrong tool... I have tried several approaches but haven't found the right one... I don't only need to detect if a call was answered, but I need also to detect and log the failure cause in case the call was not answered. Which usually can be found in the originate_disposition variable...
If I use a socket command: "bgapi originate {ignore_early_media=true,originate_timeout=10,api_hangup_hook='luarun cc.lua predictive_hangup'}sofia/gateway/gwname/13246789 9999" I cannot detect the originate_disposition variable in predictive_hangup() in lua, becouse the session is nil after hangup... I think I should start dialing out from the dialplan, but in this case how to call to the dialplan using sockets? I've tried: "bgapi originate {phoneno=13246789}loopback/9999" with no success... What do you suggest? Is it possible to get this working only with 2 call legs??? I think you might be looking at the wrong tool. The session:bridged() method is for knowing if the current session is bridged to another leg. Tony says it has a very specific use case and I doubt that this is what they had in mind. If you're building a predictive dialer and you are generating the outbound call leg then you're most likely in need of knowing that the far end has answered. In a case like this I would build a dialplan extension and have the b leg drop in there. Then set execute_on_answer to your lua script. You could also use that dialplan to handle timeouts, call failures, etc. This way you're letting the dialplan do what it's good at and your Lua script can focus on the single task of handling an answered call... -MC _______________________________________________ FreeSWITCH-dev mailing list FreeSWITCH-dev@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org