FreeSwitch支持三种Media处理模式:Default, Media Proxy 和 BypassDefault 模式: media flows through FS, full processing options。 Proxy 模式: media flows through FS, no media processing options。不能录音,也不能从FS originate。 设置Proxy 模式的方法: Set proxy_media=true before the bridge. <action application="set" data="proxy_media=true"/> Alternatively, configure the SIP profile to use proxy media by default: <param name="inbound-proxy-media" value="true"/> (see example in conf/sip_profiles/internal.xml) Bypass模式: media flows around FS directly between endpoints, no media processing options。 http://wiki./wiki/Mod_commandsshowDisplay various reports Usage: show <item> where <item> is: codec endpoint application api dialplan file timer calls [count] channels [count|like <match string>] calls detailed_calls bridged_calls detailed_bridged_calls aliases complete chat management modules nat_map say interfaces interface_types tasks limits Tips For Showing Calls and ChannelsThe best way to get an understanding of all of the show calls/channels is to actually try them out. Recently (Sept 2011) there have been some additions to the show family:
shutdownStop the FreeSWITCH program. This only works from the CLI, as an API call, you should be using 'fsctl shutdown' Warning! Shutdown from the CLI ignores arguments and exits immediately! Usage: fsctl shutdown [cancel|elegant|asap|restart|now]
Call Management CommandsbreakDeprecated. See uuid_break. create_uuidCreates a new UUID and returns it as a string. Usage: create_uuid originateOriginate a new call. Usage: originate <call_url> <exten>|&<application_name>(<app_args>) [<dialplan>] [<context>] [<cid_name>] [<cid_num>] [<timeout_sec>]
Options: These options can be used in curly braces, example: "originate {ignore_early_media=true}sofia/example/user 8334". Options must be separated by ',', Example: "originate {ignore_early_media=true,originate_timeout=2}sofia/example/user 8334"
Description of originate's related variables Examples: So you can call a locally registered sip endpoint 300 and park the call like so (Note that the "example" profile used here must be the one your local user you want to call is registered to) originate sofia/example/300%pbx.internal &park() or you could instead connect a remote sip endpoint to extension 8600 originate sofia/example/300@foo.com 8600 or you could instead connect a remote SIP endpoint to another remote extension originate sofia/example/300@foo.com &bridge(sofia/example/400@bar.com) or you could even run a javascript application test.js originate sofia/example/1000@somewhere.com &javascript(test.js) To run a javascript with arguments you must surround it in quotes. originate sofia/example/1000@somewhere.com '&javascript(test.js myArg1 myArg2)' Setting channel variables before doing the originate originate {ignore_early_media=true}sofia/mydomain.com/18005551212@1.2.3.4 15555551212 Setting variable to send to another FS box during originate originate {sip_h_X-varA=111,sip_h_X-varB=222}sofia/mydomain.com/18005551212@1.2.3.4 15555551212 Note: you can set any channel variable, even custom ones. Use single quotes to enclose values with spaces, commas, etc. originate {my_own_var=my_value}sofia/mydomain.com/that.ext@1.2.3.4 15555551212 originate {my_own_var='my value'}sofia/mydomain.com/that.ext@1.2.3.4 15555551212 If you need to fake the ringback to the originated endpoint try this: originate {ringback=\'%(2000,4000,440.0,480.0)\'}sofia/example/300@foo.com &bridge(sofia/example/400@bar.com) If you need to make originate return immediately when the channel is in "Ring-Ready" state try this: originate {return_ring_ready=true}sofia/gateway/someprovider/919246461929 &socket(127.0.0.1:8082 async full) see here for more info on return_ring_ready You can even set music on hold for the ringback if you want: originate {ringback=\'/path/to/music.wav\'}sofia/gateway/name/number &bridge(sofia/gateway/name/othernumber) You can originate a call in the background (asynchronously) and playback a message with a 60 second timeout. bgapi originate {ignore_early_media=true,originate_timeout=60}sofia/gateway/name/number &playback(message) You can specify the UUID of an originated call by doing the following:
originate {origination_uuid=...}user/100@domain.name.com Here's an example of originating a call to the echo conference (an external sip URL) and bridging it to a local user's phone: originate sofia/internal/9996@conference. &bridge(user/105@default) Here's an example of originating a call to an extension in a different context than 'default' (required for the FreePBX which uses context_1, context_2, etc.): originate sofia/internal/2001@foo.com 3001 xml context_3 You can also originate to multiple extensions as follows: originate user/1001,user/1002,user/1003 &park() To put an outbound call into a conference at early media, either of these will work (they are effectively the same thing) originate sofia/example/300@foo.com &conference(conf_uuid-TEST_CON) originate sofia/example/300@foo.com conference:conf_uuid-TEST_CON inline ( See Misc._Dialplan_Tools_InlineDialplan for more detail on 'inline' Dialplans ) An example of using loopback and inline on the A-leg can be found here pausePause <uuid> media Usage: pause <uuid> <on|off> uuid_answerAnswer a channel Usage: uuid_answer <uuid>
uuid_audioAdjust the audio levels on a channel or mute (read/write) via a media bug. Usage: uuid_audio <uuid> [start [read|write] [mute|level <level>]|stop] level is in the range from -4 to 4, 0 being the default value. uuid_breakBreak out of media being sent to a channel. For example, if an audio file is being played to a channel, issuing uuid_break will discontinue the media and the call will move on in the dialplan, script, or whatever is controlling the call. Usage: uuid_break <uuid> [all] If the all flag is used then all audio files/prompts/etc. that are queued up to be played to the channel will be removed, whereas without the all flag only the currently playing file will be discontinued. uuid_bridgeBridge two call legs together. Usage: uuid_bridge <uuid> <other_uuid> uuid_bridge needs atleast any one leg to be answered. uuid_broadcastExecute an arbitrary dialplan application on a specific uuid. If a filename is specified then it is played into the channel(s). To execute an application use "app::args" syntax. Usage: uuid_broadcast <uuid> <path> [aleg|bleg|both] Execute an application on a chosen leg(s) with optional hangup afterwards: Usage: uuid_broadcast <uuid> app[![hangup_cause]]::args [aleg|bleg|both] Examples: uuid_broadcast 336889f2-1868-11de-81a9-3f4acc8e505e sorry.wav both uuid_broadcast 336889f2-1868-11de-81a9-3f4acc8e505e say::en\snumber\spronounced\s12345 aleg uuid_broadcast 336889f2-1868-11de-81a9-3f4acc8e505e say!::en\snumber\spronounced\s12345 aleg uuid_broadcast 336889f2-1868-11de-81a9-3f4acc8e505e say!user_busy::en\snumber\spronounced\s12345 aleg uuid_broadcast 336889f2-1868-11de-81a9-3f4acc8e505e playback!user_busy::sorry.wav aleg uuid_buglistList the media bugs on channel Usage: uuid_buglist <uuid> uuid_chatSend a chat message. -USAGE: <uuid> <text> If the endpoint associated with the session <uuid> has a receive_event handler, this message gets sent to that session and is interpreted as an instant message. uuid_debug_mediaThe command was uuid_debug_audio, been changed into the current name when video options was added. Debug media Usage: <uuid> <read|write|both|vread|vwrite|vboth> <on|off> Use "read" or "write" for the audio direction to debug, or "both" for both direction. And prefix with v for video. Read Format"R %s b=%4ld %s:%u %s:%u %s:%u pt=%d ts=%u m=%d\n" where the values are:
Write Format"W %s b=%4ld %s:%u %s:%u %s:%u pt=%d ts=%u m=%d\n" where the values are:
uuid_deflectDeflect an answered SIP call off of FreeSWITCH by sending the REFER method Usage: uuid_deflect <uuid> <sip URL> uuid_deflect waits for the final response from the far end to be reported. It returns the sip fragment from that response as the text in the FreeSWITCH response to uuid_deflect. If the far end reports the REFER was successful, then FreeSWITCH will issue a bye on the channel. Example: uuid_deflect 0c9520c4-58e7-40c4-b7e3-819d72a98614 sip:info@example.net Response: Content-Type: api/response Content-Length: 30 +OK:SIP/2.0 486 Busy Here uuid_displaceDisplace the audio for the target <uuid> with the specified audio <file>. Parameters:
Usage: uuid_displace <uuid> [start|stop] <file> [<limit>] [mux] Examples: cli> uuid_displace 1a152be6-2359-11dc-8f1e-4d36f239dfb5 start /sounds/test.wav 60 cli> uuid_displace 1a152be6-2359-11dc-8f1e-4d36f239dfb5 stop /sounds/test.wav uuid_displayUpdates the display on a phone if the phone supports this. This works on some SIP phones right now including Polycom and Snom. -USAGE: <uuid> [<display>] This command makes the phone re-negotiate the codec. The SIP -> RTP Packet Size should be 0.020. If it is set to 0.030 on the SPA series phones it causes a DTMF lag. When DTMF keys are pressed on the phone they are can be seen on the fs_cli 4-6 seconds late. uuid_dual_transferTransfer each leg of a call to different destinations. -USAGE: <uuid> <A-dest-exten>[/<A-dialplan>][/<A-context>] <B-dest-exten>[/<B-dialplan>][/<B-context>] uuid_dumpDumps all variable values for a session. Usage: uuid_dump <uuid> [format] Format options: XML (any others?) uuid_early_okStops the process of ignoring early media, i.e. if ignore_early_media=true it stops ignoring early media and responds normally. Usage: uuid_early_ok <uuid> uuid_existsChecks whether a given UUID exists. Usage: uuid_exists <uuid> uuid_flush_dtmfFlush queued DTMF digits Usage: uuid_flush_dtmf <uuid> uuid_filemanManage the audio being played into a channel from a sound file Usage: uuid_fileman <uuid> <cmd:val> Commands are:
Example to seek forward 30 seconds: uuid_fileman 0171ded1-2c31-445a-bb19-c74c659b7d08 seek:+3000 (Or use the current channel via ${uuid}, e.g. in a bind_digit_action) uuid_getvarGet a variable from a channel. Usage: uuid_getvar <uuid> <varname> uuid_holdPlace a call on hold. Usage: uuid_hold <uuid> place a call on hold uuid_hold off <uuid> switch off on hold uuid_hold toggle <uuid> toggles call-state based on current call-state uuid_killReset a specific <uuid> channel. Usage: uuid_kill <uuid> [cause] uuid_limitApply or change limit(s) on a specified uuid. Usage: uuid_limit <uuid> <backend> <realm> <resource> [<max>[/interval]] [number [dialplan [context]]] See also Limit uuid_mediaReinvite FreeSWITCH out of the media path: Usage: uuid_media [off] <uuid> Reinvite FreeSWITCH back in: Usage: uuid_media <uuid> uuid_media_renegAPI command to tell a channel to send a re-invite with optional list of new codecs Usage: uuid_media_reneg <uuid> <=><codec string> Example: Adding the =PCMU makes the offered codec string absolute. uuid_parkPark call Usage: uuid_park <uuid> uuid_preanswerPreanswer a channel. Usage: uuid_preanswer <uuid>
uuid_preprocessPre-process Channel Usage: uuid_preprocess <> uuid_recv_dtmfSend DTMF digits to <uuid> set. Usage: uuid_recv_dtmf <uuid> <dtmf digits>[@<tone_duration>] Use the character w for a .5 second delay and the character W for a 1 second delay. Default tone duration is 2000ms . uuid_send_dtmfSend DTMF digits. Usage: uuid_send_dtmf <uuid> <dtmf digits>[@<tone_duration>] Use the character w for a .5 second delay and the character W for a 1 second delay. Default tone duration is 2000ms . uuid_send_infoSend info to the endpoint Usage: uuid_send_info <uuid> uuid_session_heartbeatUsage: uuid_session_heartbeat <uuid> [sched] [0|<seconds>] uuid_setvarSet a variable on a channel. If value is omitted, the variable is unset. Usage: uuid_setvar <uuid> <varname> [value] uuid_setvar_multiSet multiple vars on a channel. Usage: uuid_setvar_multi <uuid> <varname>=<value>[;<varname>=<value>[;...]] uuid_simplifyThis command directs FreeSWITCH to remove itself from the SIP signaling path if it can safely do so Usage: uuid_simplify <uuid> uuid_transferTransfers an existing call to a specific extension within a <dialplan> and <context>. Dialplan may be "xml" or "directory". Usage: uuid_transfer <uuid> [-bleg|-both] <dest-exten> [<dialplan>] [<context>] The optional first argument will allow you to transfer both parties (-both) or only the party to whom <uuid> is talking.(-bleg) NOTE: if the call has been bridged, and you want to transfer either sides of the call, then you will need to use <action application="set" data="hangup_after_bridge=false"/> (or the API equivalent). If it's not set, transfer doesn't really work as you'd expect, and leaves calls in limbo. |
|
来自: hginvent > 《freeswitch》