diff -r -u asterisk-1.4.17/apps/app_dial.c asterisk-1.4.17-h324m/apps/app_dial.c --- asterisk-1.4.17/apps/app_dial.c 2007-12-07 17:38:48.000000000 +0100 +++ asterisk-1.4.17-h324m/apps/app_dial.c 2008-01-09 19:15:55.000000000 +0100 @@ -1238,6 +1238,8 @@ tmp->chan->adsicpe = chan->adsicpe; /* Pass the transfer capability */ tmp->chan->transfercapability = chan->transfercapability; + /* Pass the user information layer 1 */ + tmp->chan->userinformationlayer1 = chan->userinformationlayer1; /* If we have an outbound group, set this peer channel to it */ if (outbound_group) diff -r -u asterisk-1.4.17/channels/chan_zap.c asterisk-1.4.17-h324m/channels/chan_zap.c --- asterisk-1.4.17/channels/chan_zap.c 2007-12-20 21:08:42.000000000 +0100 +++ asterisk-1.4.17-h324m/channels/chan_zap.c 2008-01-09 19:18:09.000000000 +0100 @@ -2130,10 +2130,14 @@ else exclusive = 1; } - + + if (p->digital) { + if (option_verbose > 2) + ast_verbose(VERBOSE_PREFIX_3 "digital call, setting user information layer 1 to %d (0x%x)\n", ast->userinformationlayer1, ast->userinformationlayer1); + } pri_sr_set_channel(sr, p->bearer ? PVT_TO_CHANNEL(p->bearer) : PVT_TO_CHANNEL(p), exclusive, 1); pri_sr_set_bearer(sr, p->digital ? PRI_TRANS_CAP_DIGITAL : ast->transfercapability, - (p->digital ? -1 : + (p->digital ? ast->userinformationlayer1 : ((p->law == ZT_LAW_ALAW) ? PRI_LAYER_1_ALAW : PRI_LAYER_1_ULAW))); if (p->pri->facilityenable) pri_facility_enable(p->pri->pri); @@ -3495,7 +3499,7 @@ static void *ss_thread(void *data); -static struct ast_channel *zt_new(struct zt_pvt *, int, int, int, int, int); +static struct ast_channel *zt_new(struct zt_pvt *, int, int, int, int, int, int); static int attempt_transfer(struct zt_pvt *p) { @@ -4260,7 +4264,7 @@ goto winkflashdone; } /* Make new channel */ - chan = zt_new(p, AST_STATE_RESERVED, 0, SUB_THREEWAY, 0, 0); + chan = zt_new(p, AST_STATE_RESERVED, 0, SUB_THREEWAY, 0, 0, -1); if (p->zaptrcallerid) { if (!p->origcid_num) p->origcid_num = ast_strdup(p->cid_num); @@ -5178,7 +5182,8 @@ return res; } -static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int index, int law, int transfercapability) +static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int index, int law, + int transfercapability, int userinformationlayer1) { struct ast_channel *tmp; int deflaw; @@ -5337,6 +5342,7 @@ tmp->cid.cid_ton = i->cid_ton; #ifdef HAVE_PRI tmp->transfercapability = transfercapability; + tmp->userinformationlayer1 = userinformationlayer1; pbx_builtin_setvar_helper(tmp, "TRANSFERCAPABILITY", ast_transfercapability2str(transfercapability)); if (transfercapability & PRI_TRANS_CAP_DIGITAL) i->digital = 1; @@ -6605,7 +6611,7 @@ zt_enable_ec(i); /* The channel is immediately up. Start right away */ res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, ZT_TONE_RINGTONE); - chan = zt_new(i, AST_STATE_RING, 1, SUB_REAL, 0, 0); + chan = zt_new(i, AST_STATE_RING, 1, SUB_REAL, 0, 0, -1); if (!chan) { ast_log(LOG_WARNING, "Unable to start PBX on channel %d\n", i->channel); res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, ZT_TONE_CONGESTION); @@ -6614,7 +6620,7 @@ } } else { /* Check for callerid, digits, etc */ - chan = zt_new(i, AST_STATE_RESERVED, 0, SUB_REAL, 0, 0); + chan = zt_new(i, AST_STATE_RESERVED, 0, SUB_REAL, 0, 0, -1); if (chan) { if (has_voicemail(i)) res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, ZT_TONE_STUTTER); @@ -6654,7 +6660,7 @@ case SIG_SF_FEATB: case SIG_SF: /* Check for callerid, digits, etc */ - chan = zt_new(i, AST_STATE_RING, 0, SUB_REAL, 0, 0); + chan = zt_new(i, AST_STATE_RING, 0, SUB_REAL, 0, 0, -1); if (chan && ast_pthread_create(&threadid, &attr, ss_thread, chan)) { ast_log(LOG_WARNING, "Unable to start simple switch thread on channel %d\n", i->channel); res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, ZT_TONE_CONGESTION); @@ -6756,7 +6762,7 @@ ast_verbose(VERBOSE_PREFIX_2 "Starting post polarity " "CID detection on channel %d\n", i->channel); - chan = zt_new(i, AST_STATE_PRERING, 0, SUB_REAL, 0, 0); + chan = zt_new(i, AST_STATE_PRERING, 0, SUB_REAL, 0, 0, -1); if (chan && ast_pthread_create(&threadid, &attr, ss_thread, chan)) { ast_log(LOG_WARNING, "Unable to start simple switch thread on channel %d\n", i->channel); } @@ -7897,7 +7903,7 @@ } } p->outgoing = 1; - tmp = zt_new(p, AST_STATE_RESERVED, 0, p->owner ? SUB_CALLWAIT : SUB_REAL, 0, 0); + tmp = zt_new(p, AST_STATE_RESERVED, 0, p->owner ? SUB_CALLWAIT : SUB_REAL, 0, 0, -1); #ifdef HAVE_PRI if (p->bearer) { /* Log owner to bearer channel, too */ @@ -8781,6 +8787,7 @@ law = ZT_LAW_ALAW; else law = ZT_LAW_MULAW; + ast_log(LOG_DEBUG, "user information layer 1 of incoming call = %d (0x%x)\n",e->ring.layer1, e->ring.layer1); res = zt_setlaw(pri->pvts[chanpos]->subs[SUB_REAL].zfd, law); if (res < 0) ast_log(LOG_WARNING, "Unable to set law on channel %d\n", pri->pvts[chanpos]->channel); @@ -8807,11 +8814,11 @@ if (crv) { /* Set bearer and such */ pri_assign_bearer(crv, pri, pri->pvts[chanpos]); - c = zt_new(crv, AST_STATE_RESERVED, 0, SUB_REAL, law, e->ring.ctype); + c = zt_new(crv, AST_STATE_RESERVED, 0, SUB_REAL, law, e->ring.ctype, e->ring.layer1); pri->pvts[chanpos]->owner = &inuse; ast_log(LOG_DEBUG, "Started up crv %d:%d on bearer channel %d\n", pri->trunkgroup, crv->channel, crv->bearer->channel); } else { - c = zt_new(pri->pvts[chanpos], AST_STATE_RESERVED, 0, SUB_REAL, law, e->ring.ctype); + c = zt_new(pri->pvts[chanpos], AST_STATE_RESERVED, 0, SUB_REAL, law, e->ring.ctype, e->ring.layer1); } ast_mutex_unlock(&pri->pvts[chanpos]->lock); @@ -8859,7 +8866,7 @@ } else { ast_mutex_unlock(&pri->lock); /* Release PRI lock while we create the channel */ - c = zt_new(pri->pvts[chanpos], AST_STATE_RING, 1, SUB_REAL, law, e->ring.ctype); + c = zt_new(pri->pvts[chanpos], AST_STATE_RING, 1, SUB_REAL, law, e->ring.ctype, e->ring.layer1); if (c) { char calledtonstr[10]; diff -r -u asterisk-1.4.17/funcs/func_channel.c asterisk-1.4.17-h324m/funcs/func_channel.c --- asterisk-1.4.17/funcs/func_channel.c 2007-03-27 18:20:53.000000000 +0200 +++ asterisk-1.4.17-h324m/funcs/func_channel.c 2008-01-09 19:15:55.000000000 +0100 @@ -88,7 +88,11 @@ locked_copy_string(chan, buf, chan->tech->type, len); else if (!strcasecmp(data, "transfercapability")) locked_copy_string(chan, buf, transfercapability_table[chan->transfercapability & 0x1f], len); - else if (!strcasecmp(data, "callgroup")) { + else if (!strcasecmp(data, "userinformationlayer1")) { + char ul1[10]; + snprintf(ul1,9,"%d",chan->userinformationlayer1); + locked_copy_string(chan, buf, ul1, len); + } else if (!strcasecmp(data, "callgroup")) { char groupbuf[256]; locked_copy_string(chan, buf, ast_print_group(groupbuf, sizeof(groupbuf), chan->callgroup), len); } else if (!chan->tech->func_channel_read @@ -133,6 +137,8 @@ break; } } + } else if (!strcasecmp(data, "userinformationlayer1")) { + chan->userinformationlayer1 = atoi(value); } else if (!chan->tech->func_channel_write || chan->tech->func_channel_write(chan, function, data, value)) { ast_log(LOG_WARNING, "Unknown or unavailable item requested: '%s'\n", @@ -158,7 +164,9 @@ "R/W musicclass class (from musiconhold.conf) for hold music\n" "R/W rxgain set rxgain level on channel drivers that support it\n" "R/O state state for channel\n" + "R/W transfercapability ISDN transfer capability (part of ISDN transfer capability)\n" "R/W tonezone zone for indications played\n" + "R/W userinformationlayer1 ISDN User Information Layer 1 (part of ISDN transfer capability)\n" "R/W txgain set txgain level on channel drivers that support it\n" "R/O videonativeformat format used natively for video\n" "\n" diff -r -u asterisk-1.4.17/include/asterisk/channel.h asterisk-1.4.17-h324m/include/asterisk/channel.h --- asterisk-1.4.17/include/asterisk/channel.h 2007-12-04 00:12:17.000000000 +0100 +++ asterisk-1.4.17-h324m/include/asterisk/channel.h 2008-01-09 19:15:55.000000000 +0100 @@ -419,6 +419,7 @@ ast_group_t pickupgroup; /*!< Pickup group - which calls groups can be picked up? */ unsigned int flags; /*!< channel flags of AST_FLAG_ type */ unsigned short transfercapability; /*!< ISDN Transfer Capbility - AST_FLAG_DIGITAL is not enough */ + unsigned short userinformationlayer1; /*!< ISDN User Information Layer 1 - transfercapability is not enough */ AST_LIST_HEAD_NOLOCK(, ast_frame) readq; int alertpipe[2];