App to flash a DAHDI trunk. More...
#include "asterisk.h"#include <dahdi/user.h>#include "asterisk/lock.h"#include "asterisk/file.h"#include "asterisk/channel.h"#include "asterisk/pbx.h"#include "asterisk/module.h"#include "asterisk/translate.h"#include "asterisk/image.h"
Go to the source code of this file.
Functions | |
| AST_MODULE_INFO_STANDARD (ASTERISK_GPL_KEY,"Flash channel application") | |
| static int | dahdi_wait_event (int fd) |
| static int | flash_exec (struct ast_channel *chan, void *data) |
| static int | load_module (void) |
| static int | unload_module (void) |
Variables | |
| static char * | app = "Flash" |
App to flash a DAHDI trunk.
Definition in file app_flash.c.
| AST_MODULE_INFO_STANDARD | ( | ASTERISK_GPL_KEY | , | |
| "Flash channel application" | ||||
| ) |
| static int dahdi_wait_event | ( | int | fd | ) | [inline, static] |
Definition at line 65 of file app_flash.c.
Referenced by flash_exec().
| static int flash_exec | ( | struct ast_channel * | chan, | |
| void * | data | |||
| ) | [static] |
Definition at line 75 of file app_flash.c.
References ast_log(), ast_safe_sleep(), ast_verb, dahdi_wait_event(), errno, ast_channel::fds, LOG_WARNING, ast_channel::tech, and ast_channel_tech::type.
Referenced by load_module().
00076 { 00077 int res = -1; 00078 int x; 00079 struct dahdi_params dahdip; 00080 00081 if (strcasecmp(chan->tech->type, "DAHDI")) { 00082 ast_log(LOG_WARNING, "%s is not a DAHDI channel\n", chan->name); 00083 return -1; 00084 } 00085 00086 memset(&dahdip, 0, sizeof(dahdip)); 00087 res = ioctl(chan->fds[0], DAHDI_GET_PARAMS, &dahdip); 00088 if (!res) { 00089 if (dahdip.sigtype & __DAHDI_SIG_FXS) { 00090 x = DAHDI_FLASH; 00091 res = ioctl(chan->fds[0], DAHDI_HOOK, &x); 00092 if (!res || (errno == EINPROGRESS)) { 00093 if (res) { 00094 /* Wait for the event to finish */ 00095 dahdi_wait_event(chan->fds[0]); 00096 } 00097 res = ast_safe_sleep(chan, 1000); 00098 ast_verb(3, "Flashed channel %s\n", chan->name); 00099 } else 00100 ast_log(LOG_WARNING, "Unable to flash channel %s: %s\n", chan->name, strerror(errno)); 00101 } else 00102 ast_log(LOG_WARNING, "%s is not an FXO Channel\n", chan->name); 00103 } else 00104 ast_log(LOG_WARNING, "Unable to get parameters of %s: %s\n", chan->name, strerror(errno)); 00105 00106 return res; 00107 }
| static int load_module | ( | void | ) | [static] |
Definition at line 114 of file app_flash.c.
References ast_register_application_xml, and flash_exec().
00115 { 00116 return ast_register_application_xml(app, flash_exec); 00117 }
| static int unload_module | ( | void | ) | [static] |
Definition at line 109 of file app_flash.c.
References ast_unregister_application().
00110 { 00111 return ast_unregister_application(app); 00112 }
char* app = "Flash" [static] |
Definition at line 63 of file app_flash.c.
1.6.1