Go to the source code of this file.
Defines | |
#define | AST_FORCE_FIRM 1 |
Firmly unload a module. | |
#define | AST_FORCE_HARD 2 |
Unconditionally unload a module. | |
#define | AST_FORCE_SOFT 0 |
Softly unload a module. | |
#define | AST_MODULE_CONFIG "modules.conf" |
Module configuration file. | |
#define | ASTERISK_GPL_KEY "This paragraph is Copyright (C) 2000, Linux Support Services, Inc. \In order for your module to load, it must return this key via a function \called \"key\". Any code which includes this paragraph must be licensed under \the GNU General Public License version 2 or later (at your option). Linux \Support Services, Inc. reserves the right to allow other parties to license \this paragraph under other terms as well." |
The text the key() function should return. | |
#define | LOCAL_USER_ACF_ADD(u) |
#define | LOCAL_USER_ADD(u) |
Add a localuser. | |
#define | LOCAL_USER_DECL |
The localuser declaration. | |
#define | LOCAL_USER_REMOVE(u) |
Remove a localuser. | |
#define | STANDARD_DECREMENT_USECOUNT |
#define | STANDARD_HANGUP_LOCALUSERS |
Hangup all localusers. | |
#define | STANDARD_INCREMENT_USECOUNT |
#define | STANDARD_LOCAL_USER |
Standard localuser struct definition. | |
#define | STANDARD_USECOUNT(res) |
Set the specfied integer to the current usecount. | |
Functions | |
int | ast_load_resource (const char *resource_name) |
Load a module. | |
int | ast_loader_register (int(*updater)(void)) |
Add a procedure to be run when modules have been updated. | |
int | ast_loader_unregister (int(*updater)(void)) |
Remove a procedure to be run when modules are updated. | |
char * | ast_module_helper (char *line, char *word, int pos, int state, int rpos, int needsreload) |
Match modules names for the Asterisk cli. | |
int | ast_module_reload (const char *name) |
Reload asterisk modules. | |
int | ast_register_atexit (void(*func)(void)) |
Register a function to be executed before Asterisk exits. | |
int | ast_unload_resource (const char *resource_name, int force) |
Unloads a module. | |
void | ast_unregister_atexit (void(*func)(void)) |
Unregister a function registered with ast_register_atexit(). | |
int | ast_update_module_list (int(*modentry)(const char *module, const char *description, int usecnt, const char *like), const char *like) |
Ask for a list of modules, descriptions, and use counts. | |
void | ast_update_use_count (void) |
Notify when usecount has been changed. | |
char * | description (void) |
Provides a description of the module. | |
char * | key (void) |
Returns the ASTERISK_GPL_KEY. | |
int | load_module (void) |
Initialize the module. | |
int | reload (void) |
Reload stuff. | |
int | unload_module (void) |
Cleanup all module structures, sockets, etc. | |
int | usecount (void) |
Provides a usecount. |
This file contains the definitons for functions Asterisk modules should provide and some other module related functions.
Definition in file module.h.
|
Firmly unload a module. This flag signals ast_unload_resource() to attempt to unload a module even if it is in use. It will attempt to use the module's unload_module function. Definition at line 130 of file module.h. Referenced by ast_unload_resource(), and handle_unload(). |
|
Unconditionally unload a module. This flag signals ast_unload_resource() to first attempt to unload a module using the module's unload_module function, then if that fails to unload the module using dlclose. The module will be unloaded even if it is still in use. Use of this flag is not recommended. Definition at line 140 of file module.h. Referenced by handle_unload(). |
|
Softly unload a module. This flag signals ast_unload_resource() to unload a module only if it is not in use, according to the module's usecount. Definition at line 121 of file module.h. Referenced by handle_unload(). |
|
Module configuration file.
Definition at line 113 of file module.h. Referenced by ast_load_resource(), and load_modules(). |
|
The text the key() function should return.
Definition at line 105 of file module.h. Referenced by key(). |
|
Definition at line 331 of file module.h. Referenced by acf_curl_exec(), acf_cut_exec(), acf_sort_exec(), acf_vmcount_exec(), dundifunc_read(), function_enum(), function_txtcidname(), and queue_function_qac(). |
|
|
Value: AST_MUTEX_DEFINE_STATIC(localuser_lock); \ static struct localuser *localusers = NULL; \ static int localusecnt = 0; This macro should be used in combination with STANDARD_LOCAL_USER. It creates a localuser mutex and several other variables used for keeping the use count. Sample Usage: |
|
Remove a localuser.
Definition at line 353 of file module.h. Referenced by __login_exec(), acf_curl_exec(), acf_cut_exec(), acf_sort_exec(), acf_vmcount_exec(), admin_exec(), adsi_exec(), agi_exec_full(), alarmreceiver_exec(), app_exec(), appendcdruserfield_exec(), aqm_exec(), auth_exec(), background_detect_exec(), chanavail_exec(), chanspy_exec(), conf_exec(), controlplayback_exec(), count_exec(), curl_exec(), cut_exec(), datetime_exec(), del_exec(), deltree_exec(), dial_exec_full(), dictate_exec(), directory_exec(), disa_exec(), dumpchan_exec(), dundi_lookup_exec(), dundifunc_read(), echo_exec(), enumlookup_exec(), eval_exec(), exec_exec(), execif_exec(), festival_exec(), flash_exec(), forkcdr_exec(), function_enum(), function_txtcidname(), get_exec(), gosub_exec(), gosubif_exec(), group_check_exec(), group_count_exec(), group_match_count_exec(), group_set_exec(), hasvoicemail_exec(), ices_exec(), lookupblacklist_exec(), lookupcidname_exec(), macro_exec(), macroif_exec(), math_exec(), md5_exec(), md5check_exec(), milliwatt_exec(), mixmonitor_exec(), mp3_exec(), NBScat_exec(), nocdr_exec(), ospfinished_exec(), osplookup_exec(), ospnext_exec(), page_exec(), park_call_exec(), park_exec(), parkandannounce_exec(), PGSQL_exec(), pickup_exec(), playback_exec(), pqm_exec(), privacy_exec(), put_exec(), queue_function_qac(), random_exec(), read_exec(), readfile_exec(), realtime_update_exec(), record_exec(), retrydial_exec(), rqm_exec(), sayunixtime_exec(), senddtmf_exec(), sendimage_exec(), sendtext_exec(), sendurl_exec(), setcallerid_exec(), setcallerid_pres_exec(), setcdruserfield_exec(), setrdnis_exec(), skel_exec(), sms_exec(), softhangup_exec(), sort_exec(), system_exec_helper(), testclient_exec(), testserver_exec(), transfer_exec(), txtcidname_exec(), upqm_exec(), userevent_exec(), verbose_exec(), vm_box_exists(), vm_exec(), vm_execmain(), vmauthenticate(), waitforring_exec(), zapateller_exec(), and zapras_exec(). |
|
Value: ast_mutex_lock(&localuser_lock); \ localusecnt--; \ ast_mutex_unlock(&localuser_lock); \ ast_update_use_count(); |
|
Hangup all localusers. This macro hangs up on all current localusers and sets the usecount to zero when finished. Definition at line 380 of file module.h. Referenced by unload_module(). |
|
Value: ast_mutex_lock(&localuser_lock); \ localusecnt++; \ ast_mutex_unlock(&localuser_lock); \ ast_update_use_count(); Definition at line 293 of file module.h. Referenced by mixmonitor_thread(). |
|
Value: struct localuser { \ struct ast_channel *chan; \ struct localuser *next; \ } This macro defines a localuser struct. The channel.h file must be included to use this macro because it refrences ast_channel. |
|
Value: { \ res = localusecnt; \ }
Sample Usage: int usecount(void) { int res; STANDARD_USECOUNT(res); return res; } Definition at line 411 of file module.h. Referenced by usecount(). |
|
Load a module.
Definition at line 422 of file loader.c. References __load_resource(), ast_config_destroy(), ast_config_load(), AST_MODULE_CONFIG, cfg, and option_verbose. Referenced by file_ok_sel(), handle_load(), load_module(), and reload_module(). 00423 { 00424 int o; 00425 struct ast_config *cfg = NULL; 00426 int res; 00427 00428 /* Keep the module file parsing silent */ 00429 o = option_verbose; 00430 option_verbose = 0; 00431 cfg = ast_config_load(AST_MODULE_CONFIG); 00432 option_verbose = o; 00433 res = __load_resource(resource_name, cfg); 00434 if (cfg) 00435 ast_config_destroy(cfg); 00436 return res; 00437 }
|
|
Add a procedure to be run when modules have been updated.
Definition at line 608 of file loader.c. References ast_log(), ast_mutex_lock(), ast_mutex_unlock(), LOG_WARNING, malloc, loadupdate::next, loadupdate::updater, and updaters. Referenced by show_console(). 00609 { 00610 struct loadupdate *tmp; 00611 /* XXX Should be more flexible here, taking > 1 verboser XXX */ 00612 if ((tmp = malloc(sizeof (struct loadupdate)))) { 00613 tmp->updater = v; 00614 if (ast_mutex_lock(&modlock)) 00615 ast_log(LOG_WARNING, "Failed to lock\n"); 00616 tmp->next = updaters; 00617 updaters = tmp; 00618 ast_mutex_unlock(&modlock); 00619 return 0; 00620 } 00621 return -1; 00622 }
|
|
Remove a procedure to be run when modules are updated.
Definition at line 624 of file loader.c. References ast_log(), ast_mutex_lock(), ast_mutex_unlock(), LOG_WARNING, loadupdate::next, loadupdate::updater, and updaters. Referenced by exit_now(). 00625 { 00626 int res = -1; 00627 struct loadupdate *tmp, *tmpl=NULL; 00628 if (ast_mutex_lock(&modlock)) 00629 ast_log(LOG_WARNING, "Failed to lock\n"); 00630 tmp = updaters; 00631 while(tmp) { 00632 if (tmp->updater == v) { 00633 if (tmpl) 00634 tmpl->next = tmp->next; 00635 else 00636 updaters = tmp->next; 00637 break; 00638 } 00639 tmpl = tmp; 00640 tmp = tmp->next; 00641 } 00642 if (tmp) 00643 res = 0; 00644 ast_mutex_unlock(&modlock); 00645 return res; 00646 }
|
|
Match modules names for the Asterisk cli.
Definition at line 166 of file loader.c. References ast_mutex_lock(), ast_mutex_unlock(), module_list, module::next, module::reload, module::resource, and strdup. Referenced by complete_mod_2(), and complete_mod_4(). 00167 { 00168 struct module *m; 00169 int which=0; 00170 char *ret; 00171 00172 if (pos != rpos) 00173 return NULL; 00174 ast_mutex_lock(&modlock); 00175 m = module_list; 00176 while(m) { 00177 if (!strncasecmp(word, m->resource, strlen(word)) && (m->reload || !needsreload)) { 00178 if (++which > state) 00179 break; 00180 } 00181 m = m->next; 00182 } 00183 if (m) { 00184 ret = strdup(m->resource); 00185 } else { 00186 ret = NULL; 00187 if (!strncasecmp(word, "extconfig", strlen(word))) { 00188 if (++which > state) 00189 ret = strdup("extconfig"); 00190 } else if (!strncasecmp(word, "manager", strlen(word))) { 00191 if (++which > state) 00192 ret = strdup("manager"); 00193 } else if (!strncasecmp(word, "enum", strlen(word))) { 00194 if (++which > state) 00195 ret = strdup("enum"); 00196 } else if (!strncasecmp(word, "rtp", strlen(word))) { 00197 if (++which > state) 00198 ret = strdup("rtp"); 00199 } 00200 00201 } 00202 ast_mutex_unlock(&modlock); 00203 return ret; 00204 }
|
|
Reload asterisk modules.
Definition at line 206 of file loader.c. References ast_cdr_engine_reload(), ast_enum_reload(), ast_lastreloadtime, ast_mutex_lock(), ast_mutex_trylock(), ast_mutex_unlock(), ast_rtp_reload(), ast_verbose(), module::description, dnsmgr_reload(), modlistver, module_list, module::next, option_verbose, read_config_maps(), module::reload, reload(), reload_manager(), module::resource, and VERBOSE_PREFIX_3. Referenced by handle_reload(), and hup_handler(). 00207 { 00208 struct module *m; 00209 int reloaded = 0; 00210 int oldversion; 00211 int (*reload)(void); 00212 /* We'll do the logger and manager the favor of calling its reload here first */ 00213 00214 if (ast_mutex_trylock(&reloadlock)) { 00215 ast_verbose("The previous reload command didn't finish yet\n"); 00216 return -1; 00217 } 00218 if (!name || !strcasecmp(name, "extconfig")) { 00219 read_config_maps(); 00220 reloaded = 2; 00221 } 00222 if (!name || !strcasecmp(name, "manager")) { 00223 reload_manager(); 00224 reloaded = 2; 00225 } 00226 if (!name || !strcasecmp(name, "cdr")) { 00227 ast_cdr_engine_reload(); 00228 reloaded = 2; 00229 } 00230 if (!name || !strcasecmp(name, "enum")) { 00231 ast_enum_reload(); 00232 reloaded = 2; 00233 } 00234 if (!name || !strcasecmp(name, "rtp")) { 00235 ast_rtp_reload(); 00236 reloaded = 2; 00237 } 00238 if (!name || !strcasecmp(name, "dnsmgr")) { 00239 dnsmgr_reload(); 00240 reloaded = 2; 00241 } 00242 time(&ast_lastreloadtime); 00243 00244 ast_mutex_lock(&modlock); 00245 oldversion = modlistver; 00246 m = module_list; 00247 while(m) { 00248 if (!name || !strcasecmp(name, m->resource)) { 00249 if (reloaded < 1) 00250 reloaded = 1; 00251 reload = m->reload; 00252 ast_mutex_unlock(&modlock); 00253 if (reload) { 00254 reloaded = 2; 00255 if (option_verbose > 2) 00256 ast_verbose(VERBOSE_PREFIX_3 "Reloading module '%s' (%s)\n", m->resource, m->description()); 00257 reload(); 00258 } 00259 ast_mutex_lock(&modlock); 00260 if (oldversion != modlistver) 00261 break; 00262 } 00263 m = m->next; 00264 } 00265 ast_mutex_unlock(&modlock); 00266 ast_mutex_unlock(&reloadlock); 00267 return reloaded; 00268 }
|
|
Register a function to be executed before Asterisk exits.
Definition at line 370 of file asterisk.c. References ast_mutex_lock(), ast_mutex_unlock(), ast_unregister_atexit(), atexits, ast_atexit::func, and malloc. Referenced by do_reload(), and load_module(). 00371 { 00372 int res = -1; 00373 struct ast_atexit *ae; 00374 ast_unregister_atexit(func); 00375 ae = malloc(sizeof(struct ast_atexit)); 00376 ast_mutex_lock(&atexitslock); 00377 if (ae) { 00378 memset(ae, 0, sizeof(struct ast_atexit)); 00379 ae->next = atexits; 00380 ae->func = func; 00381 atexits = ae; 00382 res = 0; 00383 } 00384 ast_mutex_unlock(&atexitslock); 00385 return res; 00386 }
|
|
Unloads a module.
Definition at line 122 of file loader.c. References AST_FORCE_FIRM, ast_log(), ast_mutex_lock(), ast_mutex_unlock(), ast_update_use_count(), dlclose(), free, module::lib, LOG_WARNING, modlistver, module_list, module::next, module::resource, module::unload_module, and module::usecount. Referenced by __load_resource(), exit_now(), reload_module(), and remove_module(). 00123 { 00124 struct module *m, *ml = NULL; 00125 int res = -1; 00126 if (ast_mutex_lock(&modlock)) 00127 ast_log(LOG_WARNING, "Failed to lock\n"); 00128 m = module_list; 00129 while(m) { 00130 if (!strcasecmp(m->resource, resource_name)) { 00131 if ((res = m->usecount()) > 0) { 00132 if (force) 00133 ast_log(LOG_WARNING, "Warning: Forcing removal of module %s with use count %d\n", resource_name, res); 00134 else { 00135 ast_log(LOG_WARNING, "Soft unload failed, '%s' has use count %d\n", resource_name, res); 00136 ast_mutex_unlock(&modlock); 00137 return -1; 00138 } 00139 } 00140 res = m->unload_module(); 00141 if (res) { 00142 ast_log(LOG_WARNING, "Firm unload failed for %s\n", resource_name); 00143 if (force <= AST_FORCE_FIRM) { 00144 ast_mutex_unlock(&modlock); 00145 return -1; 00146 } else 00147 ast_log(LOG_WARNING, "** Dangerous **: Unloading resource anyway, at user request\n"); 00148 } 00149 if (ml) 00150 ml->next = m->next; 00151 else 00152 module_list = m->next; 00153 dlclose(m->lib); 00154 free(m); 00155 break; 00156 } 00157 ml = m; 00158 m = m->next; 00159 } 00160 modlistver = rand(); 00161 ast_mutex_unlock(&modlock); 00162 ast_update_use_count(); 00163 return res; 00164 }
|
|
Unregister a function registered with ast_register_atexit().
Definition at line 388 of file asterisk.c. References ast_mutex_lock(), ast_mutex_unlock(), atexits, ast_atexit::func, and ast_atexit::next. Referenced by ast_register_atexit(), and do_reload(). 00389 { 00390 struct ast_atexit *ae, *prev = NULL; 00391 ast_mutex_lock(&atexitslock); 00392 ae = atexits; 00393 while(ae) { 00394 if (ae->func == func) { 00395 if (prev) 00396 prev->next = ae->next; 00397 else 00398 atexits = ae->next; 00399 break; 00400 } 00401 prev = ae; 00402 ae = ae->next; 00403 } 00404 ast_mutex_unlock(&atexitslock); 00405 }
|
|
Ask for a list of modules, descriptions, and use counts.
Definition at line 588 of file loader.c. References ast_mutex_trylock(), ast_mutex_unlock(), module::description, module_list, module::next, module::resource, and module::usecount. Referenced by handle_modlist(), and mod_update(). 00590 { 00591 struct module *m; 00592 int unlock = -1; 00593 int total_mod_loaded = 0; 00594 00595 if (ast_mutex_trylock(&modlock)) 00596 unlock = 0; 00597 m = module_list; 00598 while (m) { 00599 total_mod_loaded += modentry(m->resource, m->description(), m->usecount(), like); 00600 m = m->next; 00601 } 00602 if (unlock) 00603 ast_mutex_unlock(&modlock); 00604 00605 return total_mod_loaded; 00606 }
|
|
Notify when usecount has been changed. This function calulates use counts and notifies anyone trying to keep track of them. It should be called whenever your module's usecount changes.
Definition at line 572 of file loader.c. References ast_log(), ast_mutex_lock(), ast_mutex_unlock(), LOG_WARNING, loadupdate::next, loadupdate::updater, and updaters. Referenced by __load_resource(), __oh323_new(), adpcm_destroy(), adpcmtolin_new(), agent_new(), alaw_destroy(), alawtolin_new(), alawtoulaw_new(), alsa_new(), aopen_decusecnt(), aopen_incusecnt(), ast_iax2_new(), ast_modem_new(), ast_unload_resource(), au_close(), au_open(), au_rewrite(), bestdata_decusecnt(), bestdata_incusecnt(), exit_now(), g723_close(), g723_destroy(), g723_open(), g723_rewrite(), g723tolin_new(), g726_16_open(), g726_16_rewrite(), g726_24_open(), g726_24_rewrite(), g726_32_open(), g726_32_rewrite(), g726_40_open(), g726_40_rewrite(), g726_close(), g726_destroy(), g726tolin_new(), g729_close(), g729_open(), g729_rewrite(), gsm_close(), gsm_open(), gsm_rewrite(), h263_close(), h263_open(), h263_rewrite(), i4l_decusecnt(), i4l_incusecnt(), iax2_predestroy(), ilbc_close(), ilbc_open(), ilbc_rewrite(), lintoadpcm_new(), lintoalaw_new(), lintog723_new(), lintog726_new(), lintoulaw_new(), load_module(), local_new(), mgcp_hangup(), mgcp_new(), modem_hangup(), nbs_new(), ogg_vorbis_close(), ogg_vorbis_open(), ogg_vorbis_rewrite(), oh323_hangup(), oh323_request(), oss_new(), pcm_close(), pcm_open(), pcm_rewrite(), phone_check_exception(), phone_hangup(), phone_new(), sip_hangup(), sip_new(), sip_request_call(), sipsock_read(), skinny_new(), slinear_close(), slinear_open(), slinear_rewrite(), ulaw_destroy(), ulawtoalaw_new(), ulawtolin_new(), vox_close(), vox_open(), vox_rewrite(), vpb_hangup(), vpb_new(), wav_close(), wav_open(), wav_rewrite(), zt_hangup(), and zt_new(). 00573 { 00574 /* Notify any module monitors that the use count for a 00575 resource has changed */ 00576 struct loadupdate *m; 00577 if (ast_mutex_lock(&modlock)) 00578 ast_log(LOG_WARNING, "Failed to lock\n"); 00579 m = updaters; 00580 while(m) { 00581 m->updater(); 00582 m = m->next; 00583 } 00584 ast_mutex_unlock(&modlock); 00585 00586 }
|
|
Provides a description of the module.
Definition at line 2511 of file chan_agent.c. 02512 { 02513 return (char *) desc; 02514 }
|
|
Returns the ASTERISK_GPL_KEY. This returns the ASTERISK_GPL_KEY, signifiying that you agree to the terms of the GPL stated in the ASTERISK_GPL_KEY. Your module will not load if it does not return the EXACT message:
char *key(void) { return ASTERISK_GPL_KEY; }
Definition at line 2506 of file chan_agent.c. References ASTERISK_GPL_KEY. Referenced by __ast_check_signature(), __ast_check_signature_bin(), __ast_decrypt_bin(), __ast_encrypt_bin(), __ast_key_get(), __ast_sign(), __ast_sign_bin(), __load_resource(), ast_db_del(), ast_db_deltree(), ast_db_get(), ast_db_gettree(), ast_db_put(), ast_privacy_check(), ast_privacy_set(), authenticate(), authenticate_verify(), cache_lookup(), check_access(), check_key(), create_addr(), crypto_load(), database_show(), database_showkey(), del_exec(), function_db_exists(), function_db_read(), function_db_write(), get_exec(), init_keys(), manager_dbget(), manager_dbput(), process_returncode(), put_exec(), pw_cb(), register_verify(), reply_digest(), show_keys(), showkeys(), try_load_key(), and update_key(). 02507 { 02508 return ASTERISK_GPL_KEY; 02509 }
|
|
Initialize the module. Initialize the Agents module. This function is being called by Asterisk when loading the module. Among other thing it registers applications, cli commands and reads the cofiguration file.
Definition at line 2434 of file chan_agent.c. References ast_cli_register(), cli_show_osp, and config_load(). 02435 { 02436 /* Make sure we can register our agent channel type */ 02437 if (ast_channel_register(&agent_tech)) { 02438 ast_log(LOG_ERROR, "Unable to register channel class %s\n", channeltype); 02439 return -1; 02440 } 02441 /* Dialplan applications */ 02442 ast_register_application(app, login_exec, synopsis, descrip); 02443 ast_register_application(app2, callback_exec, synopsis2, descrip2); 02444 ast_register_application(app3, agentmonitoroutgoing_exec, synopsis3, descrip3); 02445 /* Manager commands */ 02446 ast_manager_register2("Agents", EVENT_FLAG_AGENT, action_agents, "Lists agents and their status", mandescr_agents); 02447 ast_manager_register2("AgentLogoff", EVENT_FLAG_AGENT, action_agent_logoff, "Sets an agent as no longer logged in", mandescr_agent_logoff); 02448 ast_manager_register2("AgentCallbackLogin", EVENT_FLAG_AGENT, action_agent_callback_login, "Sets an agent as logged in by callback", mandescr_agent_callback_login); 02449 /* CLI Application */ 02450 ast_cli_register(&cli_show_agents); 02451 ast_cli_register(&cli_agent_logoff); 02452 /* Read in the config */ 02453 read_agent_config(); 02454 if (persistent_agents) 02455 reload_agents(); 02456 return 0; 02457 }
|
|
Reload stuff. This function is where any reload routines take place. Re-read config files, change signalling, whatever is appropriate on a reload.
Definition at line 2459 of file chan_agent.c. References ast_log(), config_load(), and LOG_NOTICE. Referenced by ast_module_reload(). 02460 { 02461 read_agent_config(); 02462 if (persistent_agents) 02463 reload_agents(); 02464 return 0; 02465 }
|
|
Cleanup all module structures, sockets, etc. Standard module functions ... Definition at line 2467 of file chan_agent.c. Referenced by load_module(). 02468 { 02469 struct agent_pvt *p; 02470 /* First, take us out of the channel loop */ 02471 /* Unregister CLI application */ 02472 ast_cli_unregister(&cli_show_agents); 02473 ast_cli_unregister(&cli_agent_logoff); 02474 /* Unregister dialplan applications */ 02475 ast_unregister_application(app); 02476 ast_unregister_application(app2); 02477 ast_unregister_application(app3); 02478 /* Unregister manager command */ 02479 ast_manager_unregister("Agents"); 02480 ast_manager_unregister("AgentLogoff"); 02481 ast_manager_unregister("AgentCallbackLogin"); 02482 /* Unregister channel */ 02483 ast_channel_unregister(&agent_tech); 02484 if (!ast_mutex_lock(&agentlock)) { 02485 /* Hangup all interfaces if they have an owner */ 02486 p = agents; 02487 while(p) { 02488 if (p->owner) 02489 ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD); 02490 p = p->next; 02491 } 02492 agents = NULL; 02493 ast_mutex_unlock(&agentlock); 02494 } else { 02495 ast_log(LOG_WARNING, "Unable to lock the monitor\n"); 02496 return -1; 02497 } 02498 return 0; 02499 }
|
|
Provides a usecount. This function will be called by various parts of asterisk. Basically, all it has to do is to return a usecount when called. You will need to maintain your usecount within the module somewhere. The usecount should be how many channels provided by this module are in use.
Definition at line 2501 of file chan_agent.c. 02502 { 02503 return usecnt; 02504 }
|