]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
...
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 17 Apr 2007 01:15:06 +0000 (01:15 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 17 Apr 2007 01:15:06 +0000 (01:15 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4952 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_wanpipe/mod_wanpipe.c

index 2d2f1657caf59c57068ab39fb93f9bc58311ed83..693dc01d34ef1b731653fc445f80ea412fa997c5 100644 (file)
@@ -69,7 +69,8 @@ typedef enum {
        TFLAG_SWITCH = (1 << 9),
        TFLAG_NOSIG = (1 << 10),
        TFLAG_BYE = (1 << 11),
-       TFLAG_CODEC = (1 << 12)
+       TFLAG_CODEC = (1 << 12),
+       TFLAG_HANGUP = (1 << 13)
 } TFLAGS;
 
 
@@ -636,10 +637,14 @@ static switch_status_t wanpipe_on_hangup(switch_core_session_t *session)
        } else if (tech_pvt->spri) {
                chanmap = tech_pvt->spri->private_info;
 
-               switch_mutex_lock(chanmap->mutex);
-               pri_hangup(tech_pvt->spri->pri, tech_pvt->call, switch_channel_get_cause(channel));
-               pri_destroycall(tech_pvt->spri->pri, tech_pvt->call);
-               switch_mutex_unlock(chanmap->mutex);
+               if (!switch_test_flag(tech_pvt, TFLAG_HANGUP)) {
+                       switch_set_flag_locked(tech_pvt, TFLAG_HANGUP);
+                       switch_mutex_lock(chanmap->mutex);
+                       pri_hangup(tech_pvt->spri->pri, tech_pvt->call, switch_channel_get_cause(channel));
+                       pri_destroycall(tech_pvt->spri->pri, tech_pvt->call);
+                       switch_mutex_unlock(chanmap->mutex);
+               }
+
 
                switch_mutex_lock(globals.channel_mutex);
                *chanmap->map[tech_pvt->callno] = '\0';
@@ -1355,6 +1360,7 @@ static int on_hangup(struct sangoma_pri *spri, sangoma_pri_event_t event_type, p
                        }
 
                        tech_pvt->cause = pevent->hangup.cause;
+                       switch_set_flag_locked(tech_pvt, TFLAG_HANGUP);
                        switch_channel_hangup(channel, tech_pvt->cause);
                }
                switch_core_session_rwunlock(session);