<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
####### Routing Logic ########<br>
<br>
<br>
# main request routing logic<br>
<br>
route{<br>
<br>
&nbsp;&nbsp;&nbsp; # if (!pike_check_req()) { exit; };<br>
<br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; if (!mf_process_maxfwd_header("10")) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sl_send_reply("483","Too Many Hops");<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; exit;<br>
&nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp;&nbsp;&nbsp; if(!sanity_check("1511", "7"))<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; xlog("Malformed SIP message from $si:$sp\n");<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; exit;<br>
&nbsp;&nbsp;&nbsp; }<br>
<br>
<u><b>topoh_required("1"); /* in order to test my function*/</b></u><br>
<br>
route(NAT);<br>
<br>
&nbsp;&nbsp;&nbsp; if (has_totag()) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; # sequential request withing a dialog should<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; # take the path determined by record-routing<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (loose_route()) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (is_method("BYE")) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; setflag(1); # do accounting ...<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; setflag(3); # ... even if the transaction fails<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; route(RELAY);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } else {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (is_method("SUBSCRIBE") &amp;&amp; uri == myself) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; # in-dialog subscribe requests<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; route(PRESENCE);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; exit;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ( is_method("ACK") ) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ( t_check_trans() ) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; # non loose-route, but stateful ACK; must be an ACK
after a 487 or e.g. 404 from upstream server<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; t_relay();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; exit;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } else {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; # ACK without matching transaction ... ignore and
discard.\n");<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; exit;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sl_send_reply("404","Not here");<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; exit;<br>
&nbsp;&nbsp;&nbsp; }<br>
....<br>
<br>
I try with {"topoh_required", (cmd_function)m_topoh, 1, fixup_uint_null
, <u><b>ANY_ROUTE</b></u>}
<br>
<br>
no change ! :( always the same error <br>
<br>
J&eacute;r&ocirc;me<br>
<br>
<br>
marius zbihlei a &eacute;crit&nbsp;:
<blockquote cite="mid:4C161822.90400@1and1.ro" type="cite"><a class="moz-txt-link-abbreviated" href="mailto:jerome.marchet@orange-ftgroup.com">jerome.marchet@orange-ftgroup.com</a>
wrote:
  <br>
  <blockquote type="cite">Thank you Marius,
    <br>
    <br>
I do loadmodule "/home/path/to/kamailio/modules/topoh/topoh.so"
    <br>
    <br>
and now I have another problem, When it starts, Kamailio says :
    <br>
    <br>
-----------------------------------------------------------------------------------------------
    <br>
    <br>
Not starting kamailio: invalid configuration file!
    <br>
    <br>
&nbsp;0(19622) : &lt;core&gt; [cfg.y:3329]: parse error in config file
/usr/local/etc/kamailio/kamailio.cfg, line 328, column 19: Command
cannot be used in the block
    <br>
    <br>
ERROR: bad config file (1 errors)
    <br>
----------------------------------------------------------------------------------------------------
    <br>
    <br>
  </blockquote>
Hello,
  <br>
In what block are you using the function ? As I check the module
exports you kind of have everything there . Can you provide a snippet
of your cfg that shows how the function is used along with the block
information (failure_route, reply_route)
  <br>
  <blockquote type="cite">I search on google and i find this:
    <br>
    <br>
<a class="moz-txt-link-freetext" href="http://www.mail-archive.com/users@lists.kamailio.org/msg07610.html">http://www.mail-archive.com/users@lists.kamailio.org/msg07610.html</a>
    <br>
    <br>
Is it the same problem for topoh as in this mail with tm ?
    <br>
  </blockquote>
Not quite. The tm "problem" is a design decision that somehow manifests
the same why as your problem
  <br>
  <br>
I suggest that you add the cmd with this line
  <br>
  <br>
{"topoh_required", (cmd_function)m_topoh, 1, fixup_uint_null ,
ANY_ROUTE}
  <br>
  <br>
so you can call the function from any cfg block(it your resposability
to ensure that it makes sense to do it so)
  <br>
  <br>
  <br>
  <blockquote type="cite"><br>
thank you
    <br>
    <br>
  </blockquote>
You're welcome
  <br>
Marius
  <br>
  <blockquote type="cite">J&eacute;r&ocirc;me
    <br>
    <br>
ps:&nbsp; I check if the m_topoh function is compiled by looking at the
symbol table in the topoh.so file
    <br>
    <br>
nm -a topoh.so | grep m_topoh
    <br>
00008c70 t m_topoh
    <br>
  </blockquote>
  <br>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<font face="TIMES"><font size="2"><img
 src="cid:part1.05020309.02060602@orange-ftgroup.com"><br>
<font color="BLACK">
<b> MARCHET Jerome RD-CORE-LAN</b></font><br>
<b> LAN/CORE/M2V</b><br>
Tel : +33 296052479 <br>
<a href="mailto:jerome.marchet@orange-ftgroup.com">Email:
jerome.marchet@orange-ftgroup.com</a><br>
R&amp;D Lannion 2, avenue Pierre Marzin 22307 LANNION Cedex - France
<br>
<br>
<br>
Mailer ThunderBird sous YourDev Linux<br>
Installez simplement votre poste de travail Linux avec <a
 href="http://web2000.rd.francetelecom.fr">
http://web2000.rd.francetelecom.fr</a><br>
<img src="cid:part2.00090401.05070009@orange-ftgroup.com"><br>
<br>
<br>
</font></font></div>
</body>
</html>