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

Function msg_set_pseudoVar

modules/python/python_msgobj.c:412–454  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

410}
411
412static PyObject *
413msg_set_pseudoVar(msgobject *self, PyObject *args)
414{
415 str hmodel;
416 pv_spec_t model;
417 int retval;
418 pv_value_t val;
419
420 if (self->msg == NULL) {
421 PyErr_SetString(PyExc_RuntimeError, "self->msg is NULL");
422 Py_INCREF(Py_None);
423 return Py_None;
424 }
425 if(!PyArg_ParseTuple(args, "ss", &hmodel.s,&val.rs.s)){
426 PyErr_SetString(PyExc_RuntimeError, "args is not valid");
427 Py_INCREF(Py_None);
428 return Py_None;
429 }
430
431 hmodel.len = strlen(hmodel.s);
432 val.rs.len = strlen(val.rs.s);
433 if (pv_parse_spec(&hmodel, &model) < 0)
434 {
435 Py_INCREF(Py_None);
436 return Py_None;
437 }
438 if(!pv_is_w(&model)){
439 Py_INCREF(Py_None);
440 return Py_None;
441 }
442 val.flags = PV_VAL_STR;
443 retval = pv_set_value(self->msg, &model, EQ_T, &val);
444 if (retval >= 0){
445 Py_INCREF(Py_None);
446 return Py_None;
447 }else{
448 Py_INCREF(Py_None);
449 return Py_None;
450 }
451 Py_INCREF(Py_None);
452 return Py_None;
453
454}
455
456PyDoc_STRVAR(copy_doc,
457"copy() -> msg object\n\

Callers

nothing calls this directly

Calls 2

pv_parse_specFunction · 0.85
pv_set_valueFunction · 0.85

Tested by

no test coverage detected