Module: kamailio
Branch: master
Commit: 8675fd282bb5cad4e349dbb85f9ca7fc31e44167
URL:
https://github.com/kamailio/kamailio/commit/8675fd282bb5cad4e349dbb85f9ca7f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2016-04-19T15:00:33+02:00
python: use rewrite_uri() instead of core action for updating r-uri
---
Modified: modules/app_python/python_msgobj.c
---
Diff:
https://github.com/kamailio/kamailio/commit/8675fd282bb5cad4e349dbb85f9ca7f…
Patch:
https://github.com/kamailio/kamailio/commit/8675fd282bb5cad4e349dbb85f9ca7f…
---
diff --git a/modules/app_python/python_msgobj.c b/modules/app_python/python_msgobj.c
index 020a17e..f27f7c3 100644
--- a/modules/app_python/python_msgobj.c
+++ b/modules/app_python/python_msgobj.c
@@ -72,9 +72,7 @@ static PyObject *msg_copy(msgobject *self)
static PyObject *msg_rewrite_ruri(msgobject *self, PyObject *args)
{
- char *ruri;
- struct action act;
- struct run_act_ctx ra_ctx;
+ str nuri;
if (self->msg == NULL) {
PyErr_SetString(PyExc_RuntimeError, "self->msg is NULL");
@@ -88,19 +86,13 @@ static PyObject *msg_rewrite_ruri(msgobject *self, PyObject *args)
return Py_None;
}
- if(!PyArg_ParseTuple(args, "s:rewrite_ruri", &ruri))
+ if(!PyArg_ParseTuple(args, "s:rewrite_ruri", &nuri.s))
return NULL;
- memset(&act, '\0', sizeof(act));
-
- act.type = SET_URI_T;
- act.val[0].type = STRING_ST;
- act.val[0].u.str.s = ruri;
- act.val[0].u.str.len = strlen(ruri);
+ nuri.len = strlen(nuri.s);
- init_run_actions_ctx(&ra_ctx);
- if (do_action(&ra_ctx, &act, self->msg) < 0) {
- LM_ERR("Error in do_action\n");
+ if(rewrite_uri(self->msg, &nuri)<0) {
+ LM_ERR("failed to update r-uri with [%.*s]\n", nuri.len, nuri.s);
}
Py_INCREF(Py_None);