<div dir="ltr">AGAIN, JIRA... Now for the 2nd time today there is a fix with no jira to reference.<div><br></div><div>See <a href="https://jira.freeswitch.org/browse/FS-5832">https://jira.freeswitch.org/browse/FS-5832</a></div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Apr 5, 2014 at 10:00 AM, <span dir="ltr"><<a href="mailto:bruce@sqls.net" target="_blank">bruce@sqls.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div>Well, Brian, you may be right.</div>
<div> </div>
<div>I was trying to figure out how it worked and figured it probably stored the values in the FS database. So I opened that up and saw the tables and noticed both the complete and aliases database has a "sticky" integer field. So I tried the stickyadd sub-command for complete in fs_cli and it worked and created a record in the complete table with the sticky field set to 1. Great. Then I shut down FS and all the values (even those with sticky = 0) were still in the table. Then I started FS and everything was wiped out. I compared this to the aliases table where only the sticky=0 records got wiped out.</div>
<div> </div>
<div>So, I'm a bit hazy on C but I tried to hunt down how it works.. It looks like in mod_commands.c the complete and alias commands get registered as console command and that points back to the function switch_console_set_complete/alias in switch_console.c. In that function the code for "stickyadd" is already there for complete. </div>
<div> </div>
<div>So, the final culprit seems to be switch_core_sqldb.c where it clears/rebuilds the db when FS is started. There's a line in there for the alias table to delete all non-sticky records but the complete table seems to be totally different. There's a section around line 3484 that makes an array of complete, interfaces, and NULL then walks that array and deletes everything in the tables. I think the NULL just causes the for loop to exit out. So, all that code is just for two tables it seems. </div>
<div> </div>
<div>So, I don't know if there's a reason for that block of code at all. I would think the safest is to just remove complete from the array and replicate a similar line below like the alias table has. But I'm more curious if just taking that whole block out and then creating a line for complete and interfaces below would be even better and more consistent with everything else. Or at the least, remove all the array/loop business since it's a lot of code to loop over 1 item (once complete is removed) :)</div>
<div> </div>
<div>So, on the safe side, from a fresh git clone here's me learning C Brian. Of course I don't really know if any of this is right and I just starting using freeswitch last week and I haven't actually ran freeswitch with this code... So, well.. try at your own risk I guess, but it looks pretty straight forward to me.</div>
<div> </div>
<div> </div>
<div>diff -u orig-switch_core_sqldb.c switch_core_sqldb.c</div>
<div><br>--- orig-switch_core_sqldb.c 2014-04-05 08:38:09.547441223 -0500<br>+++ switch_core_sqldb.c 2014-04-05 09:45:58.916440649 -0500<br>@@ -3483,7 +3483,7 @@</div>
<div> </div>
<div> if (switch_test_flag((&runtime), SCF_CLEAR_SQL)) {<br> char sql[512] = "";<br>- char *tables[] = { "complete", "interfaces", NULL };<br>+ char *tables[] = { "interfaces", NULL };<br>
int i;<br> const char *hostname = switch_core_get_hostname();</div>
<div> </div>
<div>@@ -3494,6 +3494,7 @@<br> }</div>
<div> </div>
<div> switch_cache_db_execute_sql(sql_manager.dbh, "delete from aliases where sticky=0", NULL);<br>+ switch_cache_db_execute_sql(sql_manager.dbh, "delete from complete where sticky=0", NULL);<br>
switch_cache_db_execute_sql(sql_manager.dbh, "delete from nat where sticky=0", NULL);<br> switch_cache_db_execute_sql(sql_manager.dbh, "create index alias1 on aliases (alias)", NULL);<br>
switch_cache_db_execute_sql(sql_manager.dbh, "create index tasks1 on tasks (hostname,task_id)", NULL);<br></div>
<div> </div>
<div> </div>
<div> </div>
<div><span>Though, again.. I would question the need for that whole block at the top. </span></div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div>------ Original Message ------</div>
<div>From: "Brian West" <<a href="mailto:brian@freeswitch.org" target="_blank">brian@freeswitch.org</a>></div>
<div>To: "FreeSWITCH Users Help" <<a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a>></div>
<div>Sent: 4/4/2014 9:03:08 AM</div>
<div>Subject: Re: [Freeswitch-users] Configure aliases and auto-complete on start up.</div>
<div> </div>
<div>
<blockquote cite="http://CBFEFE37-6378-4435-8578-19FEE338EEB2@freeswitch.org" type="cite"><tt style="WORD-WRAP:break-word">
<div>This is a perfect project for someone to learn a little C on, We all have to start somewhere. :P </div>
<div>-- </div>
<div>Brian West </div>
<div><a href="mailto:brian@freeswitch.org" target="_blank">brian@freeswitch.org</a> </div>
<div>FreeSWITCH Solutions, LLC </div>
<div>PO BOX 2531 </div>
<div>Brookfield, WI 53008-2531 </div>
<div>Twitter: @FreeSWITCH , @briankwest </div>
<div><a href="http://www.freeswitchbook.com/" target="_blank">http://www.freeswitchbook.com</a> </div>
<div><a href="http://www.freeswitchcookbook.com/" target="_blank">http://www.freeswitchcookbook.com</a> </div>
<div> </div>
<div>T: <a href="tel:%2B1.918.420.9001" value="+19184209001" target="_blank">+1.918.420.9001</a> | F: <a href="tel:%2B1.918.420.9002" value="+19184209002" target="_blank">+1.918.420.9002</a> | M: +1.918.424.WEST </div>
<div>iNUM: <a href="tel:%2B883%205100%201420%209001" value="+883510014209001" target="_blank">+883 5100 1420 9001</a> </div>
<div>ISN: 410*543 </div>
<div>Skype:briankwest </div>
<div>PGP Key: <a href="http://www.bkw.org/key.txt" target="_blank">http://www.bkw.org/key.txt</a> (AB93356707C76CED) </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div>On Apr 3, 2014, at 2:18 PM, <a href="mailto:bruce@sqls.net" target="_blank">bruce@sqls.net</a> wrote: </div>
<div> </div>
<blockquote type="cite">
<div> </div>
<div> Thank you very much Steven! I hadn't seen any message you sent previously! That's perfect and will work great. </div>
<div> </div>
<div> Thanks everybody for all the hand holding :) </div>
<div> </div>
<div> ------ Original Message ------ </div>
<div> From: "Steven Ayre" <<a href="mailto:steveayre@gmail.com" target="_blank">steveayre@gmail.com</a>> </div>
<div> To: <a href="mailto:bruce@sqls.net" target="_blank">bruce@sqls.net</a> </div>
<div> Cc: "FreeSWITCH Users Help" <<a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a>> </div>
<div> Sent: 4/3/2014 1:52:37 PM </div>
<div> Subject: Re: Re[2]: [Freeswitch-users] Configure aliases and auto-complete on start up. </div>
<div> </div>
<blockquote type="cite">
<div> I sent a mail with that - in case you didn't see it: </div>
<div> </div>
<div> <a href="https://wiki.freeswitch.org/wiki/Mod_lua#Lua_scripts_at_startup" target="_blank">https://wiki.freeswitch.org/wiki/Mod_lua#Lua_scripts_at_startup</a> </div>
<div> <a href="https://wiki.freeswitch.org/wiki/Mod_lua#Make_API_calls_directly_from_Lua_code" target="_blank">https://wiki.freeswitch.org/wiki/Mod_lua#Make_API_calls_directly_from_Lua_code</a> </div>
<div> </div>
<div> Check the first link. </div>
<div> </div>
<div> </div></blockquote></blockquote>
<div> </div></tt></blockquote></div></div><br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Anthony Minessale II ♬ @anthmfs ♬ @FreeSWITCH ♬<div><br><div>☞ <a href="http://freeswitch.org/" target="_blank">http://freeswitch.org/</a> ☞ <a href="http://cluecon.com/" target="_blank">http://cluecon.com/</a> ☞ <a href="http://twitter.com/FreeSWITCH" target="_blank">http://twitter.com/FreeSWITCH</a></div>
<div><div>☞ <a href="http://irc.freenode.net" target="_blank">irc.freenode.net</a> #freeswitch ☞ <u><a href="http://freeswitch.org/g+" target="_blank">http://freeswitch.org/g+</a></u><br><br></div><div>ClueCon Weekly Development Call <br>
</div><div>☎ <a href="mailto:sip%3A888@conference.freeswitch.org" target="_blank">sip:888@conference.freeswitch.org</a> ☎ +19193869900 </div><div><br></div></div></div></div>
</div>