####### Routing Logic ########


# main request routing logic

route{

    # if (!pike_check_req()) { exit; };

   
    if (!mf_process_maxfwd_header("10")) {
        sl_send_reply("483","Too Many Hops");
        exit;
    }

    if(!sanity_check("1511", "7"))
    {
        xlog("Malformed SIP message from $si:$sp\n");
        exit;
    }

topoh_required("1"); /* in order to test my function*/

route(NAT);

    if (has_totag()) {
        # sequential request withing a dialog should
        # take the path determined by record-routing
        if (loose_route()) {
            if (is_method("BYE")) {
                setflag(1); # do accounting ...
                setflag(3); # ... even if the transaction fails
            }
            route(RELAY);
        } else {
            if (is_method("SUBSCRIBE") && uri == myself) {
                # in-dialog subscribe requests
                route(PRESENCE);
                exit;
            }
            if ( is_method("ACK") ) {
                if ( t_check_trans() ) {
                    # non loose-route, but stateful ACK; must be an ACK after a 487 or e.g. 404 from upstream server
                    t_relay();
                    exit;
                } else {
                    # ACK without matching transaction ... ignore and discard.\n");
                    exit;
                }
            }
            sl_send_reply("404","Not here");
        }
        exit;
    }
....

I try with {"topoh_required", (cmd_function)m_topoh, 1, fixup_uint_null , ANY_ROUTE}

no change ! :( always the same error

Jérôme


marius zbihlei a écrit :
jerome.marchet@orange-ftgroup.com wrote:
Thank you Marius,

I do loadmodule "/home/path/to/kamailio/modules/topoh/topoh.so"

and now I have another problem, When it starts, Kamailio says :

-----------------------------------------------------------------------------------------------

Not starting kamailio: invalid configuration file!

 0(19622) : <core> [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

ERROR: bad config file (1 errors)
----------------------------------------------------------------------------------------------------

Hello,
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)
I search on google and i find this:

http://www.mail-archive.com/users@lists.kamailio.org/msg07610.html

Is it the same problem for topoh as in this mail with tm ?
Not quite. The tm "problem" is a design decision that somehow manifests the same why as your problem

I suggest that you add the cmd with this line

{"topoh_required", (cmd_function)m_topoh, 1, fixup_uint_null , ANY_ROUTE}

so you can call the function from any cfg block(it your resposability to ensure that it makes sense to do it so)



thank you

You're welcome
Marius
Jérôme

ps:  I check if the m_topoh function is compiled by looking at the symbol table in the topoh.so file

nm -a topoh.so | grep m_topoh
00008c70 t m_topoh


--

MARCHET Jerome RD-CORE-LAN
LAN/CORE/M2V
Tel : +33 296052479
Email: jerome.marchet@orange-ftgroup.com
R&D Lannion 2, avenue Pierre Marzin 22307 LANNION Cedex - France


Mailer ThunderBird sous YourDev Linux
Installez simplement votre poste de travail Linux avec http://web2000.rd.francetelecom.fr