<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi Chris,<br>
<br>
sorry for the delay. Couldn't get to it sooner.<br>
<br>
Thanks for your input. It's working smoothly and as expected.<br>
<br>
Regards,<br>
Bernhard<br>
<br>
<div class="moz-cite-prefix">Am 13.10.2014 05:04, schrieb Chris
Tunbridge:<br>
</div>
<blockquote
cite="mid:CAO3hyzFWn-x7WQL29f+S=cq1aP8mbiZBxibsujEQkYst4xAX5w@mail.gmail.com"
type="cite">
<div dir="ltr">Also, i would remove the session:hangup from the
lua script, add an extra action to the extension that handles
the check (your xml where you call luarun) and have the hangup
there, that way if the lua script does not transfer the call, it
will automatically hangup as a default action.<br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Sun, Oct 12, 2014 at 9:01 PM, Chris
Tunbridge <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:blasterjr@gmail.com" target="_blank">blasterjr@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div>John, the matching parenthesis is found on line 17,
there's nothing wrong with the syntax of this file.<br>
<br>
</div>
Bernhard, what i recommend is setup a separate extension
that just does the conference logic for you, then in your
lua code, instead of executing the "conference" stuff,
simply transfer to your other XML extension that will put
the call in a conference. In my experience, FreeSWITCH
automatically releases db handlers when a script exits,
and this works fairly well for me. <br>
<br>
So i would remove your dbh:release() code, use a transfer.
also make sure to do <br>
<pre>session:setAutoHangup(false)
</pre>
<pre>before you transfer the call to your separate XML
</pre>
</div>
<div class="HOEnZb">
<div class="h5">
<div class="gmail_extra"><br>
<div class="gmail_quote">On Sun, Oct 12, 2014 at 1:25
PM, John <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:freeswitch@earthspike.net"
target="_blank">freeswitch@earthspike.net</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Bernhard,<br>
<br>
On line 5, you have more '(' than ')'. They
need to balance.<span><font color="#888888"><br>
<br>
John</font></span>
<div>
<div><br>
<br>
On 12/10/14 18:27, Bernhard Wendel wrote:<br>
</div>
</div>
</div>
<div>
<div>
<blockquote type="cite"> Hi John,<br>
<br>
what are you trying to tell me? <br>
Since I'm new to LUA you make me wonder
whether there is a syntax error within my
code. It should pop up somewhere,
shouldn't it? Because I haven't found one
and the code is actually working.<br>
<br>
Or am I missing something?<br>
<br>
Regards,<br>
Bernhard<br>
<br>
<br>
<div>Am 12.10.2014 17:21, schrieb John:<br>
</div>
<blockquote type="cite"> It looks like the
parentheses don't match on line 5.<br>
<br>
John<br>
<br>
<div>On 12/10/14 11:45, Bernhard Wendel
wrote:<br>
</div>
<blockquote type="cite"> Hi,<br>
<br>
I'm using the following Lua-Script to
check whether a conference exists and
only let a caller join if so.<br>
The script is called via the following
dialplan <i><action
application="lua"
data="/path/to/script.lua $1" /></i><i>
</i>, where $1 is the destination
number.<br>
<br>
<br>
<ol>
<li>-- Connect to a database</li>
<li>local dbh =
freeswitch.Dbh("pgsql://hostaddr=127.0.0.1
dbname=database user=username
password='password'
application_name='my-lua-script'")</li>
<li>assert(dbh:connected());</li>
<li>-- Execute SQL</li>
<li>dbh:query(string.format("SELECT
COUNT(*) as \"MyCount\" FROM
\"MyTable\" WHERE ColA = '%s'",
argv[1]), function(row)</li>
<li>
--freeswitch.consoleLog("INFO",
"Results: " .. row.MyCount)</li>
<li> </li>
<li> dbh:release()</li>
<li> </li>
<li> if (row.MyCount== '1') then</li>
<li>
freeswitch.consoleLog("INFO",
"User is joining conference at "
.. argv[1])</li>
<li> </li>
<li> session:answer()</li>
<li>
session:execute("conference",
argv[1] .. "@wideband")</li>
<li> end</li>
<li> session:hangup()</li>
<li>end)</li>
</ol>
<br>
Line 8 instructs FS to return the
postgres-Connection back to the pool -
which is as expected. When a user now
leaves the conference, FS throws this
errors:<br>
<br>
2014-10-12 10:32:30.065924 [DEBUG]
switch_cpp.cpp:694 CoreSession::hangup<br>
2014-10-12 10:32:30.065924 [CRIT]
switch_pgsql.c:368 An error occurred
trying to consume input for query
(200): connection pointer is NULL<br>
2014-10-12 10:32:30.065924 [CRIT]
switch_pgsql.c:122 No DB Connection<br>
2014-10-12 10:32:30.065924 [ERR]
switch_core_sqldb.c:1177 ERR: [SELECT
COUNT(*) as "MyCount" FROM "MyTable"
WHERE ColA = 'conf-1234'][connection
pointer is NULL]<br>
2014-10-12 10:32:30.065924 [ERR]
freeswitch_lua.cpp:446 DBH NOT
Connected.<br>
2014-10-12 10:32:30.065924 [DEBUG]
switch_cpp.cpp:1075 <a
moz-do-not-send="true"
href="mailto:sofia/internal/Alice@my.pbx.com"
target="_blank">sofia/internal/Alice@my.pbx.com</a>
destroy/unlink session from object<br>
<br>
Now, I could live with that. BUT: The
problem is, that sometimes, when a
user leaves the conference, FS
crashes.<br>
I've narrowed down the main cause to
the above lua script. If I comment
line 8 out, FS stops crashing. This
will also stop FS from reusing
Database-Connections. <br>
<br>
Now my questions:<br>
<ol>
<li>I don't use `dbh` after line 8.
So where does the error come from?</li>
<li>How can I stop the error?</li>
<li>How can I rewrite the lua script
to have both a) non-crashing FS
and b) reusing of connection?</li>
</ol>
<p><br>
Regards,<br>
Bernhard<br>
</p>
<br>
<fieldset></fieldset>
<br>
<pre>_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
<a moz-do-not-send="true" href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a>
<a moz-do-not-send="true" href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a>
Official FreeSWITCH Sites
<a moz-do-not-send="true" href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a>
<a moz-do-not-send="true" href="http://confluence.freeswitch.org" target="_blank">http://confluence.freeswitch.org</a>
<a moz-do-not-send="true" href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server
<a moz-do-not-send="true" href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a>
FreeSWITCH-users mailing list
<a moz-do-not-send="true" href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a>
<a moz-do-not-send="true" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a moz-do-not-send="true" href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a moz-do-not-send="true" href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a></pre>
</blockquote>
<br>
<br>
<fieldset></fieldset>
<br>
<pre>_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
<a moz-do-not-send="true" href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a>
<a moz-do-not-send="true" href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a>
Official FreeSWITCH Sites
<a moz-do-not-send="true" href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a>
<a moz-do-not-send="true" href="http://confluence.freeswitch.org" target="_blank">http://confluence.freeswitch.org</a>
<a moz-do-not-send="true" href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server
<a moz-do-not-send="true" href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a>
FreeSWITCH-users mailing list
<a moz-do-not-send="true" href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a>
<a moz-do-not-send="true" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a moz-do-not-send="true" href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a moz-do-not-send="true" href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a></pre>
</blockquote>
<br>
<br>
<fieldset></fieldset>
<br>
<pre>_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
<a moz-do-not-send="true" href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a>
<a moz-do-not-send="true" href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a>
Official FreeSWITCH Sites
<a moz-do-not-send="true" href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a>
<a moz-do-not-send="true" href="http://confluence.freeswitch.org" target="_blank">http://confluence.freeswitch.org</a>
<a moz-do-not-send="true" href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server
<a moz-do-not-send="true" href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a>
FreeSWITCH-users mailing list
<a moz-do-not-send="true" href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a>
<a moz-do-not-send="true" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a moz-do-not-send="true" href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a moz-do-not-send="true" href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a></pre>
</blockquote>
<br>
</div>
</div>
</div>
<br>
_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a moz-do-not-send="true"
href="mailto:consulting@freeswitch.org"
target="_blank">consulting@freeswitch.org</a><br>
<a moz-do-not-send="true"
href="http://www.freeswitchsolutions.com"
target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a moz-do-not-send="true"
href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a moz-do-not-send="true"
href="http://confluence.freeswitch.org"
target="_blank">http://confluence.freeswitch.org</a><br>
<a moz-do-not-send="true"
href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel
Communication Server<br>
<a moz-do-not-send="true"
href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a moz-do-not-send="true"
href="mailto:FreeSWITCH-users@lists.freeswitch.org"
target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a moz-do-not-send="true"
href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users"
target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a moz-do-not-send="true"
href="http://lists.freeswitch.org/mailman/options/freeswitch-users"
target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a moz-do-not-send="true"
href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
<a class="moz-txt-link-abbreviated" href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a>
Official FreeSWITCH Sites
<a class="moz-txt-link-freetext" href="http://www.freeswitch.org">http://www.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://confluence.freeswitch.org">http://confluence.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://www.cluecon.com">http://www.cluecon.com</a>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server
<a class="moz-txt-link-freetext" href="http://www.cudatel.com">http://www.cudatel.com</a>
FreeSWITCH-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a class="moz-txt-link-freetext" href="http://www.freeswitch.org">http://www.freeswitch.org</a></pre>
</blockquote>
<br>
</body>
</html>