Skip to content

Commit 75a17b4

Browse files
committed
[tm] Updated the XML doc for t_reply_by_callid()
Completes 870f322
1 parent 870f322 commit 75a17b4

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

modules/tm/doc/tm_admin.xml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1881,6 +1881,66 @@ if (is_method("ACK|CANCEL") && !t_check_trans()) {
18811881
</example>
18821882
</section>
18831883

1884+
<section id="func_t_reply_by_callid" xreflabel="t_reply_by_callid()">
1885+
<title>
1886+
<function moreinfo="none">t_reply_by_callid(code, reason_phrase, [callid], [cseq])</function>
1887+
</title>
1888+
<para>
1889+
This function is used to send a reply to an existing INVITE
1890+
transaction. The usual use case is when OpenSIPS is used as an UAS
1891+
and when an INVITE is receveid, it is "parked" locally on
1892+
OpenSIPS by replying to it with
1893+
<quote>t_reply(180, "Ringing")</quote> or
1894+
<quote>t_reply(183, "Session Progress")</quote>
1895+
and later we need to handle CANCEL or BYE for it and send
1896+
'487 Request Terminated' to the original INVITE transaction.
1897+
</para>
1898+
<para>
1899+
The callid and cseq used to identify the transaction
1900+
will be obtained from the current messsage being processed.
1901+
But they can be passed explicitly so that for example we can
1902+
handle a BYE where the cseq must be the cseq
1903+
of the INVITE minus one.
1904+
</para>
1905+
<para>
1906+
This function can be used from REQUEST_ROUTE.
1907+
</para>
1908+
<example>
1909+
<title><function>t_reply_by_callid</function> usage</title>
1910+
<programlisting format="linespecific">
1911+
...
1912+
route{
1913+
if($rU == "LOCAL_PARK") {
1914+
if(is_method("INVITE")) {
1915+
$T_fr_timeout = 10;
1916+
$T_fr_inv_timeout = 10;
1917+
append_to_reply("Contact: sip:LOCAL_PARK@$socket_in(ip):$socket_in(port)\r\n");
1918+
t_reply(180, "Ringing");
1919+
t_wait_for_new_branches();
1920+
} else if(is_method("CANCEL")) {
1921+
if(!t_reply_by_callid(487, "Request Terminated")) {
1922+
sl_send_reply(481, "Call Leg/Transaction Does Not Exist");
1923+
} else {
1924+
sl_send_reply(200, "OK");
1925+
}
1926+
} else if(is_method("BYE")) {
1927+
$var(prev_cseq) = ($(cs{s.int}) - 1);
1928+
if(!t_reply_by_callid(487, "Request Terminated", , $var(prev_cseq))) {
1929+
sl_send_reply(481, "Call Leg/Transaction Does Not Exist");
1930+
} else {
1931+
sl_send_reply(200, "OK");
1932+
}
1933+
} else if(is_method("ACK")) {
1934+
t_relay();
1935+
}
1936+
exit;
1937+
}
1938+
}
1939+
...
1940+
</programlisting>
1941+
</example>
1942+
</section>
1943+
18841944
</section>
18851945

18861946
<section id="exported_pseudo_variables" xreflabel="Exported Pseudo-Variables">

0 commit comments

Comments
 (0)