mod_callcenter: Add agent-originate-check pre-originate hook#2990
Open
shaunjstokes wants to merge 2 commits intosignalwire:masterfrom
Open
mod_callcenter: Add agent-originate-check pre-originate hook#2990shaunjstokes wants to merge 2 commits intosignalwire:masterfrom
agent-originate-check pre-originate hook#2990shaunjstokes wants to merge 2 commits intosignalwire:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2989
Summary
agent-originate-checkattribute that executes a FreeSWITCH API command before originating"false", originate is skipped — no SIP INVITE, no call legChanges
src/mod/applications/mod_callcenter/mod_callcenter.c:agent_originate_check VARCHAR(1024)to agents table schemaswitch_cache_db_test_reactive()for existing databasesagent_originate_checkfield tocc_agent_update()for runtimeagent setcommandsagent-originate-checkXML attribute inload_agent()agent_originate_checkto all three SQLSELECTqueries (positionargv[19])switch_api_execute()beforeswitch_ivr_originate()SUBSCRIBER_ABSENTcause handling with configurable delay (no_answer_delay_time, 5s floor)How It Works
mod_callcenterselects an agent and checks ifagent_originate_checkis setapi_cmdandapi_argsswitch_api_execute(api_cmd, api_args, NULL, &stream)stream.dataequals"false"(case-insensitive), askip_originateflag is setSUBSCRIBER_ABSENTand the normal failure path runs (settingdelay_next_agent_call)switch_ivr_originate()proceeds as normalDesign Decisions
lua,curl,python, or any registered FreeSWITCH API commandgoto done— the skip flows through the existing failure handling block sodelay_next_agent_callis set correctly, preventing tight agent loopsskip_originateflag — avoids altering the existingstatusvariable which is initialised toSWITCH_STATUS_FALSEno_answer_delay_timewith a 5-second minimum floor to prevent rapid cyclingTesting
agent-originate-checkwith a Lua script that queries a SIP registrar databaseExample Usage
XML config:
Runtime via
fs_cli: