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 #include "asterisk/autoconfig.h"
00027 #include "app_conference.h"
00028 #include "common.h"
00029 #include "asterisk/module.h"
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 static char *app = "Conference" ;
00051 static char *synopsis = "Channel Independent Conference" ;
00052 static char *descrip = " Conference(): returns 0\n"
00053 "if the user exits with the '#' key, or -1 if the user hangs up.\n" ;
00054
00055
00056
00057
00058
00059
00060 static int unload_module( void *mod )
00061 {
00062 ast_log( LOG_NOTICE, "unloading app_conference module\n" ) ;
00063
00064 ast_module_user_hangup_all();
00065
00066
00067
00068 unregister_conference_cli() ;
00069
00070 return ast_unregister_application( app ) ;
00071 }
00072
00073 static int load_module( void *mod )
00074 {
00075 ast_log( LOG_NOTICE, "loading app_conference module [ $Revision: 693 $ ]\n" ) ;
00076
00077
00078 init_conference() ;
00079
00080
00081 register_conference_cli() ;
00082
00083 return ast_register_application( app, app_conference_main, synopsis, descrip ) ;
00084 }
00085
00086
00087
00088
00089
00090 int app_conference_main( struct ast_channel* chan, void* data )
00091 {
00092 int res = 0 ;
00093 struct ast_module_user *u ;
00094
00095
00096
00097 u = ast_module_user_add(chan);
00098
00099
00100 res = member_exec( chan, data ) ;
00101
00102
00103
00104 ast_module_user_remove (u);
00105
00106 return res ;
00107 }
00108
00109
00110
00111
00112
00113
00114 long usecdiff( struct timeval* timeA, struct timeval* timeB )
00115 {
00116 long a_secs = timeA->tv_sec - timeB->tv_sec ;
00117 long b_secs = (long)( timeA->tv_usec / 1000 ) - (long)( timeB->tv_usec / 1000 ) ;
00118 long u_secs = ( a_secs * 1000 ) + b_secs ;
00119 return u_secs ;
00120 }
00121
00122
00123 void add_milliseconds( struct timeval* tv, long ms )
00124 {
00125
00126 tv->tv_usec += ( ms * 1000 ) ;
00127
00128
00129 long s = ( tv->tv_usec / 1000000 ) ;
00130
00131
00132 if ( s > 0 ) tv->tv_usec -= ( s * 1000000 ) ;
00133
00134
00135 tv->tv_sec += s ;
00136
00137 return ;
00138 }
00139
00140 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Conference");
00141