[OpenSIPS-Users] need help on accounting

haloha haloha201 at gmail.com
Sun Oct 12 06:07:29 CEST 2008


Hi all

i am learn how to use the acc module, the config is show below, i intend to
use mysql to store all call with 200ok but when i make call i got nothing in
the acc table of mysql and got the problem

[root at computer1 ~]# tail -f /var/log/messages
Oct 12 10:45:42 computer1 /sbin/opensips[3730]: INFO:registrar:mod_init:
initializing...
Oct 12 10:45:42 computer1 /sbin/opensips[3730]: INFO:textops:mod_init:
initializing...
Oct 12 10:45:42 computer1 /sbin/opensips[3730]: INFO:auth:mod_init:
initializing...
Oct 12 10:45:42 computer1 /sbin/opensips[3730]: INFO:auth_db:mod_init:
initializing...
Oct 12 10:45:42 computer1 /sbin/opensips[3730]: INFO:acc:mod_init:
initializing...
Oct 12 10:45:42 computer1 /sbin/opensips[3730]:
INFO:core:probe_max_receive_buffer: using a UDP receive buffer of 255 kb
Oct 12 10:45:42 computer1 /sbin/opensips[3730]:
INFO:core:probe_max_receive_buffer: using a UDP receive buffer of 255 kb
Oct 12 10:45:48 computer1 /sbin/opensips[3750]: ERROR:tm:t_forward_nonack:
no branch for forwarding
Oct 12 10:45:48 computer1 /sbin/opensips[3750]: ERROR:tm:w_t_relay:
t_forward_nonack failed
Oct 12 10:45:50 computer1 /sbin/opensips[3741]:
CRITICAL:tm:t_should_relay_response: pick_branch failed (lowest==-1) for
code 480



but when i comment the t_relay(); it works fine but not show up the calling
number + called number
+----+--------+----------+----------+----------------------------------------------+----------+------------+---------------------+----------+--------+
| id | method | from_tag | to_tag   |
callid                                       | sip_code | sip_reason |
time                | from_uri | to_uri |
+----+--------+----------+----------+----------------------------------------------+----------+------------+---------------------+----------+--------+
|  7 | INVITE | 1b521e5d | 3b07760d |
ZmY3OGZmZmMzY2UzNjZjNTE5YTU2MDBmMTFiM2UzZTQ. | 200      | OK         |
2008-10-12 10:55:05 |          |        |
|  8 | BYE    | 3b07760d | 1b521e5d |
ZmY3OGZmZmMzY2UzNjZjNTE5YTU2MDBmMTFiM2UzZTQ. | 200      | OK         |
2008-10-12 10:55:16 |          |        |
|  6 | INVITE | 3558b765 | d0742f7e |
MzI3N2RhOWFmYjUwYWZmNzg0ZWM2NTQwZGNmMmQ1MGQ. | 200      | OK         |
2008-10-12 10:43:30 |          |        |
+----+--------+----------+----------+----------------------------------------------+----------+------------+---------------------+----------+--------+

what is the difference between have t_relay() and not have t_replay()?
i follow the Gerenal example :

http://www.sfr-fresh.com/unix/privat/opensips-1.4.0-tls_src.tar.gz:a/opensips-1.4.0-tls/modules/acc/README


how do i use the text file instead of mysql


loadmodule "acc.so"
modparam("acc", "db_flag", 2)
modparam("acc", "db_url", "mysql://opensips:opensipsrw@localhost/opensips")
# use mysql engine
modparam("acc", "db_table_acc", "acc")


route{
        if (!mf_process_maxfwd_header("10")) {
                sl_send_reply("483","Too Many Hops");
                exit;
        }
        if (msg:len >=  2048 ) {
        sl_send_reply("513", "Message too big");
        exit;
        };
        if (loose_route()) {
                # mark routing logic in request
                append_hf("P-hint: rr-enforced\r\n");
                if (is_method("BYE"))
                        setflag(2);
                route(1);
        };
        if (is_method("PUBLISH|SUBSCRIBE"))
        {
                sl_send_reply("503", "Service Unavailable");
                exit;
        }
        if (is_method("REGISTER"))
        {
                # authenticate the REGISTER requests (uncomment to enable
auth)
                if(!www_authorize("", "subscriber")){
                      www_challenge("", "0");
                      consume_credentials();
                      exit;
                }

                if (!check_to())
                {
                      sl_send_reply("403","Forbidden auth ID");
                      exit;
                }


                if (!save("location"))
                        sl_reply_error();

                exit;
        }
        if (!lookup("location")) {
                switch ($retcode) {
                        case -1:
                        case -3:
                                t_newtran();
                                t_reply("404", "Not Found");
                                exit;
                        case -2:
                                sl_send_reply("405", "Method Not Allowed");
                                exit;
                }
        }
        if (!method=="REGISTER"){
                route(2);
        }
        route(1);
}
route[1] {
    # send it out now; use stateful forwarding as it works reliably
    # even for UDP2TCP
    if (!t_relay()) {
        sl_reply_error();
    };
    exit;
}
route[2] {
        if (is_method("INVITE")){
                if (!proxy_authorize("", "subscriber")) {
                        proxy_challenge("", "0");  # Realm will be
autogenerated
                        consume_credentials();
                };
                setflag(2);
                t_relay(); /* enter stateful mode now */
        }
    record_route();
}

Thank you
Ha`
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20081012/b46bd51d/attachment.htm 


More information about the Users mailing list