25 import ConfigParser |
25 import ConfigParser |
26 |
26 |
27 from job import SMSJob, FAXJob, MailJob |
27 from job import SMSJob, FAXJob, MailJob |
28 from joblist import Joblist |
28 from joblist import Joblist |
29 from providerlist import Providerlist |
29 from providerlist import Providerlist |
|
30 from acounting import Acounting |
30 |
31 |
31 class MyUserDB(UserDB): |
32 class MyUserDB(UserDB): |
32 def __init__(self, userlist,jobqueue): |
33 def __init__(self, userlist,jobqueue): |
33 UserDB.__init__(self, None,userlist,jobqueue) |
34 UserDB.__init__(self, None,userlist,jobqueue) |
34 |
35 |
95 |
96 |
96 MyManager.register('SMSJob', SMSJob) |
97 MyManager.register('SMSJob', SMSJob) |
97 MyManager.register('FAXob', FAXJob) |
98 MyManager.register('FAXob', FAXJob) |
98 MyManager.register('MailJob',MailJob) |
99 MyManager.register('MailJob',MailJob) |
99 MyManager.register('Providerlist',Providerlist) |
100 MyManager.register('Providerlist',Providerlist) |
|
101 MyManager.register('Acounting',Acounting) |
100 manager = MyManager() |
102 manager = MyManager() |
101 manager.start() |
103 manager.start() |
102 |
104 |
103 |
105 |
104 conf=["iro.conf", "~/iro.conf","/etc/iro/iro.conf"] |
106 conf=["iro.conf", "~/iro.conf","/etc/iro/iro.conf"] |
111 localhost=MySMTP() |
113 localhost=MySMTP() |
112 localhost.read_basic_config(conf) |
114 localhost.read_basic_config(conf) |
113 |
115 |
114 smstrade=MySmstrade() |
116 smstrade=MySmstrade() |
115 smstrade.read_basic_config(conf) |
117 smstrade.read_basic_config(conf) |
|
118 |
|
119 cp = ConfigParser.ConfigParser() |
|
120 cp.read(conf) |
|
121 dbconn={'type':cp.get('db', 'type'), |
|
122 'host':cp.get('db', 'host'), |
|
123 'db':cp.get('db', 'db'), |
|
124 'user':cp.get('db', 'user'), |
|
125 'passwd':cp.get('db', 'passwd'), |
|
126 'table':cp.get('db', 'table'), |
|
127 } |
|
128 |
116 |
129 |
117 #Benutzerdatenbank erstellen |
130 #Benutzerdatenbank erstellen |
118 queue = Queue() |
131 queue = Queue() |
119 provider=manager.Providerlist() |
132 provider=manager.Providerlist() |
120 provider.add("sipgate", sip, ["sms", "fax", ]) |
133 provider.add("sipgate", sip, ["sms", "fax", ]) |
123 #provider.add("fax.de", None, ["sms", "fax", ]) |
136 #provider.add("fax.de", None, ["sms", "fax", ]) |
124 provider.add("localhost", localhost, ["mail", ]) |
137 provider.add("localhost", localhost, ["mail", ]) |
125 provider.setDefault("sms","smstrade") |
138 provider.setDefault("sms","smstrade") |
126 provider.setDefault("fax","sipgate") |
139 provider.setDefault("fax","sipgate") |
127 provider.setDefault("mail","localhost") |
140 provider.setDefault("mail","localhost") |
128 jobqueue=Joblist(manager, queue, provider) |
141 jobqueue=Joblist(manager, queue, provider,dbconn) |
129 |
142 |
130 userdb=MyUserDB(userlist,jobqueue) |
143 userdb=MyUserDB(userlist,jobqueue) |
131 |
144 |
132 #working thread erstellen |
145 #working thread erstellen |
133 from worker import Worker |
146 from worker import Worker |