MCPcopy Create free account
hub / github.com/SIPp/sipp / get_last_request_uri

Method get_last_request_uri

src/call.cpp:1567–1606  ·  view source on GitHub ↗

Return the last request URI from the To header. On any error returns the * empty string. The caller must free the result. */

Source from the content-addressed store, hash-verified

1565/* Return the last request URI from the To header. On any error returns the
1566 * empty string. The caller must free the result. */
1567char * call::get_last_request_uri()
1568{
1569 char * tmp;
1570 char * tmp2;
1571 char * last_request_uri;
1572 int tmp_len;
1573
1574 char * last_To = get_last_header("To:");
1575 if (!last_To) {
1576 return strdup("");
1577 }
1578
1579 tmp = strchr(last_To, '<');
1580 if (!tmp) {
1581 return strdup("");
1582 }
1583 tmp++;
1584
1585 tmp2 = strchr(last_To, '>');
1586 if (!tmp2) {
1587 return strdup("");
1588 }
1589
1590 tmp_len = strlen(tmp) - strlen(tmp2);
1591 if (tmp_len < 0) {
1592 return strdup("");
1593 }
1594
1595 if (!(last_request_uri = (char *)malloc(tmp_len + 1))) {
1596 ERROR("Cannot allocate!");
1597 }
1598
1599 last_request_uri[0] = '\0';
1600 if (tmp_len > 0) {
1601 memcpy(last_request_uri, tmp, tmp_len);
1602 }
1603 last_request_uri[tmp_len] = '\0';
1604
1605 return last_request_uri;
1606}
1607
1608char * call::send_scene(int index, int *send_status, int *len)
1609{

Callers

nothing calls this directly

Calls 1

ERRORFunction · 0.85

Tested by

no test coverage detected