unsigned long *d = (unsigned long *)(buffer+MISDN_HEADER_LEN);
int ret;
- CDEBUG(NULL, NULL, "Sending PH_CONTROL %d,%d\n", c1, c2);
+ CDEBUG(NULL, NULL, "Sending PH_CONTROL %s %x,%x\n", trace_name, c1, c2);
ctrl->prim = PH_CONTROL_REQ;
ctrl->id = 0;
*d++ = c1;
ret = sendto(handle, buffer, MISDN_HEADER_LEN+sizeof(int)*2, 0, NULL, 0);
if (ret < 0)
CERROR(NULL, NULL, "Failed to send to socket %d\n", handle);
-#if 0
- chan_trace_header(mISDNport, isdnport, "BCHANNEL control", DIRECTION_OUT);
- if (c1 == CMX_CONF_JOIN)
- add_trace(trace_name, NULL, "0x%08x", trace_value);
- else
- add_trace(trace_name, NULL, "%d", trace_value);
- end_trace();
-#endif
}
static void ph_control_block(unsigned long handle, unsigned long c1, void *c2, int c2_len, char *trace_name, int trace_value)
unsigned long *d = (unsigned long *)(buffer+MISDN_HEADER_LEN);
int ret;
- CDEBUG(NULL, NULL, "Sending PH_CONTROL (block) %d\n", c1);
+ CDEBUG(NULL, NULL, "Sending PH_CONTROL (block) %s %x\n", trace_name, c1);
ctrl->prim = PH_CONTROL_REQ;
ctrl->id = 0;
*d++ = c1;
ret = sendto(handle, buffer, MISDN_HEADER_LEN+sizeof(int)+c2_len, 0, NULL, 0);
if (ret < 0)
CERROR(NULL, NULL, "Failed to send to socket %d\n", handle);
-#if 0
- chan_trace_header(mISDNport, isdnport, "BCHANNEL control", DIRECTION_OUT);
- add_trace(trace_name, NULL, "%d", trace_value);
- end_trace();
-#endif
}
CERROR(NULL, NULL, "Failed to set bchannel-socket handle 0x%x into nonblocking IO\n", bchannel->handle);
close(bchannel->b_sock);
bchannel->b_sock = -1;
- bchannel->handle = 0;
return(0);
}
/* bind socket to bchannel */
addr.family = AF_ISDN;
addr.dev = (bchannel->handle>>8)-1;
- addr.channel = bchannel->handle && 0xff;
+ addr.channel = bchannel->handle & 0xff;
ret = bind(bchannel->b_sock, (struct sockaddr *)&addr, sizeof(addr));
if (ret < 0)
{
- CERROR(NULL, NULL, "Failed to bind bchannel-socket for handle 0x%x with mISDN-DSP layer. Did you load mISDNdsp.ko?\n", bchannel->handle);
+ CERROR(NULL, NULL, "Failed to bind bchannel-socket for handle 0x%x with mISDN-DSP layer. (port %d, channel %d) Did you load mISDNdsp.ko?\n", bchannel->handle, addr.dev + 1, addr.channel);
close(bchannel->b_sock);
bchannel->b_sock = -1;
return(0);
add_trace("DTMF", NULL, "%c", cont & DTMF_TONE_MASK);
end_trace();
#endif
- if (bchannel->rx_dtmf)
- bchannel->rx_dtmf(bchannel, cont & DTMF_TONE_MASK);
+ if (bchannel->call)
+ lcr_in_dtmf(bchannel->call, cont & DTMF_TONE_MASK);
return;
}
switch(cont)
/*
+ * dtmf bchannel
+ */
+void bchannel_dtmf(struct bchannel *bchannel, int on)
+{
+ int handle;
+
+ handle = bchannel->b_sock;
+ bchannel->b_dtmf = 1;
+ if (bchannel->b_state == BSTATE_ACTIVE)
+ ph_control(handle, on?DTMF_TONE_START:DTMF_TONE_STOP, 0, "DSP-DTMF", 1);
+}
+
+
+/*
* main loop for processing messages from mISDN
*/
int bchannel_handle(void)