Setting CallBack API's in Mod_managed
Hi, How to set hooks like api_on_answer/execute_on_answer using mod_managed during originate. Iam able to get call back notification on Originate by ‘new Api().ExecuteString("originate channel/params &managed(Myclassname")) Iam not able to get notification on outbound answer. I want my API to be called. Sample code looks like… public void Run(AppContext context) { try { context.Session.Answer(); // Create UUID string OutboundUuid = new Api().ExecuteString("create_uuid"); string route = "{origination_caller_id_number=4154151234" + "}[origination_uuid=" + OutboundUuid + "]sofia/gateway/36/1234567890"; string dialPlan = "originate " + route + " '&managed(MyNameSpace.OutboundLeg)'"; new Api().ExecuteString(dialPlan); string bridgeResult = new Api().ExecuteString(string.Format("uuid_bridge {0} {1}", context.Session.GetUuid(), OutboundUuid)); } catch (Exception exception) { Log.WriteLine(LogLevel.Notice, exception.ToString()); } } public class OutboundLeg : IAppPlugin { public void Run(AppContext context) { // This is getting called on outboundleg orgination Log.WriteLine(LogLevel.Warning, "OutboundLeg Notified ------->"); } public void OnAnswer() { Log.WriteLine(LogLevel.Warning, "OutboundLeg OnAnswered ------->"); } public void OnAnswer(string uuid) { Log.WriteLine(LogLevel.Warning, "OutboundLeg OnAnswered ------->"); } } I want OutboundLeg.OnAnswer() to be called on outbound answer. I tried the following syntax but it didn’t work. originate {origination_caller_id_number=4154151234, nolocal:api_on_answer='managed MyNameSpace.OutboundLeg.OnAnswer OutboundUuid’}[origination_uuid=OutboundUuid]sofia/gateway/36/1234567890 '&managed(MyNameSpace.OutboundLeg)' originate {origination_caller_id_number=4154151234, nolocal:api_on_answer='&managed MyNameSpace.OutboundLeg.OnAnswer OutboundUuid’}[origination_uuid=OutboundUuid]sofia/gateway/36/1234567890 '&managed(MyNameSpace.OutboundLeg)' Also tried setting the Session variable on the outbound leg by outboundSession.SetVariable("export", "nolocal:api_on_answer='managed MyNameSpace.OutboundLeg.OnAnswer"); Also tried execute_on_answer instead of api_on_answer. Please do let me know the correct syntax to use execute_on_answer/api_on_answer. Note: I was able to play the prompt on outbound answer by calling system api originate {origination_caller_id_number=4154151234, api_on_answer='uuid_broadcast OutboundUuid prompt.wav both'}[origination_uuid=OutboundUuid]sofia/gateway/36/1234567890 '&managed(MyNameSpace.OutboundLeg)' Thanks Srini
participants (1)
-
Srini K