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

Function w_t_reply_body

modules/tm/t_reply.c:1879–1925  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1877
1878
1879int w_t_reply_body(struct sip_msg* msg, unsigned int* code, str *text,
1880 str *body)
1881{
1882 struct cell *t;
1883 int r, lock_replies = 1;
1884
1885 if (msg->REQ_METHOD==METHOD_ACK) {
1886 LM_DBG("ACKs are not replied\n");
1887 return 0;
1888 }
1889
1890 switch (route_type) {
1891 case FAILURE_ROUTE:
1892 t=get_t();
1893 if ( t==0 || t==T_UNDEFINED ) {
1894 LM_BUG("no transaction found in Failure Route\n");
1895 return -1;
1896 }
1897 lock_replies = 0;
1898 break;
1899 case REQUEST_ROUTE:
1900 t=get_t();
1901 if ( t==0 || t==T_UNDEFINED ) {
1902 /* t_reply_with_body() is a bit of a weird function as it is
1903 * receiving as parameter the actual msg, but the transaction
1904 * (and uses the saved msg from transaction).
1905 * So we need to take care and save everything into transaction,
1906 * otherwise we will loose the rpl lumps. --bogdan */
1907 r = t_newtran( msg, 1/*full uas cloning*/ );
1908 if (r==0) {
1909 /* retransmission -> break the script */
1910 return 0;
1911 } else if (r<0) {
1912 LM_ERR("could not create a new transaction\n");
1913 return -1;
1914 }
1915 t=get_t();
1916 } else {
1917 update_cloned_msg_from_msg( t->uas.request, msg);
1918 }
1919 break;
1920 default:
1921 LM_CRIT("unsupported route_type (%d)\n", route_type);
1922 return -1;
1923 }
1924 return _reply_with_body(t, *code, text, body, 0, 0, lock_replies);
1925}
1926
1927
1928int t_reply_with_body( struct cell *trans, unsigned int code, str *text,

Callers

nothing calls this directly

Calls 4

get_tFunction · 0.85
t_newtranFunction · 0.85
_reply_with_bodyFunction · 0.85

Tested by

no test coverage detected