Is it possible to get pjmedia_sdp_session from pjsip_tx_data?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 16, 2008 at 9:48 AM, Pedro Gon?alves <pedro.pandre at gmail.com> wrote:
> I already succeeded to send the initial offer in the INVITE:
> 1) I configured and resolved a stun server, calling pj_stun_config_init
> 2) I created the ICE Transport, by calling pjmedia_ice_create
> 3) I initialized the ICE Transport, by calling pjmedia_ice_start_init
> 4) I initialized the ICE Session, by calling pjmedia_ice_init_ice
> 5) I modified SDP to include ICE candidates, by calling
> pjmedia_ice_modify_sdp
>
> Then, the modified INVITE is sent to the callee, which receives it.
> Now, how shall I proceed so that the callee makes a similar group of actions
> in order to gather its own candidates? I know that in the end, the callee
> can start ICE connectivity checks, right?

First of all I think you're using old (probably 0.8 release) version
of pjsip, the latest SVN version has different API. So with the latest
code, here's how to do it:

- Initially call pjmedia_ice_create() with the appropriate
pj_ice_strans_cfg. The initialization will complete asynchronously and
the ICE media transport callback will be called when initialization
completes (STUN mapping is found, TURN allocation is done, etc.).

- When creating an offer, call pjmedia_transport_media_create() with
local SDP (and NULL as rem_sdp). The ICE media transport will add the
relevant ICE attributes in the local SDP. Then give the local SDP to
the invite session.

- When creating an answer, also call pjmedia_transport_media_create(),
but this time give both local and remote SDP to it. The ICE media
transport will once again modify the local SDP and add ICE attributes
to local SDP, if ICE attributes are indeed found in remote offer. If
not, then it won't add ICE attributes, and ICE will not get activated.

- When you have both local and remote SDP, and when media is okay to
be created, call pjmedia_transport_media_start(), once again giving it
both local and remote SDP. ICE negotiation will start now and ICE
media transport callback will be called when ICE negotiation
completes.

As you probably notice by now, this mechanism should be generic enough
to cover other media transports not only ICE, and indeed this is how
we do it for SRTP as well. For more info please see
http://www.pjsip.org/pjmedia/docs/html/group__PJMEDIA__TRANSPORT__H.htm

> BTW, callee's candidates will be sent in which answer? INVITE 100 Trying?
> INVITE 180 Ringing? INVITE 200 OK?
>

Whenever you want to send SDP, normally not in 180, and definitely not in 100.

Cheers
 Benny


> Best Regards
> Pedro Gon?alves
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
>



[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux