I see. It would seem since the whole project compiles in VS2008 & VS2010 that there would be more mod_managed users. Javascript/Lua seem to be the front runners for scripting and in general they should be the choice. Our particular spec requires real time interaction with web servers using socket.io. Neither of these languages made it easy to watch calls except through ESL knowing the UUID. We wanted to throw events directly from the code to a Message Queue server and deal only with what we want. Mono/C# got selected since we already have a very extensive custom module built on it by another developer in our shop. I will try to write docs for the project since I will be doing more than the average bear with mod_managed. Any doc ideas you or anyone else has shoot them over and I will try to make examples and docs. I also would appreciate if you would not mind me hitting you up to proof read my wiki entries for accuracy once they are done. Phillip On Sep 4, 2012, at 4:14 PM, Dave R. Kompel wrote:
Yes, they should be deprecated. Mod_managed has changed a lot over the years, and a lot of those things are still left over from the days when it was either single app domain, or there were no other for controling or collecting data form outbound legs.
One of the things i forgot to mention in my last reply, that is if you want to control an outbound legs completly form managed code, using the session object it is a lot easier to just do "Session.ExecuteString("originate channel/params &managed(yourclassname")". Then you can handle it just like at was an inbound call, and not even worry about clean-up.
The places you may want to use the hooks are for applications where you need to originate a call from API or other context, not actually have to control the call via managed code, but need to know about the outbound leg (execute_on_originate) where you can stash UUID, and other information about the leg, or get easy notification of call being answered/terminated (api_on_answer,api_hangup_hook). With both of these API hooks, set in the "originate" api call, you can also pass variable arguments that are expanded when they are executed {origination_nested_vars=true}. Does anyone know if that is documented on the wiki? I can't find it.
--Dave
From: Phillip Boles [mailto:freeswitch-users@vocalspace.com] To: FreeSWITCH Users Help [mailto:freeswitch-users@lists.freeswitch.org] Sent: Tue, 04 Sep 2012 13:35:47 -0700 Subject: Re: [Freeswitch-users] Problem with originated calls hanging in CS_SOFT_EXEC state
Thanks Anthony! I found the ManageSession methods by looking at the code that is exposed via swig.
Using "execute_on_*" hooks seems to be the proper procedure, it needs to be documented on the wiki. There is virtually no documentation to originate a call for mod managed on the wiki. I will correct that if I can get wiki access.
I will illustrate your solution using "execute_on_originate" as the preferred solution. There are also several "execute_on_*" hooks that would work.
Should ManagedSession.OriginateHandleHangup and .Originate() methods be deprecated to discourage their use in further releases? Or at least some comments in the code that point people to look at execute_on directives. Does Java have this same issue?
Anthony,Glad I found a bug by doing the wrong thing.... sorry for making work for ya!
I cannot say enough about how responsive Anthony and the community has been about this issue. THANKS!
On Sep 4, 2012, at 3:10 PM, Anthony Minessale wrote:
Listen to Dave. I fixed the lock leak, it was down deep into code I am not sure is ever used. You want to be careful with what you do especially since you are on linux which means you must be using Mono which I am also not sure is used a lot.
On Tue, Sep 4, 2012 at 2:08 PM, Dave R. Kompel <drk@drkngs.net> wrote:
This may be a bug, but ManagedSession really is not the right way to do this from API context. Because of the APP_DOMAIN issue its much easier to just do Api.ExecuteString("originate ... "). If you need to get to the "managed session of the leg you have two options:
For getting to it before the originate set the variable execute_on_originate to call a managed AppPlugin, or:
For getting results at the end of the call in API code, set the variable API_HANGUP_HOOK.
Both of these methoods are much easier to do from API context in mod_managed, and you won't have to worry about crossing app domain boundries, and you won't have do do any cleanup on the leg.
________________________________ From: Anthony Minessale [mailto:anthony.minessale@gmail.com] To: FreeSWITCH Users Help [mailto:freeswitch-users@lists.freeswitch.org] Sent: Tue, 04 Sep 2012 11:37:54 -0700
Subject: Re: [Freeswitch-users] Problem with originated calls hanging in CS_SOFT_EXEC state
now that you have a jira do not continue this thread it doubles the work effort, see comments there
On Tue, Sep 4, 2012 at 1:00 PM, Phillip Boles <freeswitch-users@vocalspace.com> wrote:
I have tried to get the Current HEAD to run mod_managed with this to the top of switch_core.h #define SWITCH_DEBUG_RWLOCKS 1
I am getting this error now.
2012-09-04 12:57:38.318859 [CRIT] switch_loadable_module.c:1310 Error Loading module /usr/local/freeswitch/mod/mod_managed.so **/usr/local/freeswitch/mod/mod_managed.so: undefined symbol: switch_core_session_read_lock**
Thoughts?
Thanks! On Aug 31, 2012, at 5:20 PM, Anthony Minessale wrote:
add this to the top of switch_core.h #define SWITCH_DEBUG_RWLOCKS 1
rebuild and get a full log of the call look for sign of unhandled rwlock
and put this on jira why I am i helping you over ml .... >=0
On Fri, Aug 31, 2012 at 4:16 PM, Phillip Boles <freeswitch-users@vocalspace.com> wrote:
Sorry Yes using the latest.
Using commit a8ce9ac29f3ba000bf42ab2286be04cc7bf9f509 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Aug 30 17:17:15 2012 -0500
Changes made switch_cpp.cpp starting at Line 1000 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Calling CoreSession::destroy\n"); if (session) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "We still have valid session\n");
if (!channel) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Channel is undefined! Trying to get it!\n");
channel = switch_core_session_get_channel(session); }
if (channel) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s destroy/unlink session from object\n", switch_channel_get_name(channel)); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s destroy/unlink uuid\n", switch_channel_get_uuid(channel)); switch_channel_set_private(channel, "CoreSession", NULL); if (switch_channel_up(channel) && switch_test_flag(this, S_HUP) && !switch_channel_test_flag(channel, CF_TRANSFER)) { switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); } } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Channel is undefined! We Failed to get it!\n"); }
[CRIT] switch_cpp.cpp:1000 Calling CoreSession::destroy [CRIT] switch_cpp.cpp:1002 We still have valid session [DEBUG] switch_cpp.cpp:1011 sofia/external/12146635351 destroy/unlink session from object [DEBUG] switch_cpp.cpp:1013 83451093-e04f-49c1-9f55-5dd966bc4ba9 destroy/unlink uuid [DEBUG] switch_core_state_machine.c:92 sofia/external/XXXXXXXXXX Standard REPORTING, cause: NORMAL_CLEARING [DEBUG] switch_core_state_machine.c:703 (sofia/external/XXXXXXXXXX ) State REPORTING going to sleep [DEBUG] switch_core_state_machine.c:423 (sofia/external/XXXXXXXXXX ) State Change CS_REPORTING -> CS_DESTROY [DEBUG] switch_core_session.c:1210 Send signal sofia/external/XXXXXXXXXX [BREAK] [DEBUG] switch_core_session.c:1415 Session 2 (sofia/external/XXXXXXXXXX ) Locked, Waiting on external entities
channel remains hung
P
On Aug 31, 2012, at 12:26 PM, Anthony Minessale wrote:
> 1) You did not answer the question if you are on latest GIT HEAD. If > you are on anything else update... > 2) Add some debugging to switch_cpp.cpp about line 1000 > > use lines like this to follow the code paths when you call destroy > switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "BLAH\n"); > > The part I am concerned with is when you call destroy you dont see the > log line you should: > > switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), > SWITCH_LOG_DEBUG, > "%s destroy/unlink session from > object\n", switch_channel_get_name(channel)); > > This makes me wonder if you are some older version... > > > > > > > On Fri, Aug 31, 2012 at 11:57 AM, Phillip Boles > <freeswitch-users@vocalspace.com> wrote: >> var session = ManagedSession.OriginateHandleHangup(s, dialString, ts, >> (y) >> => { >> try { >> Log.WriteLine(LogLevel.Info, "Hanging UP: "+ y.GetUuid()); >> y.SetAutoHangup(true); >> y.flushDigits(); >> y.flushEvents(); >> y.destroy(); >> y.Dispose(); >> GC.Collect(); >> } catch( Exception ) { >> Log.WriteLine(LogLevel.Critical, "Exception While Trying to handup"); >> } >> }); >> Changes yield no fix. Neither .Dispose() or .destroy() separately or >> together destroy the channel. I see in the log the hangup >> 11da29f3-2d9e-4b74-a439-a96ba60f2db1 but this is what I get from show >> channels. >> The last log lines of the debug is: >> 2012-08-31 11:25:52.109393 [DEBUG] switch_core_state_machine.c:407 >> (sofia/external/XXXXXXXXXX) State Change CS_REPORTING -> CS_DESTROY >> 2012-08-31 11:25:52.109393 [DEBUG] switch_core_session.c:1224 Send >> signal >> sofia/external/XXXXXXXXXX [BREAK] >> 2012-08-31 11:25:52.109393 [DEBUG] switch_core_session.c:1424 Session >> 1 >> (sofia/external/XXXXXXXXXX) Locked, Waiting on external entities >> >> >> freeswitch@fs03.int.colo> show channels >> 11da29f3-2d9e-4b74-a439-a96ba60f2db1,outbound,2012-08-31 >> >> 11:25:24,1346430324,sofia/external/12146635351,CS_SOFT_EXECUTE,Vocalspace,2223334444,,12146635351,,,,default,PCMU,8000,64000,PCMU,8000,64000,,fs03.int.colo,,,ACTIVE,Outbound >> Call,12146635351,,,, >> >> freeswitch@fs03.int.colo> uuid_kill >> 11da29f3-2d9e-4b74-a439-a96ba60f2db1 >> >> -ERR No Such Channel! >> >> I am calling this from "managed CustomModule.Api" >> >> Calling GC.Collect() later in the execution does not resolve either. >> //------------------------------------------------------ >> // Entrypoint for blocking API execution >> //------------------------------------------------------ >> public void Execute (ApiContext context) { >> context.Arguments, context.Event == null ? "<none>" : >> context.Event.GetEventType ())); >> >> // this contains the above code >> Run(ParseArguments(context.Arguments)); >> GC.Collect(); >> } >> >> Thanks! >> Suggestions appreciated. >> On Aug 30, 2012, at 5:22 PM, Dave R. Kompel wrote: >> >> Actually, all the managed objects are derived from IDisposable, so you >> should use the .Dispose() method, and let the wrapper do it's job. >> >> ________________________________ >> From: Anthony Minessale [mailto:anthony.minessale@gmail.com] >> To: FreeSWITCH Users Help >> [mailto:freeswitch-users@lists.freeswitch.org] >> Sent: Thu, 30 Aug 2012 13:48:07 -0700 >> Subject: Re: [Freeswitch-users] Problem with originated calls hanging >> in >> CS_SOFT_EXEC state >> >> destroy method should have a log line about (destroy/unlink session >> from >> object) >> try calling your garbage collector, this is common issue with scripts >> and make sure you are on latest GIT build >> >> >> On Thu, Aug 30, 2012 at 3:24 PM, Phillip Boles >> <freeswitch-users@vocalspace.com> wrote: >>> Sorry for the excessive logs. Here is my call to originate. >>> >>> var session = ManagedSession.OriginateHandleHangup(s, dialString, ts, >>> (y) >>> => { >>> try { >>> Log.WriteLine(LogLevel.Info, "Hanging UP: "+ y.GetUuid()); >>> y.SetAutoHangup(true); >>> y.destroy(); >>> >>> } catch( Exception ) { >>> Log.WriteLine(LogLevel.Critical, "Exception While Trying to handup"); >>> } >>> }); >>> >>> >>> My hangup callback is getting hit and I am destroying the session >>> >>> 2012-08-28 10:49:27.296108 [INFO] switch_cpp.cpp:1227 Handing UP: >>> e315f2e8-1fa8-4fd9-849b-f687dad8aed5 >>> >>> This is the only call on the system as it is a develpment machine and >>> I >>> see >>> the call state being changed. >>> >>> 2012-08-28 10:49:27.296108 [DEBUG] switch_core_state_machine.c:79 >>> sofia/external/XXXXXXXXXXX Standard REPORTING, cause: NORMAL_CLEARING >>> 2012-08-28 10:49:27.296108 [DEBUG] switch_core_state_machine.c:682 >>> (sofia/external/XXXXXXXXXXX) State REPORTING going to sleep >>> 2012-08-28 10:49:27.296108 [DEBUG] switch_core_state_machine.c:407 >>> (sofia/external/XXXXXXXXXXX) State Change CS_REPORTING -> CS_DESTROY >>> >>> >>> If I call show channels after the above output it show there is a >>> session >>> sitting in CS_SOFT_EXEC corresponding to UUID >>> e315f2e8-1fa8-4fd9-849b-f687dad8aed5. >>> Is there something else I need to do to release the lock on this >>> session >>> to >>> let the resources be reclaimed. >>> >>> Thanks! >>> >>> Phillip >>> >>> >>> >>> >>> >>> _________________________________________________________________________ >>> Professional FreeSWITCH Consulting Services: >>> consulting@freeswitch.org >>> http://www.freeswitchsolutions.com >>> >>> FreeSWITCH-powered IP PBX: The CudaTel Communication Server >>> http://www.cudatel.com >>> >>> Official FreeSWITCH Sites >>> http://www.freeswitch.org >>> http://wiki.freeswitch.org >>> http://www.cluecon.com >>> >>> 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 >> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com >> IRC: irc.freenode.net #freeswitch >> >> FreeSWITCH Developer Conference >> sip:888@conference.freeswitch.org >> googletalk:conf+888@conference.freeswitch.org >> pstn:+19193869900 >> >> >> _________________________________________________________________________ >> Professional FreeSWITCH Consulting Services: >> consulting@freeswitch.org >> http://www.freeswitchsolutions.com >> >> FreeSWITCH-powered IP PBX: The CudaTel Communication Server >> http://www.cudatel.com >> >> Official FreeSWITCH Sites >> http://www.freeswitch.org >> http://wiki.freeswitch.org >> http://www.cluecon.com >> >> 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 >> >> >> >> >> _________________________________________________________________________ >> Professional FreeSWITCH Consulting Services: >> consulting@freeswitch.org >> http://www.freeswitchsolutions.com >> >> FreeSWITCH-powered IP PBX: The CudaTel Communication Server >> http://www.cudatel.com >> >> Official FreeSWITCH Sites >> http://www.freeswitch.org >> http://wiki.freeswitch.org >> http://www.cluecon.com >> >> 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 >> >> >> >> >> _________________________________________________________________________ >> Professional FreeSWITCH Consulting Services: >> consulting@freeswitch.org >> http://www.freeswitchsolutions.com >> >> FreeSWITCH-powered IP PBX: The CudaTel Communication Server >> http://www.cudatel.com >> >> Official FreeSWITCH Sites >> http://www.freeswitch.org >> http://wiki.freeswitch.org >> http://www.cluecon.com >> >> 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 > GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com > IRC: irc.freenode.net #freeswitch > > FreeSWITCH Developer Conference > sip:888@conference.freeswitch.org > googletalk:conf+888@conference.freeswitch.org > pstn:+19193869900 > > > _________________________________________________________________________ > Professional FreeSWITCH Consulting Services: > consulting@freeswitch.org > http://www.freeswitchsolutions.com > > FreeSWITCH-powered IP PBX: The CudaTel Communication Server > http://www.cudatel.com > > Official FreeSWITCH Sites > http://www.freeswitch.org > http://wiki.freeswitch.org > http://www.cluecon.com > > 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
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
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 GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org googletalk:conf+888@conference.freeswitch.org pstn:+19193869900
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
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
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
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 GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org googletalk:conf+888@conference.freeswitch.org pstn:+19193869900
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
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
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
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 GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org googletalk:conf+888@conference.freeswitch.org pstn:+19193869900
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
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
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
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