Mod commands
From FreeSWITCH Wiki
Introduction
These are the commanded provided by mod_commands and is up to date as of r14778 (Sept 09). These commands can be issued via any of the following interfaces (not an exhaustive list):CLI
See below.API/Event Interfaces
Scripting Interfaces
From the Dialplan
An API can be called from the dialplan. Example:<extension name="Make API call from Dialplan">
<condition field="destination_number" expression="^(999)$">
<!-- next line calls hupall, so be careful! -->
<action application="set" data="api_result=${hupall(normal_clearing)}"/>
</condition>
</extension>Other examples:
<action application="set" data="api_result=${status()}"/>
<action application="set" data="api_result=${version()}"/>
<action application="set" data="api_result=${strftime()}"/>
<action application="set" data="api_result=${expr(1+1)}"/>The set of available commands is dependent on the modules that are loaded; the authoritative set of commands can be found from the set of commands registered by each module.
To see a list of available API commands simply type help or show api at the CLI.
NOTE: If you are calling an API from the dialplan make absolutely certain that there isn't already a dialplan application (see Mod_dptools) that gives you the functionality you are looking for.
Core Commands
Implemented in http://svn.freeswitch.org/svn/freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.cacl
Compare an ip to an ACL list.Usage: acl <ip> <list_name>
alias
Alias: a means to save some keystrokes on commonly used commands.Usage: alias add <alias> <command> | del [<alias>|*]
Example:
freeswitch> alias add reloadall reloadacl reloadxml
+OK
freeswitch> alias add unreg sofia profile internal flush_inbound_reg
+OKNote: Only really works from the console, not fs_cli.
bgapi
Execute an API command in a thread.Usage: bgapi <command>[ <arg>]
break
Break.Usage: break <uuid> [all]
complete
Complete.Usage: complete add <word>|del [<word>|*]
cond
Eval a conditional.Usage: cond <expr> ? <true val> : <false val>
Conditions supported by expr are:
== Equality
< Less than
> Greater thanExample:
Return true if first val is greater than the second
cond 5 > 3 ? true : false
true
domain_exists
Check if a domain exists.Usage: domain_exists <domain>
eval
Eval (noop).Usage: eval [uuid:<uuid> ]<expression>
expand
Execute an API with variable expansion.Usage: [uuid:<uuid> ]<cmd> <args>
Example:
expand originate sofia/internal/1001%${domain} 9999
In this example the value of ${domain} is expanded. If the domain were, for example, "192.168.1.1" then this command would be executed:
originate sofia/internal/1001%192.168.1.1 9999
fsctl
FreeSWITCH control messages.USAGE: fsctl [send_sighup|hupall|pause|resume|shutdown [cancel|elegant|asap|restart]|sps|sync_clock|reclaim_mem|max_sessions|min_dtmf_duration [num]|max_dtmf_duration [num]|default_dtmf_duration [num]|loglevel [level]]
hupall can also be used to disconnect existing calls to a destination. The parameters are: clearing_type dialed_ext <extension number> For example to kill an active call with the destination being extension 1000: fsctl hupall normal_clearing dialed_ext 1000 sync_clock: Freeswitch will not trust the system time. It gets one sample of system time when it first starts and uses the monotonic clock from there. You can sync it back to real time with "fsctl sync_clock"
min_dtmf_duration
Example:fsctl min_dtmf_duration 800This example sets the min_dtmf_duration switch parameter to 100ms. The number is in clock ticks where clockticks / 8 = ms. The min_dtmf_duration specifies the minimum DTMF duration to use on outgoing events. Events shorter than this will be increased in duration to match min_dtmf_duration. You cannot configure a DTMF duration on a profile that is less than this setting. You may increase this value, but cannot set it lower than 400 (the default). This value cannot exceed max_dtmf_duration. This setting can be changed in switch.conf.xml.
It is worth noting that many devices squelch in-band DTMF when sending RFC 2833. Devices that squelch in-band DTMF have a certain reaction time and clamping time which can sometimes reach as high as 40ms, though most can do it in less than 20ms. As the shortness of your DTMF event duration approaches this clamping threshold, the risk of your DTMF being ignored as a squelched event increases. If your call is always IP-IP the entire route, this is likely not a concern. However, when your call is sent to the PSTN, the RFC 2833 must be encoded in the audio stream. This means that other devices down the line (possibly a PBX or IVR you are calling into) might start considering your DTMF event a squelched tone and ignore it entirely. For this reason, it is recommended that you do not send DTMF events shorter than 80ms.
Checking the current value:
fsctl min_dtmf_duration 0The code recognizes a duration of 0 as a status check. Instead of setting the value to 0, it simply returns the current value.
max_dtmf_duration
Example:fsctl max_dtmf_duration 80000This example sets the max_dtmf_duration switch parameter to 10,000ms (10 seconds). The number is in clock ticks (CT) where CT / 8 = ms. The max_dtmf_duration caps the playout of a DTMF event at the specified duration. Events exceeding this duration will be truncated to this duration. You cannot configure a duration on a profile that exceeds this setting. This setting can be lowered, but cannot exceed 192000 (the default). This setting cannot be set lower than min_dtmf_duration. This setting can be changed in switch.conf.xml.
Checking the current value:
fsctl max_dtmf_duration 0The code recognizes a duration of 0 as a status check. Instead of setting the value to 0, it simply returns the current value.
default_dtmf_duration
Example:fsctl default_dtmf_duration 2000This example sets the default_dtmf_duration switch parameter to 250ms. The number is in clock ticks (CT) where CT / 8 = ms. The default_dtmf_duration specifies the DTMF duration to use on originated DTMF events or on events that are received without a duration specified. This value can be increased or lowered. This value is lower-bounded by min_dtmf_duration and upper-bounded by max_dtmf_duration. This setting can be changed in switch.conf.xml.
Checking the current value:
fsctl default_dtmf_duration 0The code recognizes a duration of 0 as a status check. Instead of setting the value to 0, it simply returns the current value.
global_getvar
Gets the value of a global variable. If the parameter is not provided then it gets all the global variables.Usage:
global_getvar <varname>
global_setvar
Sets the value of a global variable.Usage: global_setvar =<value>
Example:
global_setvar foo=bar
group_call
Returns the bridge string defined in a call group.Usage:
group_call group@domain[+F][+A][+E]+F will return the group members in a serial fashion (separated by |), +A will return them in a parallel fashion (separated by ,) and +E will return them in a enterprise fashion (separated by :_:). See Groups in the XML User Directory for more information.
help
Show help for all the API commands.Usage: help
host_lookup
Performs a host lookup on a domain name.Usage: host_lookup <hostname>
hupall
Disconnect existing channels.Usage: hupall <cause> [<var> <value>]
All channels that have <var> set to <value> will be disconnected with <cause>
Ex:
originate {foo=bar}sofia/internal/someone1@server.com,sofia/internal/someone2@server.com &park
hupall normal_clearing foo bar
in_group
Determine if a user is in a group.Usage: in_group <user>[@<domain>] <group_name>
is_lan_addr
See if an ip is a lan address.Usage: is_lan_addr <ip>
load
Load external moduleUsage: load <mod_name>
md5
Usage: md5 <data>module_exists
Check if module exists.Usage: module_exists <module>
nat_map
Usage: nat_map [status|reinit|republish] | [add|del] <port> [tcp|udp] [sticky]- status - Gives the NAT type, the external ip, and the currently mapped ports.
- reinit - Completely re-initializes the NAT engine. Use this if you have changed swapped out your router or have changed your router from NAT mode to uPNP mode.
- republish - Causes FreeSWITCH to republish the NAT maps. This should not be necessary in normal operation.
Warning: If you have multiple interfaces with sip profiles using the same port, nat_map *will* get confused when it tries to map the same ports for multiple profiles. Don't do that!
regex
Evaluate a regex (regular expression). This command behaves differently depending upon whether or not a substitution string is supplied:- If a subst is not supplied, regex returns either true or false
- If a subst is supplied, regex returns the subst value on a true condition, or the source string on a false condition (this is an update as of revision 14727, previously the regex would return "false" on a failed match.)
Usage: regex <data>|<pattern>[|<subst string>]
regex m:/<data>/<pattern>[/<subst string>]
regex m:~<data>~<pattern>[~<subst string>]Examples:
regex test1234|\d <== Returns "true"
regex m:/test1234/\d <== Returns "true"
regex m:~test1234~\d <== Returns "true"
regex test|\d <== Returns "false"
regex test1234|(\d+)|$1 <== Returns "1234"
regex sip:foo@bar.baz|^sip:(.*)|$1 <== Returns "foo@bar.baz"
regex testingonetwo|(\d+)|$1 <== Returns "testingonetwo" (no match)
- See also Regular_Expression
reload
Reload a module.Usage: reload [-f] <mod_name>
reloadacl
Reload ACL.Usage: reloadacl [reloadxml]
reloadxml
Reload conf/freeswitch.xml settingsUsage: reloadxml
show
Display various reportsUsage: show codec|endpoint|application|api|dialplan|file|timer|calls [count]|channels [count|like <match string>]|distinct_channels|aliases|complete|chat|management|modules|nat_map|say|interfaces|interface_types|tasks
- codec - list codecs
- endpoint - list endpoints
- application - list applications
- api - list api's
- dialplan - list dialplan modules
- file - list supported file formats
- timer - list timer modules
- calls - list current calls [count]
- channels - list current channels [count|like <match string>]
- distinct_channels - list distinct channels
- aliases - list aliases -
- complete - list command complete tables
- chat - list chat modules
- management - list management ??
- modules - list modules
- nat_map - list network address translation map
- say - list available say modules with language supported
- interfaces - list all interfaces
- interface_types - list all interface types
- tasks - list tasks
shutdown
Stop the FreeSWITCH program. This only works from the CLI, as an API call, you should be using 'fsctl shutdown'Usage: shutdown [cancel|elegant|asap|restart|now]
- cancel - discontinue a previous shutdown request.
- elegant - wait for all traffic to stop; do not prevent new traffic.
- asap - wait for all traffic to stop; do not allow new traffic.
- restart - restart FreeSWITCH immediately following the shutdown.
- now - shutdown FreeSWITCH immediately.
status
Show current statusUsage: status
strftime_tz
Displays formatted time, converted to a specific timezone. See /usr/share/zoneinfo/zone.tab for the standard list of Linux timezones.Usage: strftime_tz <timezone> [format_string]
Example: strftime_tz US/Eastern %Y-%m-%d %T
unload
Unload external module.Usage: unload [-f] <mod_name>
version
Show version of the switchUsage: version
xml_locate
xml_locate root: Will return all XML being used by FreeSWITCH xml_locate <section>: Will return the XML corresponding to the specified <section>xml_locate directory
xml_locate configuration
xml_locate dialplan
xml_locate phrasesUsage: xml_locate [root | <section> | <section> <tag> <tag_attr_name> <tag_attr_val>]
xml_wrap
Wrap another API command in XML.Usage: xml_wrap <command> <args>
Call Management Commands
create_uuid
Creates a new UUID and returns it as a string.Usage: create_uuid
originate
Originate a new call.Usage: originate <call_url> <exten>|&<application_name>(<app_args>)
[<dialplan>] [<context>] [<cid_name>] [<cid_num>] [<timeout_sec>]
Parameters:
- <call_url> URL you are calling.
For more info on sofia SIP URL syntax see: FreeSwitch Endpoint Sofia - <exten> Extension you are calling from
- <application_name> "&" plus an application name and args.
Here is a list of valid application names that can be used here:
park, bridge, javascript/lua/perl, playback (remove mod_native_file), and many others. - Note: Use single quotes to pass arguments with spaces, e.g. '&lua(test.lua arg1 arg2)'
- <cid_name> CallerID name.
- <cid_num> CallerID number.
- <timeout_sec> Timeout in seconds.
These options can be used in curly braces, example: "originate {ignore_early_media=true}sofia/example/user 8334"
- group_confirm_key
- group_confirm_file
- forked_dial
- fail_on_single_reject
- ignore_early_media
- return_ring_ready
- originate_retries
- originate_retry_sleep_ms
- origination_caller_id_name
- origination_caller_id_number
- originate_timeout
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 8600Or 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 15555551212Setting 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 15555551212Note: 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 15555551212If 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)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:
- Use create_uuid to generate a UUID to use.
- This will allow you to kill an originated call before it is answered by using uuid_kill.
- The UUID of the answered call leg will not be the same UUID as the origination_uuid specified (Each call leg always gets its own UUID)
originate sofia/internal/9996@conference.freeswitch.org &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_3You 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 )
pause
Pause <uuid> mediaUsage: pause <uuid> <on|off>
uuid_audio
Adjust 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_bridge
Bridge two call legs together.Usage: uuid_bridge <uuid> <other_uuid>
uuid_bridge needs atleast any one leg to be answered.
uuid_broadcast
Play a <path> file to a specific <uuid> call.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_chat
Send 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_audio
Debug audioUsage:
<uuid> <read|write|both> <on|off>
uuid_deflect
Deflect an answered SIP call off of FreeSWITCH by sending the REFER methodUsage: 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.netResponse:
Content-Type: api/response
Content-Length: 30 +OK:SIP/2.0 486 Busy Here
uuid_displace
Displace the audio for the target <uuid> with the specified audio <file>.Parameters:
- uuid = Unique ID of this call (see 'show channels')
- start|stop = Start/Stop this action
- file = path to an audio source (wav, shout, etc...)
- limit = number of seconds before terminating the displacement
- mux = cause the original audio to be mixed together with 'file', i.e. you can still converse with the other party while the file is playing
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_display
Updates 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>]
uuid_dump
Dumps all variable values for a session.Usage: uuid_dump <uuid> [format]
?Format options: XML (any others?)
uuid_exists
Checks whether a given UUID exists.Usage: uuid_exists <uuid>
uuid_flush_dtmf
Flush queued DTMF digitsUsage: uuid_flush_dtmf <uuid>
uuid_getvar
Get a variable from a channel.Usage: uuid_getvar <uuid> <varname>
uuid_hold
Place a call on hold.Usage:
uuid_hold <uuid> place a call on hold
uuid_hold off <uuid> switch off on hold
uuid_kill
Reset a specific <uuid> channel.Usage: uuid_kill <uuid> [cause]
uuid_media
Reinvite <uuid> bridging (B2BUA) mediaUsage: uuid_media [off] <uuid>
uuid_park
Park callUsage: uuid_park <uuid>
uuid_send_dtmf
Send dtmf digits.-USAGE: <uuid> <dtmf_data>
uuid_session_heartbeat
Usage: uuid_session_heartbeat <uuid> [sched] [0|<seconds>]uuid_setvar
Set a variable on a channel. If value is omitted, the variable is unset.Usage: uuid_setvar <uuid> <varname> [value]
uuid_setvar_multi
Set multiple vars on a channel (added in svn revision 10372).Usage: uuid_setvar_multi <uuid> <varname>=<value>[;<varname>=<value>[;...]]
uuid_transfer
Transfers 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.
uuid_simplify
Usage:uuid_simplify <uuid>
Record/Playback Commands
uuid_record
Record the audio associated with the given UUID into a file. The start command causes FreeSWITCH to start mixing all call legs together and saves the result as a file in the format that the file's extension dictates. (if available) The stop command will stop the recording and close the file. If media setup hasn't yet happened, the file will contain silent audio until media is available. (TODO: What if media doesn't flow through FS? Will it re-INVITE first? Or do we just not get the audio in that case?)Usage:
uuid_record <uuid> [start|stop] <path> [<limit>]Where limit is the max number of seconds to record.
Misc. Commands
bg_system
Execute a system command in the background.Usage: bg_system <command>
echo
Echo input back to the consoleecho This text will appear
This text will appear
find_user_xml
Checks to see if a user exists; Matches user tags found in the directory, similar to user_exists, but returns an XML representation of the user as defined in the directory (like the one shown in user_exists).Usage: find_user_xml <key> <user> <domain>
Where key references a key specified in a directory's user tag, user represents the value of the key, and the domain is the domain the user is assigned to.
sched_api
Schedule an API call in the future. Usage:sched_api [+]<time> <group_name> <command_string>time is the UNIX timestamp at which the command should be executed (or if it is prefixed by +, the number of seconds to wait before executing the command)
group_name will be the value of "Task-Group" in generated events. "none" is the proper value for no group.
command_string is the command executed
Scheduled task or group of tasks can be revoked with sched_del or unsched_api.
You could put "&" symbol at the end of the line to make command to be executed in its own thread.
Example:
sched_api +1800 none originate sofia/internal/1000%${sip_profile} &echo()
sched_broadcast
Play a <path> file to a specific <uuid> call in the future. Usage:sched_broadcast [+]<time> <uuid> <path> [aleg|bleg|both]Schedule execution of an application on a chosen leg(s) with optional hangup: Usage:
sched_broadcast [+]<time> <uuid> app[![hangup_cause]]::args [aleg|bleg|both]time is the UNIX timestamp at which the command should be executed (or if it is prefixed by +, the number of seconds to wait before executing the command)
Example:
sched_broadcast +60 336889f2-1868-11de-81a9-3f4acc8e505e commercial.wav both
sched_broadcast +60 336889f2-1868-11de-81a9-3f4acc8e505e say::en\snumber\spronounced\s12345 aleg
sched_del
Removes a prior scheduled group or task ID Usage:sched_del <group_name|task_id>The one argument can either be a group of prior scheduled tasks or the returned task-id from sched_api.
Example:
sched_del my_group
sched_del 2
sched_hangup
Schedule a running call to hangup.Usage: sched_hangup [+]<time> <uuid> [<cause>]
sched_transfer
Schedule a transfer for a running call.Usage: sched_transfer [+]<time> <uuid> <extension> [<dialplan>] [<context>]
stun
Executes a STUN lookup Usage:stun <stunserver>[:port]Example:
stun stun.freeswitch.org
system
Execute a system command.Usage: system <command>
The command is passed to the system shell, where it may be expanded or interpreted in ways you don't expect. This can lead to security bugs if you're not careful. For example, the following command is dangerous:
<action application="system" data="log_caller_name ${caller_id_name}" />If a malicious remote caller somehow sets their caller ID name to "; rm -rf /", you would unintentionally be executing this shell command:
log_caller_name; rm -rf /
time_test
Time test.Usage: time_test <mss> [count]
Runs a test to see how bad timer jiter is. It runs the test count times (default 10) and tries to sleep for mss microseconds. It returns the actual timer duration along with an average.
Sample:
time_test 100 5
test 1 sleep 100 99
test 2 sleep 100 97
test 3 sleep 100 96
test 4 sleep 100 97
test 5 sleep 100 102
avg 98
timer_test
Timer test.Usage: timer_test <10|20|40|60|120> [<1..200>] [<timer_name>]
Runs a test to see how bad timer jiter is. Unlike time_test, this uses the actual freeswitch timer infrastructure to do the timer test and exercises the timers used for call processing.
First argument is the timer interval. Second is the count. Third is the timer name ("show timers" will give you a list)
Example:
timer_test 20 3
Avg: 16.408ms Total Time: 49.269ms
2010-01-29 12:01:15.504280 [CONSOLE] mod_commands.c:310 Timer Test: 1 sleep 20 9254
2010-01-29 12:01:15.524351 [CONSOLE] mod_commands.c:310 Timer Test: 2 sleep 20 20042
2010-01-29 12:01:15.544336 [CONSOLE] mod_commands.c:310 Timer Test: 3 sleep 20 19928
tone_detect
Start Tone Detection on a channel.Usage: tone_detect <uuid> <key> <tone_spec> [<flags> <timeout> <app> <args> <hits>]
unsched_api
Unschedule an api command.Usage: unsched_api <task_id>
url_decode
Usage: url_decode <string>Url decode a string.
url_encode
Url encode a string.Usage: url_encode <string>
user_data
Retrieves user information (parameters or variables) as defined in the directory.Usage: user_data <user>@<domain> [attr|var|param] <name>
Where user is the user's id, domain is the user's domain, var|param specifies whether the info we're requesting is a variable/parameter, and the name is the name (key) of the variable.
Example:
user_data 1000@192.168.1.101 param passwordwill return a result of 1234, and
user_data 1000@192.168.1.101 var accountcodewill return a result of 1000 from the example user shown in user_exists, and
user_data 1000@192.168.1.101 attr idwill return the user's actual alphanumeric ID (i.e. "john") when number-alias="1000" was set as an attribute for that user.
user_exists
Checks to see if a user exists; Matches user tags found in the directory and returns either true/false:Usage: user_exists <key> <user> <domain>
Where key references a key specified in a directory's user tag, user represents the value of the key, and the domain is the domain the user is assigned to.
Example:
user_exists id 1000 192.168.1.101will return true where there exists in the directory a user with a key called id whose value equals 1000:
<user id="1000" randomvar="45">
<params>
<param name="password" value="1234"/>
<param name="vm-password" value="1000"/>
</params>
<variables>
<variable name="accountcode" value="1000"/>
<variable name="user_context" value="default"/>
<variable name="effective_caller_id_name" value="Extension 1000"/>
<variable name="effective_caller_id_number" value="1000"/>
</variables>
</user>In the above example, we also could have tested for randomvar:
user_exists randomvar 45 192.168.1.101And we would have received the same results, but:
user_exists accountcode 1000 192.168.1.101Or,
user_exists password 1000 192.168.1.101Would have returned false.
No comments:
Post a Comment