BSTATE_ACTIVE,
};
-#ifdef MISDN_SOCKET
-int bchannel_socket = -1;
+#ifdef SOCKET_MISDN
int bchannel_initialize(void)
{
- /* try to open raw socket to check kernel */
- bchannel_socket = socket(PF_ISDN, SOCK_RAW, ISDN_P_BASE);
- if (bchannel_socket < 0)
- {
- PERROR("Cannot open mISDN due to %s. (Does your Kernel support socket based mISDN?)\n", strerror(errno));
- return(-1);
- }
-
- mISDN_debug_init(global_debug, NULL, NULL, NULL);
-
- bchannel_pid = get_pid();
-
- /* init mlayer3 */
- init_layer3(4); // buffer of 4
-
return(0);
}
void bchannel_deinitialize(void)
{
- cleanup_layer3();
-
- mISDN_debug_close();
-
- if (bchannel_socket > -1)
- close(bchannel_socket);
}
#else
int bchannel_entity = 0; /* used for udevice */
if (channel->b_sock)
{
- PERROR("Error: Socket already created for handle %d\n", channel->handle);
+ PERROR("Error: Socket already created for handle 0x%x\n", channel->handle);
return(0);
}
channel->b_sock = socket(PF_ISDN, SOCK_DGRAM, ISDN_P_B_L2DSP);
if (channel->b_sock < 0)
{
- PERROR("Error: Failed to open bchannel-socket for handle %d with mISDN-DSP layer. Did you load mISDNdsp.ko?\n", channel->handle);
+ PERROR("Error: Failed to open bchannel-socket for handle 0x%x with mISDN-DSP layer. Did you load mISDNdsp.ko?\n", channel->handle);
return(0);
}
ret = ioctl(channel->b_sock, FIONBIO, &on);
if (ret < 0)
{
- PERROR("Error: Failed to set bchannel-socket handle %d into nonblocking IO\n", channel->handle);
+ PERROR("Error: Failed to set bchannel-socket handle 0x%x into nonblocking IO\n", channel->handle);
close(channel->b_sock);
channel->b_sock = -1;
return(0);
addr.family = AF_ISDN;
addr.dev = (channel->handle>>8)-1;
addr.channel = channel->handle && 0xff;
- ret = bind(di->bchan, (struct sockaddr *)&addr, sizeof(addr));
+ ret = bind(channel->b_sock, (struct sockaddr *)&addr, sizeof(addr));
if (ret < 0)
{
- PERROR("Error: Failed to bind bchannel-socket for handle %d with mISDN-DSP layer. Did you load mISDNdsp.ko?\n", channel->handle);
+ PERROR("Error: Failed to bind bchannel-socket for handle 0x%x with mISDN-DSP layer. Did you load mISDNdsp.ko?\n", channel->handle);
close(channel->b_sock);
channel->b_sock = -1;
return(0);
ph_control(handle, DTMF_TONE_START, 0, "DSP-DTMF", 1);
if (channel->b_crypt_len)
ph_control_block(handle, BF_ENABLE_KEY, channel->b_crypt_key, channel->b_crypt_len, "DSP-CRYPT", channel->b_crypt_len);
+ if (channel->b_conf)
+ ph_control(handle, CMX_CONF_JOIN, channel->b_conf, "DSP-CONF", channel->b_conf);
channel->b_state = BSTATE_ACTIVE;
}
#else
if (channel->b_stid)
#endif
- bchannel_destroy(channel);
+ bchannel_destroy(channel);
+ if (channel->call)
+ {
+ if (channel->call->channel)
+ channel->call->channel = NULL;
+ }
+ if (channel->bridge_channel)
+ {
+ if (channel->bridge_channel->bridge_channel)
+ channel->bridge_channel->bridge_channel = NULL;
+ }
free(channel);
return;
}