00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "asterisk/autoconfig.h"
00032 #include "app_conference.h"
00033 #include "common.h"
00034 #include "asterisk/module.h"
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 static char *tdesc = "Channel Independent Conference Application" ;
00056 static char *app = "Conference" ;
00057 static char *synopsis = "Channel Independent Conference" ;
00058 static char *descrip = " Conference(): returns 0\n"
00059 "if the user exits with the '#' key, or -1 if the user hangs up.\n" ;
00060
00061
00062 #ifdef REVISION
00063 static char *revision = REVISION;
00064 #else
00065 static char *revision = "unknown";
00066 #endif
00067
00068
00069
00070
00071
00072
00073 int unload_module(void *mod)
00074 {
00075 ast_log( LOG_NOTICE, "unloading app_conference module\n" ) ;
00076
00077 ast_module_user_hangup_all();
00078
00079
00080
00081 unregister_conference_cli() ;
00082
00083 return ast_unregister_application( app ) ;
00084 }
00085
00086 int load_module(void *mod)
00087 {
00088 ast_log( LOG_NOTICE, "Loading app_conference module, revision=%s\n", revision) ;
00089
00090
00091 init_conference() ;
00092
00093
00094 register_conference_cli() ;
00095
00096 return ast_register_application( app, app_conference_main, synopsis, descrip ) ;
00097 }
00098
00099 const char *description()
00100 {
00101 return tdesc ;
00102 }
00103
00104 #if 0
00105 static int usecount( void *mod )
00106 {
00107 int res;
00108 STANDARD_USECOUNT( res ) ;
00109 return res;
00110 }
00111 #endif
00112
00113 char *key()
00114 {
00115 return ASTERISK_GPL_KEY ;
00116 }
00117
00118
00119
00120
00121
00122
00123
00124 int app_conference_main(struct ast_channel* chan, void* data)
00125 {
00126 int res = 0 ;
00127 struct ast_module_user *u ;
00128
00129
00130
00131 u = ast_module_user_add(chan);
00132
00133
00134 res = member_exec( chan, data ) ;
00135
00136
00137
00138 ast_module_user_remove (u);
00139
00140 return res ;
00141 }
00142
00143
00144
00145
00146
00147
00148 long usecdiff(struct timeval* timeA, struct timeval* timeB)
00149 {
00150 long a_secs = timeA->tv_sec - timeB->tv_sec ;
00151 long b_secs = (long)( timeA->tv_usec / 1000 ) - (long)( timeB->tv_usec / 1000 ) ;
00152 long u_secs = ( a_secs * 1000 ) + b_secs ;
00153 return u_secs ;
00154 }
00155
00156
00157 void add_milliseconds(struct timeval* tv, long ms)
00158 {
00159
00160 tv->tv_usec += ( ms * 1000 ) ;
00161
00162
00163 long s = ( tv->tv_usec / 1000000 ) ;
00164
00165
00166 if ( s > 0 ) tv->tv_usec -= ( s * 1000000 ) ;
00167
00168
00169 tv->tv_sec += s ;
00170
00171 return ;
00172 }
00173
00174 int reload(void *mod)
00175 {
00176 return 0;
00177 }
00178
00179 #define AST_MODULE "conference"
00180
00181 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Conference");
00182
00183