Source

asterisk-parrot / app_parrot.c

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
/*
 * phoneparrot - Phone Parrot
 * Version 0.1.1
 *
 * Copyright (c) 2006-2009 J.A. Roberts Tunney
 *
 * J.A. Roberts Tunney <jtunney@lobstertech.com>
 *
 * Keep it Open Source Pigs
 *
 * This program is free software, distributed under the terms of
 * the GNU General Public License version 2.0.
 *
 * This is the most obnoxious Asterisk application ever written.
 */

#define AST_MODULE "app_parrot"

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <asterisk/file.h>
#include <asterisk/frame.h>
#include <asterisk/options.h>
#include <asterisk/logger.h>
#include <asterisk/channel.h>
#include <asterisk/pbx.h>
#include <asterisk/module.h>
#include <asterisk/lock.h>
#include <asterisk/app.h>
#include <asterisk/dsp.h>
#ifdef _LIBSOUNDTOUCH4C_
#include <soundtouch4c.h>
#endif
#ifndef _ASTERISK_1_2_
#include <asterisk/stringfields.h>
#endif

static char *moddesc = "Phone Parrot";

#ifdef _ASTERISK_1_2_
#define ast_module_user localuser
#define ast_module_user_remove LOCAL_USER_REMOVE
#define ast_module_user_hangup_all() STANDARD_HANGUP_LOCALUSERS
STANDARD_LOCAL_USER;
LOCAL_USER_DECL;
#endif

static char *parrot_app = "Parrot";
static char *parrot_synopsis = "Repeats back to caller what they say like a 5-year-old";
static char *parrot_descrip = ""
"Parrot(options)\n"
"\n"
"Description:\n"
"  When this application is invoked, it will record to memory what\n"
"  the caller is saying.  When the caller stops talking, recording\n"
"  buffer of what s?he just said is played back.\n"
"\n"
#ifdef _LIBSOUNDTOUCH4C_
"  You may also chose to add a voice pitch change effect to what\n"
"  the caller just said with the P() option.  Pitch is specified\n"
"  in semi-tones.  -5.0 is good for making the voice lower and\n"
"  5.0 is good for making the voice higher.\n"
"\n"
#else
"  If you install SoundTouch and libsoundtouch4c (Also available\n"
"  at www.lobstertech.com) and then recompile this module, it\n"
"  will include support for changing the pitch of the caller\'s\n"
"  voice when echo\'d back.\n"
"\n"
#endif
"Options:\n"
"  T(...) - Silence Threshold, default 256\n"
"  W(...) - Milliseconds of silence before repeat.  Default 1000\n"
"  N(...) - Minimum time in milliseconds the caller needs to talk\n"
"           for voice to be echo'd back.  Default 400\n"
"  M(...) - Max milliseconds of talk to buffer.  Default 6000\n"
"  S(...) - If caller rambles for more than length of call buffer,\n"
"           play a random one of these sound clips instead. List\n"
"           is delimited by '^'.  Maximum of 16.  These may not be\n"
"           interrupted.\n"
"  G(...) - Play greeting clip in response to initial thing caller\n"
"           says.  In my testing I noticed that people get a little\n"
"           confused and just keep saying hello if you start them\n"
"           off in plain old parrot mode.  Here, you can specify a\n"
"           list of sound clips from which to randomly choose just\n"
"           like with S() here.\n"
"  H(...) - Hangup after a certain number of seconds\n"
"  I(...) - Repeat may be interrupted if caller speaks for '...'\n"
"           milliseconds.  Default is 400, 0 turns off\n"
#ifdef _LIBSOUNDTOUCH4C_
"  P(...) - New pitch of voice echo'd back. Default 0.0\n"
#endif
;

#define OPT_PARROT_THRESHOLD  (1 << 0)
#define OPT_PARROT_WAIT       (1 << 1)
#define OPT_PARROT_MINTALK    (1 << 2)
#define OPT_PARROT_MAXTALK    (1 << 3)
#define OPT_PARROT_SOUNDCLIPS (1 << 4)
#define OPT_PARROT_GREETCLIPS (1 << 5)
#define OPT_PARROT_HANGUP     (1 << 6)
#define OPT_PARROT_INTERRUPT  (1 << 7)
#define OPT_PARROT_PITCH      (1 << 8)

#define PARROT_MAX_CLIPS 16

enum {
	OPT_ARG_PARROT_THRESHOLD = 0,
	OPT_ARG_PARROT_WAIT,
	OPT_ARG_PARROT_MAXTALK,
	OPT_ARG_PARROT_SOUNDCLIPS,
	OPT_ARG_PARROT_GREETCLIPS,
	OPT_ARG_PARROT_HANGUP,
	OPT_ARG_PARROT_MINTALK,
	OPT_ARG_PARROT_INTERRUPT,
	OPT_ARG_PARROT_PITCH,
	/* note: this entry _MUST_ be the last one in the enum */
	OPT_ARG_PARROT_ARRAY_SIZE
} parrot_option_args;

AST_APP_OPTIONS(parrot_options, {
	AST_APP_OPTION_ARG('T', OPT_PARROT_THRESHOLD, OPT_ARG_PARROT_THRESHOLD),
	AST_APP_OPTION_ARG('W', OPT_PARROT_WAIT, OPT_ARG_PARROT_WAIT),
	AST_APP_OPTION_ARG('M', OPT_PARROT_MAXTALK, OPT_ARG_PARROT_MAXTALK),
	AST_APP_OPTION_ARG('S', OPT_PARROT_SOUNDCLIPS, OPT_ARG_PARROT_SOUNDCLIPS),
	AST_APP_OPTION_ARG('G', OPT_PARROT_GREETCLIPS, OPT_ARG_PARROT_GREETCLIPS),
	AST_APP_OPTION_ARG('H', OPT_PARROT_HANGUP, OPT_ARG_PARROT_HANGUP),
	AST_APP_OPTION_ARG('N', OPT_PARROT_MINTALK, OPT_ARG_PARROT_MINTALK),
	AST_APP_OPTION_ARG('I', OPT_PARROT_INTERRUPT, OPT_ARG_PARROT_INTERRUPT),
	AST_APP_OPTION_ARG('P', OPT_PARROT_PITCH, OPT_ARG_PARROT_PITCH),
});

struct parrot_ops {
	int options;
	int threshold;
	int wait;
	int mintalk;
	int maxtalk;
	char *soundclips[PARROT_MAX_CLIPS];
	int soundclipcnt;
	char *greetclips[PARROT_MAX_CLIPS];
	int greetclipcnt;
	int hangup;
	int interrupt;
	float pitch;
};

struct mybuffer {
	short *buf;
	int    len;
	short *cur;
	short *end;
};

#ifdef _LIBSOUNDTOUCH4C_
static struct soundtouch *soundtouch_create(float newPitch)
{
	struct soundtouch *snd;

	ast_log(LOG_DEBUG, "Creating SoundTouch object...\n");
	snd = SoundTouch_construct();
	if (!snd) {
		ast_log(LOG_WARNING, "Failed to create SoundTouch object\n");
		return NULL;
	}

	SoundTouch_setChannels(snd, 1);
	SoundTouch_setSampleRate(snd, 8000);
	SoundTouch_setPitchSemiTonesFloat(snd, newPitch);
	SoundTouch_setSetting(snd, SETTING_USE_QUICKSEEK, 1);
	SoundTouch_setSetting(snd, SETTING_USE_AA_FILTER, 1);

	return snd;
}

static void soundtouch_free(struct soundtouch *st)
{
	ast_log(LOG_DEBUG, "Freeing SoundTouch object...\n");
	SoundTouch_destruct(st);
}
#endif

#define CONTINUEFREE { ast_frfree(f); continue; }
#define BREAKFREE { ast_frfree(f); break; }
#define SAMPPERFRAME 160

/*
 * Someone take these dreams away...
 *
 *  -1 - error or hangup
 *   0 - success
 */
static int parrot_main(struct ast_channel *chan, const struct parrot_ops *ops)
{
	enum { MODE_SILENCE,
	       MODE_RECORD,
	       MODE_PENDING } mode = MODE_SILENCE;
	struct ast_frame *f = NULL;
	struct ast_dsp *dsp;
	int hanguptime = 0;
	unsigned long samptotal = 0;
	int msofsilence = 0;
	short data[SAMPPERFRAME]; /* used to temp copy frame data */
	struct mybuffer in, out;
#ifdef _LIBSOUNDTOUCH4C_
	struct soundtouch *st;
#endif
	int greeted = 0;

	if ((ops->options & OPT_PARROT_HANGUP) == OPT_PARROT_HANGUP) {
		hanguptime = time(NULL) + ops->hangup;
	}

	if (ast_set_read_format(chan, AST_FORMAT_SLINEAR)  < 0 ||
	    ast_set_write_format(chan, AST_FORMAT_SLINEAR) < 0) {
		ast_log(LOG_WARNING, "Unable to set channel i/o to slinear mode\n");
		return -1;
	}
	if (!(dsp = ast_dsp_new())) {
		ast_log(LOG_WARNING, "Unable to create DSP object\n");
		return -1;
	}
	ast_dsp_set_threshold(dsp, ops->threshold);

	in.len  = ops->maxtalk * 8/*kHz*/;
	out.len = ops->maxtalk * 8/*kHz*/;

	if (!(in.buf = malloc(in.len * sizeof(short)))) {
		ast_log(LOG_ERROR, "Out of memory!\n");
		ast_dsp_free(dsp);
		return -1;
	}
	if (!(out.buf = malloc(out.len * sizeof(short)))) {
		ast_log(LOG_ERROR, "Out of memory!\n");
		free(in.buf);
		ast_dsp_free(dsp);
		return -1;
	}

#ifdef _LIBSOUNDTOUCH4C_
	if (!(st = soundtouch_create(ops->pitch))) {
		free(in.buf);
		free(out.buf);
		ast_dsp_free(dsp);
		return -1;
	}
#endif

	in.end = in.cur = in.buf;
	out.end = out.cur = out.buf;

	while (ast_waitfor(chan, -1) > -1) {
		if (ast_check_hangup(chan))
			break;
		if (hanguptime && time(NULL) >= hanguptime)
			break;
		if (!(f = ast_read(chan)))
			break;
		if (f->frametype != AST_FRAME_VOICE || f->samples != SAMPPERFRAME)
			CONTINUEFREE;

		/* copy frame data to temporary buffer */
		samptotal += SAMPPERFRAME;
		ast_dsp_silence(dsp, f, &msofsilence);
		memcpy((void *)data, (void *)f->data, SAMPPERFRAME * sizeof(short));

		/* write any pending repeat data back to caller in really cheap way.
		 * if asterisk doesn't give us a steady flow of frames, like if
		 * silence suppression is used, this application will get owned */
		if (out.cur < out.end) {
			f->delivery.tv_sec = 0;
			f->delivery.tv_usec = 0;
			if (out.end - out.cur < SAMPPERFRAME) {
				memset((void *)f->data, 0, SAMPPERFRAME * sizeof(short));
				memcpy((void *)f->data, (void *)out.cur, (void *)out.end - (void *)out.cur);
				out.end = out.cur = out.buf;
			} else {
				memcpy((void *)f->data, (void *)out.cur, SAMPPERFRAME * sizeof(short));
				out.cur += SAMPPERFRAME;
			}
#ifdef _LIBSOUNDTOUCH4C_
			if (ops->pitch != 0.0) {
				SoundTouch_putSamples(st, f->data, SAMPPERFRAME);
				memset((void *)f->data, 0, SAMPPERFRAME * sizeof(short));
				f->samples = SoundTouch_receiveSamplesEx(st, f->data, SAMPPERFRAME);
			}
#endif
			if (ast_write(chan, f) == -1)
				BREAKFREE;
		}

		/* in silence mode, we wait for non-silence ^_^ */
		if (mode == MODE_SILENCE) {
			if (msofsilence)
				CONTINUEFREE;
			in.end = in.cur = in.buf;
			mode = MODE_RECORD;
			if (option_verbose >= 6)
				ast_verbose(VERBOSE_PREFIX_4 "Record(%ld)\n",
				            (unsigned long)(samptotal / 8));
		}

		/* have we run out of in buffer? */
		if (in.buf + in.len - in.cur < SAMPPERFRAME) {
			if ((ops->options & OPT_PARROT_SOUNDCLIPS) == OPT_PARROT_SOUNDCLIPS) {
				/* play random clip */
				ast_frfree(f);
				mode = MODE_SILENCE;
				in.end = in.cur = in.buf;
				out.end = out.cur = out.buf;
				if (ast_streamfile(chan, ops->soundclips[rand() % ops->soundclipcnt], chan->language) == -1)
					goto OHSNAP;
				if (ast_waitstream(chan, "") == -1)
					goto OHSNAP;
				ast_stopstream(chan);
				continue;
			}
			memcpy((void *)out.buf, (void *)in.buf, (void *)in.end - (void *)in.buf);
			out.cur = out.buf;
			out.end = out.buf + (in.end - in.buf);
			in.end = in.cur = in.buf;
			mode = MODE_SILENCE;
			if (option_verbose >= 6)
				ast_verbose(VERBOSE_PREFIX_4 "Repeat(%ld): %d so far (ran out of buffer)\n",
				            (unsigned long)(samptotal / 8),
				            (int)((out.end - out.buf) / 8));
		} else {
			memcpy((void *)in.cur, (void *)data, SAMPPERFRAME * sizeof(short));
			in.cur += SAMPPERFRAME;
		}

		/* in record mode, we slam more data on the 'in' buffer */
		if (mode == MODE_RECORD) {
			if (msofsilence < 200) {
				in.end = in.cur;

				if (ops->interrupt &&                          /* interrupting is enabled       */
				    out.cur < out.end &&                       /* there is voice being repeated */
				    (in.end - in.buf) / 8 >= ops->interrupt) { /* there is enough chatter       */
					out.end = out.cur = out.buf;
					if (option_verbose >= 6)
						ast_verbose(VERBOSE_PREFIX_4 "Repeat(%ld): Interrupted\n",
						            (unsigned long)(samptotal / 8));
				}
			} else {
				if ((in.end - in.buf) / 8 < ops->mintalk) {
					if (option_verbose >= 6)
						ast_verbose(VERBOSE_PREFIX_4 "Silence(%ld): %d not enough\n",
						            (unsigned long)(samptotal / 8),
						            (int)((in.end - in.buf) / 8));
					mode = MODE_SILENCE;
					CONTINUEFREE;
				} else {
					in.end -= msofsilence * 8;
					mode = MODE_PENDING;
					if (option_verbose >= 6)
						ast_verbose(VERBOSE_PREFIX_4 "Pending(%ld): %d so far\n",
						            (unsigned long)(samptotal / 8),
						            (int)((in.end - in.buf) / 8));
				}
			}
			CONTINUEFREE;
		}

		/* in the temple of love, cry like rain */
		if (mode == MODE_PENDING) {
			if (!msofsilence) {
				in.end = in.cur;
				mode = MODE_RECORD;
				if (option_verbose >= 6)
					ast_verbose(VERBOSE_PREFIX_4 "Record(%ld)\n",
					            (unsigned long)(samptotal / 8));
				CONTINUEFREE;
			} else if (msofsilence >= ops->wait) {
				if (!greeted && (ops->options & OPT_PARROT_GREETCLIPS) == OPT_PARROT_GREETCLIPS) {
					/* greeting tyme! */
					ast_frfree(f);
					mode = MODE_SILENCE;
					in.end = in.cur = in.buf;
					out.end = out.cur = out.buf;
					greeted = 1;
					if (ast_streamfile(chan, ops->greetclips[rand() % ops->greetclipcnt], chan->language) == -1)
						goto OHSNAP;
					if (ast_waitstream(chan, "") == -1)
						goto OHSNAP;
					ast_stopstream(chan);
					continue;
				} else {
					/* add their recording to out so it gets repeated */
					/* add 300 ms of the silence to smooth end of voice */
					in.end += msofsilence < 300 ? msofsilence * 8 : 300 * 8;
					if (in.end > in.cur)
						in.end = in.cur;
					memcpy((void *)out.buf, (void *)in.buf, (void *)in.end - (void *)in.buf);
					out.cur = out.buf;
					out.end = out.buf + (in.end - in.buf);
					in.end = in.cur = in.buf;
					mode = MODE_SILENCE;
					if (option_verbose >= 6)
						ast_verbose(VERBOSE_PREFIX_4 "Repeat(%ld): %d to say after %d of silence\n",
						            (unsigned long)(samptotal / 8),
						            (int)((out.end - out.buf) / 8),
						            (int)(msofsilence));
				}
			} else
				CONTINUEFREE;
		}

		/* life is short and love is always over in the mou?rning */
		CONTINUEFREE;
	}

OHSNAP:
	ast_dsp_free(dsp);
	free(in.buf);
	free(out.buf);
#ifdef _LIBSOUNDTOUCH4C_
	soundtouch_free(st);
#endif

	return 0;
}

static int parrot(struct ast_channel *chan, const struct parrot_ops *ops)
{
	int rc;
	struct ast_module_user *u;
#ifdef _ASTERISK_1_2_
	LOCAL_USER_ADD(u);
#else
	u = ast_module_user_add(chan);
#endif
	rc = parrot_main(chan, ops);
	ast_module_user_remove(u);
	return rc;
}

static int parrot_app_exec(struct ast_channel *chan, void *data)
{
	AST_DECLARE_APP_ARGS(args,
		AST_APP_ARG(options);
	);
	char *parse;
	struct parrot_ops ops;
	struct ast_flags opts = { 0, };
	char *opt_args[OPT_ARG_PARROT_ARRAY_SIZE];

	srand(time(NULL));

	memset(&ops, 0, sizeof(ops));
	ops.threshold = 256;
	ops.wait = 1000;
	ops.mintalk = 400;
	ops.maxtalk = 6000;
	ops.interrupt = 400;
	ops.pitch = 0.0;

	if (!ast_strlen_zero(data)) {
		parse = ast_strdupa(data);
		AST_STANDARD_APP_ARGS(args, parse);

		if (ast_app_parse_options(parrot_options, &opts, opt_args, args.options))
			return -1;

		if (ast_test_flag(&opts, OPT_PARROT_THRESHOLD) && !ast_strlen_zero(opt_args[OPT_ARG_PARROT_THRESHOLD])) {
			ops.options |= OPT_PARROT_THRESHOLD;
			ops.threshold = strtol(opt_args[OPT_ARG_PARROT_THRESHOLD], NULL, 10);
		}
		if (ast_test_flag(&opts, OPT_PARROT_WAIT) && !ast_strlen_zero(opt_args[OPT_ARG_PARROT_WAIT])) {
			ops.options |= OPT_PARROT_WAIT;
			ops.wait = strtol(opt_args[OPT_ARG_PARROT_WAIT], NULL, 10);
		}
		if (ast_test_flag(&opts, OPT_PARROT_MINTALK) && !ast_strlen_zero(opt_args[OPT_ARG_PARROT_MINTALK])) {
			ops.options |= OPT_PARROT_MINTALK;
			ops.mintalk = strtol(opt_args[OPT_ARG_PARROT_MINTALK], NULL, 10);
		}
		if (ast_test_flag(&opts, OPT_PARROT_MAXTALK) && !ast_strlen_zero(opt_args[OPT_ARG_PARROT_MAXTALK])) {
			ops.options |= OPT_PARROT_MAXTALK;
			ops.maxtalk = strtol(opt_args[OPT_ARG_PARROT_MAXTALK], NULL, 10);
		}
		if (ast_test_flag(&opts, OPT_PARROT_SOUNDCLIPS) && !ast_strlen_zero(opt_args[OPT_ARG_PARROT_SOUNDCLIPS])) {
			char *s;
			int n;
			ops.options |= OPT_PARROT_SOUNDCLIPS;
			s = ast_strdupa(opt_args[OPT_ARG_PARROT_SOUNDCLIPS]);
			for (n = 0; n < PARROT_MAX_CLIPS; n++) {
				ops.soundclips[n] = strsep(&s, "^");
				if (ops.soundclips[n])
					ops.soundclipcnt++;
				else
					break;
			}
		}
		if (ast_test_flag(&opts, OPT_PARROT_GREETCLIPS) && !ast_strlen_zero(opt_args[OPT_ARG_PARROT_GREETCLIPS])) {
			char *s;
			int n;
			ops.options |= OPT_PARROT_GREETCLIPS;
			s = ast_strdupa(opt_args[OPT_ARG_PARROT_GREETCLIPS]);
			for (n = 0; n < PARROT_MAX_CLIPS; n++) {
				ops.greetclips[n] = strsep(&s, "^");
				if (ops.greetclips[n])
					ops.greetclipcnt++;
				else
					break;
			}
		}
		if (ast_test_flag(&opts, OPT_PARROT_HANGUP) && !ast_strlen_zero(opt_args[OPT_ARG_PARROT_HANGUP])) {
			ops.options |= OPT_PARROT_HANGUP;
			ops.hangup = strtol(opt_args[OPT_ARG_PARROT_HANGUP], NULL, 10);
		}
		if (ast_test_flag(&opts, OPT_PARROT_INTERRUPT) && !ast_strlen_zero(opt_args[OPT_ARG_PARROT_INTERRUPT])) {
			ops.options |= OPT_PARROT_INTERRUPT;
			ops.hangup = strtol(opt_args[OPT_ARG_PARROT_INTERRUPT], NULL, 10);
		}
#ifdef _LIBSOUNDTOUCH4C_
		if (ast_test_flag(&opts, OPT_PARROT_PITCH) && !ast_strlen_zero(opt_args[OPT_ARG_PARROT_PITCH])) {
			ops.options |= OPT_PARROT_PITCH;
			ops.pitch = strtof(opt_args[OPT_ARG_PARROT_PITCH], NULL);
		}
#endif
	}

	return parrot(chan, &ops);
}

int load_module(void)
{
	return ast_register_application(parrot_app, parrot_app_exec, parrot_synopsis, parrot_descrip);
}

int unload_module(void)
{
	ast_module_user_hangup_all();
	return ast_unregister_application(parrot_app);
}

int reload(void)
{
	return 0;
}

#ifdef _ASTERISK_1_2_

int usecount(void)
{
	int res;
	STANDARD_USECOUNT(res);
	return res;
}

char *key()
{
	return ASTERISK_GPL_KEY;
}

char *description(void)
{
	return "Phone Parrot Application";
}

#else /* #ifdef _ASTERISK_1_2_ */

AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Phone Parrot Application");

#endif /* #ifdef _ASTERISK_1_2_ */