~davewalker/ubuntu/maverick/asterisk/lp_705014

« back to all changes in this revision

Viewing changes to channels/chan_local.c

  • Committer: Bazaar Package Importer
  • Author(s): Lionel Porcheron
  • Date: 2007-06-19 18:08:27 UTC
  • mto: (1.2.1 upstream) (8.2.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 26.
  • Revision ID: james.westby@ubuntu.com-20070619180827-4d9gqoqys7kel3yk
Tags: upstream-1.4.5~dfsg
ImportĀ upstreamĀ versionĀ 1.4.5~dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
#include "asterisk.h"
29
29
 
30
 
ASTERISK_FILE_VERSION(__FILE__, "$Revision: 60989 $")
 
30
ASTERISK_FILE_VERSION(__FILE__, "$Revision: 64193 $")
31
31
 
32
32
#include <stdio.h>
33
33
#include <string.h>
582
582
{
583
583
        struct ast_channel *tmp = NULL, *tmp2 = NULL;
584
584
        int randnum = ast_random() & 0xffff, fmt = 0;
 
585
        const char *t;
 
586
        int ama;
585
587
 
586
588
        /* Allocate two new Asterisk channels */
587
 
        if (!(tmp = ast_channel_alloc(1, state, 0, 0, "", p->exten, p->context, 0, "Local/%s@%s-%04x,1", p->exten, p->context, randnum)) 
588
 
                        || !(tmp2 = ast_channel_alloc(1, AST_STATE_RING, 0, 0, "", p->exten, p->context, 0, "Local/%s@%s-%04x,2", p->exten, p->context, randnum))) {
 
589
        /* safe accountcode */
 
590
        if (p->owner && p->owner->accountcode)
 
591
                t = p->owner->accountcode;
 
592
        else
 
593
                t = "";
 
594
 
 
595
        if (p->owner)
 
596
                ama = p->owner->amaflags;
 
597
        else
 
598
                ama = 0;
 
599
        if (!(tmp = ast_channel_alloc(1, state, 0, 0, t, p->exten, p->context, ama, "Local/%s@%s-%04x,1", p->exten, p->context, randnum)) 
 
600
                        || !(tmp2 = ast_channel_alloc(1, AST_STATE_RING, 0, 0, t, p->exten, p->context, ama, "Local/%s@%s-%04x,2", p->exten, p->context, randnum))) {
589
601
                if (tmp)
590
602
                        ast_channel_free(tmp);
591
603
                if (tmp2)