[Freeswitch-users] Correct way to hangup a channel

Stephen Wilde wstephen80 at gmail.com
Fri Nov 11 16:42:39 MSK 2011


Thank you Anthony, solved!
I have in my code a call to a "switch_core_session_locate" so, as you say,
after adding a "switch_core_session_rwunlock" the problem disappear and
there are no more "zombie" sessions in my Freeswitch.

Stephen

On Fri, Nov 11, 2011 at 12:34 AM, Anthony Minessale <
anthony.minessale at gmail.com> wrote:

> look for something that calls either switch_core_session_locate
> switch_core_session_get_partner or something that calls
> switch_core_session_read_lock(session);  in all of these cases its
> necessary to call switch_core_session_rwunlock(session); before letting the
> session pointer go out of scope.
>
>
> On Thu, Nov 10, 2011 at 3:17 PM, Stephen Wilde <wstephen80 at gmail.com>wrote:
>
>> I have the necessity to hangup a channel inside a media bug callback in a
>> my custom module.
>>
>> Currently, what I do is:
>>
>> static switch_bool_t my_media_callback(switch_media_bug_t *bug, void
>> *user_data, switch_abc_type_t type)
>> {
>>     struct my_custom_helper * my_helper = (struct my_custom_helper *)
>> user_data;
>>
>>     switch (type) {
>>     case SWITCH_ABC_TYPE_READ_REPLACE:
>>     case SWITCH_ABC_TYPE_WRITE_REPLACE:
>>         {
>>             switch_frame_t *frame;
>>
>>             if (sth->read) {
>>                 frame = switch_core_media_bug_get_read_replace_frame(bug);
>>             } else {
>>                 frame =
>> switch_core_media_bug_get_write_replace_frame(bug);
>>             }
>>
>>             /*
>>             ....
>>             media analysis
>>             ....
>>             */
>>
>>             if (to_hangup) {
>>                 switch_channel_t *channel =
>> switch_core_session_get_channel(my_helper->session);
>>
>>                 if (channel) {
>>                     switch_channel_hangup(channel,
>> SWITCH_CAUSE_NORMAL_CLEARING);
>>                 }
>>             }
>>         }
>>
>>     return SWITCH_TRUE;
>> }
>>
>>
>> The dropped channel is a b-leg, previously bridged with an a-leg
>> (incoming call).
>>
>> Probably in my code there is an error because the code works fine and the
>> channel is correctly dropped but inside Freeswitch remain some "zombies"
>> calls.
>> If I issue a fs_cli  "show channels" I see that there are some calls
>> dropped by my module showed in "ACTIVE" state.
>> What is wrong with my channel hangup?
>>
>> Thanks in advance
>> Stephen
>>
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>>
>>
>
>
> --
> Anthony Minessale II
>
> FreeSWITCH http://www.freeswitch.org/
> ClueCon http://www.cluecon.com/
> Twitter: http://twitter.com/FreeSWITCH_wire
>
> AIM: anthm
> MSN:anthony_minessale at hotmail.com
> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
> IRC: irc.freenode.net #freeswitch
>
> FreeSWITCH Developer Conference
> sip:888 at conference.freeswitch.org
> googletalk:conf+888 at conference.freeswitch.org
> pstn:+19193869900
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20111111/f9b314e0/attachment.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list