Issue 9477 - Improve menuselect labels
[asterisk/asterisk.git] / channels / chan_vpb.cc
index 26e1bee..3cacf03 100644 (file)
@@ -105,14 +105,11 @@ static char context[AST_MAX_EXTENSION] = "default";
 
 /* Default language */
 static char language[MAX_LANGUAGE] = "";
-static int usecnt =0;
 
 static int gruntdetect_timeout = 3600000; /* Grunt detect timeout is 1hr. */
 
 static const int prefformat = AST_FORMAT_SLINEAR;
 
-AST_MUTEX_DEFINE_STATIC(usecnt_lock);
-
 /* Protect the interface list (of vpb_pvt's) */
 AST_MUTEX_DEFINE_STATIC(iflock);
 
@@ -2095,11 +2092,6 @@ static int vpb_hangup(struct ast_channel *ast)
                p->vad = NULL;
        }
 
-       ast_mutex_lock(&usecnt_lock); {
-               usecnt--;
-       } ast_mutex_unlock(&usecnt_lock);
-       ast_update_use_count();
-
        if (option_verbose > 1)
                ast_verbose(VERBOSE_PREFIX_2 "%s: Hangup complete\n", ast->name);
 
@@ -2634,7 +2626,7 @@ static struct ast_channel *vpb_new(struct vpb_pvt *me, enum ast_channel_state st
        if (option_verbose > 3)
                ast_verbose("%s: New call for context [%s]\n",me->dev,context);
            
-       tmp = ast_channel_alloc(1);
+       tmp = ast_channel_alloc(1, state, 0, 0, "", me->exten, me->context, 0, me->dev);
        if (tmp) {
                if (use_ast_ind == 1){
                        tmp->tech = &vpb_tech_indicate;
@@ -2643,8 +2635,6 @@ static struct ast_channel *vpb_new(struct vpb_pvt *me, enum ast_channel_state st
                        tmp->tech = &vpb_tech;
                }
 
-               ast_string_field_set(tmp, name, me->dev);
-               
                tmp->callgroup = me->callgroup;
                tmp->pickupgroup = me->pickupgroup;
               
@@ -2655,7 +2645,6 @@ static struct ast_channel *vpb_new(struct vpb_pvt *me, enum ast_channel_state st
                tmp->nativeformats = prefformat;
                tmp->rawreadformat = AST_FORMAT_SLINEAR;
                tmp->rawwriteformat =  AST_FORMAT_SLINEAR;
-               ast_setstate(tmp, state);
                if (state == AST_STATE_RING) {
                        tmp->rings = 1;
                        cid_name[0] = '\0';
@@ -2686,10 +2675,6 @@ static struct ast_channel *vpb_new(struct vpb_pvt *me, enum ast_channel_state st
                me->lastgrunt  = ast_tvnow(); /* Assume at least one grunt tone seen now. */
                me->lastplay  = ast_tvnow(); /* Assume at least one grunt tone seen now. */
 
-               ast_mutex_lock(&usecnt_lock);
-               usecnt++;
-               ast_mutex_unlock(&usecnt_lock);
-               ast_update_use_count();
                if (state != AST_STATE_DOWN) {
                        if ((me->mode != MODE_FXO)&&(state != AST_STATE_UP)){
                                vpb_answer(tmp);
@@ -2872,7 +2857,7 @@ int load_module()
        /* We *must* have a config file otherwise stop immediately */
        if (!cfg) {
                ast_log(LOG_ERROR, "Unable to load config %s\n", config);
-               return -1;
+               return AST_MODULE_LOAD_DECLINE;
        }  
 
        vpb_seterrormode(VPB_ERROR_CODE);
@@ -3064,4 +3049,8 @@ const char *key()
 #endif
 /**/
 
-
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "VoiceTronix API driver",
+               .load = load_module,
+               .unload = unload_module,
+               .reload = reload,
+              );