Module: kamailio Branch: master Commit: 5f711554a21df4463f647a0d4c5df5ec9563099e URL: https://github.com/kamailio/kamailio/commit/5f711554a21df4463f647a0d4c5df5ec9563099e
Author: Daniel-Constantin Mierla <[email protected]> Committer: Daniel-Constantin Mierla <[email protected]> Date: 2025-10-14T11:36:03+02:00 dialog: added dlg_refer_did(...) - send refer by did --- Modified: src/core/mod_fix.c Modified: src/core/mod_fix.h Modified: src/modules/dialog/dialog.c --- Diff: https://github.com/kamailio/kamailio/commit/5f711554a21df4463f647a0d4c5df5ec9563099e.diff Patch: https://github.com/kamailio/kamailio/commit/5f711554a21df4463f647a0d4c5df5ec9563099e.patch --- diff --git a/src/core/mod_fix.c b/src/core/mod_fix.c index aa632635bc1..efc249a5c42 100644 --- a/src/core/mod_fix.c +++ b/src/core/mod_fix.c @@ -1135,6 +1135,40 @@ int fixup_free_iss(void **param, int param_no) } } +/** + * + */ +int fixup_iiss(void **param, int param_no) +{ + switch(param_no) { + case 1: + case 2: + return fixup_igp_null(param, 1); + case 3: + case 4: + return fixup_spve_null(param, 1); + default: + return E_UNSPEC; + } +} + +/** + * + */ +int fixup_free_iiss(void **param, int param_no) +{ + switch(param_no) { + case 1: + case 2: + return fixup_free_igp_null(param, 1); + case 3: + case 4: + return fixup_free_spve_null(param, 1); + default: + return E_UNSPEC; + } +} + /** * */ diff --git a/src/core/mod_fix.h b/src/core/mod_fix.h index f0e6f0e47f4..f58e150d611 100644 --- a/src/core/mod_fix.h +++ b/src/core/mod_fix.h @@ -193,6 +193,9 @@ int fixup_free_isi(void **param, int param_no); int fixup_iss(void **param, int param_no); int fixup_free_iss(void **param, int param_no); +int fixup_iiss(void **param, int param_no); +int fixup_free_iiss(void **param, int param_no); + int fixup_isii(void **param, int param_no); int fixup_free_isii(void **param, int param_no); diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c index 1ddaef3f6b7..93d547e4ea9 100644 --- a/src/modules/dialog/dialog.c +++ b/src/modules/dialog/dialog.c @@ -190,6 +190,7 @@ static int w_dlg_reset_property(struct sip_msg *msg, char *prop, char *s2); static int w_dlg_manage(struct sip_msg *, char *, char *); static int w_dlg_bye(struct sip_msg *, char *, char *); static int w_dlg_refer(struct sip_msg *, char *, char *); +static int w_dlg_refer_did(sip_msg_t *, char *, char *, char *, char *); static int w_dlg_bridge(struct sip_msg *, char *, char *, char *); static int w_dlg_set_timeout(struct sip_msg *, char *, char *, char *); static int w_dlg_set_timeout_by_profile2(struct sip_msg *, char *, char *); @@ -265,6 +266,8 @@ static cmd_export_t cmds[]={ 0, ANY_ROUTE }, {"dlg_refer",(cmd_function)w_dlg_refer, 2,fixup_dlg_refer, 0, ANY_ROUTE }, + {"dlg_refer_did",(cmd_function)w_dlg_refer_did, 4,fixup_iiss, + fixup_free_iiss, ANY_ROUTE }, {"dlg_bridge",(cmd_function)w_dlg_bridge, 3,fixup_dlg_bridge, 0, ANY_ROUTE }, {"dlg_get",(cmd_function)w_dlg_get, 3,fixup_dlg_bridge, @@ -1576,6 +1579,58 @@ static int w_dlg_refer(struct sip_msg *msg, char *side, char *to) return -1; } +static int w_dlg_refer_did( + sip_msg_t *msg, char *entry, char *id, char *side, char *to) +{ + dlg_cell_t *dlg = NULL; + int h_entry = 0; + int h_id = 0; + str sside = {0, 0}; + str sto = {0, 0}; + + if(fixup_get_ivalue(msg, (gparam_t *)entry, &h_entry) != 0) { + LM_ERR("unable to get entry\n"); + goto error; + } + if(fixup_get_ivalue(msg, (gparam_t *)id, &h_id) != 0) { + LM_ERR("unable to get id\n"); + goto error; + } + if(fixup_get_svalue(msg, (gparam_t *)side, &sside) != 0) { + LM_ERR("unable to get side\n"); + goto error; + } + if(fixup_get_svalue(msg, (gparam_t *)to, &sto) != 0) { + LM_ERR("unable to get To\n"); + goto error; + } + if(sto.s == NULL || sto.len == 0) { + LM_ERR("invalid To parameter\n"); + goto error; + } + dlg = dlg_lookup((unsigned int)h_entry, (unsigned int)h_id); + if(dlg == NULL) { + LM_DBG("dialog not found (%d:%d)\n", h_entry, h_id); + goto error; + } + if(sside.len == 6 && strncasecmp(sside.s, "caller", 6) == 0) { + if(dlg_transfer(dlg, &sto, DLG_CALLER_LEG) != 0) + goto error; + } else { + if(dlg_transfer(dlg, &sto, DLG_CALLEE_LEG) != 0) + goto error; + } + + dlg_release(dlg); + return 1; + +error: + if(dlg != NULL) { + dlg_release(dlg); + } + return -1; +} + static int w_dlg_bridge(struct sip_msg *msg, char *from, char *to, char *op) { str sf = {0, 0}; _______________________________________________ Kamailio - Development Mailing List -- [email protected] To unsubscribe send an email to [email protected] Important: keep the mailing list in the recipients, do not reply only to the sender!
