2

Not able keep control in lua script after

session:execute("conference", conf_name);

All the below commands are not able to get executed.

originate {}dialstring &test.lua

test.lua

api = freeswitch.API()
    freeswitch.consoleLog("DEBUG", "test1")
    session:execute("conference", "test_conf");
    freeswitch.consoleLog("DEBUG", "test2")

test2 is not printed in consolelog

Ankit
  • 31
  • 4
  • provide more info. are there any error messages_ is there more code to share? – Piglet May 18 '20 at 17:03
  • No there are no error messages .. I have a simple lua script => originate {}dialstring &test.lua I am adding this session to conference with session:execute("conference", conf_name); – Ankit May 19 '20 at 06:06
  • and what is 'are not able to get executed' supposed to mean? what is conf_name? provide your script´and read [ask] – Piglet May 19 '20 at 06:07
  • test.lua freeswitch,consoleLog("DEBUG", "test1") session:execute("conference", conf_name); freeswitch,consoleLog("DEBUG", "test2") test2 is not printed in consolelog – Ankit May 19 '20 at 06:11
  • please improve your post, don't add code in comments – Piglet May 19 '20 at 06:11
  • Lets focus in freeswitch lua script .. I believe its quite understandable now. Thanks for helping me improve the post – Ankit May 19 '20 at 06:17
  • It is understood .. lets focus on logical discussion. FREESWITCH CONFERENCE is the part where we need to put our focus on. – Ankit May 19 '20 at 06:22

2 Answers2

1

Posting my answer from the freeswitch mailing list: Question, answer 1, additional information 2.

To the best of my understanding, when you call session:execute it's a synchronous operation. The Lua script will keep running, waiting for that execute to finish. If you would kick the user out of the conference, the lua script would continue where it left off.

(If you would hangup on the user or transfer them, the session would be over and the script may do it's best to continue, but with no active session.)

Alternatives: Depending on what you want to accomplish, you can first schedule a task before the conference. Or call the lua script only for some things and process the rest in the dialplan. When you need, kick it back to another lua script for further processing.


Brian posted one additional piece of information:

It won't continue the lua unless hangup_after_conference=false. but you are correct, the script is executing the conference, it stopped there.

user1278519
  • 861
  • 6
  • 9
0

yes the control of the script is lost after the session got transferred ton conference.

Logically we can initiate a call from conference itself by

conference dial

Ankit
  • 31
  • 4