Index: channels/chan_zap.c =================================================================== --- channels/chan_zap.c (revision 75182) +++ channels/chan_zap.c (working copy) @@ -2377,10 +2377,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); @@ -3772,7 +3776,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) { @@ -4530,7 +4534,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); @@ -5485,7 +5489,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; @@ -5645,6 +5650,7 @@ tmp->cid.cid_ton = i->cid_ton; #if defined(HAVE_PRI) || defined(HAVE_SS7) tmp->transfercapability = transfercapability; + tmp->userinformationlayer1 = userinformationlayer1; pbx_builtin_setvar_helper(tmp, "TRANSFERCAPABILITY", ast_transfercapability2str(transfercapability)); if (transfercapability & PRI_TRANS_CAP_DIGITAL) i->digital = 1; @@ -6956,7 +6962,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); @@ -6965,7 +6971,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); @@ -7006,9 +7012,9 @@ case SIG_SF: /* Check for callerid, digits, etc */ if (i->cid_start == CID_START_POLARITY_IN) { - 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); } else { - 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_detached(&threadid, NULL, ss_thread, chan)) { ast_log(LOG_WARNING, "Unable to start simple switch thread on channel %d\n", i->channel); @@ -7105,7 +7111,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_detached(&threadid, NULL, ss_thread, chan)) { ast_log(LOG_WARNING, "Unable to start simple switch thread on channel %d\n", i->channel); } @@ -8326,7 +8332,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 */ @@ -9758,6 +9764,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); @@ -9784,11 +9791,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_debug(1, "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); } if (!ast_strlen_zero(e->ring.callingsubaddr)) { pbx_builtin_setvar_helper(c, "CALLINGSUBADDR", e->ring.callingsubaddr); @@ -9828,7 +9835,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); ast_mutex_lock(&pri->lock); if (c) { char calledtonstr[10]; Index: apps/app_dial.c =================================================================== --- apps/app_dial.c (revision 75182) +++ apps/app_dial.c (working copy) @@ -1418,6 +1418,7 @@ tc->cid.cid_tns = chan->cid.cid_tns; tc->adsicpe = chan->adsicpe; tc->transfercapability = chan->transfercapability; + tc->userinformationlayer1 = chan->userinformationlayer1; /* If we have an outbound group, set this peer channel to it */ if (outbound_group) Index: funcs/func_channel.c =================================================================== --- funcs/func_channel.c (revision 75182) +++ funcs/func_channel.c (working copy) @@ -89,7 +89,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 @@ -134,6 +138,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", @@ -159,7 +165,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" Index: include/asterisk/channel.h =================================================================== --- include/asterisk/channel.h (revision 75182) +++ include/asterisk/channel.h (working copy) @@ -470,6 +470,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];