]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
more gracefully handle messagees with unexpected chan id that we don't have allocated.
authorMichael Jerris <mike@jerris.com>
Mon, 28 Jan 2008 22:17:34 +0000 (22:17 +0000)
committerMichael Jerris <mike@jerris.com>
Mon, 28 Jan 2008 22:17:34 +0000 (22:17 +0000)
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@376 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/freetdm/src/zap_isdn.c

index 5f92cfa4b6a1bbaa80ef28cfd70e42c185293edf..4d10f8c5557609c15afc127a5d843e65cc3e773a 100644 (file)
@@ -144,7 +144,11 @@ static L3INT zap_isdn_931_34(void *pvt, L2UCHAR *msg, L2INT mlen)
                case Q931mes_RELEASE:
                case Q931mes_RELEASE_COMPLETE:
                        {
-                               zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_DOWN);
+                               if (zchan) {
+                                       zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_DOWN);
+                               } else {
+                                       zap_log(ZAP_LOG_CRIT, "Received Release Complete with no matching channel %d\n", chan_id);
+                               }
                        }
                        break;
                case Q931mes_DISCONNECT:
@@ -157,17 +161,29 @@ static L3INT zap_isdn_931_34(void *pvt, L2UCHAR *msg, L2INT mlen)
                        break;
                case Q931mes_ALERTING:
                        {
-                               zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_PROGRESS_MEDIA);
+                               if (zchan) {
+                                       zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_PROGRESS_MEDIA);
+                               } else {
+                                       zap_log(ZAP_LOG_CRIT, "Received Alerting with no matching channel %d\n", chan_id);
+                               }
                        }
                        break;
                case Q931mes_PROGRESS:
                        {
-                               zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_PROGRESS);
+                               if (zchan) {
+                                       zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_PROGRESS);
+                               } else {
+                                       zap_log(ZAP_LOG_CRIT, "Received Progress with no matching channel %d\n", chan_id);
+                               }
                        }
                        break;
                case Q931mes_CONNECT:
                        {
-                               zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_UP);
+                               if (zchan) {
+                                       zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_UP);
+                               } else {
+                                       zap_log(ZAP_LOG_CRIT, "Received Connect with no matching channel %d\n", chan_id);
+                               }
                        }
                        break;
                case Q931mes_SETUP: