Freeswitch API调用方式

1.API调用方式

可以复制下面内容成.bat文件直接在windows下运行,修改成对应的ip加端口。

@echo off
SETLOCAL
:_starting
cls
set input=

echo  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@    
echo  @   1 add agent 21009      @@   11 uuid_check  21009   @@   21 list users          @@   31 check modules       @@   41 add agent 21010     @
echo  @   2 register DN1000      @@   12 show channels as xml@@   22 make a call         @@   32 sched_transfer      @@   42 register DN1003     @
echo  @   3 login agent 21009    @@   13 show channels as json@   23 fifo operation      @@   33 uuid_setvar         @@   43 login agent 21010   @
echo  @   4 queue_support monitor@@   14 uuid_kill           @@   24 show calls          @@   34 uuid_getvar         @@   44 other               @
echo  @   5 ready agent 21009    @@   15 notReady agent 21009@@   25 show outbounding    @@   35 answer a dn         @@   45 ready agent 21010   @
echo  @   6 logout agent 21009   @@   16 global_getvar       @@   26 myprofile           @@   36 21009LogoutFromTier @@   46 logout agent 21010  @
echo  @   7 tier support         @@   17 extension list      @@   27 gateway list        @@   37 tier list json_api  @@   47 other               @
echo  @   8 agent list           @@   18 del agent 1000      @@   28 lua_helloworld      @@   38 agent list json_api @@   48 other               @
echo  @   9 queue list           @@   19 shutdown FS         @@   29 fs status           @@   39 memberList json_api @@   49 DN status               @
echo  @   0 quit                 @@   20 other               @@   30 show Dialplan       @@   40 hold a dn           @@   50 eavesdrop uuid      @
echo  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@echo off 
set /p input=Press:
if "%input%" == "0"     goto :EOFd
if /I "%input%" == "1"  goto _cmd1
if /I "%input%" == "2"  goto _cmd2
if /I "%input%" == "3"  goto _cmd3
if /I "%input%" == "4"  goto _cmd4
if /I "%input%" == "5"  goto _cmd5
if /I "%input%" == "6"  goto _cmd6
if /I "%input%" == "7"  goto _cmd7
if /I "%input%" == "8"  goto _cmd8
if /I "%input%" == "9"  goto _cmd9
if /I "%input%" == "11" goto _cmd11
if /I "%input%" == "12" goto _cmd12
if /I "%input%" == "13" goto _cmd13
if /I "%input%" == "14" goto _cmd14
if /I "%input%" == "15" goto _cmd15
if /I "%input%" == "16" goto _cmd16
if /I "%input%" == "17" goto _cmd17
if /I "%input%" == "18" goto _cmd18
if /I "%input%" == "19" goto _cmd19
if /I "%input%" == "20" goto _cmd20
if /I "%input%" == "21" goto _cmd21
if /I "%input%" == "22" goto _cmd22
if /I "%input%" == "24" goto _cmd24
if /I "%input%" == "25" goto _cmd25
if /I "%input%" == "26" goto _cmd26
if /I "%input%" == "27" goto _cmd27
if /I "%input%" == "28" goto _cmd28
if /I "%input%" == "29" goto _cmd29
if /I "%input%" == "30" goto _cmd30
if /I "%input%" == "31" goto _cmd31
if /I "%input%" == "32" goto _cmd32
if /I "%input%" == "33" goto _cmd33
if /I "%input%" == "34" goto _cmd34
if /I "%input%" == "35" goto _cmd35
if /I "%input%" == "36" goto _cmd36
if /I "%input%" == "37" goto _cmd37
if /I "%input%" == "38" goto _cmd38
if /I "%input%" == "39" goto _cmd39
if /I "%input%" == "40" goto _cmd40
if /I "%input%" == "41" goto _cmd41
if /I "%input%" == "42" goto _cmd42
if /I "%input%" == "43" goto _cmd43
if /I "%input%" == "45" goto _cmd45
if /I "%input%" == "46" goto _cmd46
if /I "%input%" == "49" goto _cmd49
if /I "%input%" == "50" goto _cmd50

:_cmd1
curl -s -S -G -X GET --user freeswitch:works --data "agent%%20add%%2021009%%40default%%20callback" http://192.168.5.97:8080/webapi/callcenter_config
pause
goto _starting 

:_cmd2
curl -s -S -G -X GET --user freeswitch:works --data "agent%%20set%%20contact%%2021009%%40default%%20user%%2F1000" http://192.168.5.97:8080/webapi/callcenter_config
pause
goto _starting 

:_cmd3
curl -s -S -G -X GET --user freeswitch:works --data "tier%%20add%%20support%%40default%%2021009%%40default%%201%%201" http://192.168.5.97:8080/webapi/callcenter_config
pause
goto _starting 

:_cmd4
curl -s -S -G -X GET --user freeswitch:works --data "queue%%20list%%20members%%20support%%40default" http://192.168.5.97:8080/webapi/callcenter_config
pause
goto _starting 

:_cmd5
curl -s -S -G -X GET --user freeswitch:works --data "agent%%20set%%20status%%2021009%%40default%%20'Available'" http://192.168.5.97:8080/webapi/callcenter_config
pause
goto _starting 

:_cmd6
curl -s -S -G -X GET -v --user freeswitch:works --data "agent%%20set%%20status%%2021009%%40default%%20%%27Logged%%20Out%%27" http://192.168.5.97:8080/webapi/callcenter_config
pause
goto _starting 

:_cmd7
curl -s -S -G -X GET --user freeswitch:works --data "tier%%20list" http://192.168.5.97:8080/webapi/callcenter_config
pause
goto _starting 

:_cmd8
curl -s -S -G -X GET --user freeswitch:works --data "agent%%20list" http://192.168.5.97:8080/webapi/callcenter_config
pause
goto _starting 

:_cmd9
curl -s -S -G -X GET --user freeswitch:works --data "queue%%20list" http://192.168.5.97:8080/webapi/callcenter_config
pause
goto _starting 

:_cmd11
curl -s -S -G -X GET --user freeswitch:works --data "agent%%20get%%20uuid%%2021009%%40default" http://192.168.5.97:8080/webapi/callcenter_config
echo.
pause
goto _starting 

:_cmd12
curl -s -S -G -X GET --user freeswitch:works --data "channels" http://192.168.5.97:8080/webapi/show
pause
goto _starting 

:_cmd13
curl -s -S -G -X GET --user freeswitch:works --data "channels%%20as%%20json" http://192.168.5.97:8080/webapi/show
pause
goto _starting 


:_cmd14
set uuid=
set /p uuid=UUID input here:
curl -s -S -G -X GET --user freeswitch:works --data "%uuid%" http://192.168.5.97:8080/webapi/uuid_kill
pause
goto _starting 

:_cmd15
curl -s -S -G -X GET --user freeswitch:works --data "agent%%20set%%20status%%2021009%%40default%%20'On%%20Break'" http://192.168.5.97:8080/webapi/callcenter_config
pause
goto _starting 

:_cmd16
curl -s -S -G -X GET --user freeswitch:works http://192.168.5.97:8080/webapi/global_getvar
pause
goto _starting 

:_cmd17
curl -s -S -G -X GET --user freeswitch:works --data "status%%20profile%%20internal%%20reg" http://192.168.5.97:8080/webapi/sofia
pause
goto _starting 

:_cmd18
curl -s -S -G -X GET --user freeswitch:works --data "agent%%20del%%201000%%40default" http://192.168.5.97:8080/webapi/callcenter_config
pause
goto _starting 

:_cmd19
curl -s -S -G -X GET --user freeswitch:works http://192.168.5.97:8080/webapi/shutdown
pause
goto _starting 

:_cmd20
curl -s -S -G -X GET --user freeswitch:works http://192.168.5.97:8080/webapi/reloadxml
pause
goto _starting 

:_cmd21
curl -s -S -G -X GET --user freeswitch:works http://192.168.5.97:8080/webapi/list_users
pause
goto _starting 

:_cmd22
set dnis=
set /p dnis=DNIS input here:
curl -s -S -G -X GET --user freeswitch:works --data "user%%2F1000%%20%dnis%" http://192.168.5.97:8080/webapi/originate
pause
goto _starting 

:_cmd23
curl -s -S -G -X GET --user freeswitch:works --data "channels" http://192.168.5.97:8080/webapi/show
pause
goto _starting 

:_cmd24
curl -s -S -G -X GET --user freeswitch:works --data "calls" http://192.168.5.97:8080/webapi/show
pause
goto _starting 

:_cmd25
curl -s -S -G -X GET --user freeswitch:works --data "channels%%20like%%20external" http://192.168.5.97:8080/webapi/show
pause
goto _starting 

:_cmd26
curl -s -S -G -X GET --user freeswitch:works --data "status%%20profile%%20internal" http://192.168.5.97:8080/webapi/sofia
pause
goto _starting 

:_cmd27
curl -s -S -G -X GET --user freeswitch:works --data "status" http://192.168.5.97:8080/webapi/sofia
pause
goto _starting 

:_cmd28
curl -s -S -G -X GET -v --user freeswitch:works --data "%%2Fusr%%2Flocal%%2Ffreeswitch%%2Fscripts%%2Flua_list_active_calls.lua" http://192.168.5.97:8080/webapi/lua
pause
goto _starting 

:_cmd29
curl -s -S -G -X GET --user freeswitch:works http://192.168.5.97:8080/webapi/status
pause
goto _starting 


:_cmd30
curl -s -S -G -X GET --user freeswitch:works --data "dialplan" http://192.168.5.97:8080/webapi/show
pause
goto _starting 


:_cmd31
set mod=
set /p mod=MOD input here:
curl -s -S -G -X GET --user freeswitch:works --data "modules" http://192.168.5.97:8080/webapi/show |findstr %mod%
pause
goto _starting 


:_cmd32
set uuid=
set /p uuid=UUID input here:
curl -s -S -G -X GET --user freeswitch:works --data "%%2B10%%20%uuid%%%20900699%%20XML%%20doosan_inbound_target" http://192.168.5.97:8080/webapi/sched_transfer
pause
goto _starting 


:_cmd33
set uuid=
set var_val1=
set /p uuid=UUID input here:
set /p var_val1=userdata1 is about to set:
curl -s -S -G -X GET --user freeswitch:works --data "%uuid%%%20%userdata1%%var_val1%" http://192.168.5.97:8080/webapi/uuid_setvar
pause
goto _starting 

:_cmd34
set uuid=
set var_name=
set /p uuid=UUID input here:
set /p var_name=VAR_NAME input here:
curl -s -S -G -X GET --user freeswitch:works --data "%uuid%%%20%var_name%" http://192.168.5.97:8080/webapi/uuid_getvar
echo.
pause
goto _starting 

:_cmd35
set uuid=
set /p uuid=UUID input here:
curl -s -S -G -X GET --user freeswitch:works --data "%uuid%%%20talk" http://192.168.5.97:8080/webapi/uuid_phone_event
pause
goto _starting

:_cmd36
curl -s -S -G -X GET --user freeswitch:works --data "tier%%20del%%20support%%40default%%2021009%%40default" http://192.168.5.97:8080/webapi/callcenter_config
pause
goto _starting 

:_cmd37
curl -s -S -G -X GET --user freeswitch:works --data "%%7B%%22command%%22%%3A%%20%%22callcenter_config%%22%%2C%%22data%%22%%3A%%20%%7B%%22arguments%%22%%3A%%22tier%%20list%%22%%7D%%7D" http://192.168.5.97:8080/webapi/json
pause
goto _starting 

:_cmd38
curl -s -S -G -X GET --user freeswitch:works --data "%%7B%%22command%%22%%3A%%20%%22callcenter_config%%22%%2C%%20%%22format%%22%%3A%%20%%22pretty%%22%%2C%%20%%22data%%22%%3A%%20%%7B%%22arguments%%22%%3A%%22agent%%20list%%22%%7D%%7D" http://192.168.5.97:8080/webapi/json
pause
goto _starting 

:_cmd39
curl -s -S -G -X GET --user freeswitch:works --data "%%7B%%22command%%22%%3A%%20%%22callcenter_config%%22%%2C%%22data%%22%%3A%%20%%7B%%22arguments%%22%%3A%%22member%%20list%%22%%7D%%7D" http://192.168.5.97:8080/webapi/json
pause
goto _starting 

:_cmd40
set uuid=
set /p uuid=UUID input here:
curl -s -S -G -X GET --user freeswitch:works --data "toggle%%20%uuid%" http://192.168.5.97:8080/webapi/uuid_hold 
pause
goto _starting 

:_cmd41
curl -s -S -G -X GET --user freeswitch:works --data "agent%%20add%%2021010%%40default%%20callback" http://192.168.5.97:8080/webapi/callcenter_config
pause
goto _starting 

:_cmd42
curl -s -S -G -X GET --user freeswitch:works --data "agent%%20set%%20contact%%2021010%%40default%%20user%%2F1003" http://192.168.5.97:8080/webapi/callcenter_config
pause
goto _starting 


:_cmd43
curl -s -S -G -X GET --user freeswitch:works --data "tier%%20add%%20zhuangzaiji%%40default%%2021010%%40default%%201%%201" http://192.168.5.97:8080/webapi/callcenter_config
pause
goto _starting 


:_cmd45
curl -s -S -G -X GET --user freeswitch:works --data "agent%%20set%%20status%%2021010%%40default%%20'Available'" http://192.168.5.97:8080/webapi/callcenter_config
pause
goto _starting 


:_cmd46
curl -s -S -G -X GET --user freeswitch:works --data "tier%%20del%%20zhuangzaiji%%40default%%2021010%%40default" http://192.168.5.97:8080/webapi/callcenter_config
pause
goto _starting 

:_cmd49
set userid=
set /p userid=USERID input here:
curl -s -S -G -X GET --user freeswitch:works --data "group%%20default%%20user%%20%userid%" http://192.168.5.97:8080/webapi/list_users
pause
goto _starting 

:_cmd50
set uuid=
set /p uuid=UUID input here:
curl -s -S -G -X GET --user freeswitch:works --data "user%%2F1001%%40192.168.5.97%%20%%26eavesdrop(%uuid%)" http://192.168.5.97:8080/webapi/originate
pause
goto _starting 


goto :EOF

2.执行命令 

Freeswitch API调用方式_第1张图片

你可能感兴趣的:(Freeswitch,windows,junit)