diff --git a/modules/b2b_logic/b2b_load.h b/modules/b2b_logic/b2b_load.h index debd62d9b44..597a56160b6 100644 --- a/modules/b2b_logic/b2b_load.h +++ b/modules/b2b_logic/b2b_load.h @@ -57,6 +57,8 @@ typedef struct b2bl_init_params { str e2_to; str e1_from_dname; str e2_from_dname; + str ctx_key; + str ctx_val; } b2bl_init_params_t; diff --git a/modules/b2b_logic/logic.c b/modules/b2b_logic/logic.c index ec99b1c4cf0..45f457c1608 100644 --- a/modules/b2b_logic/logic.c +++ b/modules/b2b_logic/logic.c @@ -2771,6 +2771,8 @@ str* b2bl_init_extern(struct b2b_params *init_params, /* set the context values given in the b2b_trigger_scenario MI cmd */ tuple->vals = local_ctx_vals; local_ctx_vals = NULL; + if (scen_params->ctx_key.len) + store_ctx_value(&tuple->vals, &scen_params->ctx_key, &scen_params->ctx_val); memset(&e1, 0, sizeof e1); memset(&e2, 0, sizeof e1); diff --git a/modules/call_center/call_center.c b/modules/call_center/call_center.c index 87ff10ac503..b20e6026ff0 100644 --- a/modules/call_center/call_center.c +++ b/modules/call_center/call_center.c @@ -46,6 +46,7 @@ static str rt_db_url = {NULL, 0};; static struct cc_data *data=NULL; static str b2b_scenario = str_init("call center"); static str b2b_scenario_agent = str_init("call center agent"); +static str b2b_logic_ctx_param = str_init("call_center"); /* b2b logic API */ b2bl_api_t b2b_api; @@ -168,6 +169,7 @@ static const param_export_t mod_params[]={ { "ccf_m_dissuading_column", STR_PARAM, &ccf_m_dissuading_column.s }, { "ccf_m_flow_id_column", STR_PARAM, &ccf_m_flow_id_column.s }, + { "b2b_logic_ctx_param", STR_PARAM, &b2b_logic_ctx_param.s }, { 0,0,0 } }; @@ -374,6 +376,7 @@ static int mod_init(void) ccf_m_queue_column.len = strlen(ccf_m_queue_column.s); ccf_m_dissuading_column.len = strlen(ccf_m_dissuading_column.s); ccf_m_flow_id_column.len = strlen(ccf_m_flow_id_column.s); + b2b_logic_ctx_param.len = strlen(b2b_logic_ctx_param.s); if (queue_pos_param.s) queue_pos_param.len = strlen(queue_pos_param.s); @@ -988,6 +991,10 @@ int set_call_leg( struct sip_msg *msg, struct cc_call *call, str *new_leg) b2b_params.e1_from_dname = call->caller_dn; b2b_params.e2_type = B2B_CLIENT; b2b_params.e2_to = *new_leg; + if (call->script_param.len) { + b2b_params.ctx_key = b2b_logic_ctx_param; + b2b_params.ctx_val = call->script_param; + } id = b2b_api.init(NULL, &b2b_scenario_agent, &b2b_params, b2bl_callback_agent, (void*)call, B2B_DESTROY_CB|B2B_REJECT_CB|B2B_BYE_CB, NULL); @@ -1014,6 +1021,10 @@ int set_call_leg( struct sip_msg *msg, struct cc_call *call, str *new_leg) b2b_params.e1_type = B2B_SERVER; b2b_params.e2_type = B2B_CLIENT; b2b_params.e2_to = *new_leg; + if (call->script_param.len) { + b2b_params.ctx_key = b2b_logic_ctx_param; + b2b_params.ctx_val = call->script_param; + } id = b2b_api.init(msg, &b2b_scenario, &b2b_params, b2bl_callback_customer, (void*)call, B2B_DESTROY_CB|B2B_REJECT_CB|B2B_BYE_CB, NULL /* custom_hdrs */ ); diff --git a/modules/call_center/doc/call_center_admin.xml b/modules/call_center/doc/call_center_admin.xml index 7caad0c38ef..f2dca530a06 100644 --- a/modules/call_center/doc/call_center_admin.xml +++ b/modules/call_center/doc/call_center_admin.xml @@ -864,6 +864,44 @@ modparam("call_center", "ccf_m_dissuading_column", "audio_dissuading") ... modparam("call_center", "ccf_m_flow_id_column", "audio_flow_id") ... + + + + +
+ <varname>b2b_logic_ctx_param</varname> (string) + + The name of the $b2b_logic.ctx variable that can be + used to retrieve the value of the parameter passed to + the function. + + + This parameter will be copied throughout all the B2B scenarios started + by the call_center module. NOTE that you can change the value of the current + scenario by writing into it, but the change will not be reflected in a + different scenario. + + + Default value is call_center. + + + + Set <varname>b2b_logic_ctx_param</varname> parameter + +... +modparam("call_center", "b2b_logic_ctx_param", "b2b_callid") +... +route[handle_call_center] { + ... + cc_handle_call("flow", $ci); + ... +} +... +route[b2b_handle_request] { + ... + xlog("Initial Callid is $b2b_logic.ctx(b2b_callid)\n"); + ... +}
@@ -898,6 +936,10 @@ modparam("call_center", "ccf_m_flow_id_column", "audio_flow_id") intended for custom integration of the call center module and it is 100% up to the script writer about the value and purpose of this parameter, OpenSIPS will not touch or interpret it. + You can retrieve the value of this parameter using the + $b2b_logic.ctx variable with the name + defined in the + parameter.