[SR-Users] Error when using function lookup_branches

Anthony Messina amessina at messinet.com
Tue Nov 11 06:35:11 CET 2014


On Monday, November 10, 2014 06:56:08 PM J Hazenberg wrote:
> Hello,
> 
> I'm runnig kamailio 4.2.0 and using the lookup_branches function from 
> the register module to lookup all branches after a alias_db_lookup. The 
> function seems to work fine but i see the following error in the log 
> file just after the lookup:
> 
> INFO: <core> [mem/f_malloc.c:599]: fm_free(): freeing a free fragment 
> (0x7fad277fe110/0x7fad277fe148) - ignore
> INFO: <core> [mem/f_malloc.c:599]: fm_free(): freeing a free fragment 
> (0x7fad277fcd38/0x7fad277fcd70) - ignore
> INFO: <core> [mem/f_malloc.c:599]: fm_free(): freeing a free fragment 
> (0x7fad277fcd88/0x7fad277fcdc0) - ignore
> 
> Code:
> 
> alias_db_lookup("dbaliases");
> 
> if (!lookup_branches("location")) {
> 
> 
> This only happens when i have multiple branches, could this be a error 
> in my script?

Jan, I'm seeing the same error (with Kamailio build from the git master 
def8d26) when I have multiple branches, though mine is proceeded with a 
uri2dst2() error:

ERROR: tm [ut.h:272]: uri2dst2(): ERROR: uri2dst: bad_uri:
INFO: <core> [mem/f_malloc.c:599]: fm_free(): freeing a free fragment 
(0x7f6717cb7a88/0x7f6717cb7ac0) - ignore
INFO: <core> [mem/f_malloc.c:599]: fm_free(): freeing a free fragment 
(0x7f6717d133a0/0x7f6717d133d8) - ignore
INFO: <core> [mem/f_malloc.c:599]: fm_free(): freeing a free fragment 
(0x7f6717ccb6b0/0x7f6717ccb6e8) - ignore
INFO: <core> [mem/f_malloc.c:599]: fm_free(): freeing a free fragment 
(0x7f6717d11bb0/0x7f6717d11be8) - ignore


Unfortunately, I'm learning Kamailio and trying to work with branch routing 
and I can't figure out if my script is wrong, or if there's a bug.

My script is as follows:

route[LOCATION] {
#!ifdef WITH_SPEEDDIAL
        # search for short dialing - 2-digit extension
        if($rU=~"^[0-9][0-9]$")
                if(sd_lookup("speed_dial"))
                        route(SIPOUT);
#!endif

#!ifdef WITH_ALIASDB
        # search in DB-based aliases
        if(alias_db_lookup("dbaliases")) {
                $avp(oexten) = $oU;
                route(SIPOUT);

        }
#!endif


        if($avp(oexten)==$null) $avp(oexten) = $rU;
        if(!lookup_branches("location")) {
                # Save the return code from the lookup function
                $var(rc_lookup) = $rc;

                if(is_method("MESSAGE")) {
                        route(IMC);
                        route(MESSAGEGW);
                        route(MSILO);
                        send_reply("404", "Not Found");
                        exit;
                }

                # Route to Asterisk
                if(is_method("INVITE") && !is_subscriber("$ru", "subscriber", 
"1")) {
                        route(TOASTERISK);
                        exit;
                }

                # Route to VoiceMail
                route(TOVOICEMAIL);
                t_newtran();
                switch ($var(rc_lookup)) {
                        case -1:
                        case -3:
                                send_reply("404", "Not Found");
                                exit;
                        case -2:
                                send_reply("405", "Method Not Allowed");
                                exit;
                }
        }

        # when routing via usrloc, log the missed calls also
        if(is_method("INVITE"))
        {
                setflag(FLT_ACCMISSED);
        }
}

route[SIPOUT] {
        if(uri==myself) return;

        append_hf("P-hint: outbound\r\n");
        route(RELAY);
        exit;
}

-- 
Anthony - https://messinet.com/ - https://messinet.com/~amessina/gallery
8F89 5E72 8DF0 BCF0 10BE 9967 92DC 35DC B001 4A4E
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20141110/a74a795c/attachment.pgp>


More information about the sr-users mailing list