147{
148 int i = 0, j, k = 0, did_ignore = 0, special_noanswer = 0;
153 char pwline[256];
154 char ourcidname[256],ourcidnum[256];
156 struct timeval lastdigittime;
157 int res;
158 FILE *fp;
165 );
166
169 return -1;
170 }
171
172 ast_debug(1,
"Digittimeout: %d\n", digittimeout);
173 ast_debug(1,
"Responsetimeout: %d\n", firstdigittimeout);
174
176
178
180 args.context =
"disa";
185 } else {
186
188 }
189
190
192
195
197 }
198 } else special_noanswer = 1;
199
201
202 if (!strcasecmp(
args.passcode,
"no-password")) {
203 k |= 1;
204 ast_debug(1,
"DISA no-password login success\n");
205 }
206
208
210
212
213 for (;;) {
214
216 ast_debug(1,
"DISA %s entry timeout on chan %s\n",
218 break;
219 }
220
222 ast_debug(1,
"Waitfor returned %d\n", res);
223 continue;
224 }
225
228 return -1;
229 }
230
236 return -1;
237 }
238
239
242 continue;
243 }
244
247
248 if (!i) {
249 k |= 2;
251 }
252
254
255
257 if (!(k&1)) {
258 if (j == '#') {
259
260 if (sscanf(
args.passcode,
"%30d",&j) < 1) {
261 fp = fopen(
args.passcode,
"r");
262 if (!fp) {
265 return -1;
266 }
267 pwline[0] = 0;
268 while(fgets(pwline,sizeof(pwline) - 1,fp)) {
269 if (!pwline[0])
270 continue;
271 if (pwline[strlen(pwline) - 1] == '\n')
272 pwline[strlen(pwline) - 1] = 0;
273 if (!pwline[0])
274 continue;
275
276 if (pwline[0] == '#')
277 continue;
278 if (pwline[0] == ';')
279 continue;
280
282
284
285
286 if (sscanf(
args.passcode,
"%30d", &j) < 1)
287 continue;
288
289 if (!strcmp(exten,
args.passcode)) {
291 args.context =
"disa";
294 break;
295 }
296 }
297 fclose(fp);
298 }
299
300 if (strcmp(exten,
args.passcode)) {
302 goto reorder;
303
304 }
305
308
309 k|=1;
310 i = 0;
311 exten[sizeof(acctcode)] = 0;
313 exten[0] = 0;
315 continue;
316 }
317 } else {
318 if (j == '#') {
319 if (i == 0
324
325 } else {
326 break;
327 }
328 }
329 }
330
331 exten[i++] = j;
332 exten[i] = 0;
333 if (!(k&1))
334 continue;
335
336
337
339 exten[--i] = 0;
340 break;
341 }
342
345 did_ignore = 1;
346 } else
347 if (did_ignore) {
349 did_ignore = 0;
350 }
351
352
355 break;
356 }
357 }
358 }
359
361
362 if (k == 3) {
363 int recheck = 0;
364
368 exten[0] = 'i';
369 exten[1] = '\0';
370 recheck = 1;
371 }
372 if (!recheck
376
380 }
381
384 ast_channel_accountcode_set(chan, acctcode);
386 }
387
390 }
392 return 0;
393 }
394 }
395
396
397
398reorder:
399
402
404
405 return -1;
406}
static const struct ast_app_option app_opts[128]
static void play_dialtone(struct ast_channel *chan, char *mailbox)
#define ast_strdupa(s)
duplicate a string in memory from the stack
int ast_callerid_split(const char *src, char *name, int namelen, char *num, int numlen)
const char * ast_channel_name(const struct ast_channel *chan)
void ast_channel_clear_flag(struct ast_channel *chan, unsigned int flag)
Clear a flag on a channel.
#define ast_channel_lock(chan)
int ast_waitfor(struct ast_channel *chan, int ms)
Wait for input on a channel.
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
void ast_set_callerid(struct ast_channel *chan, const char *cid_num, const char *cid_name, const char *cid_ani)
Set caller ID number, name and ANI and generate AMI event.
void ast_channel_set_flag(struct ast_channel *chan, unsigned int flag)
Set a flag on a channel.
struct ast_pbx * ast_channel_pbx(const struct ast_channel *chan)
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
int ast_answer(struct ast_channel *chan)
Answer a channel.
int ast_indicate(struct ast_channel *chan, int condition)
Indicates condition of channel.
int ast_safe_sleep(struct ast_channel *chan, int ms)
Wait for a specified amount of time, looking for hangups.
#define ast_channel_unlock(chan)
#define AST_MAX_EXTENSION
ast_channel_state
ast_channel states
#define AST_APP_ARG(name)
Define an application argument.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags *flags, char **args, char *optstr)
Parses a string containing application options and sets flags/arguments.
#define ast_debug(level,...)
Log a DEBUG message.
void ast_playtones_stop(struct ast_channel *chan)
Stop playing tones on a channel.
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name.
int ast_pbx_exec_application(struct ast_channel *chan, const char *app_name, const char *app_args)
Execute an application.
int ast_explicit_goto(struct ast_channel *chan, const char *context, const char *exten, int priority)
int ast_ignore_pattern(const char *context, const char *pattern)
Checks to see if a number should be ignored.
int ast_matchmore_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Looks to see if adding anything to this extension might match something. (exists ^ canmatch)
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
static force_inline int attribute_pure ast_strlen_zero(const char *s)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Structure used to handle boolean flags.
Data structure associated with a single frame of data.
struct ast_frame_subclass subclass
union ast_frame::@226 data
enum ast_frame_type frametype
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
#define ast_test_flag(p, flag)
#define ast_clear_flag(p, flag)