Monthly Archives: April 2017

FreeSWITCH status on LED display using socket connection

It is a simple experiment to show  FreeSWITCH  status on LED display using socket connection. Here is Video :

What You Need

1.Raspberry pi-3

2.MAX-7219 based 8×8 LED Matrix Displays(4.No’s or more).

Those available in kit form and assembled form. And we can purchase through on- line marketing like Amazon etc.

In my case 4 modules are powered from GPIO pins of Raspberry . It is good to use separate power for modules for more than 2 modules.

3.Female to Female connector wires

to connect GPIO pins and MAX7219 LED modules.

Next What to do(installing FreeSWITCH)

1.Prepare SD card and load Raspbian and install FreeSWITCH.  For details

2.Install Display drivers for MAX7219. 

git clone
sudo python max7219/ install

3.Do wiring.

(as given below) between GPIO of Raspberry pi and MAX 7219 matrix LED displays.

Pin        Name       Remarks            RPi Pin          RPi Function

1            Vcc          +5V Power              2                        5V0

2            Gnd           Ground                  6                        Gnd

3            DIN            Data In                 19                GPIO 10 (MOSI)

4             CS          Chip Select              24                 GPIO  8 (SPI CS0)

5            CLK           Clock                      23                GPIO 11 (SPI CLK)

4.Run demo program.

Edit according to no. of matrix devices used  i.e cascaded= n, in my case n=4.

device = max7219(serial, cascaded=4 or 1, block_orientation=block_orientation).

sudo python max7219/examples/

At Last

Use ESL connection between FreeSWITCH and Max7219demo program. For details

Here is my source file.

#!/usr/bin/env python

import string
import sys
import re
import time
import argparse

from optparse import OptionParser
from ESL import *
from luma.led_matrix.device import max7219
from luma.core.serial import spi, noop
from luma.core.render import canvas
from luma.core.virtual import viewport
from luma.core.legacy import text, show_message
from luma.core.legacy.font import proportional, CP437_FONT, TINY_FONT, SINCLAIR_FONT, LCD_FONT

def main(argv):


                parser = OptionParser()
                parser.add_option("-a", "--auth", dest="auth", default="ClueCon",
                                                                help="ESL password")
                parser.add_option("-s", "--server", dest="server", default="",
                                                                help="FreeSWITCH server IP address")
                parser.add_option("-p", "--port", dest="port", default="8021",
                                                                help="FreeSWITCH server event socket port")
                parser.add_option("-c", "--command", dest="command", default="status",
                                                                help="command to run, surround mutli word commands in \"\'s")

                (options, args) = parser.parse_args()

                con = ESLconnection(options.server, options.port, options.auth)
        #are we connected?

                if con.connected():
                        #run command

                        e = con.api(options.command)
                        print e.getBody()
                        global data
                        data = e.getBody()

                        print "Not Connected"


                print parser.get_usage()

def demo(n, block_orientation):
    # create matrix device
    serial = spi(port=0, device=0, gpio=noop())
    device = max7219(serial, cascaded=n or 1, block_orientation=block_orientation)
    print("Created device")

    # start demo
    msg = data
    show_message(device, msg, fill="white", font=proportional(CP437_FONT))

while 1:
        if __name__ == "__main__":

        if __name__ == "__main__":
            parser = argparse.ArgumentParser(description='matrix_demo arguments',

            parser.add_argument('--cascaded', '-n', type=int, default=4, help='Number of cascaded MAX7219 LED matrices')
            parser.add_argument('--block-orientation', type=int, default=0, choices=[0, 90, -90], help='Corrects block orientation when wired vertically')

            args = parser.parse_args()

                demo(args.cascaded, args.block_orientation)
            except KeyboardInterrupt: