XML it's not all bad.

Submitted by anthm on Fri, 05/30/2008 - 07:13.
::

I just wanted to take the time to defend our use of XML if I can. =D

Originally, FreeSWITCH used the same .ini format that Asterisk uses in all of it's config. Actually the interface to parse .ini still exists and a module writer is able to use it if he pleases. The reasoning for XMLizing what we chose to XMLize becomes more clear when you begin to scale the system. FreeSWITCH parses it's XML registry when it first starts and keeps it in memory. This is one big entity that can be navigated similar to a file system. There are top level major sections: configuration, dialplan, directory and phrases. All of the bits and pieces of these sections are exploded out onto the disk in the default arrangement so you can edit the portion of the document you need and it also allows you to insert small XML representations of a single entity such as a SIP UA, a user on the system, the configuration for what modules you want to load. All of these files will be concatenated in the end into 1 big XML document that the entire core and its modules can access with a common API that gives you the entities as a tangible object that can be extended without more code.

Now for the interesting part. It's possible to bind callback functions to certain sections of the XML registry so that when code tries to access a particular section your handler can conjure the XML on-demand any way it wants and deliver it back in place of whatever is in the default document. For instance, you can bind your dialplan and user directory sections to mod_xml_curl, A callback that translates XML lookups to and from a nearby HTTP server. When the call hits the XML dialplan the cURL handler kicks in and posts a request to a custom CGI. The CGI gets post data that is identical to a web form being posted with a few dozen facts about the channel that you can use to determine where the call was intended to go and who's calling etc. The CGI then creates a small snippet of XML that will satisfy the request and returns it to FreeSWITCH who will parse it as if it was part of the static config. The same can be done when someone registers to SIP or tries to check their voicemail or when the config is called up during load.

Trust me. I am far from XML's biggest fan, but I do feel it's actual uses are lost in a sea of contrived forced solutions that give it a bad name. To serialize complex objects to and from a text format and to make markup that is easily parsed and generated are the real strengths of XML. The best used XML is XML nobody ever realizes is even there. Certainly that is not true completely with FreeSWITCH today but as we scale and more GUI's and config apps are made, the curve will be in our favor and most people besides only the truly advanced users will ever have to see the XML again.

Caveat: We do have mod_dialplan_asterisk in tree that will allow your dialplan to look and feel more like the asterisk extensions.conf (using .ini) for a sort of cross-over feel.

Submitted by bigpanda on Wed, 08/06/2008 - 23:15.

I prefer XML anyway, it looks much cleaner IMO.

Submitted by diego.viola on Mon, 06/30/2008 - 18:43.

There is YAML support on FreeSWITCH now trough mod_yaml.

So for those who prefer a more simple way of writing dialplans, you can write it in a more friendly way now, like this:

In XML:

Anthony
Mike
Brian

In YAML:

AmazingTeam:
project : FreeSwitch
projectowner: Anthony
projectlead: Mike
qa: Brian

Read more about YAML here: http://en.wikipedia.org/wiki/YAML

Keep up the great work!

Submitted by diego.viola on Thu, 06/26/2008 - 19:35.

Anthony: I really love your project... I love the design you took with FS, I love the stability, the openness of it, it's the VoIP platform I always dreamed of it, FreeSWITCH is what Asterisk should have been.

But I just don't like one thing: XML.

Sadly... XML is the only reason I still stay with Asterisk, I just can't like XML, and I don't like Asterisk as well... I want FreeSWITCH stability, features, etc, but I can't like XML, not even if I try to, it's too verbose and complex.

In the other hand, parameter=value is simple, I like simplicity but without sacrificing functionality, I'm a Linux/UNIX guy and I don't want a GUI either, I love CLI, but I want something simple I can remember in the top of my head... and something simple to read/write, plain text files allows me to do this... and it's the way I like to do things.

I would like to have more than one option to configure FreeSWITCH, not everyone likes to do the same thing the same way and it would be cool if FS gives this freedom to people...

I would really like to see YAML as a configuration option in FreeSWITCH, give me this any day and I swear I don't toch Asterisk _ever again_, YAML can be used for data serialization and it's more simple than XML, Ruby projects like Rails uses it.

Take a look here:

http://yaml.org/
http://yaml.org/spec/1.2/

I'd love if someone does mod_yaml as an alternative of XML, I know the benefits of XML and I like that, this is why I don't use mod_dialplan_asterisk either, XML is too verbose but I realize it's advantages, this is why I would like YAML.

YAML gives you the advantages of XML and at the same time it gives you simplicity... which is what I would like to have in FreeSWITCH, please consider it.

I'm also willing to pay for a mod_yaml, other than this I really love FreeSWITCH and I think it's great, I will love and switch in a heartbeat if you guys add YAML support ;-)

Submitted by garakelian on Sat, 06/07/2008 - 11:16.

Your decision to use XML was completely appropriate, and makes managing the dialplan a joy by comparison to Asterisk. I wish more *nix applications did the same thing.

I don't mind the simple "parameter=value" configuration file approach for some applications, but for complex apps where the configuration is hierarchical (i.e. mail servers, spam configuration, software PBXs), XML is godsend as far as I'm concerned.

Postfix and Amavis, for example, are a real pain in rear-end to learn to configure because they rely on naming tricks to store hierarchial information. They also overwhelm beginners with configuration files where everything is commented out. Both of these issues are solved with XML and XML Schemas. XML allows you to naturally express a hierarchy of information, and XML Schemas define the hierarchy that is acceptable.

Greg

Submitted by diego.viola on Thu, 06/05/2008 - 09:37.

I really like FreeSWITCH and I think it's ahead of Asterisk in many areas.

I also like the better design that anthm made on FS.

I deployed a asterisk server a while ago, nothing big... just 40 users or something, with a few features, conferences, etc.

First it wasn't working correctly, but now in later versions, it appears that it's working... even though, FreeSWITCH has some features that I want and that Asterisk doesn't offer at this time: conferencing without zaptel, the ability to dial from conferences, etc.

I tried FS before but I went back to asterisk for the easy of configure of the system, it's all plain text, and I'm already used to it, XML may be better for some things and I think I should give it a try again with vim + syntax highlighting.

I also would like to make IVR's more easily... my language of choice is Ruby, but it would be nice if I can have more applications in XML and in other languages, like Ruby, etc.

I think FreeSWITCH is great and I will give it a try again soon, it feels a lot like the Apache of VoIP, I also like the design and PCRE, it's also very modular and the design is great.

Keep up the great work FreeSWITCH team.

Submitted by coppice on Wed, 06/04/2008 - 06:58.
Submitted by mcollins on Sun, 06/01/2008 - 23:53.

I'm sorry that you have to defend your use of XML - it seems silly to have to do so. Under the circumstances there just isn't a better choice. XML is human readable enough for competent IT guys to edit and is strict enough to allow for machine parsing (not to mention generation). Like you said, GUIs and front-end apps will eventually abstract away much of the XML in the near future, and having XML in the first place will allow those apps to be developed more quickly and effectively.

XML is by no means perfect, but it is more than adequate for the FS configs. Anyone who criticizes that choice needs to put his money where his mouth is and offer up a better solution. Ironic, since having the configs in XML actually would allow one to offer up a better solution in the form of a front-end (G)UI.

Keep up the good work, gentlemen.

-MC

P.S. - When editing XML you really should have an editor with syntax highlighting. Fortunately if you're on Linux you can just use vim. On Windows I prefer notepad2. I'm sure there are dozens of others to chose from.

Submitted by teleweb on Mon, 06/02/2008 - 19:19.

On Windows, you can just use Visual Studio, apart from syntax highlighting, you also have Intellisense!

I wonder what the motivation for this post was, maybe I have missed something, but the fact that Freeswitch uses XML is obviously a very good thing! I never understood why Asterisk couldn't use it, it's so much more useful and powerful for automation, integration and interoperability.
XML is the industry standard for data exchange and it was the only sensible choice in this day and age.