MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / lua_do_action

Function lua_do_action

modules/lua/sipapi.c:751–792  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

749}
750
751static int lua_do_action(lua_State *L, struct sip_msg* msg,
752 struct action *act, const cmd_export_t *cmd, int *retval)
753{
754 void* cmdp[MAX_CMD_PARAMS];
755 pv_value_t tmp_vals[MAX_CMD_PARAMS];
756 int i;
757 const struct cmd_param *param;
758 gparam_p gp;
759
760 if (fix_cmd(cmd->params, act->elem) < 0) {
761 LM_ERR("Failed to fix command <%s>\n", cmd->name);
762 return luaL_error(L, "failed to fix command");
763 }
764
765 if (get_cmd_fixups(msg, cmd->params, act->elem, cmdp, tmp_vals) < 0) {
766 LM_ERR("Failed to get fixups for command <%s>\n", cmd->name);
767 return luaL_error(L, "failed to get fixups for command");
768 }
769
770 *retval = cmd->function(msg,
771 cmdp[0],cmdp[1],cmdp[2],
772 cmdp[3],cmdp[4],cmdp[5],
773 cmdp[6],cmdp[7]);
774
775 for (param=cmd->params, i=1; param->flags; param++, i++) {
776 gp = (gparam_p)act->elem[i].u.data;
777 if (!gp)
778 continue;
779
780 if (param->free_fixup && param->free_fixup(&cmdp[i-1]) < 0) {
781 LM_ERR("Failed to free fixup for param [%d]\n", i);
782 return luaL_error(L, "failed to free fixups");
783 }
784
785 if (param->flags & CMD_PARAM_REGEX && gp->type != GPARAM_TYPE_PVS) {
786 regfree((regex_t*)cmdp[i-1]);
787 pkg_free(cmdp[i-1]);
788 }
789 }
790
791 return 1;
792}
793
794static int l_siplua_moduleFunc(lua_State *L)
795{

Callers 1

l_siplua_moduleFuncFunction · 0.85

Calls 2

fix_cmdFunction · 0.85
get_cmd_fixupsFunction · 0.85

Tested by

no test coverage detected