module load crash Astrisk-11.5.1 Confbridge

0

any help ? using confbridge,conf as confbridge is way making conference same as meetme.conf **===================================================================== Asterisk-11.5.1 Centos6 app_confbridge.c =====================================================================

    APP: MyConfbridgeCount(Confbridgename,variablename)
    it will return no of user in conference if conference is created or else zero.
    Task: Using Dailplan user want to retrive no of user in conference 
    '6050' => 
    1. Verbose(3,"testMyConfbridgeCount") [pbx_config]
    2. MyConfbridgeCount(4000,count) [pbx_config]
    3. verbose(3,"== ${count} ====") [pbx_config]
    ======================================================================
    issue:Currently asterisk core dumped as soon as app2 load . 
    I want to load module as after join confbridge by any user , using MyConfbridgeCount() to know no of conference user count .
    file: app/app_confbrige.c**
    ==========================================================================
    partial code of app_confbridge.c:
    =========================================================================

    static const char *const app2 ="MyConfbridgeCount";

    static int count_exec(struct ast_channel *chan, const char *data)
        {
        int res = 0;
        struct conference_bridge *conf=NULL;
        int count;
        char *localdata;
        char val[80] = "0";

        struct ao2_iterator i;
        //struct conference_bridge *bridge = NULL;
        struct conference_bridge tmp;

        AST_DECLARE_APP_ARGS(args,
        AST_APP_ARG(confno);
        AST_APP_ARG(varname);
        );

        ast_verb(3,"\n============Inside count_exec =============\n");

        if ( ast_strlen_zero(data)) {
        ast_log(LOG_WARNING, "MyConfbrigeCount requires an argument (conference number)\n");
        ast_verb(3, "\n MyConfbrigeCount requires an argument (conference number\n ");
        return -1;

        }

        if (!ao2_container_count(conference_bridges)) {
        ast_verb(3, "No active conferences."); 
        ast_log(LOG_NOTICE, "No active conferences.");

        return -1;
        }
        if (!(localdata = ast_strdupa(data))){

        return -1;
        }
        AST_STANDARD_APP_ARGS(args, localdata);

        ast_copy_string(tmp.name, args.confno, sizeof(tmp.name));

        conf = ao2_find(conference_bridges, &tmp, OBJ_POINTER);

        if (conf) {
        ao2_lock(conf);
        count = conf->markedusers;
        ao2_unlock(conf);


        }else{
        count = 0;
        }


        if (!ast_strlen_zero(args.varname)) {

        snprintf(val, sizeof(val), "%d", count);
        pbx_builtin_setvar_helper(chan, args.varname, val);
        } else {
        if ( ast_channel_state(chan)!= AST_STATE_UP) {
        ast_answer(chan);
        }
        res = ast_say_number(chan, count, "",ast_channel_language(chan),(char *) NULL);
        }

        return res;
        }


        static int load_module(void)
        {
        ast_verb(3 ,"==Inside load_module==");

        res |= ast_register_application_xml(app2,count_exec);
        return res;
        }
        static int unload_module(void)
        {

        res |= ast_unregister_application(app2);
        return res;
        }

        static struct ast_cli_entry cli_confbridge[] = {
        AST_CLI_DEFINE(count_exec, "MyConfbrigdeCount Show Number of adminUser(s) in Conference." ),
    }

============core dump=================================================
    Program terminated with signal 11, Segmentation fault.
#0 __strlen_ia32 () at ../sysdeps/i386/i586/strlen.S:56
 56  cmpb %dh, (%eax)   /* is byte NUL? *
(gdb) bt
    #0 __strlen_ia32 () at ../sysdeps/i386/i586/strlen.S:56
    #1 0x00c1b4df in _IO_vfprintf_internal (s=0xfffffffe, format=<value optimized out>, ap=<value optimized out>) at vfprintf.c:1641
    #2 0x00c409f0 in _IO_vsnprintf (string=0x835af1c "\374 -- \n======== inside count_exec == data is at address:[0xbf918b64] data:[nnel)\n", maxlen=<value optimized out>, 
    format=0xbf9175c0 "\374 -- \n======== inside count_exec == data is at address:[%p] data:[%s] ", '=' <repeats 11 times>, "\n", 
    args=0xbf917724 "d\213\221\277\376\377\377\377\213\261\065\b") at vsnprintf.c:120
    #3 0x081a0f94 in __ast_str_helper (buf=0xbf9176a8, max_len=0, append=0, 
    fmt=0xbf9175c0 "\374 -- \n======== inside count_exec == data is at address:[%p] data:[%s] ", '=' <repeats 11 times>, "\n", 
    ap=0xbf917724 "d\213\221\277\376\377\377\377\213\261\065\b") at strings.c:76
    #4 0x081b17d0 in ast_str_set_va (buf=0xbf9176a8, max_len=0, 
    fmt=0xbf9175c0 "\374 -- \n======== inside count_exec == data is at address:[%p] data:[%s] ", '=' <repeats 11 times>, "\n", 
    ap=0xbf917724 "d\213\221\277\376\377\377\377\213\261\065\b") at /usr/src/My-asterisk/asterisk-11.5.1/include/asterisk/strings.h:803
    #5 0x08134a6f in __ast_verbose_ap (file=0xe1ca74 "app_confbridge.c", line=2453, func=0xe20652 "count_exec", level=3, callid=0x0, 
    fmt=0xbf9175c0 "\374 -- \n======== inside count_exec == data is at address:[%p] data:[%s] ", '=' <repeats 11 times>, "\n", 
    ap=0xbf917724 "d\213\221\277\376\377\377\377\213\261\065\b") at logger.c:1818
    #6 0x08134b0b in __ast_verbose (file=0xe1ca74 "app_confbridge.c", line=2453, func=0xe20652 "count_exec", level=3, 
    fmt=0xe1da30 "\n======== inside count_exec == data is at address:[%p] data:[%s] ", '=' <repeats 11 times>, "\n") at logger.c:1836
    #7 0x00e09a45 in count_exec (chan=0xe23c18, data=0xfffffffe <Address 0xfffffffe out of bounds>) at app_confbridge.c:2453
    #8 0x080d40eb in __ast_cli_register (e=0xe23c18, ed=0x0) at cli.c:2118
    #9 0x080d4459 in ast_cli_register (e=0xe23c18) at cli.c:2178
    #10 0x080d4482 in ast_cli_register_multiple (e=0xe237a0, len=13) at cli.c:2189
    #11 0x00e11f7d in load_module () at app_confbridge.c:4771
    #12 0x0812ba89 in start_resource (mod=0x87fa908) at loader.c:845
    #13 0x0812c45c in load_resource_list (load_order=0xbf918e90, global_symbols=0, mod_count=0xbf918e88) at loader.c:1045
    #14 0x0812ca5a in load_modules (preload_only=0) at loader.c:1198
    #15 0x080895f7 in main (argc=4, argv=0xbf91a3a4) at asterisk.c:4180
c++
c
asterisk
conference
asked on Stack Overflow Mar 12, 2014 by user3391432

1 Answer

0

As i underestand you created NEW application MyConfbridgeCount,right?

And you are not voip nor c++ expert.

If so, recommended way is use GROUP functions to calculate number of channels BEFORE confbridge. That can be done via pure dialplan.

Creating c/c++ app require very carefull coding and multithreaded debugging(which is extreamly complex thing).

If you realy care what is your error - your error is sending to printf function incorrect address of string.

answered on Stack Overflow Mar 12, 2014 by arheops

User contributions licensed under CC BY-SA 3.0