| 1492 | } |
| 1493 | |
| 1494 | static int w_get_timestamp(struct sip_msg *msg, pv_spec_t *sec_avp, |
| 1495 | pv_spec_t *usec_avp) |
| 1496 | { |
| 1497 | int sec,usec; |
| 1498 | int avp_name; |
| 1499 | int_str res; |
| 1500 | unsigned short avp_type; |
| 1501 | |
| 1502 | if (get_timestamp(&sec,&usec) == 0) { |
| 1503 | if (pv_get_avp_name(msg, &(sec_avp->pvp), &avp_name, |
| 1504 | &avp_type) != 0) { |
| 1505 | LM_CRIT("BUG in getting AVP name\n"); |
| 1506 | return -1; |
| 1507 | } |
| 1508 | |
| 1509 | res.n = sec; |
| 1510 | if (add_avp(avp_type, avp_name, res) < 0) { |
| 1511 | LM_ERR("cannot add AVP\n"); |
| 1512 | return -1; |
| 1513 | } |
| 1514 | |
| 1515 | if (pv_get_avp_name(msg, &(usec_avp->pvp), &avp_name, |
| 1516 | &avp_type) != 0) { |
| 1517 | LM_CRIT("BUG in getting AVP name\n"); |
| 1518 | return -1; |
| 1519 | } |
| 1520 | |
| 1521 | res.n = usec; |
| 1522 | if (add_avp(avp_type, avp_name, res) < 0) { |
| 1523 | LM_ERR("cannot add AVP\n"); |
| 1524 | return -1; |
| 1525 | } |
| 1526 | } else { |
| 1527 | LM_ERR("failed to get time\n"); |
| 1528 | return -1; |
| 1529 | } |
| 1530 | |
| 1531 | return 1; |
| 1532 | } |
| 1533 | |
| 1534 | static int w_script_trace(struct sip_msg *msg, int *log_level, |
| 1535 | pv_elem_t *fmt_string, void *info_str) |
nothing calls this directly
no test coverage detected