| 5502 | } |
| 5503 | |
| 5504 | int pv_get_spec_value(struct sip_msg* msg, const pv_spec_p sp, pv_value_t *value) |
| 5505 | { |
| 5506 | struct sip_msg* pv_msg; |
| 5507 | |
| 5508 | if(msg==NULL || sp==NULL || sp->getf==NULL || value==NULL |
| 5509 | || sp->type==PVT_NONE) |
| 5510 | { |
| 5511 | LM_ERR("bad parameters\n"); |
| 5512 | return -1; |
| 5513 | } |
| 5514 | |
| 5515 | memset(value, 0, sizeof(pv_value_t)); |
| 5516 | |
| 5517 | if(sp->pvc && sp->pvc->contextf) |
| 5518 | { |
| 5519 | LM_DBG("Found context function %p\n", sp->pvc->contextf); |
| 5520 | pv_msg = sp->pvc->contextf(msg); |
| 5521 | if(pv_msg == NULL || pv_msg==FAKED_REPLY) |
| 5522 | { |
| 5523 | LM_DBG("Invalid %p pv context message\n",pv_msg); |
| 5524 | return pv_get_null( NULL, NULL, value); |
| 5525 | } |
| 5526 | } else { |
| 5527 | pv_msg = msg; |
| 5528 | } |
| 5529 | if((*sp->getf)(pv_msg, &(sp->pvp), value)!=0) |
| 5530 | return pv_get_null( NULL, NULL, value); |
| 5531 | if(sp->trans) |
| 5532 | if (run_transformations(pv_msg, (trans_t*)sp->trans, value)!=0) |
| 5533 | return pv_get_null( NULL, NULL, value); |
| 5534 | return 0; |
| 5535 | } |
| 5536 | |
| 5537 | int pv_print_spec(struct sip_msg* msg, const pv_spec_p sp, char *buf, int *len) |
| 5538 | { |
no test coverage detected