I hope everybody is fine. I have a question about freeswitch.
I have a very minimal experience in freeswitch and working to connect my node js script to the freeswitch server. I have successfully connected to the freeswitch server and the outbound calls are generated successfully.
I want to catch the event CHANNEL_ANSWER in my node js script to perform further tasks related to call flow but I am only getting CHANNEL_EXECUTE_COMPLETE event whenever the call is completed, rejected or terminates by itself due to timeout. I have also checked the fs_cli logs but the CHANNEL_ANSWER is not generated by the freeswitch server. I want to get the event whenever the call is answered by the second party.
My question is: Can we get the CHANNEL_ANSWER or call is answered event in node js script?
I am getting the CHANNEL_EXECUTE_COMPLETE but i am not getting any event when the call is answered. These are the logs:
2023-11-07 10:18:56.896930 [DEBUG] sofia.c:7084 Channel sofia/external/+1122334455 entering state [ready][200] 2023-11-07 10:18:56.896930 [NOTICE] sofia.c:8159 Channel [sofia/external/+1122334455] has been answered 2023-11-07 10:18:56.896930 [DEBUG] switch_channel.c:3773 (sofia/external/+1122334455) Callstate Change EARLY -> ACTIVE 2023-11-07 10:18:56.976870 [DEBUG] switch_rtp.c:7271 Correct audio ip/port confirmed. 2023-11-07 10:19:05.996866 [NOTICE] sofia.c:1012 Hangup sofia/external/+1122334455 [CS_EXECUTE] [NORMAL_CLEARING]
I have not done any tele coding before however it looks cool. So I dug into the docs (NOTE: not 100% on accuracy or preciseness of) and I can see here https://github.com/englercj/node-esl/blob/master/examples/channels/lib/api.js from ln181 we have:
So could that be a good place to do your further work when an id and it's buffer exists?
Also on ln210 we have
CHANNEL_EXECUTE_COMPLETE
which I believe judging by its name could mean the Channel is in Answer state as it has been executed. So in here too like shown on ln213 if the buffer exists it means the channel is true and inside a buffer and you can do the further work here.Finally on ln229 we have
Api.prototype._updateState
function and on ln232 we update the answerstate row with this line:I believe in this answer state could show your answer and depending on what that is you may want to do further work here or not e.g.
This is the most help I can give until I see all of your code and which version of the api AND documentation you are following.
I would also determine does the state variable CHANNEL_ANSWER still exist? If not then it's deprecated and a custom solution may be needed.