- /* process all bchannels */
- bchannel = bchannel_first;
- while(bchannel)
- {
- /* handle message from bchannel */
- if (bchannel->b_sock > -1)
- {
- ret = recv(bchannel->b_sock, buffer, sizeof(buffer), 0);
- if (ret >= (int)MISDN_HEADER_LEN)
- {
- work = 1;
- switch(hh->prim)
- {
- /* we don't care about confirms, we use rx data to sync tx */
- case PH_DATA_CNF:
- break;
-
- /* we receive audio data, we respond to it AND we send tones */
- case PH_DATA_IND:
- case PH_DATA_REQ:
- case DL_DATA_IND:
- case PH_CONTROL_IND:
- bchannel_receive(bchannel, buffer, ret-MISDN_HEADER_LEN);
- break;
-
- case PH_ACTIVATE_IND:
- case DL_ESTABLISH_IND:
- case PH_ACTIVATE_CNF:
- case DL_ESTABLISH_CNF:
- CDEBUG(NULL, NULL, "DL_ESTABLISH confirm: bchannel is now activated (socket %d).\n", bchannel->b_sock);
- bchannel_activated(bchannel);
- break;
-
- case PH_DEACTIVATE_IND:
- case DL_RELEASE_IND:
- case PH_DEACTIVATE_CNF:
- case DL_RELEASE_CNF:
- CDEBUG(NULL, NULL, "DL_RELEASE confirm: bchannel is now de-activated (socket %d).\n", bchannel->b_sock);
-// bchannel_deactivated(bchannel);
- break;
-
- default:
- CERROR(NULL, NULL, "child message not handled: prim(0x%x) socket(%d) data len(%d)\n", hh->prim, bchannel->b_sock, ret - MISDN_HEADER_LEN);
- }
- } else
- {
- if (ret < 0 && errno != EWOULDBLOCK)
- CERROR(NULL, NULL, "Read from socket %d failed with return code %d\n", bchannel->b_sock, ret);
+ ret = recv(bchannel->b_sock, buffer, sizeof(buffer), 0);
+ if (ret >= (int)MISDN_HEADER_LEN) {
+ switch(hh->prim) {
+ /* after a confim, we can send more from queue */
+ case PH_DATA_CNF:
+ if (bchannel->nodsp_queue) {
+ bchannel->queue_sent = 0;
+ bchannel_send_queue(bchannel);