Thursday, July 1, 2010

Some notes on FreeSWITCH and Radius Integration



There are some decent modules out there that help us in tying up FreeSWITCH with Radius namely mod_rad_auth and mod_radius_cdr. However, they are pretty much limited and lack some of main features like dynamic routing that some radius servers can provide. Integrating FreeSWITCH with such radius server which can do routing and billing logic will allow us to deploy FreeSWITCH on a large scale, ideal for whole sale carriers kind of thing.


This integration will give us the luxury of not having to configure any endpoint details that FreeSWITCH has to send calls to. We will have one centralized billing server which talks radius protocol. And NAS (name is debatable ) talking to many FreeSWITCH instances. The following image makes it clear.


Now the challenge is to implement NAS that does the conversion of radius protocol to a language that FreeSWITCH understands. Luckily FreeSWITCH comes with numerous features and tools that offer hooks into every place of FreeSWTICH. I've implemented this NAS in python using Twisted's higly scalable network architecture. The major pain is understanding the cisco's radius dictionary attributes and how exactly they map to the FreeSWITCH variables. I've implemented all the important features of what VoIP radius protocol has to offer.

  • Endpioint Authorization (Digest and IP)
  • Route Autthorization (for Dynamic routing, limit call duration based on balance amount)
  • Accouting Requests (Radius CDR for billing )

Tuesday, April 20, 2010

Threads in Python GUIs


One easy way to crash GUIs built in python is to call any method that updates GUI ( causes to re-draw GUI ) from a thread other than the main thread! Most often people use threads to run long running tasks in background to keep the GUIs responsive how ever, ignorance of such a limitation like not call GUI update methods from threads other than main thread will sure leave people scratching their head. In my experience this happens at least in Tkinter and wxPython.

As a workaround wxPython provides wx.CallAfter method which can be used to invoke GUI update related methods from non main threads. However people also can device their own ways like creating custom events and binding them to a listener which gets fired from main thread.

There is no such method for Tkinter, one easy way is to use python standard library Queue module. Queue module is thread safe. To update GUI from non main thread, put messages,flags, any thing you like in Queue (you can place any data type in Queue) and have watch dog timer checking for contents of this Queue, if it finds any contents take action to update accordingly.

Note:main thread is the place where you call the main loop method of GUI framework

Thursday, April 8, 2010

Web woke up on StreamHarvester !

Recently I've seen a sudden increase in my site's traffic. Reason for this is after many months that I've published StreamHarvester-0.1 on Google Code web has started picking it up. StreamHarvester was reviewed on couple of websites. I am giving the links of the the sites that I was I able to find.


  • Ghacks
  • SoftPedia
  • And scores of other sites that follow the above mentioned websites.
Any way I am happy to see that people are trying it out. This is motivates me to work on it again and improve it more & more.

If you have specific feature request, feel free to drop a mail to me.

Wednesday, November 25, 2009

StreamHarvester-0.1

I've been working on StreamHarvester for the past one week. Last night I've created and made Streamharvester-0.1 available for windows. It is currently hosted google code.

http://code.google.com/p/streamharvester/

StreamHarvester is a cross-platform internet radio and TV recoder.StreamHarverster works with Shoutcast and Icecast streams. You can record multiple streams simultaneously, also you can relay a stream locally while recording it. So that you can listen to the stream in an external media player like VLC , Windows media player.

It can handle various media format and playlist formats.

Supported Media formats

  1. mp3
  2. ogg
  3. nsv
Supported Playlist formats

  1. pls
  2. m3u
which means while adding a job you can paste playlist URLs directly into the program. And it will automatically retrieve media from URLs available in playlist. Also StreamHarvester will automatically fallback to next available URL in a playlist in case of any URL fails.

Visit project page to know more about it and to freely download and try it.

Friday, October 10, 2008

starpy-1.0.0a13 Released (Asterisk protocols for twisted)

Today I did a new release of starpy. (Asteirsk protocols for Twisted ) which can be downloaded from here https://sourceforge.net/project/showfiles.php?group_id=164040

This release contains addition of many manager commands to manager API. Following is a list of newly added commands.

  1. agentLogoff
  2. dbGet
  3. dbPut
  4. extensionState
  5. getConfig
  6. meetmeMute
  7. meetmeUnmute
  8. park
  9. pauseMonitor
  10. playDTMF
  11. queuePause
  12. sipShowPeers
  13. unpauseMonitor
  14. updateConfig (read AMI documentation before using this )
  15. userEvent
  16. waitEvent
  17. zapDNDoff
  18. zapDNDon
  19. zapDialOffhook
  20. zapHangup
  21. zapRestart
  22. zapShowChannels
  23. zapTransfer
Those are all the new manager Actions that were added. Queues action is there but it won't work cause AMI returns improperly formatted lines, same case with IAXPeers action, as AgentCallbackLogin is deprecated and is not functioning properly it was not included.

Bug fix in queueStatus manager api, in collectDeferred argument 'QueueStatusEnd' is changed to 'QueueStatusComplete'. Now the deferred fires properly.

Bug fix in fastagi playback (not a standard AGI command, was created by Mike as a workaround for buggy streamFile command back in Asterisk 1.2 days. Now streamFile is working properly so you might not be using this playback ).

Those are all the changes that involved in this release if you find any bugs or hope for any features let me know.

Have fun with starpy.

Saturday, May 24, 2008

Zaptel to DHADI

Due to trademark issues with the name Zaptel digium has announced change in the name,DHADI (Digium Asterisk Hardware Device Interface ) name sounds funny while trying to be serious

http://blogs.digium.com/2008/05/19/zaptel-project-being-renamed-to-dahdi/

Thursday, January 3, 2008

RoR - Rants on Rails

Today there was a long long rant on rails & its community that got slashdotted. He got strong feelings against rails community and says when he hangs around with Django or other python related stuff people are nice to him!

At least in my experience python and python related frameworks communities is been so nice.

Here is the full rant

http://www.zedshaw.com/rants/rails_is_a_ghetto.html

And this is how I got the news from #twisted

(10:36:30 IST) Jerub: you know that rant about RoR that got on slashdot today?
(10:36:35 IST) Jerub: the dude is in #python
(10:37:21 IST) glyph: Jerub: Ask him if now that he's f***ed in the Ruby community he wants to maintain a Python webserver.
(10:38:08 IST) Jerub: ask him yourself, slacker.
(10:40:15 IST) dash: Jerub: yeah. I just got to that part :)
(10:41:50 IST) glyph: Jerub: hey, you're my *connection* man; I don't know nothin about no #python no more
(10:44:03 IST) jml: MFen: is that like DM of the Rings?
(10:46:50 IST) jml: MFen: DM of the Rings is better
(10:48:36 IST) MFen: i haven't seen DM of the rings, that sounds good
(10:52:20 IST) MFen: Jerub: and asking about Django
(10:52:22 IST) Jerub: glyph: which web server did you mean?
(10:52:32 IST) Jerub: web, web2, or some divmod thing?
(10:52:33 IST) MFen: just don't tell him about twisted, please
(10:52:55 IST) Jerub: dm of the rings is complete, which is nice.
(10:52:58 IST) glyph: Jerub: all of the above
(10:53:41 IST) glyph: Jerub: the problem being that "all of the above" is the answer, I need someone to make 2 of those options go away :)
(10:54:26 IST) MFen: glyph: and some collateral damage to take out 6 or 7 other python web frameworks would be nice
(10:54:36 IST) glyph: MFen: hehe

Atleast people are not flaming each other here.