summary
Freeswitch Is a very easy to use open source VOIP Softswitch platform .
I've been right recently fs Do some functional tests , A requirement generated during testing , How to go from fs Initiate a call and transfer the subsequent call flow to a dialplan On , This will be very convenient and easy to use when testing , It can be modified at any time dialplan Customize business processes .
Through to fs After official document search , Exclude “transfer”、“execute_extension”、“bind_meta_app”, By chance “originate” Interfaces can directly implement such functional requirements .
Environmental Science
centos:CentOS release 7.0 (Final) Or above
freeswitch:v1.8.7
GCC:4.8.5
originate
originate It's a API Interface , The interface format is as follows .
originate <call url> <exten>|&<application_name>(<app_args>) [<dialplan>] [<context>] [<cid_name>] [<cid_num>] [<timeout_sec>]
Interface instance .
originate {origination_caller_id_number=9005551212}sofia/default/[email protected] &bridge({origination_caller_id_number=8001234567}sofia/profile/[email protected])
From the interface format ,originate The interface can use “&” Pick up a APP Interface , Continue the process after the call is connected , But sometimes one APP It's not enough , So we need to be in “originate” Then transfer the call flow to dialplan Continue to deal with .
turn dialplan Interface instance of .
originate {origination_caller_id_number=9005551212}sofia/default/[email protected] 19005551212 XML default CALLER_ID_NAME CALLER_ID_NUMBER
In this case , Use originate The interface initiates a call , Then go to XML Type of dial plan “default” in .
To configure
Modify the configuration file “/usr/local/freeswitch/conf/dialplan/test.xml”.
<include>
<context name="ext_test">
<extension name="test" continue="false">
<condition field="destination_number" expression="^(\d+)$">
<action application="sched_hangup" data="+10"/>
<action application="send_dtmf" data="1234"/>
<action application="sleep" data="5000"/>
<action application="endless_playback" data="/usr/local/freeswitch/sounds/101-baidu-mp3.mp3"/>
</condition>
</extension>
</context>
</include>
test
stay freeswitch Use in command line originate Make a call , Then go to the dial plan ext_test send out DTMF.
[email protected]> originate {originator_codec=PCMA,origination_caller_id_number=0755110}sofia/external/sip:[email protected]:5080 1001 XML ext_test
fs call 138 On the server 1001, After the call is connected , send out DTMF And play the prompt voice , The log is as follows .
[email protected]> originate {originator_codec=PCMA,origination_caller_id_number=0755110}sofia/external/sip:[email protected]:5080 1001 XML ext_test
...
2022-06-13 11:37:15.601015 [DEBUG] sofia.c:7084 Channel sofia/external/[email protected]:5080 entering state [ready][200]
...
2022-06-13 11:37:15.610983 [INFO] mod_dialplan_xml.c:637 Processing <0755110>->1001 in context ext_test
Dialplan: sofia/external/[email protected]:5080 parsing [ext_test->test] continue=false
Dialplan: sofia/external/[email protected]:5080 Regex (PASS) [test] destination_number(1001) =~ /^(\d+)$/ break=on-false
Dialplan: sofia/external/[email protected]:5080 Action sched_hangup(+10)
Dialplan: sofia/external/[email protected]:5080 Action send_dtmf(1234)
Dialplan: sofia/external/[email protected]:5080 Action sleep(5000)
Dialplan: sofia/external/[email protected]:5080 Action endless_playback(/usr/local/freeswitch/sounds/101-baidu-mp3.mp3)
...
EXECUTE sofia/external/[email protected]:5080 sched_hangup(+10)
EXECUTE sofia/external/[email protected]:5080 send_dtmf(1234)
2022-06-13 11:37:15.610983 [DEBUG] switch_core_io.c:1918 sofia/external/[email protected]:5080 send dtmf digit=1 ms=250 samples=2000
...
EXECUTE sofia/external/[email protected]:5080 sleep(5000)
...
EXECUTE sofia/external/[email protected]:5080 endless_playback(/usr/local/freeswitch/sounds/101-baidu-mp3.mp3)
...
2022-06-13 11:37:25.121013 [DEBUG] switch_ivr_play_say.c:1942 done playing file /usr/local/freeswitch/sounds/101-baidu-mp3.mp3
...
2022-06-13 11:37:25.121013 [DEBUG] mod_sofia.c:440 Channel sofia/external/[email protected]:5080 hanging up, cause: ALLOTTED_TIMEOUT
summary
Use originate Interface , Call forwarding can be realized directly dialplan Business process .
Think about it , adopt bridge Transfer to a dailplan It should also have the feasibility of implementation . The specific situation has not been thoroughly understood .
Empty as usual
Be serious
Freeswitch Use originate turn dialplan More articles about
- FreeSWITCH Learning notes
[1]FreeSWITCH Learning notes 1.Windows Installation package download address :http://files.freeswitch.org/windows/installer/ 2. Source code download address :http://fi ...
- Know the dial plan -dialplan
The dial plan is FreeSWITCH A vital part of . Its main function is to route the telephone ( At this point , It is equivalent to a routing table ). Be concise , When a user dials , Analyze the number dialed by the user , And then decide what to do next ...
- fs event_socket
mod_event_socket Skip to end of metadata Created by John Boteler, last modified by Niek Vlesse ...
- FreeSWITCH Internal dialing Always used dialplan/public Dial plan , And yes dialplan/default turn a blind eye to
FreeSWITCH Internal dialing Always used dialplan/public Dial plan , And yes dialplan/default turn a blind eye to Yesterday it was still Okay, well , today That's all. , Lead to The configuration is messy , To make the ...
- freeswitch dialplan Basics
freeswitch dialplan Basics One . Basic concepts dialplan Dial plan context Dial table ( block ) extension Dial to action ( Executed after dialing ) action condit ...
- Freeswitch sound recording Dialplan
<extension name="record"> <condition field="destination_number" express ...
- freeswitch Module event_socket
This is what I sorted out before about freeswitch mod_event_socket Related content of , Record here , It's also convenient for me to check later . mod_event_socket With socket In the form of , Provide external control FS One way , ...
- FreeSWITCH 1.2.5.3 Step by Step Install
Ubuntu: apt-get -y install build-essential automake autoconf git-core wget libtool apt-get -y instal ...
- FreeSwitch Detailed introduction to terminal commands
FreeSwitch edition :1.6.9 The following are some terminal commands alias grammar : alias [add|stickyadd] <alias> <command> | del [&l ...
- Freeswitch introduction
Let's start with the initial run , Step by step into FreeSWITCH The mysterious world of . Command line arguments Generally speaking ,FreeSWITCH You don't need any command line arguments to start , But in some cases , You need to start with some special parameters . Here it is , ...
Random recommendation
- waf2 Control name
1, Query form (queryGrid), Edit the form (editGrid) wafGrid 2, Fast F7 wafPromptQuick 3, form F7 wafPromptGrid 4, Customize F7 wafPromp ...
- About Python Iterator A bit of thinking about the agreement
turn :http://www.jianshu.com/p/dcf83643deeb Python There are several container or sequence types in :list tuple dict set str, For content in these types , Often need to ...
- Amarino The problem that routines cannot be used
Serial.begin(9600); Instead of using it 57600
- jQuery Flexible sliding navigation menu implementation ideas and code
<!DOCTYPE HTML> <html> <head> <meta charset="UTF-8" /> <meta na ...
- Python2.7 Chinese character encoding & Pycharm utf-8 Set up 、Unicode And utf-8 The difference between
Python2.7 Chinese character encoding & Pycharm utf-8 Set up .Unicode And utf-8 The difference between [email protected] http://www.cnblogs.com/sw ...
- precmd:6: job table full or recursion limit exceeded
Use GDC Data Transfer Tool download 10999 individual isoforms.quantification.txt When you file , Yes shell The little script of the loop : cat all_id_file |while ...
- jQuery Generate qr code jquery.qrcode.js
https://github.com/jeromeetienne/jquery-qrcode 1. take jquery.qrcode.min.js and jquery Add to your web page <script src ...
- Python Crawler settings Headers
Python Set up Headers import urllib import urllib2 url = 'http://www.server.com/login' user_agent = 'Mozil ...
- Ubuntu Add below OpenERP command Quick way to start
edit home In the catalog .bashrc file alias xjerp="~/odoo/xj/openerp-server -r openerp --addons-path='~/odoo/xj/o ...
- System programming .py( Multi process and multi thread dry goods )
1. Concurrency and parallelism * Multiple tasks rotate in CPU Running up is called concurrency * Multiple tasks in multiple CPU Run up , There's no alternate execution * The state is called parallel . It's usually concurrent , Even if it's multi-core .* The scheduling algorithm of the operating system is used to control who is executed first and who is executed later . At present ...