Trim trailing whitespace.
authorRichard Mudgett <rmudgett@digium.com>
Mon, 3 Aug 2009 16:24:13 +0000 (16:24 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Mon, 3 Aug 2009 16:24:13 +0000 (16:24 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@210094 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/sig_analog.c
channels/sig_pri.c
channels/sig_pri.h

index 9a5081e..6556b0e 100644 (file)
@@ -17,7 +17,7 @@
  */
 
 /*! \file
- * 
+ *
  * \brief Analog signaling module
  *
  * \author Matthew Fredrickson <creslin@digium.com>
@@ -618,7 +618,7 @@ int analog_available(struct analog_pvt *p, int channelmatch, ast_group_t groupma
        if (p->dnd)
                return 0;
        /* If guard time, definitely not */
-       if (p->guardtime && (time(NULL) < p->guardtime)) 
+       if (p->guardtime && (time(NULL) < p->guardtime))
                return 0;
 
        /* If no owner definitely available */
@@ -645,7 +645,7 @@ int analog_available(struct analog_pvt *p, int channelmatch, ast_group_t groupma
        }
 
        /* If it's not an FXO, forget about call wait */
-       if ((p->sig != ANALOG_SIG_FXOKS) && (p->sig != ANALOG_SIG_FXOLS) && (p->sig != ANALOG_SIG_FXOGS)) 
+       if ((p->sig != ANALOG_SIG_FXOKS) && (p->sig != ANALOG_SIG_FXOLS) && (p->sig != ANALOG_SIG_FXOGS))
                return 0;
 
        if (!p->callwaiting) {
@@ -854,14 +854,14 @@ int analog_call(struct analog_pvt *p, struct ast_channel *ast, char *rdest, int
                switch (mysig) {
                case ANALOG_SIG_FEATD:
                        l = ast->connected.id.number;
-                       if (l) 
+                       if (l)
                                snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "T*%s*%s*", l, c);
                        else
                                snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "T**%s*", c);
                        break;
                case ANALOG_SIG_FEATDMF:
                        l = ast->connected.id.number;
-                       if (l) 
+                       if (l)
                                snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "M*00%s#*%s#", l, c);
                        else
                                snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "M*02#*%s#", c);
@@ -1027,7 +1027,7 @@ int analog_hangup(struct analog_pvt *p, struct ast_channel *ast)
                                /* This is actually part of a three way, placed on hold.  Place the third part
                                   on music on hold now */
                                if (p->subs[ANALOG_SUB_THREEWAY].owner && ast_bridged_channel(p->subs[ANALOG_SUB_THREEWAY].owner)) {
-                                       ast_queue_control_data(p->subs[ANALOG_SUB_THREEWAY].owner, AST_CONTROL_HOLD, 
+                                       ast_queue_control_data(p->subs[ANALOG_SUB_THREEWAY].owner, AST_CONTROL_HOLD,
                                                S_OR(p->mohsuggest, NULL),
                                                !ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0);
                                }
@@ -1042,7 +1042,7 @@ int analog_hangup(struct analog_pvt *p, struct ast_channel *ast)
                                /* The other party of the three way call is currently in a call-wait state.
                                   Start music on hold for them, and take the main guy out of the third call */
                                if (p->subs[ANALOG_SUB_CALLWAIT].owner && ast_bridged_channel(p->subs[ANALOG_SUB_CALLWAIT].owner)) {
-                                       ast_queue_control_data(p->subs[ANALOG_SUB_CALLWAIT].owner, AST_CONTROL_HOLD, 
+                                       ast_queue_control_data(p->subs[ANALOG_SUB_CALLWAIT].owner, AST_CONTROL_HOLD,
                                                S_OR(p->mohsuggest, NULL),
                                                !ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0);
                                }
@@ -1623,12 +1623,12 @@ static void *__analog_ss_thread(void *data)
                timeout = analog_firstdigittimeout;
                /* If starting a threeway call, never timeout on the first digit so someone
                   can use flash-hook as a "hold" feature */
-               if (p->subs[ANALOG_SUB_THREEWAY].owner) 
+               if (p->subs[ANALOG_SUB_THREEWAY].owner)
                        timeout = 999999;
                while (len < AST_MAX_EXTENSION-1) {
                        /* Read digit unless it's supposed to be immediate, in which case the
                           only answer is 's' */
-                       if (p->immediate) 
+                       if (p->immediate)
                                res = 's';
                        else
                                res = ast_waitfordigit(chan, timeout);
@@ -1650,7 +1650,7 @@ static void *__analog_ss_thread(void *data)
                                if (!res || !ast_matchmore_extension(chan, chan->context, exten, 1, p->cid_num)) {
                                        if (getforward) {
                                                /* Record this as the forwarding extension */
-                                               ast_copy_string(p->call_forward, exten, sizeof(p->call_forward)); 
+                                               ast_copy_string(p->call_forward, exten, sizeof(p->call_forward));
                                                ast_verb(3, "Setting call forward to '%s' on channel %d\n", p->call_forward, p->channel);
                                                res = analog_play_tone(p, index, ANALOG_TONE_DIALRECALL);
                                                if (res)
@@ -1667,9 +1667,9 @@ static void *__analog_ss_thread(void *data)
                                                ast_copy_string(chan->exten, exten, sizeof(chan->exten));
                                                if (!ast_strlen_zero(p->cid_num)) {
                                                        if (!p->hidecallerid)
-                                                               ast_set_callerid(chan, p->cid_num, NULL, p->cid_num); 
+                                                               ast_set_callerid(chan, p->cid_num, NULL, p->cid_num);
                                                        else
-                                                               ast_set_callerid(chan, NULL, NULL, p->cid_num); 
+                                                               ast_set_callerid(chan, NULL, NULL, p->cid_num);
                                                }
                                                if (!ast_strlen_zero(p->cid_name)) {
                                                        if (!p->hidecallerid)
@@ -1701,7 +1701,7 @@ static void *__analog_ss_thread(void *data)
                                p->callwaiting = 0;
                                res = analog_play_tone(p, index, ANALOG_TONE_DIALRECALL);
                                if (res) {
-                                       ast_log(LOG_WARNING, "Unable to do dial recall on channel %s: %s\n", 
+                                       ast_log(LOG_WARNING, "Unable to do dial recall on channel %s: %s\n",
                                                chan->name, strerror(errno));
                                }
                                len = 0;
@@ -1941,7 +1941,7 @@ static void *__analog_ss_thread(void *data)
                                if (!analog_start_cid_detect(p, p->cid_signalling)) {
                                        while (1) {
                                                res = analog_get_callerid(p, namebuf, numbuf, &ev, timeout - ast_tvdiff_ms(ast_tvnow(), start));
-       
+
                                                if (res == 0) {
                                                        break;
                                                }
@@ -1951,20 +1951,20 @@ static void *__analog_ss_thread(void *data)
                                                                if (ev == ANALOG_EVENT_RINGBEGIN) {
                                                                        analog_off_hook(p);
                                                                        usleep(1);
-                                                               } 
+                                                               }
                                                        } else {
                                                                ev = ANALOG_EVENT_NONE;
                                                                break;
                                                        }
                                                }
-       
+
                                                if (ast_tvdiff_ms(ast_tvnow(), start) > timeout)
                                                        break;
-       
+
                                        }
                                        name = namebuf;
                                        number = numbuf;
-       
+
                                        analog_stop_cid_detect(p);
 
                                        if (p->cid_signalling == CID_SIG_V23_JP) {
@@ -1998,7 +1998,7 @@ static void *__analog_ss_thread(void *data)
 
                                        if (analog_distinctive_ring(chan, p, index, NULL))
                                                goto quit;
-       
+
                                        if (res < 0) {
                                                ast_log(LOG_WARNING, "CallerID returned with error on channel '%s'\n", chan->name);
                                        }
@@ -2009,7 +2009,7 @@ static void *__analog_ss_thread(void *data)
                                ast_log(LOG_WARNING, "Channel %s in prering "
                                        "state, but I have nothing to do. "
                                        "Terminating simple switch, should be "
-                                       "restarted by the actual ring.\n", 
+                                       "restarted by the actual ring.\n",
                                        chan->name);
                                ast_hangup(chan);
                                goto quit;
@@ -2038,7 +2038,7 @@ static void *__analog_ss_thread(void *data)
                                                        p->polarity = POLARITY_IDLE;
                                                        ast_hangup(chan);
                                                        goto quit;
-                                               } else if (ev != ANALOG_EVENT_NONE && ev != ANALOG_EVENT_RINGBEGIN && ev != ANALOG_EVENT_RINGOFFHOOK) { 
+                                               } else if (ev != ANALOG_EVENT_NONE && ev != ANALOG_EVENT_RINGBEGIN && ev != ANALOG_EVENT_RINGOFFHOOK) {
                                                        break;
                                                }
                                                if (res != 2) {
@@ -2595,7 +2595,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
 
                                                if (p->subs[ANALOG_SUB_THREEWAY].owner->cdr)
                                                        cdr3way = 1;
-                                               
+
                                                ast_verb(3, "Started three way call on channel %d\n", p->channel);
                                                /* Start music on hold if appropriate */
                                                if (ast_bridged_channel(p->subs[ANALOG_SUB_THREEWAY].owner)) {
@@ -2624,7 +2624,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
                                        p->subs[ANALOG_SUB_THREEWAY].inthreeway = 0;
                                } else {
                                        /* Lets see what we're up to */
-                                       if (((ast->pbx) || (ast->_state == AST_STATE_UP)) && 
+                                       if (((ast->pbx) || (ast->_state == AST_STATE_UP)) &&
                                            (p->transfertobusy || (ast->_state != AST_STATE_BUSY))) {
                                                int otherindex = ANALOG_SUB_THREEWAY;
                                                struct ast_channel *other = ast_bridged_channel(p->subs[ANALOG_SUB_THREEWAY].owner);
@@ -2739,7 +2739,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
                                        ast_log(LOG_WARNING, "Unable to initiate dialing on trunk channel %d: %s\n", p->channel, strerror(errno));
                                        p->dop.dialstr[0] = '\0';
                                        return NULL;
-                               } else 
+                               } else
                                        ast_debug(1, "Sent deferred digit string on channel %d: %s\n", p->channel, p->dop.dialstr);
                        }
                        p->dop.dialstr[0] = '\0';
@@ -2768,7 +2768,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
                 * mark the channel as UP or if this is an indication
                 * of remote end disconnect.
                 */
-               
+
                if (p->polarityonanswerdelay > 0) {
                        /* check if event is not too soon after OffHook or Answer */
 
@@ -2827,7 +2827,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
                                        }
                                        break;
 
-                               default:        
+                               default:
                                        if (p->answeronpolarityswitch || p->hanguponpolarityswitch) {
                                                ast_debug(1, "Polarity switch detected (too close to previous event) on channel %d, state %d\n", p->channel, ast->_state);
                                        }
index 5b678c2..6b6613f 100644 (file)
@@ -17,7 +17,7 @@
  */
 
 /*! \file
- * 
+ *
  * \brief PRI signaling module
  *
  * \author Matthew Fredrickson <creslin@digium.com>
@@ -193,7 +193,7 @@ static char *pri_order(int level)
                return "Quaternary";
        default:
                return "<Unknown>";
-       }               
+       }
 }
 
 /* Returns index of the active dchan */
@@ -311,7 +311,7 @@ static int pri_find_principle(struct sig_pri_pri *pri, int channel)
                        break;
                }
        }
-       
+
        return principle;
 }
 
@@ -323,9 +323,9 @@ static int pri_fixup_principle(struct sig_pri_pri *pri, int principle, q931_call
                        return -1;
                return principle;
        }
-       if ((principle > -1) && 
-               (principle < pri->numchans) && 
-               (pri->pvts[principle]) && 
+       if ((principle > -1) &&
+               (principle < pri->numchans) &&
+               (pri->pvts[principle]) &&
                (pri->pvts[principle]->call == c))
                return principle;
        /* First, check for other bearers */
@@ -464,7 +464,7 @@ static int pri_find_empty_chan(struct sig_pri_pri *pri, int backwards)
                if (!backwards && (x >= pri->numchans))
                        break;
                if (pri->pvts[x] && !pri->pvts[x]->inalarm && !pri->pvts[x]->owner) {
-                       ast_debug(1, "Found empty available channel %d/%d\n", 
+                       ast_debug(1, "Found empty available channel %d/%d\n",
                                pri->pvts[x]->logicalspan, pri->pvts[x]->prioffset);
                        return x;
                }
@@ -644,7 +644,7 @@ static void *pri_dchannel(void *vpri)
        int nextidle = -1;
        int haveidles;
        int activeidles;
-       
+
        gettimeofday(&lastidle, NULL);
        pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
 
@@ -693,7 +693,7 @@ static void *pri_dchannel(void *vpri)
                        haveidles = 0;
                        activeidles = 0;
                        for (x = pri->numchans; x >= 0; x--) {
-                               if (pri->pvts[x] && !pri->pvts[x]->owner && 
+                               if (pri->pvts[x] && !pri->pvts[x]->owner &&
                                    !pri->pvts[x]->call) {
                                        if (haveidles < pri->minunused) {
                                                haveidles++;
@@ -721,7 +721,7 @@ static void *pri_dchannel(void *vpri)
                                }
                        } else if ((haveidles < pri->minunused) &&
                                   (activeidles > pri->minidle)) {
-                               /* Mark something for hangup if there is something 
+                               /* Mark something for hangup if there is something
                                   that can be hungup */
                                for (x = pri->numchans; x >= 0; x--) {
                                        /* find a candidate channel */
@@ -733,7 +733,7 @@ static void *pri_dchannel(void *vpri)
                                                if ((haveidles >= pri->minunused) ||
                                                    (activeidles <= pri->minidle))
                                                        break;
-                                       } 
+                                       }
                                }
                        }
                }
@@ -877,13 +877,13 @@ static void *pri_dchannel(void *vpri)
                                if (e->restart.channel > -1) {
                                        chanpos = pri_find_principle(pri, e->restart.channel);
                                        if (chanpos < 0)
-                                               ast_log(LOG_WARNING, "Restart requested on odd/unavailable channel number %d/%d on span %d\n", 
+                                               ast_log(LOG_WARNING, "Restart requested on odd/unavailable channel number %d/%d on span %d\n",
                                                        PRI_SPAN(e->restart.channel), PRI_CHANNEL(e->restart.channel), pri->span);
                                        else {
 #ifdef HAVE_PRI_SERVICE_MESSAGES
                                                char db_chan_name[20], db_answer[5], state;
                                                int why, skipit = 0;
-                                               
+
                                                ast_mutex_lock(&pri->pvts[chanpos]->service_lock);
                                                snprintf(db_chan_name, sizeof(db_chan_name), "%s/%d:%d", dahdi_db, pri->pvts[chanpos]->pri->span, pri->pvts[chanpos]->channel);
                                                ast_mutex_unlock(&pri->pvts[chanpos]->service_lock);
@@ -900,7 +900,7 @@ static void *pri_dchannel(void *vpri)
                                                }
                                                if (!skipit) {
 #endif
-                                                       ast_verb(3, "B-channel %d/%d restarted on span %d\n", 
+                                                       ast_verb(3, "B-channel %d/%d restarted on span %d\n",
                                                                        PRI_SPAN(e->restart.channel), PRI_CHANNEL(e->restart.channel), pri->span);
                                                        sig_pri_lock_private(pri->pvts[chanpos]);
                                                        if (pri->pvts[chanpos]->call) {
@@ -933,7 +933,7 @@ static void *pri_dchannel(void *vpri)
                        case PRI_EVENT_KEYPAD_DIGIT:
                                chanpos = pri_find_principle(pri, e->digit.channel);
                                if (chanpos < 0) {
-                                       ast_log(LOG_WARNING, "KEYPAD_DIGITs received on unconfigured channel %d/%d span %d\n", 
+                                       ast_log(LOG_WARNING, "KEYPAD_DIGITs received on unconfigured channel %d/%d span %d\n",
                                                PRI_SPAN(e->digit.channel), PRI_CHANNEL(e->digit.channel), pri->span);
                                } else {
                                        chanpos = pri_fixup_principle(pri, chanpos, e->digit.call);
@@ -944,8 +944,8 @@ static void *pri_dchannel(void *vpri)
                                                        /* how to do that */
                                                        int digitlen = strlen(e->digit.digits);
                                                        char digit;
-                                                       int i;                                  
-                                                       for (i = 0; i < digitlen; i++) {        
+                                                       int i;
+                                                       for (i = 0; i < digitlen; i++) {
                                                                digit = e->digit.digits[i];
                                                                {
                                                                        struct ast_frame f = { AST_FRAME_DTMF, digit, };
@@ -957,11 +957,11 @@ static void *pri_dchannel(void *vpri)
                                        }
                                }
                                break;
-                               
+
                        case PRI_EVENT_INFO_RECEIVED:
                                chanpos = pri_find_principle(pri, e->ring.channel);
                                if (chanpos < 0) {
-                                       ast_log(LOG_WARNING, "INFO received on unconfigured channel %d/%d span %d\n", 
+                                       ast_log(LOG_WARNING, "INFO received on unconfigured channel %d/%d span %d\n",
                                                PRI_SPAN(e->ring.channel), PRI_CHANNEL(e->ring.channel), pri->span);
                                } else {
                                        chanpos = pri_fixup_principle(pri, chanpos, e->ring.call);
@@ -972,8 +972,8 @@ static void *pri_dchannel(void *vpri)
                                                        /* how to do that */
                                                        int digitlen = strlen(e->ring.callednum);
                                                        char digit;
-                                                       int i;                                  
-                                                       for (i = 0; i < digitlen; i++) {        
+                                                       int i;
+                                                       for (i = 0; i < digitlen; i++) {
                                                                digit = e->ring.callednum[i];
                                                                {
                                                                        struct ast_frame f = { AST_FRAME_DTMF, digit, };
@@ -998,7 +998,7 @@ static void *pri_dchannel(void *vpri)
                                        ast_mutex_lock(&pri->pvts[chanpos]->service_lock);
                                        ch = pri->pvts[chanpos]->channel;
                                        ast_mutex_unlock(&pri->pvts[chanpos]->service_lock);
-                                       
+
                                        snprintf(db_chan_name, sizeof(db_chan_name), "%s/%d:%d", dahdi_db, pri->pvts[chanpos]->pri->span, ch);
                                        if (!ast_db_get(db_chan_name, SRVST_DBKEY, db_answer, sizeof(db_answer))) {
                                                sscanf(db_answer, "%c:%d", &state, &why);
@@ -1048,18 +1048,18 @@ static void *pri_dchannel(void *vpri)
                                        chanpos = pri_find_principle(pri, e->ring.channel);
                                /* if no channel specified find one empty */
                                if (chanpos < 0) {
-                                       ast_log(LOG_WARNING, "Ring requested on unconfigured channel %d/%d span %d\n", 
+                                       ast_log(LOG_WARNING, "Ring requested on unconfigured channel %d/%d span %d\n",
                                                PRI_SPAN(e->ring.channel), PRI_CHANNEL(e->ring.channel), pri->span);
                                } else {
                                        sig_pri_lock_private(pri->pvts[chanpos]);
                                        if (pri->pvts[chanpos]->owner) {
                                                if (pri->pvts[chanpos]->call == e->ring.call) {
-                                                       ast_log(LOG_WARNING, "Duplicate setup requested on channel %d/%d already in use on span %d\n", 
+                                                       ast_log(LOG_WARNING, "Duplicate setup requested on channel %d/%d already in use on span %d\n",
                                                                PRI_SPAN(e->ring.channel), PRI_CHANNEL(e->ring.channel), pri->span);
                                                        break;
                                                } else {
                                                        /* This is where we handle initial glare */
-                                                       ast_debug(1, "Ring requested on channel %d/%d already in use or previously requested on span %d.  Attempting to renegotiating channel.\n", 
+                                                       ast_debug(1, "Ring requested on channel %d/%d already in use or previously requested on span %d.  Attempting to renegotiating channel.\n",
                                                        PRI_SPAN(e->ring.channel), PRI_CHANNEL(e->ring.channel), pri->span);
                                                        sig_pri_unlock_private(pri->pvts[chanpos]);
                                                        chanpos = -1;
@@ -1131,14 +1131,14 @@ static void *pri_dchannel(void *vpri)
                                                        pri->pvts[chanpos]->proceeding = 1;
                                                        pri_proceeding(pri->pri, e->ring.call, PVT_TO_CHANNEL(pri->pvts[chanpos]), 0);
                                                } else {
-                                                       if (pri->switchtype != PRI_SWITCH_GR303_TMC) 
+                                                       if (pri->switchtype != PRI_SWITCH_GR303_TMC)
                                                                pri_need_more_info(pri->pri, e->ring.call, PVT_TO_CHANNEL(pri->pvts[chanpos]), 1);
                                                        else
                                                                pri_answer(pri->pri, e->ring.call, PVT_TO_CHANNEL(pri->pvts[chanpos]), 1);
                                                }
                                                /* Get the use_callingpres state */
                                                pri->pvts[chanpos]->callingpres = e->ring.callingpres;
-                                       
+
                                                /* Start PBX */
                                                if (!e->ring.complete && (pri->overlapdial & DAHDI_OVERLAPDIAL_INCOMING) && ast_matchmore_extension(NULL, pri->pvts[chanpos]->context, pri->pvts[chanpos]->exten, 1, pri->pvts[chanpos]->cid_num)) {
                                                        /* Release the PRI lock while we create the channel */
@@ -1181,7 +1181,7 @@ static void *pri_dchannel(void *vpri)
                                                                                plancallingnum, S_OR(pri->pvts[chanpos]->exten, "<unspecified>"),
                                                                                pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span);
                                                        } else {
-                                                               ast_log(LOG_WARNING, "Unable to start PBX on channel %d/%d, span %d\n", 
+                                                               ast_log(LOG_WARNING, "Unable to start PBX on channel %d/%d, span %d\n",
                                                                        pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span);
                                                                if (c)
                                                                        ast_hangup(c);
@@ -1195,7 +1195,7 @@ static void *pri_dchannel(void *vpri)
                                                        ast_mutex_unlock(&pri->lock);
                                                        /* Release PRI lock while we create the channel */
                                                        c = sig_pri_new_ast_channel(pri->pvts[chanpos], AST_STATE_RING, 1, (e->ring.layer1 == PRI_LAYER_1_ALAW) ? SIG_PRI_ALAW : SIG_PRI_ULAW, e->ring.ctype, pri->pvts[chanpos]->exten, NULL);
-                                               
+
                                                        if (c) {
                                                                char calledtonstr[10];
 
@@ -1226,7 +1226,7 @@ static void *pri_dchannel(void *vpri)
                                                                ast_mutex_lock(&pri->lock);
 
                                                                ast_verb(3, "Accepting call from '%s' to '%s' on channel %d/%d, span %d\n",
-                                                                               plancallingnum, pri->pvts[chanpos]->exten, 
+                                                                               plancallingnum, pri->pvts[chanpos]->exten,
                                                                                        pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span);
                                                                sig_pri_set_echocanceller(pri->pvts[chanpos], 1);
                                                        } else {
@@ -1241,7 +1241,7 @@ static void *pri_dchannel(void *vpri)
                                                }
                                        } else {
                                                ast_verb(3, "Extension '%s' in context '%s' from '%s' does not exist.  Rejecting call on channel %d/%d, span %d\n",
-                                                               pri->pvts[chanpos]->exten, pri->pvts[chanpos]->context, pri->pvts[chanpos]->cid_num, pri->pvts[chanpos]->logicalspan, 
+                                                               pri->pvts[chanpos]->exten, pri->pvts[chanpos]->context, pri->pvts[chanpos]->cid_num, pri->pvts[chanpos]->logicalspan,
                                                                        pri->pvts[chanpos]->prioffset, pri->span);
                                                pri_hangup(pri->pri, e->ring.call, PRI_CAUSE_UNALLOCATED);
                                                pri->pvts[chanpos]->call = NULL;
@@ -1258,12 +1258,12 @@ static void *pri_dchannel(void *vpri)
                        case PRI_EVENT_RINGING:
                                chanpos = pri_find_principle(pri, e->ringing.channel);
                                if (chanpos < 0) {
-                                       ast_log(LOG_WARNING, "Ringing requested on unconfigured channel %d/%d span %d\n", 
+                                       ast_log(LOG_WARNING, "Ringing requested on unconfigured channel %d/%d span %d\n",
                                                PRI_SPAN(e->ringing.channel), PRI_CHANNEL(e->ringing.channel), pri->span);
                                } else {
                                        chanpos = pri_fixup_principle(pri, chanpos, e->ringing.call);
                                        if (chanpos < 0) {
-                                               ast_log(LOG_WARNING, "Ringing requested on channel %d/%d not in use on span %d\n", 
+                                               ast_log(LOG_WARNING, "Ringing requested on channel %d/%d not in use on span %d\n",
                                                        PRI_SPAN(e->ringing.channel), PRI_CHANNEL(e->ringing.channel), pri->span);
                                        } else {
                                                sig_pri_lock_private(pri->pvts[chanpos]);
@@ -1314,7 +1314,7 @@ static void *pri_dchannel(void *vpri)
                                                                }
                                                        }
                                                }
-                                               
+
                                                sig_pri_lock_private(pri->pvts[chanpos]);
                                                ast_log(LOG_DEBUG, "Queuing frame from PRI_EVENT_PROGRESS on channel %d/%d span %d\n",
                                                                pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset,pri->span);
@@ -1339,7 +1339,7 @@ static void *pri_dchannel(void *vpri)
                                if (chanpos > -1) {
                                        if (!pri->pvts[chanpos]->proceeding) {
                                                struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_PROCEEDING, };
-                                               
+
                                                sig_pri_lock_private(pri->pvts[chanpos]);
                                                ast_log(LOG_DEBUG, "Queuing frame from PRI_EVENT_PROCEEDING on channel %d/%d span %d\n",
                                                                pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset,pri->span);
@@ -1362,12 +1362,12 @@ static void *pri_dchannel(void *vpri)
                        case PRI_EVENT_FACNAME:
                                chanpos = pri_find_principle(pri, e->facname.channel);
                                if (chanpos < 0) {
-                                       ast_log(LOG_WARNING, "Facility Name requested on unconfigured channel %d/%d span %d\n", 
+                                       ast_log(LOG_WARNING, "Facility Name requested on unconfigured channel %d/%d span %d\n",
                                                PRI_SPAN(e->facname.channel), PRI_CHANNEL(e->facname.channel), pri->span);
                                } else {
                                        chanpos = pri_fixup_principle(pri, chanpos, e->facname.call);
                                        if (chanpos < 0) {
-                                               ast_log(LOG_WARNING, "Facility Name requested on channel %d/%d not in use on span %d\n", 
+                                               ast_log(LOG_WARNING, "Facility Name requested on channel %d/%d not in use on span %d\n",
                                                        PRI_SPAN(e->facname.channel), PRI_CHANNEL(e->facname.channel), pri->span);
                                        } else {
                                                /* Re-use *69 field for PRI */
@@ -1379,16 +1379,16 @@ static void *pri_dchannel(void *vpri)
                                                sig_pri_unlock_private(pri->pvts[chanpos]);
                                        }
                                }
-                               break;                          
+                               break;
                        case PRI_EVENT_ANSWER:
                                chanpos = pri_find_principle(pri, e->answer.channel);
                                if (chanpos < 0) {
-                                       ast_log(LOG_WARNING, "Answer on unconfigured channel %d/%d span %d\n", 
+                                       ast_log(LOG_WARNING, "Answer on unconfigured channel %d/%d span %d\n",
                                                PRI_SPAN(e->answer.channel), PRI_CHANNEL(e->answer.channel), pri->span);
                                } else {
                                        chanpos = pri_fixup_principle(pri, chanpos, e->answer.call);
                                        if (chanpos < 0) {
-                                               ast_log(LOG_WARNING, "Answer requested on channel %d/%d not in use on span %d\n", 
+                                               ast_log(LOG_WARNING, "Answer requested on channel %d/%d not in use on span %d\n",
                                                        PRI_SPAN(e->answer.channel), PRI_CHANNEL(e->answer.channel), pri->span);
                                        } else {
                                                sig_pri_lock_private(pri->pvts[chanpos]);
@@ -1409,11 +1409,11 @@ static void *pri_dchannel(void *vpri)
                                                sig_pri_unlock_private(pri->pvts[chanpos]);
                                        }
                                }
-                               break;                          
+                               break;
                        case PRI_EVENT_HANGUP:
                                chanpos = pri_find_principle(pri, e->hangup.channel);
                                if (chanpos < 0) {
-                                       ast_log(LOG_WARNING, "Hangup requested on unconfigured channel %d/%d span %d\n", 
+                                       ast_log(LOG_WARNING, "Hangup requested on unconfigured channel %d/%d span %d\n",
                                                PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span);
                                } else {
                                        chanpos = pri_fixup_principle(pri, chanpos, e->hangup.call);
@@ -1445,14 +1445,14 @@ static void *pri_dchannel(void *vpri)
                                                                        }
                                                                }
                                                        }
-                                                       ast_verb(3, "Channel %d/%d, span %d got hangup, cause %d\n", 
+                                                       ast_verb(3, "Channel %d/%d, span %d got hangup, cause %d\n",
                                                                        pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span, e->hangup.cause);
                                                } else {
                                                        pri_hangup(pri->pri, pri->pvts[chanpos]->call, e->hangup.cause);
                                                        pri->pvts[chanpos]->call = NULL;
                                                }
                                                if (e->hangup.cause == PRI_CAUSE_REQUESTED_CHAN_UNAVAIL) {
-                                                       ast_verb(3, "Forcing restart of channel %d/%d on span %d since channel reported in use\n", 
+                                                       ast_verb(3, "Forcing restart of channel %d/%d on span %d since channel reported in use\n",
                                                                        PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span);
                                                        pri_reset(pri->pri, PVT_TO_CHANNEL(pri->pvts[chanpos]));
                                                        pri->pvts[chanpos]->resetting = 1;
@@ -1472,10 +1472,10 @@ static void *pri_dchannel(void *vpri)
 
                                                sig_pri_unlock_private(pri->pvts[chanpos]);
                                        } else {
-                                               ast_log(LOG_WARNING, "Hangup on bad channel %d/%d on span %d\n", 
+                                               ast_log(LOG_WARNING, "Hangup on bad channel %d/%d on span %d\n",
                                                        PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span);
                                        }
-                               } 
+                               }
                                break;
 #ifndef PRI_EVENT_HANGUP_REQ
 #error please update libpri
@@ -1483,7 +1483,7 @@ static void *pri_dchannel(void *vpri)
                        case PRI_EVENT_HANGUP_REQ:
                                chanpos = pri_find_principle(pri, e->hangup.channel);
                                if (chanpos < 0) {
-                                       ast_log(LOG_WARNING, "Hangup REQ requested on unconfigured channel %d/%d span %d\n", 
+                                       ast_log(LOG_WARNING, "Hangup REQ requested on unconfigured channel %d/%d span %d\n",
                                                PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span);
                                } else {
                                        chanpos = pri_fixup_principle(pri, chanpos, e->hangup.call);
@@ -1519,7 +1519,7 @@ static void *pri_dchannel(void *vpri)
                                                        pri->pvts[chanpos]->call = NULL;
                                                }
                                                if (e->hangup.cause == PRI_CAUSE_REQUESTED_CHAN_UNAVAIL) {
-                                                       ast_verb(3, "Forcing restart of channel %d/%d span %d since channel reported in use\n", 
+                                                       ast_verb(3, "Forcing restart of channel %d/%d span %d since channel reported in use\n",
                                                                        PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span);
                                                        pri_reset(pri->pri, PVT_TO_CHANNEL(pri->pvts[chanpos]));
                                                        pri->pvts[chanpos]->resetting = 1;
@@ -1538,12 +1538,12 @@ static void *pri_dchannel(void *vpri)
                                        } else {
                                                ast_log(LOG_WARNING, "Hangup REQ on bad channel %d/%d on span %d\n", PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span);
                                        }
-                               } 
+                               }
                                break;
                        case PRI_EVENT_HANGUP_ACK:
                                chanpos = pri_find_principle(pri, e->hangup.channel);
                                if (chanpos < 0) {
-                                       ast_log(LOG_WARNING, "Hangup ACK requested on unconfigured channel number %d/%d span %d\n", 
+                                       ast_log(LOG_WARNING, "Hangup ACK requested on unconfigured channel number %d/%d span %d\n",
                                                PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span);
                                } else {
                                        chanpos = pri_fixup_principle(pri, chanpos, e->hangup.call);
@@ -1581,15 +1581,15 @@ static void *pri_dchannel(void *vpri)
                                                if (pri->pvts[x] && pri->pvts[x]->resetting) {
                                                        chanpos = x;
                                                        sig_pri_lock_private(pri->pvts[chanpos]);
-                                                       ast_log(LOG_DEBUG, "Assuming restart ack is really for channel %d/%d span %d\n", pri->pvts[chanpos]->logicalspan, 
+                                                       ast_log(LOG_DEBUG, "Assuming restart ack is really for channel %d/%d span %d\n", pri->pvts[chanpos]->logicalspan,
                                                                        pri->pvts[chanpos]->prioffset, pri->span);
                                                        if (pri->pvts[chanpos]->owner) {
-                                                               ast_log(LOG_WARNING, "Got restart ack on channel %d/%d with owner on span %d\n", pri->pvts[chanpos]->logicalspan, 
+                                                               ast_log(LOG_WARNING, "Got restart ack on channel %d/%d with owner on span %d\n", pri->pvts[chanpos]->logicalspan,
                                                                        pri->pvts[chanpos]->prioffset, pri->span);
                                                                ast_softhangup_nolock(pri->pvts[chanpos]->owner, AST_SOFTHANGUP_DEV);
                                                        }
                                                        pri->pvts[chanpos]->resetting = 0;
-                                                       ast_verb(3, "B-channel %d/%d successfully restarted on span %d\n", pri->pvts[chanpos]->logicalspan, 
+                                                       ast_verb(3, "B-channel %d/%d successfully restarted on span %d\n", pri->pvts[chanpos]->logicalspan,
                                                                        pri->pvts[chanpos]->prioffset, pri->span);
                                                        sig_pri_unlock_private(pri->pvts[chanpos]);
                                                        if (pri->resetting)
@@ -1598,7 +1598,7 @@ static void *pri_dchannel(void *vpri)
                                                }
                                        }
                                        if (chanpos < 0) {
-                                               ast_log(LOG_WARNING, "Restart ACK requested on strange channel %d/%d span %d\n", 
+                                               ast_log(LOG_WARNING, "Restart ACK requested on strange channel %d/%d span %d\n",
                                                        PRI_SPAN(e->restartack.channel), PRI_CHANNEL(e->restartack.channel), pri->span);
                                        }
                                } else {
@@ -1610,7 +1610,7 @@ static void *pri_dchannel(void *vpri)
                                                        ast_softhangup_nolock(pri->pvts[chanpos]->owner, AST_SOFTHANGUP_DEV);
                                                }
                                                pri->pvts[chanpos]->resetting = 0;
-                                               ast_verb(3, "B-channel %d/%d successfully restarted on span %d\n", pri->pvts[chanpos]->logicalspan, 
+                                               ast_verb(3, "B-channel %d/%d successfully restarted on span %d\n", pri->pvts[chanpos]->logicalspan,
                                                                        pri->pvts[chanpos]->prioffset, pri->span);
                                                sig_pri_unlock_private(pri->pvts[chanpos]);
                                                if (pri->resetting)
@@ -1621,7 +1621,7 @@ static void *pri_dchannel(void *vpri)
                        case PRI_EVENT_SETUP_ACK:
                                chanpos = pri_find_principle(pri, e->setup_ack.channel);
                                if (chanpos < 0) {
-                                       ast_log(LOG_WARNING, "Received SETUP_ACKNOWLEDGE on unconfigured channel %d/%d span %d\n", 
+                                       ast_log(LOG_WARNING, "Received SETUP_ACKNOWLEDGE on unconfigured channel %d/%d span %d\n",
                                                PRI_SPAN(e->setup_ack.channel), PRI_CHANNEL(e->setup_ack.channel), pri->span);
                                } else {
                                        chanpos = pri_fixup_principle(pri, chanpos, e->setup_ack.call);
@@ -1631,7 +1631,7 @@ static void *pri_dchannel(void *vpri)
                                                /* Send any queued digits */
                                                for (x = 0;x < strlen(pri->pvts[chanpos]->dialdest); x++) {
                                                        ast_log(LOG_DEBUG, "Sending pending digit '%c'\n", pri->pvts[chanpos]->dialdest[x]);
-                                                       pri_information(pri->pri, pri->pvts[chanpos]->call, 
+                                                       pri_information(pri->pri, pri->pvts[chanpos]->call,
                                                                pri->pvts[chanpos]->dialdest[x]);
                                                }
                                                sig_pri_unlock_private(pri->pvts[chanpos]);
@@ -1663,7 +1663,7 @@ static void *pri_dchannel(void *vpri)
                        default:
                                ast_log(LOG_DEBUG, "Event: %d\n", e->e);
                        }
-               }       
+               }
                ast_mutex_unlock(&pri->lock);
        }
        /* Never reached */
@@ -1695,7 +1695,7 @@ int sig_pri_hangup(struct sig_pri_chan *p, struct ast_channel *ast)
                ast_log(LOG_WARNING, "Asked to hangup channel not connected\n");
                return 0;
        }
-       
+
        p->owner = NULL;
        p->outgoing = 0;
        p->digital = 0;
@@ -1706,7 +1706,7 @@ int sig_pri_hangup(struct sig_pri_chan *p, struct ast_channel *ast)
        p->rdnis[0] = '\0';
        p->exten[0] = '\0';
        sig_pri_set_dialing(p, 0);
-       
+
        if (!p->call) {
                res = 0;
                goto exit;
@@ -1739,9 +1739,9 @@ int sig_pri_hangup(struct sig_pri_chan *p, struct ast_channel *ast)
                        }
                        pri_hangup(p->pri->pri, p->call, icause);
                }
-               if (res < 0) 
+               if (res < 0)
                        ast_log(LOG_WARNING, "pri_disconnect failed\n");
-               pri_rel(p->pri);                        
+               pri_rel(p->pri);
        } else {
                ast_log(LOG_WARNING, "Unable to grab PRI on span %d\n", p->pri->span);
                res = -1;
@@ -1833,11 +1833,11 @@ int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, char *rdest, i
        } else {
                exclusive = 0;
        }
-       
+
        pri_sr_set_channel(sr, PVT_TO_CHANNEL(p), exclusive, 1);
-       pri_sr_set_bearer(sr, p->digital ? PRI_TRANS_CAP_DIGITAL : ast->transfercapability, 
+       pri_sr_set_bearer(sr, p->digital ? PRI_TRANS_CAP_DIGITAL : ast->transfercapability,
                                (p->digital ? -1 : layer1));
-                                       
+
        if (p->pri->facilityenable)
                pri_facility_enable(p->pri->pri);
 
@@ -2017,7 +2017,7 @@ int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, char *rdest, i
 #endif
 
        if (pri_setup(p->pri->pri, p->call, sr)) {
-               ast_log(LOG_WARNING, "Unable to setup call to %s (using %s)\n", 
+               ast_log(LOG_WARNING, "Unable to setup call to %s (using %s)\n",
                        c + p->stripmsd + dp_strip, dialplan2str(p->pri->dialplan));
                pri_rel(p->pri);
                pri_sr_free(sr);
@@ -2059,7 +2059,7 @@ int sig_pri_indicate(struct sig_pri_chan *p, struct ast_channel *chan, int condi
                break;
        case AST_CONTROL_RINGING:
                if ((!p->alerting) && p->pri && !p->outgoing && (chan->_state != AST_STATE_UP)) {
-                       if (p->pri->pri) {              
+                       if (p->pri->pri) {
                                if (!pri_grab(p, p->pri)) {
                                        pri_acknowledge(p->pri->pri,p->call, PVT_TO_CHANNEL(p), !p->digital);
                                        pri_rel(p->pri);
@@ -2078,7 +2078,7 @@ int sig_pri_indicate(struct sig_pri_chan *p, struct ast_channel *chan, int condi
        case AST_CONTROL_PROCEEDING:
                ast_debug(1,"Received AST_CONTROL_PROCEEDING on %s\n",chan->name);
                if (!p->proceeding && p->pri && !p->outgoing) {
-                       if (p->pri->pri) {              
+                       if (p->pri->pri) {
                                if (!pri_grab(p, p->pri)) {
                                        pri_proceeding(p->pri->pri,p->call, PVT_TO_CHANNEL(p), !p->digital);
                                        pri_rel(p->pri);
@@ -2096,7 +2096,7 @@ int sig_pri_indicate(struct sig_pri_chan *p, struct ast_channel *chan, int condi
                ast_log(LOG_DEBUG,"Received AST_CONTROL_PROGRESS on %s\n",chan->name);
                p->digital = 0; /* Digital-only calls isn't allowing any inband progress messages */
                if (!p->progress && p->pri && !p->outgoing) {
-                       if (p->pri->pri) {              
+                       if (p->pri->pri) {
                                if (!pri_grab(p, p->pri)) {
                                        pri_progress(p->pri->pri,p->call, PVT_TO_CHANNEL(p), 1);
                                        pri_rel(p->pri);
@@ -2116,7 +2116,7 @@ int sig_pri_indicate(struct sig_pri_chan *p, struct ast_channel *chan, int condi
                        chan->_softhangup |= AST_SOFTHANGUP_DEV;
                        res = 0;
                } else if (!p->progress && p->pri && !p->outgoing) {
-                       if (p->pri) {           
+                       if (p->pri) {
                                if (!pri_grab(p, p->pri)) {
 #ifdef HAVE_PRI_PROG_W_CAUSE
                                        pri_progress_with_cause(p->pri->pri,p->call, PVT_TO_CHANNEL(p), 1, PRI_CAUSE_SWITCH_CONGESTION); /* cause = 42 */
@@ -2188,7 +2188,7 @@ int sig_pri_available(struct sig_pri_chan *p, int channelmatch, ast_group_t grou
 #ifdef HAVE_PRI_SERVICE_MESSAGES
                        char db_chan_name[20], db_answer[5], state;
                        int why = 0;
-                                               
+
                        snprintf(db_chan_name, sizeof(db_chan_name), "%s/%d:%d", dahdi_db, p->pri->span, p->channel);
                        if (!ast_db_get(db_chan_name, SRVST_DBKEY, db_answer, sizeof(db_answer))) {
                                sscanf(db_answer, "%c:%d", &state, &why);
@@ -2238,7 +2238,7 @@ int sig_pri_start_pri(struct sig_pri_pri *pri)
 {
        int x;
        int i;
-       
+
        ast_mutex_init(&pri->lock);
 
        for (i = 0; i < NUM_DCHANS; i++) {
index 1353103..ebf84e5 100644 (file)
@@ -91,7 +91,7 @@ struct sig_pri_callback {
 #define SRVST_DBKEY "service-state"
 /*! \brief The out-of-service SERVICE state */
 #define SRVST_TYPE_OOS "O"
-/*! \brief SRVST_INITIALIZED is used to indicate a channel being out-of-service 
+/*! \brief SRVST_INITIALIZED is used to indicate a channel being out-of-service
  *  The SRVST_INITIALIZED is mostly used maintain backwards compatibility but also may
  *  mean that the channel has not yet received a RESTART message.  If a channel is
  *  out-of-service with this reason a RESTART message will result in the channel
@@ -153,7 +153,7 @@ struct sig_pri_chan {
 
        struct ast_channel *owner;
 
-       struct sig_pri_pri *pri;                
+       struct sig_pri_pri *pri;
        q931_call *call;                                /*!< opaque libpri call control structure */
 
        int prioffset;                                  /*!< channel number in span */