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

Function pv_get_dsturi_attr

pvar.c:1456–1499  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1454}
1455
1456static int pv_get_dsturi_attr(struct sip_msg *msg, pv_param_t *param,
1457 pv_value_t *res)
1458{
1459 struct sip_uri uri;
1460 unsigned short proto;
1461 str proto_s;
1462
1463 if(msg==NULL)
1464 return -1;
1465
1466 if (msg->dst_uri.s == NULL) {
1467 LM_DBG("no destination URI\n");
1468 return pv_get_null(msg, param, res);
1469 }
1470
1471 if(parse_uri(msg->dst_uri.s, msg->dst_uri.len, &uri)!=0)
1472 {
1473 LM_ERR("failed to parse dst uri\n");
1474 return pv_get_null(msg, param, res);
1475 }
1476
1477 if(param->pvn.u.isname.name.n==1) /* domain */
1478 {
1479 if(uri.host.s==NULL || uri.host.len<=0)
1480 return pv_get_null(msg, param, res);
1481 return pv_get_strval(msg, param, res, &uri.host);
1482 } else if(param->pvn.u.isname.name.n==2) /* port */ {
1483 if(uri.port.s==NULL)
1484 return pv_get_uintval(msg, param, res, get_uri_port(&uri, &proto));
1485 return pv_get_strintval(msg, param, res, &uri.port, (int)uri.port_no);
1486 } else if(param->pvn.u.isname.name.n==3) /* proto */ {
1487 if(uri.transport_val.s==NULL) {
1488 get_uri_port(&uri, &proto);
1489 proto_s.s = protos[proto].name;
1490 proto_s.len = proto_s.s ? strlen(proto_s.s) : 0;
1491 return pv_get_strintval(msg, param, res, &proto_s, (int)proto);
1492 }
1493 return pv_get_strintval(msg, param, res, &uri.transport_val,
1494 (int)uri.proto);
1495 }
1496
1497 LM_ERR("invalid specifier\n");
1498 return pv_get_null(msg, param, res);
1499}
1500
1501static int pv_get_content_type(struct sip_msg *msg, pv_param_t *param,
1502 pv_value_t *res)

Callers

nothing calls this directly

Calls 6

pv_get_nullFunction · 0.85
parse_uriFunction · 0.85
pv_get_strvalFunction · 0.85
pv_get_uintvalFunction · 0.85
get_uri_portFunction · 0.85
pv_get_strintvalFunction · 0.85

Tested by

no test coverage detected