- pbx.agent_call_att_transfer
- pbx.agent_call_bargein
- pbx.agent_call_hold
- pbx.agent_call_spy
- pbx.agent_call_spy_disable
- pbx.agent_call_spy_enable
- pbx.agent_call_transfer
- pbx.agent_call_unhold
- pbx.agent_call_whisper
- pbx.agent_create
- pbx.agent_delete
- pbx.agent_dial
- pbx.agent_hangup
- pbx.agent_is_available
- pbx.agent_login
- pbx.agent_logout
- pbx.agent_pause
- pbx.agent_se_previous_state
- pbx.agent_set_attr
- pbx.agent_set_call_forward
- pbx.agent_skill_add
- pbx.agent_skill_remove
- pbx.agent_unpause
- pbx.call_att_transfer
- pbx.call_hangup
- pbx.call_hold
- pbx.call_mixmonitor_mute
- pbx.call_soft_hangup
- pbx.call_transfer
- pbx.chan_optimize_away
- pbx.channel_transfer
- pbx.create_embedded_phone_token
- pbx.create_embedded_phone_token
- pbx.dial
- pbx.dp_check_acl_group
- pbx.exten_call_answer
- pbx.exten_call_att_transfer
- pbx.exten_call_bargein
- pbx.exten_call_hold
- pbx.exten_call_spy
- pbx.exten_call_transfer
- pbx.exten_call_unhold
- pbx.exten_call_whisper
- pbx.exten_change_number
- pbx.exten_dial
- pbx.exten_hangup
- pbx.exten_is_available
- pbx.exten_set_mode
- pbx.get_active_calls
- pbx.get_active_calls_v2
- pbx.get_active_held_calls
- pbx.get_agent_option
- pbx.get_agents
- pbx.get_calls_overview_v2
- pbx.get_exten_from_channame
- pbx.get_exten_from_channame2
- pbx.get_exten_last_call_id
- pbx.get_group_numbers
- pbx.get_groups
- pbx.get_incoming_numbers
- pbx.get_random_element_from_string
- pbx.group_number_add
- pbx.group_number_remove
- pbx.is_exten_busy
- pbx.log
- pbx.normalize_number
- pbx.queue_agent_add
- pbx.queue_agent_remove
- pbx.queue_agent_set
- pbx.queue_exten_add
- pbx.queue_exten_pause
- pbx.queue_exten_remove
- pbx.queue_exten_set
- pbx.queue_exten_unpause
- pbx.queue_reload
- pbx.queue_sip_add
- pbx.queue_sip_remove
- pbx.reload
- pbx.sccp_line_create
- pbx.sccp_line_delete
- pbx.search_contact
- pbx.set_call_tag
- pbx.set_devstate
- pbx.set_incoming_number
- pbx.set_incoming_numbers
- pbx.set_variable
- pbx.sip_line_create
- pbx.sip_line_delete
- pbx.sorcery_expire
- pbx.sorcery_expire_object
- pbx.sorcery_expire_pjsip
- pbx.sorcery_populate
- pbx.sorcery_populate_pjsip
- pbx.virt_line_create
- pbx.virt_line_delete
- pbx.vpn_line_create
- pbx.vpn_line_delete
LinuxBox PBX API: PLPGSQL API
Built: 2024-11-29 09:29:28
Function pbx.agent_call_att_transfer
Attended transfer of a call from one agent to another
Parameters:
x_userid TEXT user ID
x_duserid TEXT user ID of destination agent
x_fail_on_busy BOOLEAN if is set, then return error when agent exten is busy (optional)
Returns: TEXT status
Function pbx.agent_call_bargein
Join agent into another agent call
Parameters:
x_userid TEXT user ID of barging agent
x_duserid TEXT user ID of destination agent
Returns: TEXT status
Function pbx.agent_call_hold
Put agent call on hold
Parameters:
x_userid TEXT agent user ID
x_call_id TEXT call ID
Returns: TEXT status
Function pbx.agent_call_spy
Initiate agent call spy on another agent call
Parameters:
x_userid TEXT user ID of spying agent
x_duserid TEXT user ID of destination agent
Returns: TEXT status
Function pbx.agent_call_spy_disable
Disable agent call spy for some agent spied by another agent
Parameters:
x_userid TEXT user ID of spying agent
x_duserid TEXT user ID of destination agent
x_spy_type TEXT spy type (spy, bargein, whisper)
Returns: TEXT status
Function pbx.agent_call_spy_enable
Enable agent call spy for some agent spied by another agent
Parameters:
x_userid TEXT user ID of spying agent
x_duserid TEXT user ID of destination agent
x_spy_type TEXT spy type (spy, bargein, whisper)
Returns: TEXT status
Function pbx.agent_call_transfer
Transfer call from one agent to another
Parameters:
x_userid TEXT user ID
x_duserid TEXT user ID of destination agent
Returns: TEXT status
Function pbx.agent_call_unhold
Transfer held call back to agent
Parameters:
x_userid TEXT agent user ID
x_call_id TEXT call ID
Returns: TEXT status
Function pbx.agent_call_whisper
Initiate agent whisper on another agent call
Parameters:
x_userid TEXT user ID of whispering agent
x_duserid TEXT user ID of destination agent
Returns: TEXT status
Function pbx.agent_create
Create new agent
Parameters:
x_userid TEXT agent user ID
Returns: TEXT status
Function pbx.agent_delete
Delete agent
Parameters:
x_userid TEXT agent user ID
Returns: TEXT status
Function pbx.agent_dial
Dial call to agent
Parameters:
x_userid TEXT user ID
x_number TEXT target number
x_params JSONB optional parameters and variables to be passed to diaplan (outgoing_cid_num)
Returns: TEXT status
Function pbx.agent_hangup
Hangup pending agent call
Parameters:
x_userid TEXT user ID
Returns: TEXT status
Function pbx.agent_is_available
Returns true if agent is available for incoming call (from queue or direct one)
Parameters:
x_userid TEXT user ID
x_direct_call BOOLEAN
Returns: BOOLEAN
Function pbx.agent_login
Login agent
Parameters:
x_userid TEXT user ID
x_exten TEXT phone extensions
x_queues TEXT[] list of queues to login to (optional)
x_attrs JSON attributes (optional)
Returns: TEXT status
Function pbx.agent_logout
Logout agent
Parameters:
x_userid TEXT user ID
x_reason TEXT logout reason (optional)
Returns: TEXT status
Function pbx.agent_pause
Pause agent
Parameters:
x_userid TEXT agent user ID
x_reason TEXT pause reason (name of state) (optional)
x_attrs JSON pause attributes (optional)
Returns: TEXT status
Function pbx.agent_se_previous_state
Return agent to previous state
Parameters:
x_userid TEXT agent user ID
Returns: TEXT status
Function pbx.agent_set_attr
Set attribute for agent
Parameters:
x_userid TEXT agent user ID
x_attr JSON attribute(s) to set
Returns: TEXT status
Function pbx.agent_set_call_forward
Set call forward for agent.
Parameters:
x_forward_type TEXT forward type (only CFU now)
x_userid TEXT source agent user ID
x_duserid TEXT target agent user ID
x_dnum TEXT target line number
Returns: TEXT status
Function pbx.agent_skill_add
Add skill to agent
Parameters:
x_userid TEXT agent user ID
x_skill TEXT name of the skill to add
Returns: TEXT status
Function pbx.agent_skill_remove
Remove skill from agent
Parameters:
x_userid TEXT agent user ID
x_skill TEXT name of the skill to remove
Returns: TEXT status
Function pbx.agent_unpause
Unpause agent
Parameters:
x_userid TEXT agent user ID
Returns: TEXT status
Function pbx.call_att_transfer
Attended transfer of call to destination extension at given context
Parameters:
x_call_id TEXT call ID
x_dst_exten TEXT destination extensions
x_dst_context TEXT destination context (optional)
x_fail_on_busy BOOLEAN if is set, then return error when agent exten is busy (optional)
Returns: TEXT status
Function pbx.call_hangup
Request call hangup
Parameters:
x_call_id TEXT call ID
Returns: TEXT status
Function pbx.call_hold
Put call on hold
Parameters:
x_call_id TEXT call ID
Returns: TEXT status
Function pbx.call_mixmonitor_mute
(un)mute call mixmonitor
Parameters:
x_call_id TEXT call ID
x_direction TEXT direction (optional)
Returns: TEXT status
Function pbx.call_soft_hangup
Hangup all ringing channels
Parameters:
x_exten TEXT exten for which i want to hangup all incoming channels
x_caller_num TEXT caller num to identify right call_id
Returns: TEXT status
Function pbx.call_transfer
Transfer call to destination extension at given context
Parameters:
x_call_id TEXT call ID
x_dst_exten TEXT destination extensions
x_dst_context TEXT destination context (optional)
x_src_exten TEXT transferring exten (optional)
x_params ARRAY - list of optional variable+value pairs to pass to transferred channel
Returns: TEXT status
Function pbx.chan_optimize_away
Try to optimize away Local channel
Parameters:
x_channel TEXT name of the channel
Returns: TEXT status
Function pbx.channel_transfer
Transfer channel to destination extension at given context
Parameters:
x_channame TEXT channel name
x_dst_exten TEXT destination extensions
x_dst_context TEXT destination context
Returns: TEXT status
Function pbx.create_embedded_phone_token
Delete expired authentication tokens for embedded phone @function pbx.create_embedded_phone_token()
Function pbx.create_embedded_phone_token
Create authentication token for embedded phone @function pbx.create_embedded_phone_token() @param type TEXT agent/line @param target TEXT user ID or line number @returns token TEXT, expiration TIMESTAMPTZ
Parameters:
type TEXT agent/line
target TEXT user ID or line number
Returns: token TEXT, expiration TIMESTAMPTZ
Function pbx.dial
Dial number1 first, after number1 answer, dial number2. number1 and number2 can be Internal line or Public number. We recommend to use /exten_dial or /agent_dial as first choice for dialing as these functions have aditional validity and busy checks. outgoing_cid_num1 TEXT outgoing caller identification number (optional) outgoing_cid_num2 TEXT outgoing callee identification number (optional) outgoing_cid_name1 TEXT caller outgoing name (optional) outgoing_cid_name2 TEXT callee outgoing name (optional) outgoing_rdnis1 TEXT caller RDNIS (billing) number (optional) outgoing_rdnis2 TEXT callee RDNIS (billing) number (optional) additional variables as key, value pairs )
Parameters:
x_number1 TEXT first dialed number or extension
x_number2 TEXT second dialed number or extension
x_context1 TEXT caller context default pbx_dial_caller
x_context2 TEXT caller context default pbx_dial_callee
x_params JSON optional parameters (
Returns: TEXT status
Function pbx.dp_check_acl_group
Parameters:
x_group_uid TEXT group_uid where to check the number(x_number)
x_number TEXT number to check in group
Returns: TEXT found number/pattern
Function pbx.exten_call_answer
Answer call ringing on particular extension by transferint it to auto_answer context
Parameters:
exten TEXT extension
call_id TEXT call ID (optional)
Returns: TEXT status
Function pbx.exten_call_att_transfer
Attended transfer call from extension to another at given context
Parameters:
x_exten TEXT extension
x_dst_exten TEXT destination extension
x_dst_context TEXT destination context (optional)
Returns: TEXT status
Function pbx.exten_call_bargein
Join exten into another exten call
Parameters:
x_exten TEXT barging extension
x_dst_exten TEXT destination extension
Returns: TEXT status
Function pbx.exten_call_hold
Put call on hold for given extensions
Parameters:
x_exten TEXT extensions
x_call_id TEXT call ID
Returns: TEXT status
Function pbx.exten_call_spy
Initiate exten call spy on another extension call
Parameters:
x_exten TEXT spying extension
x_dst_exten TEXT destination extension
Returns: TEXT status
Function pbx.exten_call_transfer
Transfer call from extension to another at given context
Parameters:
x_exten TEXT extension
x_dst_exten TEXT destination extension
x_dst_context TEXT destination context (optional)
x_params ARRAY - list of optional variable+value pairs to pass to transferred channel
Returns: TEXT status
Function pbx.exten_call_unhold
Transfer held call back to extension
Parameters:
x_exten TEXT extension
x_call_id TEXT call ID
Returns: TEXT status
Function pbx.exten_call_whisper
Initiate exten call whisper on another extension call
Parameters:
x_exten TEXT whispering extension
x_dst_exten TEXT destination extension
Returns: TEXT status
Function pbx.exten_change_number
Change extension number
Parameters:
x_exten TEXT current phone extension
x_new_exten TEXT new phone extension
Returns: TEXT status
Function pbx.exten_dial
Dial call to extension
Parameters:
x_exten TEXT phone extension
x_number TEXT target number
x_outgoing_cid_num TEXT outgoing caller identification (number)
x_params JSON optional parameters
Returns: TEXT status
Function pbx.exten_hangup
Request exten call hangup
Parameters:
x_exten TEXT phone extension
Returns: TEXT status
Function pbx.exten_is_available
Returns true if exten is available for incoming call (from queue or direct one)
Parameters:
x_exten TEXT user ID
x_direct_call BOOLEAN - DEPRECATED, UNUSED TODO REFACTOR
x_queue TEXT
Returns: BOOLEAN
Function pbx.exten_set_mode
Changes dialplan mode for extension
Parameters:
x_exten TEXT user ID
x_mode INTEGER - new mode
Returns: TEXT status
Function pbx.get_active_calls
get calls overview
Returns: calls
Function pbx.get_active_calls_v2
get calls overview
Returns: calls
Function pbx.get_active_held_calls
Return list of currently held calls
Function pbx.get_agent_option
get agent option value (or global, if agent does not have it set)
Parameters:
x_userid TEXT user ID
x_option TEXT option name
Returns: option value
Function pbx.get_agents
get agents
Parameters:
userid TEXT user ID (optional)
Returns: agents
Function pbx.get_calls_overview_v2
get calls overview
Parameters:
x_ts_from TIMESTAMPTZ from timestamp
x_ts_to TIMESTAMPTZ to timestamp
x_call_id INT only call_id (optional)
x_finished_call_id INT only greater than or equal to finished_call_id (optional)
x_limit INT only first N calls (optional)
Returns: calls
Function pbx.get_exten_from_channame
Return number of extension from the name of SIP or SCCP channel
Parameters:
x_channame TEXT asterisk channel name
Returns: TEXT extension number
Function pbx.get_exten_from_channame2
Return number of extension from the name of SIP or SCCP channel
Parameters:
x_channame TEXT asterisk channel name
x_call_id TEXT asterisk call_id
Returns: TEXT extension number
Function pbx.get_exten_last_call_id
Return call id of exten last call (finished or pending)
Parameters:
x_exten TEXT extension
Returns: TEXT call id
Function pbx.get_group_numbers
Get group numbers
Parameters:
x_group TEXT group name or group_uid
Returns: TEXT group_number
Function pbx.get_groups
Get groups
Parameters:
x_group TEXT group name or group_uid
x_lang TEXT language cs,en...
Returns: BOOLEAN tarif_group
Function pbx.get_incoming_numbers
get incoming route to agent or exten
Parameters:
x_number TEXT incoming number
x_target_type TEXT target type ("line"/"agent")
x_target TEXT target (exten or userid)
Returns: pbx.incoming_numbers data
Function pbx.get_random_element_from_string
Get random element from string if elements in string are separated by ',', one item can be excluded, if only one element in string, exclude is ignored
Parameters:
x_string TEXT string (for example 'ab,cd,ef')
x_exclude TEXT DEFAULT ''
Returns: TEXT
Function pbx.group_number_add
Add number to number group
Parameters:
x_group TEXT group name
x_number TEXT number
Returns: TEXT status
Function pbx.group_number_remove
Remove number from number group
Parameters:
x_group TEXT group name
x_number TEXT number
Returns: TEXT status
Function pbx.is_exten_busy
Returns true if exten is engaged in a call (incoming or outgoing)
Parameters:
x_exten TEXT exten number
Returns: BOOLEAN status
Function pbx.log
log message to lblogs.log with lbox.pbx appname, given severity and optional JSON attrs
Parameters:
x_severity lblogs.tmessage (DEBUG, NOTICE, WARNING, ERROR) - if loglevel is higher then x_severity, message is dropped
x_msg TEXT - message to log
x_attrs JSONB - attributes (optional)
Returns: VOID
Function pbx.normalize_number
Change number format into one of requested @function pbx.normalize_number() @param x_num TEXT phone number @param x_format TEXT number format: - international ie 00420777093799 - international2 ie 420777093799 - international_e164 ie +420777093799 - national ie 777093799 @returns TEXT normalized number
Parameters:
x_num TEXT phone number
x_format TEXT number format:
Returns: TEXT normalized number
Function pbx.queue_agent_add
Add agent to queue
Parameters:
x_queue TEXT queue name
x_userid TEXT agent user id
x_priority INTEGER (optional)
x_penalty INTEGER (optional)
Returns: TEXT status
Function pbx.queue_agent_remove
Add agent to queue
Parameters:
x_queue TEXT queue name
x_userid TEXT agent user id
x_priority INTEGER (optional)
Returns: TEXT status
Function pbx.queue_agent_set
Set exten queue attrs
Parameters:
x_userid TEXT user ID
x_queue TEXT queue name
x_attrs JSON attributes key/value json object, keys: paused, priority
Returns: JSON current_state
Function pbx.queue_exten_add
Add line to queue
Parameters:
x_queue TEXT queue name
x_exten TEXT exten
x_priority INTEGER (optional)
x_penalty INTEGER (optional)
Returns: TEXT status
Function pbx.queue_exten_pause
Pause exten in a queue, or all queues if none is given
Parameters:
x_exten TEXT exten
x_queue TEXT queue name
Returns: TEXT status
Function pbx.queue_exten_remove
Remove line from queue
Parameters:
x_queue TEXT queue name
x_exten TEXT exten
Returns: TEXT status
Function pbx.queue_exten_set
Set exten queue attrs
Parameters:
x_exten TEXT phone extensions
x_queue TEXT queue name
x_attrs JSON attributes key/value json object, keys: paused, priority
Returns: JSON current_state
Function pbx.queue_exten_unpause
Unpause exten in a queue or all queues if none is given
Parameters:
x_exten TEXT exten
x_queue TEXT queue name
Returns: TEXT status
Function pbx.queue_reload
Reload a queue, queues, or any sub-section of a queue or queues.
Parameters:
x_queue The name of the queue to take action on. If no queue name is specified, then all queues are affected.
x_reload_members Whether to reload the queue's members.
x_reload_rules Whether to reload queue rules.
x_reload_parameters Whether to reload the other queue options.
Returns: TEXT status
Function pbx.queue_sip_add
Add SIP line to queue
Parameters:
x_queue TEXT queue name
x_exten TEXT SIP exten
x_priority INTEGER (optional)
x_penalty INTEGER (optional)
Returns: TEXT status
Function pbx.queue_sip_remove
Remove SIP line from queue
Parameters:
x_queue TEXT queue name
x_exten TEXT SIP exten
Returns: TEXT status
Function pbx.reload
Reload asterisk module
Parameters:
x_module TEXT module name
Returns: TEXT status
Function pbx.sccp_line_create
Provision new SCCP line
Parameters:
x_linenum TEXT line number
x_description TEXT line description
x_attrs JSON additional attributes (optional)
Returns: TEXT status
Function pbx.sccp_line_delete
Deprovision SCCP line
Parameters:
x_linenum TEXT line number
Returns: TEXT status
Function pbx.search_contact
Search contact in address book if is installed @function pbx.search_contact() @param x_number TEXT phone number @returns TEXT contact name
Parameters:
x_number TEXT phone number
Returns: TEXT contact name
Function pbx.set_call_tag
Insert call tag for specified call into cel table
Parameters:
x_call_id TEXT call id
x_tag TEXT tag
Returns: NULL
Function pbx.set_devstate
Set asterisk custom device state
Parameters:
x_device TEXT name the device to change state
x_state TEXT the state to set
Returns: TEXT status
Function pbx.set_incoming_number
Set incoming number route to agent or exten
Parameters:
x_number TEXT incoming number
x_target_type TEXT target type ("line"/"agent")
x_target TEXT target (exten or userid)
x_attrs JSON additional route attributes (optional)
Returns: TEXT status
Function pbx.set_incoming_numbers
Set/replace incoming route to agent or exten for multiple numbers
Parameters:
x_numbers TEXT[] list of incoming numbers
x_target_type TEXT target type ("exten"/"agent")
x_target TEXT target (exten or userid)
Returns: TEXT status
Function pbx.set_variable
Set asterisk variable (channel or global)
Parameters:
x_variable TEXT name of the variable
x_value TEXT value to set
x_channel TEXT name of the channel (optional)
Returns: TEXT status
Function pbx.sip_line_create
Provision new SIP line
Parameters:
x_linenum TEXT line number
x_description TEXT line description
x_secret
x_transport TEXT type of transport (optional)
x_attrs JSON additional attributes (optional)
Returns: TEXT status
Function pbx.sip_line_delete
Deprovision SIP line
Parameters:
x_linenum TEXT line number
Returns: TEXT status
Function pbx.sorcery_expire
Expire (remove) ALL objects from a sorcery memory cache.
Parameters:
x_cache_name TEXT name of the cache
Returns: TEXT status
Function pbx.sorcery_expire_object
Expire (remove) an object from a asterisk sorcery memory cache.
Parameters:
x_cache_name TEXT name of the cache
x_object_name TEXT name of the object to expire
Returns: TEXT status
Function pbx.sorcery_expire_pjsip
Expire (remove) ALL objects from a sorcery pjsip memory caches.
Returns: TEXT status
Function pbx.sorcery_populate
Expire all objects from asterisk memory cache and populate it with all objects from the backend
Parameters:
x_cache_name TEXT name of the cache
Returns: TEXT status
Function pbx.sorcery_populate_pjsip
Expire all objects from asterisk pjsip memory cache and populate it with all objects from the backend
Returns: TEXT status
Function pbx.virt_line_create
Provision new VIRT line
Parameters:
x_linenum TEXT line number
x_linename TEXT name of line
x_attrs JSON additional attributes (optional)
Returns: TEXT status
Function pbx.virt_line_delete
Deprovision VIRTUAL line
Parameters:
x_linenum TEXT line number
Returns: TEXT status
Function pbx.vpn_line_create
Provision new VPN line
Parameters:
x_linenum TEXT line number
x_linename TEXT name of line
x_vpn_number TEXT vpn number
x_attrs JSON additional attributes (optional)
Returns: TEXT status
Function pbx.vpn_line_delete
Deprovision VPN line
Parameters:
x_linenum TEXT line number
Returns: TEXT status