Freeswitch users directory using a database - freeswitch

I am quite new to freeswitch and want my directory currently hardcoded in XML config files on the server to be in a relational database. I found this tutorial:
https://saevolgo.blogspot.com/2012/07/freeswitch-with-sip-users-in-mysql-mod.html
But this seems very outdated as the GIT repository used does not exist anymore. Can anyone let me know the XML I have to fill so that it gets the users from database instead of other XML files? Per default it does this:
<users>
<X-PRE-PROCESS cmd="include" data="default/*.xml"/>
</users>
But I guess there is a similar configuration to get them from database? Thanks in advance

The FreeSWITCH Database Handler allows you to connect to databases from your Lua script:
https://freeswitch.org/confluence/display/FREESWITCH/Lua+FreeSWITCH+Dbh
Here is example for using Database handler with user directory
https://asterisk-pbx.ru/wiki/blog/freeswitch_directory_mysql_storage_with_lua_dbh

Although #os11k answered the question with good references I decided to go antoher way:
In /etc/freeswitch/autoload_configs/xml_curl.conf.xml I put
<configuration name="xml_curl.conf" description="cURL XML Gateway">
<bindings>
<binding name="directory">
<param name="method" value="GET" />
<param name="gateway-url" value="https://example.com/my-freeswitch-directory.xml" bindings="directory"/>
</binding>
<binding name="dialplan">
<param name="gateway-url" value="https://example.com/my-freeswitch-dialplan.xml" bindings="diaplan"/>
<param name="method" value="GET" />
</binding>
</bindings>
</configuration>
Then I am able to autogenerate the dialplan and directory on my webserver and don't need to connect to a central database with my freeswitch servers. Don't forget to activate the module xml_curl in /etc/freeswitch/autoload_configs/modules.xml

Related

Importing existing power desktop pbix file into workspace on Azure portal

I am getting an error when I try to follow the steps to run PowerBI using the sample solution located in PowerBI-CSharp, when importing the PBIX Desktop file into my workspace on Azure (which is the second step and 6 item in the console provisioning app )
Error message does not say anything helpful: "Ooops, something broke: A task was canceled."
I tried with different PBIX files and even different workspaces in different times, no luck yet.
Currently I am using visual studio 2015 64 bit (planning to try with VS 2013 in near future).
I also had same issue.
I solved it by performing following steps:
1) creating simple .pbix file using Power BI desktop.
2) Save it on your harddisk
3) then try to upload it using console provisioning app.
Hope this will help!!
I received similar kind of error with a message "file not found".
The issue occurs when we do not write ".pbix" extention with the file name.
For example:
if your power bi file has name "myproject" then while writing the file name in the "File name" option give name with extension as "myproject.pbix".
I faced the same issue some time ago. Multiple things were going wrong.
First, the PBIX file I attempted to upload resided on a remote Hard Drive linked in my LAN network. The 'Getting-started' app did not have permissions to read the file.
I fixed this by copying the PBIX file to my personal desktop.
Second, make sure to fill in the correct data required before-hand in the program. Edit the file power-bi-embedded-integrate-report-into-web-app/ProvisionSample/App.config to save your personal settings. This will give fast reproduction of running the code.
<!-- The Power BI API Endpoint -->
<add key="powerBiApiEndpoint" value="https://api.powerbi.com" />
<!-- The Azure Resource Manager API Endpoint-->
<add key="azureApiEndpoint" value="https://management.azure.com" />
<!-- Your Azure subscription ID -->
<add key="subscriptionId" value="" />
<!-- The Azure resource group name -->
<add key="resourceGroup" value="" />
<!-- The Power BI Workspace Collection Name -->
<add key="workspaceCollectionName" value="" />
<!-- The Power BI Workspace Collection Access Key -->
<add key="accessKey" value="" />
<!-- The Power BI Workspace-->
<add key="workspaceId" value="" />
<!-- Credentials to connect to datasource within Power BI -->
<add key="username" value="" />
<add key="password" value="" />
Note the last two values username and password are not required for uploading a PBIX file. All other values subscriptionId, resourceGroup, workspaceCollectionName, accessKey and workspaceId are a must. All this information can be found on the Azure cloud in the PowerBI workspace collection tile.
Third, make sure the workspaceId you are uploading to does not already contain a PBIX file. As far as I am concerned, it is not possible to replace a PBIX file on a workspace and therefore a new workspace must be created to upload the PBIX file to. Please correct me if I am wrong.

How to set Gmail gadget extractor to use multiple params name/value in COB extensions

Maybe a silly question but when you want to publish a gmail contextual gadget on google-app-market place, the COB extensions ask for one param name and value per extractor.
How can I specify two names and then two respective values ?
I'm not sure adding 2 extractors will do what I want...
I need one extractor with a filter on 2 params. It worked well for development with the manifest, but I don't know how to replicate my manifest on the form below:
My manifest part:
<Extension id="Extractor" type="contextExtractor">
<Name>My Name</Name>
<Url>google.com:HttpLinkExtractor</Url>
<Param name="host" value="example.com|www.example.com"/>
<Param name="path" value="^\/\w{16}$|^\/\w{16}\/"/>
<Triggers ref="Gadget"/>
<Scope ref="emailSubject"/>
<Scope ref="emailBody"/>
<Container name="mail"/>
</Extension>
thanks

web.debug.config Transform not working

I don't know what I'm doing wrong, but I almost feel I've tried everything. I can't seem to get the web.config of my project to transform with my web.debug.config changes. I read someplace that transformation only takes place when being published. Then I read that SlowCheetah could handle this, so I installed it into my project. It doesn't make any difference either.
Running VS 2012 Express. I debug using the IIS Express local server that was installed by VS. I run Firefox as my browser.
web.config:
<appSettings>
<add key="SiteUrl" value="http://development.mysite.com/" />
</appSettings>
web.debug.config:
<appSettings>
<add key="SiteUrl" value="http://localhost:4652/"
xdt:Transform="SetAttributes"
xdt:Locator="Match(key)" />
</appSettings>
I've also tried using Replace:
<appSettings>
<add key="SiteUrl" value="http://localhost:4652/"
xdt:Transform="Replace"
xdt:Locator="Match(key)" />
</appSettings>
When running in Debug configuration locally:
string siteurl = ConfigurationManager.AppSettings["SiteUrl"];
Still results in siteurl being http://development.mysite.com/
I've ran Preview Transform by right clicking on the web.debug.config and it shows the transform being made perfectly, but not when I run the web application locally.
Have to admit, I don't see how to configure SlowCheetah. I don't see any way to configure it and I've been thinking maybe it does "something" on its own. :S
Does anyone know how to overcome this or if I might be doing something wrong?
I'd suggest ignoring slow cheetah for the moment because I don't think you need it. I've used it for Windows Forms development, but haven't had a need for web development. Instead use the standard one click web deploy mechanism, and rethink how you use config transforms.
Basically, only utilize transforms when you are publishing, and put your local development settings in your main Web.config instead of a transform.
Then if you have a lab/test/sandbox environment you want to publish to create a solution and project configuration for that environment.
Next right click on the Web.config and click Add Config Transform to add a config transform for the solution configuration you just created.
Let's say you added a "Sandbox" solution configuration. If that's the case then a new file named Web.Sandbox.config will appear in Solution Explorer. Go ahead and update the values in Web.config and Web.Sandbox.config like so.
Web.config:
<appSettings>
<add key="SiteUrl" value="http://localhost:4652/" />
</appSettings>
Web.Sandbox.config:
<appSettings>
<add key="SiteUrl" value="http://sandbox.mysite.com/"
xdt:Transform="SetAttributes"
xdt:Locator="Match(key)" />
</appSettings>
Finally, you need to make a "sandbox.mysite.com" (or whatever your URL really is) publish profile and make sure that its Configuration is Sandbox so that the Web.Sandbox.config transform is used during publish.

Using the same DbCompiledModel to create contexts against different types of database servers is not supported

I am learning ASP.NET MVC from tutorials of Microsoft :
http://www.asp.net/mvc/tutorials/getting-started-with-aspnet-mvc3/cs/accessing-your-model's-https://stackoverflow.com/editing-helpdata-from-a-controller
At the link above mentioned, while adding a controller named "MoviesController" , i am getting this error
"Unable to retreive metadata for 'MvcMovie.Models.Movie'. Using the same DbCompiledModel to create contexts against different types of database servers is not supported. Instead, create a separate DbCompiledModel for each type of server being used"
How can i fix that?
I had the same issue.
I switched providerName="System.Data.SqlServerCe.4.0" with providerName="System.Data.SqlClient", and it created the Controller and Views.
I found this: http://msdn.microsoft.com/en-US/library/ms171861.aspx
I followed the directions and added a reference to SQL Server Compact, but it still doesn't work.
I also tried commenting out the default SQL Server Express connection, but it still gave the same error when trying to add the controller.
I'm just going to use SQL Server Express. I will let you know if I have any issues.
I've found that using the following works:
(Assuming that you've got SQL Server Express or higher installed)
<add name="MovieDBContext" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\v11.0;AttachDBFilename=|DataDirectory|MovieDB.sdf"/>
I think the reason of this error is because the VS is having some difficult to reuse your existing DBContext, while scaffolding. The VS try to use a property in DBContext with similar name of the Domain (like trying the Domain name concatenating "s"). If it cant find the property and your context already has a DBSet with you Domain class, it generates that error.
My solution was to create a new DBContext named "DeleteContext". After creating with success the controller and views, I have replaced the "DeleteContext" in my Controller to my existing one. Finally I deleted the "DeleteContext" class.
It works really fine.
That solution was not working for me, it blows on return View(db.Movies.ToList());
Instead use this :
<add name="MovieDBContext" connectionString="Data Source=|DataDirectory|Movie.sdf" providerName="System.Data.SqlServerCe.4.0"/>
and this:
public class MovieDBContext : DbContext
{
public MovieDBContext() : base("Movie") { }
public DbSet<Movie> Movies { get; set; }
}
I ran into the same error on another Microsoft ASP.NET MVC tutorial while using Visual Studio 2012 (http://www.asp.net/mvc/tutorials/mvc-music-store/mvc-music-store-part-5).
I decided that for the sake of completing the tutorial, it was easier to just use SQL Express in place of SQL CE.
What I did to resolve the issue was delete MvcMusicStore.sdf from Server Explorer, then deleted the same database file from App_Data in Solution Explorer.
I updated the connection strings section in the Web.config to use a Sql Express database (.mdf) in place of Sql CE (.sdf). For this particular tutorial, MusicStoreEntities is the name of the class that extends DbContext:
<connectionStrings>
<add name="MusicStoreEntities" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\MvcMusicStore.mdf;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
I built the solution, ran the site, and the database was regenerated for me. To add the database file back to the solution, click the "Show All Files" button in Solution Explorer, right-click the .mdf file in App_Data, and select "Include in Project."
Hi there's one solution that worked fine to me. In your Web.config, the tutorial told you to add the following line in the connectionStrings section:
<add name="SchoolContext" connectionString="Data Source=|DataDirectory|School.sdf" providerName="System.Data.SqlServerCe.4.0"/>
Do not delete it or change it!
When you're adding a new controller you can make this to avoid the error that is presenting:
Comment the line above.
Add the following line:
<'add name="SchoolContext" connectionString="Data Source=|DataDirectory|School.sdf" providerName="System.Data.SqlClient"/>
Save your solution
Add the controller
Before you run your app, uncomment the line you have commented (1), and comment the line you added (the one with the providerName="System.Data.SqlClient") (2).
This worked very fine to me, when adding the controllers.
Hope this could help you.
I just tryed a bit around and found the problem.
In the tutorial you are adding the following line in your web.config
<add name="MovieDBContext" connectionString="Data Source=|DataDirectory|Movies.sdf" providerName="System.Data.SqlServerCe.4.0"/>
It seems that there is a problem with it.. i just commented it out and used the SqlServer and it works for me. If you still want to use the SqlServerCe you need to take a look how to fix that problem.
If you're using VS 2012, you will need to also tell EF to use SQL Compact instead of localDb.
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework">
<parameters>
<parameter value="System.Data.SqlServerCe.4.0" />
</parameters>
</defaultConnectionFactory>
An easier way is to install the EF SQL Compact Nuget package.
For more details, check out this blog entry.
I ran into this same problem while working through the Contoso University asp.net MVC tutorial. It appears that the problem comes from mixing the SQL Server Compact connection strings with the Membership provider Sql Server connection.
I initially used hyperGeoMetric's fix, and that did work. Then I looked at the downloadable code's web.config and noticed some additional configuration.
If you add/replace the default parameter of entityFramework with this:
<parameters>
<parameter value="Data Source=(localdb)\v11.0; Integrated Security=True; MultipleActiveResultSets=True" />
</parameters>
add a system.data section like this:
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.4.0" />
<add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</DbProviderFactories>
</system.data>
and modify the existing (default) DefaultConnection to look like this:
<add name="DefaultConnection" providerName="System.Data.SqlServerCe.4.0" connectionString="Data Source=|DataDirectory|aspnet-membership.sdf" />
After these modification, I was able to continue the tutorial using the Sql Server Compact edition.
Sam
I followed that tutorial too, and got the same issue. I deleted the connection string, then I was able to add the controller, and it created the other files. Then I added the same connection string again to the Web.config file, inserted it ecxactly to the same place where it was before. It solved my problem.
I'm learning this tutorial:http://mvcmusicstore.codeplex.com/. and got the same error. I found a item name "EntityFramework.SqlServerCompact" in the NuGet packages list, and install it, all things go fine! note, the packages dependent entityframework, you can view all the version here:https://www.nuget.org/packages/EntityFramework.SqlServerCompact. GOOD LUCK!
the path of data source is wrong , you can add a "\" before "Movie.sdf".
like this:
<add name="MovieDBContext" connectionString="Data Source=|DataDirectory|\Movie.sdf" providerName="System.Data.SqlServerCe.4.0"/>
I ran into the same problem in another solution. It appeared just after I introduced a parametrized call to the base constructor, like the one included in the default UsersContext class.
This fails
public class MovieDBContext : DbContext
{
public MovieDBContext() : base("DefaultConnection")
{
}
...
}
This works
public class MovieDBContext : DbContext
{
// No constructor here
...
}
It seems that naming the connection string in the constructor creates the error. I only have one connection string in my web.config, so DefaultConnection is still used, although I don't name it explicitly.

Debugging in J2ME Polish

How to debug the J2ME Polish MIDlet?
How can I show the logs which are generated?
You can easly log statements with J2ME Polish using the following:
//#debug
System.out.println("Error...");
Using //#debug with J2ME Polish indicates a pre-processing directive to log the println statement.
There are various levels of logging, including debug, info, warn, error and fatal. You can define your own logging levels but I find that over exhaustive for most situtations.
The best thing I found was to add a handler to the build file within the debug section.
<handler name="http">
<parameter name="server" value="http://a.server.com:80/Debug/" />
</handler>
Will post any log information straight to a server, so you can literally see the log flow in as your application is running.
Or you can add a handler that logs to an RMS and use the J2ME Polish Logviewer sample application to view the logs stored within the RMS. The can be found in the sample directory of your J2ME Polish installation.
<handler name="rms">
<parameter name="useBackgroundThread" value="false" />
</handler>
Remember to set the varriables in the logview build file. See below:
<variables>
<variable name="polish.log.MIDletSuite" value="Demonstrator" />
<variable name="polish.log.Vendor" value="Enough Software" />
</variables>
I had a collegue at work try to debug via bluetooth but I think this doesn't actually work.
Just a note to any one reading this who is new J2ME, you cannot debug on device! MIDlets and J2ME were first concieved in the late 90's.

Resources