res_musiconhold.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. /*
  2. * Asterisk -- A telephony toolkit for Linux.
  3. *
  4. * Routines implementing call parking
  5. *
  6. * Copyright (C) 1999, Mark Spencer
  7. *
  8. * Mark Spencer <markster@linux-support.net>
  9. *
  10. * This program is free software, distributed under the terms of
  11. * the GNU General Public License
  12. */
  13. #include <asterisk/lock.h>
  14. #include <asterisk/file.h>
  15. #include <asterisk/logger.h>
  16. #include <asterisk/channel.h>
  17. #include <asterisk/pbx.h>
  18. #include <asterisk/options.h>
  19. #include <asterisk/module.h>
  20. #include <asterisk/translate.h>
  21. #include <asterisk/say.h>
  22. #include <asterisk/channel_pvt.h>
  23. #include <asterisk/musiconhold.h>
  24. #include <asterisk/config.h>
  25. #include <stdlib.h>
  26. #include <errno.h>
  27. #include <unistd.h>
  28. #include <string.h>
  29. #include <signal.h>
  30. #include <stdlib.h>
  31. #include <stdio.h>
  32. #include <sys/time.h>
  33. #include <sys/signal.h>
  34. #include <netinet/in.h>
  35. #include <sys/stat.h>
  36. #include <dirent.h>
  37. #ifdef ZAPATA_MOH
  38. #include <linux/zaptel.h>
  39. #endif
  40. #include <unistd.h>
  41. #include <sys/ioctl.h>
  42. #include <pthread.h>
  43. static char *app0 = "MusicOnHold";
  44. static char *app1 = "WaitMusicOnHold";
  45. static char *app2 = "SetMusicOnHold";
  46. static char *synopsis0 = "Play Music On Hold indefinitely";
  47. static char *synopsis1 = "Wait, playing Music On Hold";
  48. static char *synopsis2 = "Set default Music On Hold class";
  49. static char *descrip0 = "MusicOnHold(class): "
  50. "Plays hold music specified by class. If omitted, the default\n"
  51. "music source for the channel will be used. Set the default \n"
  52. "class with the SetMusicOnHold() application.\n"
  53. "Returns -1 on hangup.\n"
  54. "Never returns otherwise.\n";
  55. static char *descrip1 = "WaitMusicOnHold(delay): "
  56. "Plays hold music specified number of seconds. Returns 0 when\n"
  57. "done, or -1 on hangup. If no hold music is available, the delay will\n"
  58. "still occur with no sound.\n";
  59. static char *descrip2 = "SetMusicOnHold(class): "
  60. "Sets the default class for music on hold for a given channel. When\n"
  61. "music on hold is activated, this class will be used to select which\n"
  62. "music is played.\n";
  63. struct mohclass {
  64. char class[80];
  65. char dir[256];
  66. char miscargs[256];
  67. int destroyme;
  68. int pid; /* PID of mpg123 */
  69. int quiet;
  70. pthread_t thread;
  71. struct mohdata *members;
  72. /* Source of audio */
  73. int srcfd;
  74. /* FD for timing source */
  75. int pseudofd;
  76. struct mohclass *next;
  77. };
  78. struct mohdata {
  79. int pipe[2];
  80. int origwfmt;
  81. struct mohclass *parent;
  82. struct mohdata *next;
  83. };
  84. static struct mohclass *mohclasses;
  85. static ast_mutex_t moh_lock = AST_MUTEX_INITIALIZER;
  86. #define LOCAL_MPG_123 "/usr/local/bin/mpg123"
  87. #define MPG_123 "/usr/bin/mpg123"
  88. #define MAX_MP3S 256
  89. static int spawn_mp3(struct mohclass *class)
  90. {
  91. int fds[2];
  92. int files;
  93. char fns[MAX_MP3S][80];
  94. char *argv[MAX_MP3S + 50];
  95. char xargs[256];
  96. char *argptr;
  97. int argc;
  98. DIR *dir;
  99. struct dirent *de;
  100. dir = opendir(class->dir);
  101. if (!dir) {
  102. ast_log(LOG_WARNING, "%s is not a valid directory\n", class->dir);
  103. return -1;
  104. }
  105. argv[0] = "mpg123";
  106. argv[1] = "-q";
  107. argv[2] = "-s";
  108. argv[3] = "--mono";
  109. argv[4] = "-r";
  110. argv[5] = "8000";
  111. argv[6] = "-b";
  112. argv[7] = "2048";
  113. argc = 8;
  114. if (class->quiet) {
  115. argv[argc++] = "-f";
  116. argv[argc++] = "8192";
  117. }
  118. /* Look for extra arguments and add them to the list */
  119. strncpy(xargs, class->miscargs, sizeof(xargs) - 1);
  120. argptr = xargs;
  121. while(argptr && strlen(argptr)) {
  122. argv[argc++] = argptr;
  123. argptr = strchr(argptr, ',');
  124. if (argptr) {
  125. *argptr = '\0';
  126. argptr++;
  127. }
  128. }
  129. files = 0;
  130. while((de = readdir(dir)) && (files < MAX_MP3S)) {
  131. if ((strlen(de->d_name) > 3) && !strcasecmp(de->d_name + strlen(de->d_name) - 4, ".mp3")) {
  132. strncpy(fns[files], de->d_name, sizeof(fns[files]));
  133. argv[argc++] = fns[files];
  134. files++;
  135. }
  136. }
  137. argv[argc] = NULL;
  138. closedir(dir);
  139. if (pipe(fds)) {
  140. ast_log(LOG_WARNING, "Pipe failed\n");
  141. return -1;
  142. }
  143. #if 0
  144. printf("%d files total, %d args total\n", files, argc);
  145. {
  146. int x;
  147. for (x=0;argv[x];x++)
  148. printf("arg%d: %s\n", x, argv[x]);
  149. }
  150. #endif
  151. if (!files) {
  152. ast_log(LOG_WARNING, "Found no files in '%s'\n", class->dir);
  153. close(fds[0]);
  154. close(fds[1]);
  155. return -1;
  156. }
  157. class->pid = fork();
  158. if (class->pid < 0) {
  159. close(fds[0]);
  160. close(fds[1]);
  161. ast_log(LOG_WARNING, "Fork failed: %s\n", strerror(errno));
  162. return -1;
  163. }
  164. if (!class->pid) {
  165. int x;
  166. close(fds[0]);
  167. /* Stdout goes to pipe */
  168. dup2(fds[1], STDOUT_FILENO);
  169. /* Close unused file descriptors */
  170. for (x=3;x<8192;x++)
  171. close(x);
  172. /* Child */
  173. chdir(class->dir);
  174. /* Default install is /usr/local/bin */
  175. execv(LOCAL_MPG_123, argv);
  176. /* Many places have it in /usr/bin */
  177. execv(MPG_123, argv);
  178. /* Check PATH as a last-ditch effort */
  179. execvp("mpg123", argv);
  180. ast_log(LOG_WARNING, "Exec failed: %s\n", strerror(errno));
  181. close(fds[1]);
  182. exit(1);
  183. } else {
  184. /* Parent */
  185. close(fds[1]);
  186. }
  187. return fds[0];
  188. }
  189. static void *monmp3thread(void *data)
  190. {
  191. #define MOH_MS_INTERVAL 100
  192. struct mohclass *class = data;
  193. struct mohdata *moh;
  194. char buf[8192];
  195. short sbuf[8192];
  196. int res, res2;
  197. struct timeval tv;
  198. struct timeval tv_tmp;
  199. long error_sec, error_usec;
  200. long delay;
  201. tv_tmp.tv_sec = 0;
  202. tv_tmp.tv_usec = 0;
  203. tv.tv_sec = 0;
  204. tv.tv_usec = 0;
  205. error_sec = 0;
  206. error_usec = 0;
  207. for(;/* ever */;) {
  208. /* Spawn mp3 player if it's not there */
  209. if (class->srcfd < 0) {
  210. if ((class->srcfd = spawn_mp3(class)) < 0) {
  211. ast_log(LOG_WARNING, "unable to spawn mp3player\n");
  212. /* Try again later */
  213. sleep(500);
  214. }
  215. }
  216. if (class->pseudofd > -1) {
  217. /* Pause some amount of time */
  218. res = read(class->pseudofd, buf, sizeof(buf));
  219. } else {
  220. /* Reliable sleep */
  221. if (gettimeofday(&tv_tmp, NULL) < 0) {
  222. ast_log(LOG_NOTICE, "gettimeofday() failed!\n");
  223. return NULL;
  224. }
  225. if (((unsigned long)(tv.tv_sec) > 0)&&((unsigned long)(tv.tv_usec) > 0)) {
  226. if ((unsigned long)(tv_tmp.tv_usec) < (unsigned long)(tv.tv_usec)) {
  227. tv_tmp.tv_usec += 1000000;
  228. tv_tmp.tv_sec -= 1;
  229. }
  230. error_sec = (unsigned long)(tv_tmp.tv_sec) - (unsigned long)(tv.tv_sec);
  231. error_usec = (unsigned long)(tv_tmp.tv_usec) - (unsigned long)(tv.tv_usec);
  232. } else {
  233. error_sec = 0;
  234. error_usec = 0;
  235. }
  236. if (error_sec * 1000 + error_usec / 1000 < MOH_MS_INTERVAL) {
  237. tv.tv_sec = tv_tmp.tv_sec + (MOH_MS_INTERVAL/1000 - error_sec);
  238. tv.tv_usec = tv_tmp.tv_usec + ((MOH_MS_INTERVAL % 1000) * 1000 - error_usec);
  239. delay = (MOH_MS_INTERVAL/1000 - error_sec) * 1000 +
  240. ((MOH_MS_INTERVAL % 1000) * 1000 - error_usec) / 1000;
  241. } else {
  242. ast_log(LOG_NOTICE, "Request to schedule in the past?!?!\n");
  243. tv.tv_sec = tv_tmp.tv_sec;
  244. tv.tv_usec = tv_tmp.tv_usec;
  245. delay = 0;
  246. }
  247. if (tv.tv_usec > 1000000) {
  248. tv.tv_sec++;
  249. tv.tv_usec-= 1000000;
  250. }
  251. if (delay > 0)
  252. usleep(delay * 1000);
  253. res = 800; /* 800 samples */
  254. }
  255. if (!class->members)
  256. continue;
  257. /* Read mp3 audio */
  258. if ((res2 = read(class->srcfd, sbuf, res * 2)) != res * 2) {
  259. if (!res2) {
  260. close(class->srcfd);
  261. class->srcfd = -1;
  262. if (class->pid) {
  263. kill(class->pid, SIGKILL);
  264. class->pid = 0;
  265. }
  266. } else
  267. ast_log(LOG_DEBUG, "Read %d bytes of audio while expecting %d\n", res2, res * 2);
  268. continue;
  269. }
  270. ast_mutex_lock(&moh_lock);
  271. moh = class->members;
  272. while(moh) {
  273. /* Write data */
  274. if ((res = write(moh->pipe[1], sbuf, res2)) != res2)
  275. if (option_debug)
  276. ast_log(LOG_DEBUG, "Only wrote %d of %d bytes to pipe\n", res, res2);
  277. moh = moh->next;
  278. }
  279. ast_mutex_unlock(&moh_lock);
  280. }
  281. return NULL;
  282. }
  283. static int moh0_exec(struct ast_channel *chan, void *data)
  284. {
  285. if (ast_moh_start(chan, data)) {
  286. ast_log(LOG_WARNING, "Unable to start music on hold (class '%s') on channel %s\n", (char *)data, chan->name);
  287. return -1;
  288. }
  289. while(!ast_safe_sleep(chan, 10000));
  290. return -1;
  291. }
  292. static int moh1_exec(struct ast_channel *chan, void *data)
  293. {
  294. int res;
  295. if (!data || !atoi(data)) {
  296. ast_log(LOG_WARNING, "WaitMusicOnHold requires an argument (number of seconds to wait)\n");
  297. return -1;
  298. }
  299. if (ast_moh_start(chan, NULL)) {
  300. ast_log(LOG_WARNING, "Unable to start music on hold (class '%s') on channel %s\n", (char *)data, chan->name);
  301. return -1;
  302. }
  303. res = ast_safe_sleep(chan, atoi(data) * 1000);
  304. ast_moh_stop(chan);
  305. return res;
  306. }
  307. static int moh2_exec(struct ast_channel *chan, void *data)
  308. {
  309. if (!data || !strlen(data)) {
  310. ast_log(LOG_WARNING, "SetMusicOnHold requires an argument (class)\n");
  311. return -1;
  312. }
  313. strncpy(chan->musicclass, data, sizeof(chan->musicclass));
  314. return 0;
  315. }
  316. static struct mohclass *get_mohbyname(char *name)
  317. {
  318. struct mohclass *moh;
  319. moh = mohclasses;
  320. while(moh) {
  321. if (!strcasecmp(name, moh->class))
  322. return moh;
  323. moh = moh->next;
  324. }
  325. return NULL;
  326. }
  327. static struct mohdata *mohalloc(struct mohclass *cl)
  328. {
  329. struct mohdata *moh;
  330. long flags;
  331. moh = malloc(sizeof(struct mohdata));
  332. if (!moh)
  333. return NULL;
  334. memset(moh, 0, sizeof(struct mohdata));
  335. if (pipe(moh->pipe)) {
  336. ast_log(LOG_WARNING, "Failed to create pipe: %s\n", strerror(errno));
  337. free(moh);
  338. return NULL;
  339. }
  340. /* Make entirely non-blocking */
  341. flags = fcntl(moh->pipe[0], F_GETFL);
  342. fcntl(moh->pipe[0], F_SETFL, flags | O_NONBLOCK);
  343. flags = fcntl(moh->pipe[1], F_GETFL);
  344. fcntl(moh->pipe[1], F_SETFL, flags | O_NONBLOCK);
  345. moh->parent = cl;
  346. moh->next = cl->members;
  347. cl->members = moh;
  348. return moh;
  349. }
  350. static void moh_release(struct ast_channel *chan, void *data)
  351. {
  352. struct mohdata *moh = data, *prev, *cur;
  353. int oldwfmt;
  354. ast_mutex_lock(&moh_lock);
  355. /* Unlink */
  356. prev = NULL;
  357. cur = moh->parent->members;
  358. while(cur) {
  359. if (cur == moh) {
  360. if (prev)
  361. prev->next = cur->next;
  362. else
  363. moh->parent->members = cur->next;
  364. break;
  365. }
  366. prev = cur;
  367. cur = cur->next;
  368. }
  369. ast_mutex_unlock(&moh_lock);
  370. close(moh->pipe[0]);
  371. close(moh->pipe[1]);
  372. oldwfmt = moh->origwfmt;
  373. free(moh);
  374. if (chan) {
  375. if (oldwfmt && ast_set_write_format(chan, oldwfmt))
  376. ast_log(LOG_WARNING, "Unable to restore channel '%s' to format %s\n", chan->name, ast_getformatname(oldwfmt));
  377. if (option_verbose > 2)
  378. ast_verbose(VERBOSE_PREFIX_3 "Stopped music on hold on %s\n", chan->name);
  379. }
  380. }
  381. static void *moh_alloc(struct ast_channel *chan, void *params)
  382. {
  383. struct mohdata *res;
  384. struct mohclass *class;
  385. ast_mutex_lock(&moh_lock);
  386. class = get_mohbyname(params);
  387. if (class)
  388. res = mohalloc(class);
  389. else {
  390. if (strcasecmp(params, "default"))
  391. ast_log(LOG_WARNING, "No class: %s\n", (char *)params);
  392. res = NULL;
  393. }
  394. ast_mutex_unlock(&moh_lock);
  395. if (res) {
  396. res->origwfmt = chan->writeformat;
  397. if (ast_set_write_format(chan, AST_FORMAT_SLINEAR)) {
  398. ast_log(LOG_WARNING, "Unable to set '%s' to signed linear format\n", chan->name);
  399. moh_release(NULL, res);
  400. res = NULL;
  401. }
  402. #if 0
  403. /* Allow writes to interrupt */
  404. chan->writeinterrupt = 1;
  405. #endif
  406. if (option_verbose > 2)
  407. ast_verbose(VERBOSE_PREFIX_3 "Started music on hold, class '%s', on %s\n", (char *)params, chan->name);
  408. }
  409. return res;
  410. }
  411. static int moh_generate(struct ast_channel *chan, void *data, int len, int samples)
  412. {
  413. struct ast_frame f;
  414. struct mohdata *moh = data;
  415. short buf[1280 + AST_FRIENDLY_OFFSET / 2];
  416. int res;
  417. len = samples * 2;
  418. if (len > sizeof(buf) - AST_FRIENDLY_OFFSET) {
  419. ast_log(LOG_WARNING, "Only doing %d of %d requested bytes on %s\n", sizeof(buf), len, chan->name);
  420. len = sizeof(buf) - AST_FRIENDLY_OFFSET;
  421. }
  422. res = read(moh->pipe[0], buf + AST_FRIENDLY_OFFSET/2, len);
  423. #if 0
  424. if (res != len) {
  425. ast_log(LOG_WARNING, "Read only %d of %d bytes: %s\n", res, len, strerror(errno));
  426. }
  427. #endif
  428. if (res > 0) {
  429. memset(&f, 0, sizeof(f));
  430. f.frametype = AST_FRAME_VOICE;
  431. f.subclass = AST_FORMAT_SLINEAR;
  432. f.mallocd = 0;
  433. f.datalen = res;
  434. f.samples = res / 2;
  435. f.data = buf + AST_FRIENDLY_OFFSET / 2;
  436. f.offset = AST_FRIENDLY_OFFSET;
  437. if (ast_write(chan, &f)< 0) {
  438. ast_log(LOG_WARNING, "Failed to write frame to '%s': %s\n", chan->name, strerror(errno));
  439. return -1;
  440. }
  441. }
  442. return 0;
  443. }
  444. static struct ast_generator mohgen =
  445. {
  446. alloc: moh_alloc,
  447. release: moh_release,
  448. generate: moh_generate,
  449. };
  450. static int moh_register(char *classname, char *mode, char *param, char *miscargs)
  451. {
  452. struct mohclass *moh;
  453. #ifdef ZAPATA_MOH
  454. int x;
  455. #endif
  456. ast_mutex_lock(&moh_lock);
  457. moh = get_mohbyname(classname);
  458. ast_mutex_unlock(&moh_lock);
  459. if (moh) {
  460. ast_log(LOG_WARNING, "Music on Hold '%s' already exists\n", classname);
  461. return -1;
  462. }
  463. moh = malloc(sizeof(struct mohclass));
  464. if (!moh)
  465. return -1;
  466. memset(moh, 0, sizeof(struct mohclass));
  467. strncpy(moh->class, classname, sizeof(moh->class) - 1);
  468. if (miscargs)
  469. strncpy(moh->miscargs, miscargs, sizeof(moh->miscargs) - 1);
  470. if (!strcasecmp(mode, "mp3") || !strcasecmp(mode, "quietmp3") || !strcasecmp(mode, "httpmp3")) {
  471. if (!strcasecmp(mode, "quietmp3"))
  472. moh->quiet = 1;
  473. strncpy(moh->dir, param, sizeof(moh->dir) - 1);
  474. moh->srcfd = -1;
  475. #ifdef ZAPATA_MOH
  476. /* It's an MP3 Moh -- Open /dev/zap/pseudo for timing... Is
  477. there a better, yet reliable way to do this? */
  478. moh->pseudofd = open("/dev/zap/pseudo", O_RDONLY);
  479. if (moh->pseudofd < 0) {
  480. ast_log(LOG_WARNING, "Unable to open pseudo channel for timing... Sound may be choppy.\n");
  481. } else {
  482. x = 320;
  483. ioctl(moh->pseudofd, ZT_SET_BLOCKSIZE, &x);
  484. }
  485. #else
  486. moh->pseudofd = -1;
  487. #endif
  488. if (pthread_create(&moh->thread, NULL, monmp3thread, moh)) {
  489. ast_log(LOG_WARNING, "Unable to create moh...\n");
  490. if (moh->pseudofd > -1)
  491. close(moh->pseudofd);
  492. free(moh);
  493. return -1;
  494. }
  495. } else {
  496. ast_log(LOG_WARNING, "Don't know how to do a mode '%s' music on hold\n", mode);
  497. free(moh);
  498. return -1;
  499. }
  500. ast_mutex_lock(&moh_lock);
  501. moh->next = mohclasses;
  502. mohclasses = moh;
  503. ast_mutex_unlock(&moh_lock);
  504. return 0;
  505. }
  506. int ast_moh_start(struct ast_channel *chan, char *class)
  507. {
  508. if (!class || !strlen(class))
  509. class = chan->musicclass;
  510. if (!class || !strlen(class))
  511. class = "default";
  512. return ast_activate_generator(chan, &mohgen, class);
  513. }
  514. void ast_moh_stop(struct ast_channel *chan)
  515. {
  516. ast_deactivate_generator(chan);
  517. }
  518. static void load_moh_classes(void)
  519. {
  520. struct ast_config *cfg;
  521. struct ast_variable *var;
  522. char *data;
  523. char *args;
  524. cfg = ast_load("musiconhold.conf");
  525. if (cfg) {
  526. var = ast_variable_browse(cfg, "classes");
  527. while(var) {
  528. data = strchr(var->value, ':');
  529. if (data) {
  530. *data = '\0';
  531. data++;
  532. args = strchr(data, ',');
  533. if (args) {
  534. *args = '\0';
  535. args++;
  536. }
  537. moh_register(var->name, var->value, data,args);
  538. }
  539. var = var->next;
  540. }
  541. ast_destroy(cfg);
  542. }
  543. }
  544. static void ast_moh_destroy(void)
  545. {
  546. struct mohclass *moh;
  547. char buff[8192];
  548. int bytes, tbytes=0, stime = 0;
  549. if (option_verbose > 1)
  550. ast_verbose(VERBOSE_PREFIX_2 "Destroying any remaining musiconhold processes\n");
  551. ast_mutex_lock(&moh_lock);
  552. moh = mohclasses;
  553. while(moh) {
  554. if (moh->pid) {
  555. ast_log(LOG_DEBUG, "killing %d!\n", moh->pid);
  556. stime = time(NULL);
  557. kill(moh->pid, SIGKILL);
  558. while ((bytes = read(moh->srcfd, buff, 8192)) && time(NULL) < stime + 5) {
  559. tbytes = tbytes + bytes;
  560. }
  561. ast_log(LOG_DEBUG, "mpg123 pid %d and child died after %d bytes read\n", moh->pid, tbytes);
  562. close(moh->srcfd);
  563. moh->pid = 0;
  564. }
  565. moh = moh->next;
  566. }
  567. ast_mutex_unlock(&moh_lock);
  568. }
  569. int load_module(void)
  570. {
  571. int res;
  572. load_moh_classes();
  573. res = ast_register_application(app0, moh0_exec, synopsis0, descrip0);
  574. ast_register_atexit(ast_moh_destroy);
  575. if (!res)
  576. res = ast_register_application(app1, moh1_exec, synopsis1, descrip1);
  577. if (!res)
  578. res = ast_register_application(app2, moh2_exec, synopsis2, descrip2);
  579. return res;
  580. }
  581. int unload_module(void)
  582. {
  583. return -1;
  584. }
  585. char *description(void)
  586. {
  587. return "Music On Hold Resource";
  588. }
  589. int usecount(void)
  590. {
  591. /* Never allow Music On Hold to be unloaded
  592. unresolve needed symbols in the dialer */
  593. #if 0
  594. int res;
  595. STANDARD_USECOUNT(res);
  596. return res;
  597. #else
  598. return 1;
  599. #endif
  600. }
  601. char *key()
  602. {
  603. return ASTERISK_GPL_KEY;
  604. }