fixed multiplexing bug at NT-mode.
authorSuper User <root@isdn.jolly.ten>
Sat, 22 Sep 2007 07:28:26 +0000 (09:28 +0200)
committerSuper User <root@isdn.jolly.ten>
Sat, 22 Sep 2007 07:28:26 +0000 (09:28 +0200)
this means: multiple telephones now work together on same bus.

Makefile
dss1.cpp
joinpbx.cpp
mISDN.cpp

index dcfcaea..fe9e712 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@
 #*                                                                           **
 #*****************************************************************************/ 
 
 #*                                                                           **
 #*****************************************************************************/ 
 
-#WITH-CRYPTO = 42 # comment this out, if no libcrypto should be used
+WITH-CRYPTO = 42 # comment this out, if no libcrypto should be used
 #WITH-ASTERISK = 42 # comment this out, if you don't require built-in Asterisk channel driver.
 #WITH-SOCKET = 42 # compile for socket based mISDN (
 # note: check your location and the names of libraries.
 #WITH-ASTERISK = 42 # comment this out, if you don't require built-in Asterisk channel driver.
 #WITH-SOCKET = 42 # compile for socket based mISDN (
 # note: check your location and the names of libraries.
index 0134ed4..cd6a41e 100644 (file)
--- a/dss1.cpp
+++ b/dss1.cpp
@@ -1185,7 +1185,6 @@ void Pdss1::disconnect_ind_i(unsigned long prim, unsigned long dinfo, void *data
                add_trace("old-cause", "value", "%d", p_m_d_collect_cause);
        }
        dec_ie_cause(disconnect->CAUSE, (Q931_info_t *)((unsigned long)data+headerlen), &location, &cause);
                add_trace("old-cause", "value", "%d", p_m_d_collect_cause);
        }
        dec_ie_cause(disconnect->CAUSE, (Q931_info_t *)((unsigned long)data+headerlen), &location, &cause);
-       end_trace();
        if (location == LOCATION_PRIVATE_LOCAL)
                location = LOCATION_PRIVATE_REMOTE;
 
        if (location == LOCATION_PRIVATE_LOCAL)
                location = LOCATION_PRIVATE_REMOTE;
 
@@ -1193,6 +1192,7 @@ void Pdss1::disconnect_ind_i(unsigned long prim, unsigned long dinfo, void *data
        collect_cause(&p_m_d_collect_cause, &p_m_d_collect_location, cause, location);
        add_trace("new-cause", "location", "%d", p_m_d_collect_location);
        add_trace("new-cause", "value", "%d", p_m_d_collect_cause);
        collect_cause(&p_m_d_collect_cause, &p_m_d_collect_location, cause, location);
        add_trace("new-cause", "location", "%d", p_m_d_collect_location);
        add_trace("new-cause", "value", "%d", p_m_d_collect_cause);
+       end_trace();
 
 }
 
 
 }
 
@@ -1979,8 +1979,8 @@ int Pdss1::handler(void)
 {
        int ret;
 
 {
        int ret;
 
-if (p_m_delete && p_m_d_l3id==0)
-       printf("ping! %d", p_serial);
+//if (p_m_delete && p_m_d_l3id==0)
+//     printf("ping! %d", p_serial);
        if ((ret = PmISDN::handler()))
                return(ret);
 
        if ((ret = PmISDN::handler()))
                return(ret);
 
@@ -3069,21 +3069,40 @@ int stack2manager_nt(void *dat, void *arg)
                        /* check out correct stack */
                        if (pdss1->p_m_mISDNport == mISDNport)
                        /* check out correct id */
                        /* check out correct stack */
                        if (pdss1->p_m_mISDNport == mISDNport)
                        /* check out correct id */
-                       if ((hh->dinfo&0xffff0000) == (pdss1->p_m_d_l3id&0xffff0000))
+                       if ((pdss1->p_m_d_l3id&0x0000ff00) != 0x000ff00)
                        {
                        {
-                               /* found port, the message belongs to */
-                               break;
+                               /* a single process */
+                               if (hh->dinfo == pdss1->p_m_d_l3id)
+                               {
+                                       /* found port, the message belongs to */
+                                       break;
+                               }
+                       } else
+                       {
+                               /* a broadcast process */
+                               if ((hh->dinfo&0xffff0000) == (pdss1->p_m_d_l3id&0xffff0000))
+                               {
+                                       /* found port, the message belongs to */
+                                       break;
+                               }
                        }
                }
                port = port->next;
        }
        if (port)
        {
                        }
                }
                port = port->next;
        }
        if (port)
        {
+//printf("%x %x\n", hh->dinfo, pdss1->p_m_d_l3id);
                /* if process id is master process, but a child disconnects */
                /* if process id is master process, but a child disconnects */
-               if ((hh->dinfo&0x0000ff00)!=0x0000ff00 && (pdss1->p_m_d_l3id&0x0000ff00)==0x0000ff00 && hh->prim==(CC_DISCONNECT|INDICATION))
+               if ((hh->dinfo&0x0000ff00)!=0x0000ff00 && (pdss1->p_m_d_l3id&0x0000ff00)==0x0000ff00)
                {
                {
-                       /* send special indication for child disconnect */
-                       pdss1->disconnect_ind_i(hh->prim, hh->dinfo, msg->data);
+                       if (hh->prim == (CC_DISCONNECT|INDICATION))
+                       {
+                               /* send special indication for child disconnect */
+                               pdss1->disconnect_ind_i(hh->prim, hh->dinfo, msg->data);
+                               free_msg(msg);
+                               return(0);
+                       }
+                       // ignoring other messages from child processes
                        free_msg(msg);
                        return(0);
                }
                        free_msg(msg);
                        return(0);
                }
@@ -3166,11 +3185,25 @@ int stack2manager_nt(void *dat, void *arg)
                PERROR("unhandled message from stack: call ref released (l3id=0x%x)\n", hh->dinfo);
                break;
 
                PERROR("unhandled message from stack: call ref released (l3id=0x%x)\n", hh->dinfo);
                break;
 
-               case CC_DISCONNECT | INDICATION:
+               case CC_RELEASE_COMPLETE | INDICATION:
+               break;
 
 
-               // fall throug
                default:
                PERROR("unhandled message: prim(0x%x) dinfo(0x%x) msg->len(%d)\n", hh->prim, hh->dinfo, msg->len);
                default:
                PERROR("unhandled message: prim(0x%x) dinfo(0x%x) msg->len(%d)\n", hh->prim, hh->dinfo, msg->len);
+               port = port_first;
+               while(port)
+               {
+                       if (port->p_type == PORT_TYPE_DSS1_NT_IN || port->p_type == PORT_TYPE_DSS1_NT_OUT)
+                       {
+                               pdss1 = (class Pdss1 *)port;
+       //PDEBUG(DEBUG_ISDN, "comparing dinfo = 0x%x with l3id 0x%x\n", hh->dinfo, pdss1->p_m_d_l3id);
+                               /* check out correct stack */
+                               if (pdss1->p_m_mISDNport == mISDNport)
+                               /* check out correct id */
+                               PERROR("unhandled message: dinfo=%x is not associated with port-dinfo=%x\n",hh->dinfo,pdss1->p_m_d_l3id);
+                       }
+                       port = port->next;
+               }
                return(-EINVAL);
        }
        free_msg(msg);
                return(-EINVAL);
        }
        free_msg(msg);
index ec03dc5..76e547a 100644 (file)
@@ -717,7 +717,7 @@ void JoinPBX::message_epoint(unsigned long epoint_id, int message_type, union pa
                        message->param.connectinfo.ntype = INFO_NTYPE_UNKNOWN;
                        message_put(message);
                        j_updatebridge = 1; /* update bridge flag */
                        message->param.connectinfo.ntype = INFO_NTYPE_UNKNOWN;
                        message_put(message);
                        j_updatebridge = 1; /* update bridge flag */
-                       if (j_relation->next && j_partyline_jingle)
+                       if (j_partyline_jingle)
                               play_jingle(1);
                        break;
                        
                               play_jingle(1);
                        break;
                        
index 5129519..0abffd6 100644 (file)
--- a/mISDN.cpp
+++ b/mISDN.cpp
@@ -1415,6 +1415,7 @@ int PmISDN::handler(void)
                                        /* next loop */
                                        p_m_crypt_msg_current = 0;
                                        p_m_crypt_msg_loops--;
                                        /* next loop */
                                        p_m_crypt_msg_current = 0;
                                        p_m_crypt_msg_loops--;
+//                                     puts("eine loop weniger");
                                }
 
                                /* new length */
                                }
 
                                /* new length */
@@ -1914,7 +1915,7 @@ void PmISDN::message_crypt(unsigned long epoint_id, int message_id, union parame
                        break;
                }
                p_m_crypt_msg_current = 0; /* reset */
                        break;
                }
                p_m_crypt_msg_current = 0; /* reset */
-               p_m_crypt_msg_loops = 3; /* enable */
+               p_m_crypt_msg_loops = 6; /* enable */
 #if 0
                /* disable txmix, or we get corrupt data due to audio process */
                if (p_m_txmix && p_m_b_index>=0)
 #if 0
                /* disable txmix, or we get corrupt data due to audio process */
                if (p_m_txmix && p_m_b_index>=0)