150{
151 int i = 0, j, k = 0, did_ignore = 0, special_noanswer = 0;
156 char pwline[256];
157 char ourcidname[256],ourcidnum[256];
159 struct timeval lastdigittime;
160 int res;
161 FILE *fp;
168 );
169
172 return -1;
173 }
174
175 ast_debug(1,
"Digittimeout: %d\n", digittimeout);
176 ast_debug(1,
"Responsetimeout: %d\n", firstdigittimeout);
177
179
181
183 args.context =
"disa";
188 } else {
189
191 }
192
193
195
198
200 }
201 } else special_noanswer = 1;
202
204
205 if (!strcasecmp(
args.passcode,
"no-password")) {
206 k |= 1;
207 ast_debug(1,
"DISA no-password login success\n");
208 }
209
211
213
215
216 for (;;) {
217
219 ast_debug(1,
"DISA %s entry timeout on chan %s\n",
221 break;
222 }
223
225 ast_debug(1,
"Waitfor returned %d\n", res);
226 continue;
227 }
228
231 return -1;
232 }
233
239 return -1;
240 }
241
242
245 continue;
246 }
247
250
251 if (!i) {
252 k |= 2;
254 }
255
257
258
260 if (!(k&1)) {
261 if (j == '#') {
262
263 if (sscanf(
args.passcode,
"%30d",&j) < 1) {
264 fp = fopen(
args.passcode,
"r");
265 if (!fp) {
268 return -1;
269 }
270 pwline[0] = 0;
271 while(fgets(pwline,sizeof(pwline) - 1,fp)) {
272 if (!pwline[0])
273 continue;
274 if (pwline[strlen(pwline) - 1] == '\n')
275 pwline[strlen(pwline) - 1] = 0;
276 if (!pwline[0])
277 continue;
278
279 if (pwline[0] == '#')
280 continue;
281 if (pwline[0] == ';')
282 continue;
283
285
287
288
289 if (sscanf(
args.passcode,
"%30d", &j) < 1)
290 continue;
291
292 if (!strcmp(exten,
args.passcode)) {
294 args.context =
"disa";
297 break;
298 }
299 }
300 fclose(fp);
301 }
302
303 if (strcmp(exten,
args.passcode)) {
305 goto reorder;
306
307 }
308
311
312 k|=1;
313 i = 0;
314 exten[sizeof(acctcode)] = 0;
316 exten[0] = 0;
318 continue;
319 }
320 } else {
321 if (j == '#') {
322 if (i == 0
327
328 } else {
329 break;
330 }
331 }
332 }
333
334 exten[i++] = j;
335 exten[i] = 0;
336 if (!(k&1))
337 continue;
338
339
340
342 exten[--i] = 0;
343 break;
344 }
345
348 did_ignore = 1;
349 } else
350 if (did_ignore) {
352 did_ignore = 0;
353 }
354
355
358 break;
359 }
360 }
361 }
362
364
365 if (k == 3) {
366 int recheck = 0;
367
371 exten[0] = 'i';
372 exten[1] = '\0';
373 recheck = 1;
374 }
375 if (!recheck
379
383 }
384
387 ast_channel_accountcode_set(chan, acctcode);
389 }
390
393 }
395 return 0;
396 }
397 }
398
399
400
401reorder:
402
405
407
408 return -1;
409}
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.
union ast_frame::@228 data
struct ast_frame_subclass subclass
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)