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

« back to all changes in this revision

Viewing changes to channels/chan_misdn.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:
33
33
 ***/
34
34
#include "asterisk.h"
35
35
 
36
 
ASTERISK_FILE_VERSION(__FILE__, "$Revision: 84345 $")
 
36
ASTERISK_FILE_VERSION(__FILE__, "$Revision: 89445 $")
37
37
 
38
38
#include <stdio.h>
39
39
#include <pthread.h>
683
683
                } else {
684
684
misdn_overlap_dial_task_disconnect:
685
685
                        hanguptone_indicate(ch);
686
 
                        if (ch->bc->nt)
687
 
                                misdn_lib_send_event(ch->bc, EVENT_RELEASE_COMPLETE );
688
 
                        else
689
 
                                misdn_lib_send_event(ch->bc, EVENT_RELEASE);
 
686
                        ch->bc->out_cause=1;
 
687
                        ch->state=MISDN_CLEANING;
 
688
                        misdn_lib_send_event(ch->bc, EVENT_DISCONNECT);
690
689
                }
691
690
                ch->overlap_dial_task = -1;
692
691
                return 0;
798
797
        return 0;
799
798
}
800
799
 
801
 
 
802
800
static int misdn_port_block(int fd, int argc, char *argv[])
803
801
{
804
802
        int port;
873
871
static int misdn_port_down (int fd, int argc, char *argv[])
874
872
{
875
873
        int port;
876
 
        
 
874
 
877
875
        if (argc != 4)
878
876
                return RESULT_SHOWUSAGE;
879
877
        
2423
2421
{
2424
2422
        struct chan_list *p;
2425
2423
        struct misdn_bchannel *bc=NULL;
2426
 
        
 
2424
 
2427
2425
        ast_log(LOG_DEBUG, "misdn_hangup(%s)\n", ast->name);
2428
2426
        
2429
2427
        if (!ast || ! (p=MISDN_ASTERISK_TECH_PVT(ast) ) ) return -1;
2511
2509
                        release_chan(bc);
2512
2510
 
2513
2511
                        p->state=MISDN_CLEANING;
2514
 
                        misdn_lib_send_event( bc, EVENT_RELEASE_COMPLETE);
 
2512
                        if (bc->need_release_complete)
 
2513
                                misdn_lib_send_event( bc, EVENT_RELEASE_COMPLETE);
2515
2514
                        break;
2516
2515
                case MISDN_HOLDED:
2517
2516
                case MISDN_DIALING:
2554
2553
                        /*p->state=MISDN_CLEANING;*/
2555
2554
                        break;
2556
2555
                case MISDN_DISCONNECTED:
2557
 
                        misdn_lib_send_event( bc, EVENT_RELEASE);
 
2556
                        if (bc->need_release)
 
2557
                                misdn_lib_send_event( bc, EVENT_RELEASE);
2558
2558
                        p->state=MISDN_CLEANING; /* MISDN_HUNGUP_FROM_AST; */
2559
2559
                        break;
2560
2560
 
2572
2572
                        chan_misdn_log(1, bc->port, " --> out_cause %d\n",bc->out_cause);
2573
2573
                        
2574
2574
                        bc->out_cause=-1;
2575
 
                        misdn_lib_send_event(bc,EVENT_RELEASE);
 
2575
                        if (bc->need_release)
 
2576
                                misdn_lib_send_event(bc,EVENT_RELEASE);
2576
2577
                        p->state=MISDN_CLEANING;
2577
2578
                        break;
2578
2579
                default:
2579
2580
                        if (bc->nt) {
2580
2581
                                bc->out_cause=-1;
2581
 
                                misdn_lib_send_event(bc, EVENT_RELEASE);
 
2582
                                if (bc->need_release)
 
2583
                                        misdn_lib_send_event(bc, EVENT_RELEASE);
2582
2584
                                p->state=MISDN_CLEANING; 
2583
2585
                        } else {
2584
2586
                                if (bc->need_disconnect)
3141
3143
                        if (!rr->port)
3142
3144
                                rr->port = misdn_cfg_get_next_port_spin(rr->port);
3143
3145
                        
3144
 
                        for (; rr->port > 0 && rr->port != port_start;
3145
 
                                 rr->port = misdn_cfg_get_next_port_spin(rr->port)) {
 
3146
                        for (; rr->port > 0; rr->port = misdn_cfg_get_next_port_spin(rr->port)) {
3146
3147
                                int port_up;
3147
3148
                                int check;
3148
3149
                                int max_chan;
3149
3150
                                int last_chance = 0;
3150
3151
 
3151
 
                                if (!port_start)
3152
 
                                        port_start = rr->port;
3153
 
 
3154
3152
                                misdn_cfg_get(rr->port, MISDN_CFG_GROUPNAME, cfg_group, BUFFERSIZE);
3155
3153
                                if (strcasecmp(cfg_group, group))
3156
3154
                                        continue;
3164
3162
                                if (check && port_up < 0)
3165
3163
                                        ast_log(LOG_WARNING,"This port (%d) is blocked\n", rr->port);
3166
3164
 
 
3165
                                if ((port_start == rr->port) && (port_up <= 0))
 
3166
                                        break;
 
3167
 
 
3168
                                if (!port_start)
 
3169
                                        port_start = rr->port;
 
3170
 
3167
3171
                                if (port_up <= 0)
3168
3172
                                        continue;
3169
3173
 
4352
4356
                        break;
4353
4357
                }
4354
4358
 
 
4359
 
 
4360
                /*
 
4361
                 * When we are NT and overlapdial is set and if 
 
4362
                 * the number is empty, we wait for the ISDN timeout
 
4363
                 * instead of our own timer.
 
4364
                 */
 
4365
                if (ch->overlap_dial && bc->nt && !bc->dad[0] ) {
 
4366
                        wait_for_digits(ch, bc, chan);
 
4367
                        break;
 
4368
                }
 
4369
 
4355
4370
                /* 
4356
4371
                 * If overlapdial we will definitely send a SETUP_ACKNOWLEDGE and wait for more 
4357
4372
                 * Infos with a Interdigit Timeout.
4999
5014
                chan_misdn_log(0, 0, "Got: %s from get_ports\n",ports);
5000
5015
        
5001
5016
        {
5002
 
                int ntflags=0;
 
5017
                int ntflags=0, ntkc=0;
5003
5018
                char ntfile[BUFFERSIZE+1];
5004
5019
                struct misdn_lib_iface iface = {
5005
5020
                        .cb_event = cb_events,
5012
5027
        
5013
5028
                misdn_cfg_get( 0, MISDN_GEN_NTDEBUGFLAGS, &ntflags, sizeof(int));
5014
5029
                misdn_cfg_get( 0, MISDN_GEN_NTDEBUGFILE, &ntfile, BUFFERSIZE);
5015
 
 
5016
5030
                misdn_lib_nt_debug_init(ntflags,ntfile);
5017
5031
 
 
5032
                misdn_cfg_get( 0, MISDN_GEN_NTKEEPCALLS, &ntkc, sizeof(int));
 
5033
                misdn_lib_nt_keepcalls(ntkc);
5018
5034
        }
5019
5035
 
5020
5036
        {