static int route_call(layer4_t *l4) { layer4_t *newl4; fprintf(stderr, "%s: msn ", __FUNCTION__); display_NR_IE(l4->msn); fprintf(stderr, "%s: nr ", __FUNCTION__); display_NR_IE(l4->nr); if (l4->usednr->typ == NR_TYPE_INTERN) { newl4 = get_free_channel(&kern_if, -1, NULL); if (!newl4) { l4->cause_loc = CAUSE_LOC_PNET_LOCUSER; l4->cause_val = CAUSE_USER_BUSY; l4->progress = PROGRESS_TONE; if_link(l4->nst, man_down, MAN_CLEAR_CALL | REQUEST, l4->channel, 0, NULL, 0); return(0); } l4->sdata = newl4; l4->rdata = newl4; newl4->sdata = l4; newl4->rdata = l4; l4->sbuf = &newl4->rbuf; newl4->sbuf = &l4->rbuf; newl4->msn[0] = l4->usednr->len +1; newl4->msn[1] = 0x81; memcpy(&newl4->msn[2], l4->usednr->nr, l4->usednr->len); if (l4->msn[0]) memcpy(newl4->nr, l4->msn, l4->msn[0] + 1); newl4->l1_prot = ISDN_PID_L1_B_64TRANS; if_link(newl4->nst, man_down, MAN_SETUP | REQUEST, newl4->channel, 0, NULL, 0); } else if (l4->usednr->typ == NR_TYPE_AUDIO) { l4->sdata = NULL; l4->rdata = NULL; strcpy(l4->display,"connect to AUDIO"); do_connect(l4); l4->display[0] = 0; deactivate_bchannel(l4); setup_bchannel_rawdev(l4); activate_bchannel(l4); } else if (l4->usednr->typ == NR_TYPE_VOIP) { l4->sdata = NULL; l4->rdata = NULL; sprintf(l4->display,"calling %s", l4->usednr->name); do_alert(l4); sprintf(l4->display,"connect to %s", l4->usednr->name); do_connect(l4); l4->display[0] = 0; deactivate_bchannel(l4); setup_bchannel_rawdev(l4); activate_bchannel(l4); } return(0); }
static int hfcusb_l2l1B(struct mISDNchannel *ch, struct sk_buff *skb) { struct bchannel *bch = container_of(ch, struct bchannel, ch); struct hfcsusb *hw = bch->hw; int ret = -EINVAL; struct mISDNhead *hh = mISDN_HEAD_P(skb); u_long flags; if (debug & DBG_HFC_CALL_TRACE) printk(KERN_DEBUG "%s: %s\n", hw->name, __func__); switch (hh->prim) { case PH_DATA_REQ: spin_lock_irqsave(&hw->lock, flags); ret = bchannel_senddata(bch, skb); spin_unlock_irqrestore(&hw->lock, flags); if (debug & DBG_HFC_CALL_TRACE) printk(KERN_DEBUG "%s: %s PH_DATA_REQ ret(%i)\n", hw->name, __func__, ret); if (ret > 0) { queue_ch_frame(ch, PH_DATA_CNF, hh->id, NULL); ret = 0; } return ret; case PH_ACTIVATE_REQ: if (!test_and_set_bit(FLG_ACTIVE, &bch->Flags)) { hfcsusb_start_endpoint(hw, bch->nr); ret = hfcsusb_setup_bch(bch, ch->protocol); } else ret = 0; if (!ret) _queue_data(ch, PH_ACTIVATE_IND, MISDN_ID_ANY, 0, NULL, GFP_KERNEL); break; case PH_DEACTIVATE_REQ: deactivate_bchannel(bch); _queue_data(ch, PH_DEACTIVATE_IND, MISDN_ID_ANY, 0, NULL, GFP_KERNEL); ret = 0; break; } if (!ret) dev_kfree_skb(skb); return ret; }