fixed partyline-conference handling
authorSuper User <root@isdn.jolly.ten>
Fri, 24 Aug 2007 06:39:42 +0000 (08:39 +0200)
committerSuper User <root@isdn.jolly.ten>
Fri, 24 Aug 2007 06:39:42 +0000 (08:39 +0200)
README
channel.c
default/options.conf
joinpbx.cpp
main.h
todo.txt

diff --git a/README b/README
index 32193ca..c434f4d 100644 (file)
--- a/README
+++ b/README
@@ -336,7 +336,7 @@ Changes in Version 3.4
 
 New Verion for new name: LCR
 
-Changes in Version 1.0
+Changes in Version 0.1
 - Statefull b-channel open and closing
 - Rebuild audio flow
   Made much simpler
@@ -361,3 +361,8 @@ Changes in Version 1.0
 - A new remote interface for external applications is integrated
   -> Our first application is (-: *ASTERISK CHANNEL DRIVER* :-)
 
+Changes in Version 0.2
+- Fixed partyline handling
+- Audio recoriding still does not work.
+
+
index 56d9e0d..2adec86 100644 (file)
--- a/channel.c
+++ b/channel.c
@@ -161,6 +161,7 @@ int mISDN_handler(void)
        msg_t *dmsg;
        mISDNuser_head_t *hh;
        int i;
+       struct chan_bchannel *bchannel;
 
        /* no device, no read */
        if (mISDNdevice < 0)
@@ -199,16 +200,16 @@ int mISDN_handler(void)
        }
 
        /* look for channel instance, that has the address of this message */
-       chan = chan_first;
-       while(chan)
+       bchannel = bchannel_first;
+       while(bchannel)
        {
-               if (frm->addr == chan->b_addr)
+               if (frm->addr == bchannel->b_addr)
                        break;
-               chan = chan->next;
+               bchannel = chan->next;
        } 
-       if (!chan)
+       if (!bchannel)
        {
-               PERROR("message belongs to no chan: prim(0x%x) addr(0x%x) msg->len(%d)\n", frm->prim, frm->addr, msg->len);
+               PERROR("message belongs to no bchannel: prim(0x%x) addr(0x%x) msg->len(%d)\n", frm->prim, frm->addr, msg->len);
                goto out;
        }
 
@@ -225,7 +226,7 @@ int mISDN_handler(void)
                case DL_DATA | INDICATION:
                case PH_CONTROL | INDICATION:
                i = 0;
-               chan->bchannel_receive(frm);
+               bchannel_receive(bchannel, frm);
                break;
 
                case PH_ACTIVATE | INDICATION:
@@ -233,7 +234,6 @@ int mISDN_handler(void)
                case PH_ACTIVATE | CONFIRM:
                case DL_ESTABLISH | CONFIRM:
                PDEBUG(DEBUG_BCHANNEL, "DL_ESTABLISH confirm: bchannel is now activated (address 0x%x).\n", frm->addr);
-               chan->b_active = 1;
                bchannel_event(mISDNport, i, B_EVENT_ACTIVATED);
                break;
 
@@ -242,7 +242,6 @@ int mISDN_handler(void)
                case PH_DEACTIVATE | CONFIRM:
                case DL_RELEASE | CONFIRM:
                PDEBUG(DEBUG_BCHANNEL, "DL_RELEASE confirm: bchannel is now de-activated (address 0x%x).\n", frm->addr);
-               chan->b_active = 0;
                bchannel_event(mISDNport, i, B_EVENT_DEACTIVATED);
                break;
 
index 6c84d97..6b1ca27 100644 (file)
@@ -13,7 +13,7 @@
 #define DEBUG_ISDN     0x0110
 #define DEBUG_VBOX     0x0180
 #define DEBUG_EPOINT   0x0200
-#define DEBUG_CALL     0x0400
+#define DEBUG_JOIN     0x0400
 #define DEBUG_CRYPT     0x1000
 #define DEBUG_ROUTE     0x2000
 #define DEBUG_IDLETIME  0x4000
index 6d8b1b9..406d9e8 100644 (file)
@@ -698,6 +698,57 @@ void JoinPBX::message_epoint(unsigned long epoint_id, int message_type, union pa
                return;
        }
 
+       /* process party line */
+       if (message_type == MESSAGE_SETUP) if (param->setup.partyline)
+       {
+               j_partyline = param->setup.partyline;
+       }
+       if (j_partyline)
+       {
+               switch(message_type)
+               {
+                       case MESSAGE_SETUP:
+                       PDEBUG(DEBUG_JOIN, "respsone with connect in partyline mode.\n");
+                       relation->type = RELATION_TYPE_CONNECT;
+                       message = message_create(j_serial, epoint_id, JOIN_TO_EPOINT, MESSAGE_CONNECT);
+                       SPRINT(message->param.connectinfo.id, "%d", j_partyline);
+                       message->param.connectinfo.ntype = INFO_NTYPE_UNKNOWN;
+                       message_put(message);
+                       j_updatebridge = 1; /* update bridge flag */
+                       break;
+                       
+                       case MESSAGE_AUDIOPATH:
+                       PDEBUG(DEBUG_JOIN, "join received channel message: %d.\n", param->audiopath);
+                       if (relation->channel_state != param->audiopath)
+                       {
+                               relation->channel_state = param->audiopath;
+                               j_updatebridge = 1; /* update bridge flag */
+                               if (options.deb & DEBUG_JOIN)
+                                       joinpbx_debug(this, "Join::message_epoint{after setting new channel state}");
+                       }
+                       break;
+
+                       case MESSAGE_DISCONNECT:
+                       PDEBUG(DEBUG_JOIN, "releasing after receiving disconnect, because join in partyline mode.\n");
+                       message = message_create(j_serial, epoint_id, JOIN_TO_EPOINT, MESSAGE_RELEASE);
+                       message->param.disconnectinfo.cause = CAUSE_NORMAL;
+                       message->param.disconnectinfo.location = LOCATION_PRIVATE_LOCAL;
+                       message_put(message);
+                       // fall through
+
+                       case MESSAGE_RELEASE:
+                       PDEBUG(DEBUG_JOIN, "releasing from join\n");
+                       release(relation, 0, 0);
+                       break;
+
+                       default:
+                       PDEBUG(DEBUG_JOIN, "ignoring message, because join in partyline mode.\n");
+               }
+               return;
+       }
+
+
+       /* process messages */
        switch(message_type)
        {
                /* process audio path message */
@@ -826,34 +877,6 @@ void JoinPBX::message_epoint(unsigned long epoint_id, int message_type, union pa
                return; // must return, because join may be destroyed
        }
 
-       /* process party line */
-       if (message_type == MESSAGE_SETUP) if (param->setup.partyline)
-       {
-               PDEBUG(DEBUG_JOIN, "respsone with connect in partyline mode.\n");
-               j_partyline = param->setup.partyline;
-               message = message_create(j_serial, epoint_id, JOIN_TO_EPOINT, MESSAGE_CONNECT);
-               message->param.setup.partyline = j_partyline;
-               message_put(message);
-               j_updatebridge = 1; /* update bridge flag */
-       }
-       if (j_partyline)
-       {
-               if (message_type == MESSAGE_DISCONNECT)
-               {
-                       PDEBUG(DEBUG_JOIN, "releasing after receiving disconnect, because join in partyline mode.\n");
-                       message = message_create(j_serial, epoint_id, JOIN_TO_EPOINT, MESSAGE_RELEASE);
-                       message->param.disconnectinfo.cause = CAUSE_NORMAL;
-                       message->param.disconnectinfo.location = LOCATION_PRIVATE_LOCAL;
-                       message_put(message);
-                       return;
-               }
-       }
-       if (j_partyline)
-       {
-               PDEBUG(DEBUG_JOIN, "ignoring message, because join in partyline mode.\n");
-               return;
-       }
-
        /* count relations */
        num=joinpbx_countrelations(j_serial);
 
diff --git a/main.h b/main.h
index 6e679c0..4ea51b0 100644 (file)
--- a/main.h
+++ b/main.h
@@ -13,7 +13,7 @@
 
 #define DEFAULT_ENDPOINT_APP EndpointAppPBX
 
-#define VERSION_STRING "0.1 (August 2007)"
+#define VERSION_STRING "0.2 (August 2007)"
 
 extern int memuse;
 extern int mmemuse;
index e4eee99..9f73240 100644 (file)
--- a/todo.txt
+++ b/todo.txt
@@ -3,9 +3,6 @@ make asterisk call implementation
 
 display message during nothing/play
 
-Port -> Proc
-Call -> Link
-
 maybe:
 delay - per param setzen, lokal als mISDNsignal und remote mittels setup
 
@@ -17,7 +14,6 @@ NOTE: check CENTREX
 
 durchstellen mit disconnect
 durchstellen mit keypad
-ruf bei CFP gibt besetzt, wenn teilnehmer intern besetzt ist.
 short ring
 sleep relaxed
 auto pick