Scripting Control FreeSWITCH Summary using the Python language

Source: Internet
Author: User
Tags freeswitch

1, in the Linux environment has installed the FreeSWITCH, (not installed FreeSWITCH, please install the documentation)

2, enter the source code directory CD LIBS/ESL directory first install yum install Python-devel

L Install Python-devel First, execute yum install Python-devel

L Make Pymod

L Make Pymod-install

3, install the PIP tool to refer to a previous blog

4. Installing Swig tools, yum install Swig

5, after the installation of PIP, then installpython-ESL 执行  pip install python-ESL

Script:

Import ESL
Con = ESL. Eslconnection (' localhost ', ' 8021 ', ' Cluecon ')  #通过ESL与freeswitch建立连接
If con.connected:
Con.events (' plain ', ' channel_create channel_answer channel_progress channel_progress_media CHANNEL_HANGUP ')
While 1:
E = Con.recvevent ()
Event_Name = E.getheader ("Event-name")
If event_name in ["Channel_create"]:
unique_id = E.getheader ("Unique-id")
Caller = E.getheader ("Caller-caller-id-number") #主叫 get the value in the message field according to things
callee = E.getheader ("Caller-destination-number") #被叫
Con.execute ("Ring_ready", "", unique_id)
Elif (Event_Name in [' server_disconnected ']):
Break

There are a number of functions can refer to LIBS/ESL examples and source code

Scripting Control FreeSWITCH Summary using the Python language

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.