fixes for some join-object-release problems
[lcr.git] / joinpbx.cpp
index 792fc4b..ec03dc5 100644 (file)
@@ -418,7 +418,7 @@ void JoinPBX::bridge(void)
                relation->next->tx_state = notify_state_change(j_serial, relation->next->epoint_id, relation->next->tx_state, relation->rx_state);
        } else
        /* one member in a join, so we put her on hold */
-       if (relations==1 || numconnect==1)
+       if ((relations==1 || numconnect==1) && !j_partyline_jingle)
        {
                PDEBUG(DEBUG_JOIN, "join%d 1 member or only 1 connected, put on hold\n");
                relation = j_relation;
@@ -855,6 +855,12 @@ void JoinPBX::message_epoint(unsigned long epoint_id, int message_type, union pa
                        break;
 
                        case RELATION_TYPE_CALLING: /* by calling */
+                       /* remove us, if we don't have a called releation yet */
+                       if (!j_relation->next)
+                       {
+                               release(j_relation, LOCATION_PRIVATE_LOCAL, CAUSE_NORMAL);
+                               return; // must return, because join IS destroyed
+                       }
                        /* remove all relations that are in called */
                        release_again2:
                        reltemp = j_relation;