[Freeswitch-dev] How to hangup bridged sessions

Achim Stamm stamm at lyth.de
Tue Oct 26 02:21:20 PDT 2010


Anthony Minessale schrieb:
> switch_call_cause_t *cancel_cause is the last arg to originate
>
> switch_call_cause_t cancel_cause = SWITCH_CAUSE_NONE;
>
> pass &cancel_cause as the final arg to originate.
>
> if originate is in some other thread you will need to create the
> cancel_cause in the other thread and pass it up.
>
> Then when you change cancel cause to some cause, all sessions in the
> originate thread will terminate with that cause.
>
>
> On Fri, Oct 1, 2010 at 11:36 AM, Achim Stamm <stamm at lyth.de> wrote:
>   
>> Bernhard Suttner schrieb:
>>     
>>> Hi,
>>>
>>> Did you try to hangup the session (not the peer session). This should freeswitch force to hangup all related channels (the session + the connected sessions).
>>>
>>> BR,
>>> Bernhard
>>>
>>> -----Ursprüngliche Nachricht-----
>>> Von: freeswitch-dev-bounces at lists.freeswitch.org [mailto:freeswitch-dev-bounces at lists.freeswitch.org] Im Auftrag von Achim Stamm
>>> Gesendet: Freitag, 1. Oktober 2010 18:02
>>> An: freeswitch-dev at lists.freeswitch.org
>>> Betreff: [Freeswitch-dev] How to hangup bridged sessions
>>>
>>> How to hangup bridged sessions
>>>
>>> Hello,
>>>
>>> i have following problem:
>>>
>>> I used following code for brdiging my current session to multiple Voip
>>> Phones
>>> in a freeswitch thread (same as bgapi):
>>>
>>> switch_ivr_originate(session, &peer_session, &cause,
>>> "user/60 at 192.168.1.50,user/61 at 192.168.1.50", timelimit, NULL, NULL,
>>> NULL, NULL, NULL, SOF_NONE,NULL) != SWITCH_STATUS_SUCCESS)
>>>
>>> Both Phones with number 60 and 61 rings.
>>>
>>> In a special case I need to force hangup both Phones (stop ringing).
>>> I use following code for hangup bridged sessions:
>>>
>>> char * my_uuid = switch_core_session_get_uuid(session);
>>> char other_uuid[255];
>>> switch_ivr_find_bridged_uuid(my_uuid, other_uuid,255 );
>>> sessionNebenstelle = switch_core_session_locate(other_uuid);
>>> if (sessionNebenstelle)
>>> {
>>>     channelNebenstelle =
>>> switch_core_session_get_channel(sessionNebenstelle);
>>>     switch_channel_hangup(channelNebenstelle,SWITCH_CAUSE_NO_ANSWER);
>>>     if (switch_core_session_private_event_count(sessionNebenstelle)) {
>>>         switch_ivr_parse_all_events(sessionNebenstelle);
>>>     }
>>> }
>>>
>>> This Code works only for one phone, so Phone 61 stops ringing, but Phone
>>> 60 continue ringing.
>>>
>>> It is possible, that i can hangup the other phone ?
>>>
>>> Is there a better solution for cancel switch_ivr_originate (hangup all
>>> originating sessions ?)
>>>
>>> Greetings
>>>
>>> Achim Stamm
>>>
>>>
>>>       
>> For my special case:
>> I need my session alive for doing read and write frame in a while loop.
>> After hanging up the peer Sessions. I do an answer (for my session) and
>> enter the while loop.
>> The "Connection" to another Session (also in a read and write frame
>> while loop) is done
>> by exchanging manually audio frames.
>>
>> Thanks for your question.
>>
>> --
>> Achim Stamm, Dipl.-Inform. (FH)
>>
>>
>> Lyncker & Theis GmbH
>> Wilhelmstr. 16
>> 65185 Wiesbaden
>> Germany
>>
>> Fon +49 611/9006951
>> Fax +49 611/9406125
>>
>>
>> Handelsregister: HRB 23156 Amtsgericht Wiesbaden
>> Steuernummer: 04323897052
>> USt-IdNr.: DE255806399
>>
>> Geschäftsführer:
>> Filip Lyncker,
>> Armin Theis
>>
>>
>> _______________________________________________
>> FreeSWITCH-dev mailing list
>> FreeSWITCH-dev at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
>> http://www.freeswitch.org
>>
>>     
>
>
>
>   
Thanks for Helping.
Your solution works fine.

regards

Achim Stamm

-- 
Achim Stamm, Dipl.-Inform. (FH)


Lyncker & Theis GmbH
Wilhelmstr. 16
65185 Wiesbaden
Germany

Fon +49 611/9006951
Fax +49 611/9406125


Handelsregister: HRB 23156 Amtsgericht Wiesbaden
Steuernummer: 04323897052
USt-IdNr.: DE255806399

Geschäftsführer:
Filip Lyncker,
Armin Theis 




More information about the FreeSWITCH-dev mailing list