[Freeswitch-dev] How to get Peer Session after Bridge (Originate)

Anthony Minessale anthony.minessale at gmail.com
Fri Oct 29 07:44:11 PDT 2010


you should not be interacting with originate like that from another thread.
you do not have access to the channels it's trying to call,
peer_session is only populated with the call that succeeds once it
happens.

If none of them succeed, the pointer to cause code you supply to
originate will return the cause.

originate is designed to produce either a session or a cause code
based on the input you provide and that's all.


On Fri, Oct 29, 2010 at 7:01 AM, Achim Stamm <stamm at lyth.de> wrote:
> Hello,
>
> I have following problem:
>
> I used following code for bridging 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 know when the peer_session hanged up
> (channel is not ready any more).
> I use following code for controling my bridged session (The
> peer_session) in another Thread:
>
> while (!peer_session)
>      {
>            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
> "Session Nebenstelle is NULL ... Wait\n");
>            Sleep(200);
>        }
>        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Session
> Nebenstelle is created from originate call! \n");
>        channelNebenstelle = switch_core_session_get_channel(peer_session);
>
>        while(switch_channel_ready(channel) &&
> switch_channel_ready(channelNebenstelle))
>        {
>            // Communication :
>            Sleep(200);
>        }
>        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Session
> or Peer Session hangsup!\n");
>       // doing something special ...
>
>
> My peer_session is NULL, but Communication is possible.
>
> Why is my peer_session always NULL ?
>
> Is there a better solution (example a core-function) for getting my
> current connected  peer_session ?
> I have tried switch_ivr_find_bridged_uuid(my_uuid, other_uuid,255 ); and
> sessionNebenstelle = switch_core_session_locate(other_uuid);
> ... but I get the session, which have loosed the race.
>
>
> 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
>
>
> _______________________________________________
> 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
>



-- 
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



More information about the FreeSWITCH-dev mailing list