Freeswitch Scripting strangeness
I am working on a system that invokes a LUA script of the dial plan to handle interaction on the call. All is fine when running a single instance of the script (one call). The issue is when there is more than one call things become erratic. Right now the script opens a log file who's name is based on the date of the call and its DNIS using io.open with append. The script then writes lines to file as it runs detailing its actions. The same log function also uses posix.syslog to log the same information via syslog. All is fine when there is one call up. If there is more than one concurrent on two different DNIS's both log files a present but have output that was created by the other call. The syslog is sane but not the file of logging information. The time stamp will jump backward and pickup with information from the other call (can tell via the UUID) It is my assumption that each call should spin up a thread and they should share no data/variables/handles with other calls in the system. Looking at the logs indicates there is some issue but logging is not the only issue since it seems that call events updating state information is affecting the other call also. If my assumption on a isolated thread per call is incorrect let me know. I inherited this code and suspect that running an application out of the dialplan script is unconventional. Paul
Your assumption is correct. however, open file handles are not threadsafe and you cannot have 2 threads opening the same file and expect sane results. That's why syslog is a udp network server so it can serialize the log messages into a single threaded open file handle in the central syslog process. On Tue, May 11, 2010 at 4:39 PM, paul bilke <fsmail@conspiracy.net> wrote:
I am working on a system that invokes a LUA script of the dial plan to handle interaction on the call. All is fine when running a single instance of the script (one call). The issue is when there is more than one call things become erratic. Right now the script opens a log file who's name is based on the date of the call and its DNIS using io.open with append. The script then writes lines to file as it runs detailing its actions. The same log function also uses posix.syslog to log the same information via syslog. All is fine when there is one call up. If there is more than one concurrent on two different DNIS's both log files a present but have output that was created by the other call. The syslog is sane but not the file of logging information. The time stamp will jump backward and pickup with information from the other call (can tell via the UUID) It is my assumption that each call should spin up a thread and they should share no data/variables/handles with other calls in the system. Looking at the logs indicates there is some issue but logging is not the only issue since it seems that call events updating state information is affecting the other call also. If my assumption on a isolated thread per call is incorrect let me know. I inherited this code and suspect that running an application out of the dialplan script is unconventional. Paul
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ Twitter: http://twitter.com/FreeSWITCH_wire AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:+19193869900
Paul, something is not clear for me in your description. Is the script writing all logs for all calls to the same file, or to one file per call ? David Ponzone Direction Technique email: david.ponzone@ipeva.fr tel: 01 74 03 18 97 gsm: 06 66 98 76 34 Service Client IPeva tel: 0811 46 26 26 www.ipeva.fr - www.ipeva-studio.com Ce message et toutes les pièces jointes sont confidentiels et établis à l'intention exclusive de ses destinataires. Toute utilisation ou diffusion non autorisée est interdite. Tout message électronique est susceptible d'altération. IPeva décline toute responsabilité au titre de ce message s'il a été altéré, déformé ou falsifié. Si vous n'êtes pas destinataire de ce message, merci de le détruire immédiatement et d'avertir l'expéditeur. Le 11/05/2010 à 23:39, paul bilke a écrit :
I am working on a system that invokes a LUA script of the dial plan to handle interaction on the call. All is fine when running a single instance of the script (one call). The issue is when there is more than one call things become erratic. Right now the script opens a log file who's name is based on the date of the call and its DNIS using io.open with append. The script then writes lines to file as it runs detailing its actions. The same log function also uses posix.syslog to log the same information via syslog. All is fine when there is one call up. If there is more than one concurrent on two different DNIS's both log files a present but have output that was created by the other call. The syslog is sane but not the file of logging information. The time stamp will jump backward and pickup with information from the other call (can tell via the UUID) It is my assumption that each call should spin up a thread and they should share no data/variables/handles with other calls in the system. Looking at the logs indicates there is some issue but logging is not the only issue since it seems that call events updating state information is affecting the other call also. If my assumption on a isolated thread per call is incorrect let me know. I inherited this code and suspect that running an application out of the dialplan script is unconventional. Paul
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
participants (3)
-
Anthony Minessale
-
David Ponzone
-
paul bilke