module load Crash Asterisk 11.5.1 app_confbridge.c
====================================================================Asterisk-11.5.1 CentOS6 app_confbrige.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(admincount_exec, “MyConfbrigdeCount Show Number of adminUser(s) in Conference.” ),
}
=============core dumap================================================Program terminated with signal 11, Segmentation fault.
#0 __strlen_ia32 () at ../sysdeps/i386/i586/strlen.S:56
56 cmpb %dh, (%eax) /* is byte NUL? */
Missing separate debuginfos, use: debuginfo-install bzip2-libs-1.0.5-
7.el6_0.i686 cyrus-sasl-lib-2.1.23-8.el6.i686 db4-4.7.25-16.el6.i686
elfutils-libelf-0.152-1.el6.i686 expat-2.0.1-11.el6_2.i686 gnutls-2.8.5-
4.el6_2.2.i686 keyutils-libs-1.4-4.el6.i686 krb5-libs-1.10.3-10.el6_4.3.i686
libacl-2.2.49-4.el6.i686 libattr-2.4.44-4.el6.i686 libcap-2.16-5.2.el6.i686
libcom_err-1.41.12-14.el6.i686 libcurl-7.19.7-26.el6_2.4.i686 libgcc-4.4.7-
3.el6.i686 libgcrypt-1.4.5-9.el6_2.2.i686 libgpg-error-1.7-4.el6.i686
libical-0.43-6.el6.i686 libidn-1.18-2.el6.i686 libproxy-0.3.0-2.el6.i686
libselinux-2.0.94-5.3.el6_4.1.i686 libsrtpcvs.el6.i686
libssh2-1.2.2-7.el6.i686 libtasn1-2.3-3.el6.i686 libtool-ltdl-2.2.6-
15.5.el6.i686 libuuid-2.17.2-12.9.el6_4.3.i686 libxml2-2.7.6-12.el6_4.1.i686
lm_sensors-libs-3.1.1-17.el6.i686 lua-5.1.4-4.1.el6.i686 Mysql-connector-
odbc-5.1.5r1144-7.el6.i686 Mysql-libs-5.1.69-1.el6_4.i686 ncurses-libs-
.el6.i686 neon-0.29.3-3.el6_4.i686 net-snmp-libs-5.5-
44.el6_4.1.i686 nspr-4.8.6-1.el6.i686 nss-3.12.7-2.el6.i686 nss-softokn-
freebl-3.12.7-1.1.el6.i686 nss-util-3.12.7-1.el6.i686 openLDAP-2.4.19-
15.el6.i686 openssl-1.0.0-27.el6_4.2.i686 pakchois-0.4-3.2.el6.i686 perl-
libs-5.10.1-136.el6.i686 popt-1.13-7.el6.i686 rpm-libs-4.8.0-32.el6.i686
sqlite-3.6.20-1.el6.i686 tcp_wrappers-libs-7.6-57.el6.i686 unixODBC-2.2.14-
12.el6_3.i686 xz-libs-4.999.9-0.3.betagit.el6.i686 zlib-1.2.3-
29.el6.i686
(gdb) bt
#0 __strlen_ia32 () at ../sysdeps/i386/i586/strlen.S:56
#1 0x00c1b4df in _IO_vfprintf_internal (s=0xfffffffe, format