~ubuntu-branches/ubuntu/karmic/asterisk/karmic

« back to all changes in this revision

Viewing changes to apps/app_followme.c

  • Committer: Bazaar Package Importer
  • Author(s): Faidon Liambotis, Tzafrir Cohen, Faidon Liambotis
  • Date: 2007-12-06 17:20:21 UTC
  • mfrom: (1.1.19 upstream)
  • Revision ID: james.westby@ubuntu.com-20071206172021-pd0wrjirz3os7hia
Tags: 1:1.4.15~dfsg-1
* New upstream release (Closes: #452054)
  - Fix a potential corrupt of voicemail.conf on simultaneous PIN updates
    (Closes: #353227)

[ Tzafrir Cohen ]
* Add some sample/reference config files as documentation.
* Provide asterisk-bristuff for upgrading from Etch.
* Move libc-client to not be last, so debian/backports/xorcom.etch would
  still work.

[ Faidon Liambotis ]
* Really enable the libcap/ToS functionality; the previous patch didn't
  enable the functionality, even though the code and the libcap.so
  dependency were there. (Closes: #454342)
* Fix a minor issue with init script's stop target when running with
  safe_asterisk.
* Add chan_vpb, adding support for VoiceTronix OpenSwitch and OpenLine
  cards. (Closes: #396499)
* Fix debian/watch by using a pkg-voip wrapper to avoid upstream's silly
  redirections. (Closes: #449706)
* Use DEBVERSION as asterisk's version string.
* Disable the MD5 build sum that breaks all out-of-tree plugins (duh!).
* Create /usr/local/share/asterisk/sounds to put all site-specific
  non-modifiable sounds.
* Add a note about bugs.debian.org to the banner.
* Add noload for res_config_* since loading them results in errors and
  doesn't provide any functionality.
* News entries were added but we never shipped the file; ship NEWS.Debian.
* Add an entry to NEWS.Debian warning users about app_voicemail_*.so
  (Closes: #452596)
* Provide options in /etc/default/asterisk for configuring safe_asterisk.
  (Closes: #381786)

[ Tzafrir Cohen ]
* Provide a custom sounds directory under /var/lib - user-modifieble at
  runtime and hence not under /usr. (Closes: #337209)

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
#include "asterisk.h"
32
32
 
33
 
ASTERISK_FILE_VERSION(__FILE__, "$Revision: 81455 $")
 
33
ASTERISK_FILE_VERSION(__FILE__, "$Revision: 87534 $")
34
34
 
35
35
#include <stdio.h>
36
36
#include <stdlib.h>
78
78
struct number {
79
79
        char number[512];       /*!< Phone Number(s) and/or Extension(s) */
80
80
        long timeout;           /*!< Dial Timeout, if used. */
 
81
        char language[MAX_LANGUAGE]; /*!< The language to be used on this dial, if used. */
81
82
        int order;              /*!< The order to dial in */
82
83
        AST_LIST_ENTRY(number) entry; /*!< Next Number record */
83
84
};
255
256
}
256
257
 
257
258
/*! \brief Add a new number */
258
 
static struct number *create_followme_number(char *number, int timeout, int numorder)
 
259
static struct number *create_followme_number(char *number, char *language, int timeout, int numorder)
259
260
{
260
261
        struct number *cur;
261
262
        char *tmp;
268
269
        if ((tmp = strchr(number, ','))) 
269
270
                *tmp = '\0';
270
271
        ast_copy_string(cur->number, number, sizeof(cur->number));
 
272
        ast_copy_string(cur->language, language, sizeof(cur->language));
271
273
        cur->order = numorder;
272
274
        if (option_debug)
273
275
                ast_log(LOG_DEBUG, "Created a number, %s, order of , %d, with a timeout of %ld.\n", cur->number, cur->order, cur->timeout);
402
404
                                                        idx++;
403
405
                                                numorder = idx;
404
406
                                        }
405
 
                                        cur = create_followme_number(numberstr, timeout, numorder);
 
407
                                        cur = create_followme_number(numberstr, "", timeout, numorder);
406
408
                                        AST_LIST_INSERT_TAIL(&f->numbers, cur, entry);
407
409
                                } else {
408
410
                                        profile_set_param(f, var->name, var->value, var->lineno, 1);
916
918
        struct ast_module_user *u;
917
919
        char *argstr;
918
920
        char namerecloc[255];
 
921
        char *fname = NULL;
919
922
        int duration = 0;
920
923
        struct ast_channel *caller;
921
924
        struct ast_channel *outbound;
976
979
                                   (and locked) while we're trying to do a follow-me */
977
980
                AST_LIST_HEAD_INIT_NOLOCK(&targs.cnumbers);
978
981
                AST_LIST_TRAVERSE(&f->numbers, nm, entry) {
979
 
                        newnm = create_followme_number(nm->number, nm->timeout, nm->order);
 
982
                        newnm = create_followme_number(nm->number, "", nm->timeout, nm->order);
980
983
                        AST_LIST_INSERT_TAIL(&targs.cnumbers, newnm, entry);
981
984
                }
982
985
                ast_mutex_unlock(&f->lock);
1011
1014
                        free(nm);
1012
1015
                }
1013
1016
                AST_LIST_TRAVERSE_SAFE_END
1014
 
        
1015
 
                if (!ast_strlen_zero(namerecloc))
1016
 
                        unlink(namerecloc);     
1017
 
 
1018
1017
                if (targs.status != 100) {
1019
1018
                        ast_moh_stop(chan);
1020
1019
                        if (ast_test_flag(&targs.followmeflags, FOLLOWMEFLAG_UNREACHABLEMSG)) 
1053
1052
                }
1054
1053
        }
1055
1054
        outrun:
 
1055
 
 
1056
        if (!ast_strlen_zero(namerecloc)){
 
1057
                fname = alloca(strlen(namerecloc) + 5);
 
1058
                sprintf(fname, "%s.sln", namerecloc);
 
1059
                unlink(fname);
 
1060
        }
1056
1061
        
1057
1062
        ast_module_user_remove(u);
1058
1063