[pjsip] Create conf port with incoming RTP stream

Nanang Izzuddin nanang at pjsip.org
Mon Apr 28 14:35:10 EDT 2008


Hi Hubert,

It seems you are using PJSUA and you need to receive an RTP stream on
port 4002, then pass the stream to conference bridge without call
signaling at the first place.

Since there is no call signaling, I think you better use your own
media transport and don't need to deal with pjmedia session. So the
steps should be around:

1. create a UDP pjmedia transport listening on port 4002.
2. create stream port with the above pjmedia transport.
3. add the stream port to conference bridge (use
pjsua_conf_add_port(), instead of pjmedia_conf_add_port(), since you
are using pjsua)
4. connect the stream port to other port(s), e.g: sound device, or
other stream ports.

You should only use the API and not modifying any parts of the
library, something rather strange/'illegal' in your code snippet
(well, actually not directly related to the problem):
- accessing member of pjmedia_session while this struct is opaque.
- calling create_conf_port(), not API.
- manage the pjsua's conference manually instead of using PJSUA API
pjsua_conf_add_port().


Regards,
nanang


On 27/04/2008, Hubert Langevin <hubertlangevin at gmail.com> wrote:
> Hi everyone,
>
>  I just had an enquiry. I have a separate audio device that transmits
>  an RTP stream (with no RTCP) to my PC running PJSIP on port 4002. I
>  would like to convert that incoming RTP stream into a conference port
>  in PJSIP so I can use it for conferencing purposes.
>
>  Here is a little bit of what i did so far:
>
>  =================================================
>
>  pj_str_t port_name = pj_str("Stream from Radio 1");
>  pj_str_t codec = pj_str("PCMU/8000/1");
>
>  pool = pjmedia_endpt_create_pool( pjsua_var.med_endpt, "session",
>  PJMEDIA_SESSION_SIZE, PJMEDIA_SESSION_INC);
>
>  session = PJ_POOL_ZALLOC_T(pool, pjmedia_session);
>  session->pool = pool;
>  session->endpt = pjsua_var.med_endpt;
>  session->stream_cnt = 1;
>  session->user_data = call;
>
>  session->stream_info[0].dir = PJMEDIA_DIR_ENCODING_DECODING;
>  session->stream_info[0].type = PJMEDIA_TYPE_AUDIO;
>  session->stream_info[0].fmt.clock_rate = 8000;
>  session->stream_info[0].fmt.type = PJMEDIA_TYPE_AUDIO;
>  session->stream_info[0].fmt.channel_cnt = 2;
>  session->stream_info[0].fmt.encoding_name = codec;
>  session->stream_info[0].rem_addr = addr_RTP;
>
>  pjmedia_stream_create(pjsua_var.med_endpt,
>  session->pool,&session->stream_info[0],
>  call->med_tp, session, &session->stream[0]);
>
>  pjmedia_stream_start(session->stream[0]);
>
>  pjmedia_session_get_port(session, 0, &media_port);
>
>  create_conf_port(pjsua_var.pool, pjsua_var.mconf,
>  media_port, &port_name, &conf_port);
>
>  pjsua_var.mconf->ports[1] = conf_port;
>  pjsua_var.mconf->port_cnt++;
>
>  =================================================
>
>  I do receive the stream on the right port, but I can't seem to get the
>  audio out of the conf port.
>
>  Any ideas of what i might be doing wrong?
>
>  Thank you so much in advance,
>
>  Best Regards,
>
>  Hubert Langevin.
>
>  _______________________________________________
>  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
>




More information about the pjsip mailing list