Hi Bill. Thanks for the quick response.
I'm using pjmedia_conf_add_port inside of
on_stream_created, which (I think) adds the stream port
(p_port) to the conference bridge (cd->conf) and saves the
slot number into &cd->call_slot.
static void on_stream_created(pjsua_call_id call_id,
pjmedia_stream *strm,
unsigned stream_idx,
pjmedia_port **p_port){
log_message("RUNNING...
on_stream_created\n");
struct
call_data *cd;
cd
= (struct call_data*) pjsua_call_get_user_data(call_id);
if
(!cd)
return;
pjmedia_conf_add_port(cd->conf,
cd->pool, *p_port, NULL, &cd->call_slot);
}
Elsewhere in call_media_init which is called when the
call state is 'CALLING', I'm running the following:
pjmedia_conf_connect_port(cd->conf, cd->call_slot,
cd->writer_slot, 0); //flow audio from call to writer
pjmedia_conf_connect_port(cd->conf,
cd->player_slot, cd->call_slot, 0); //flow wav reader
audio to call
... to connect the call_slot to the writer_slot and the
player_slot.
Do I need to make another connection? Perhaps to connect
the master port and/or the null port to one or more of
these? I'm afraid that I haven't been able to really get to
grips with these two ports, I don't really understand what
they are for. (I've just read that I need them when there's
no sound device in order to drive the get_frame and
put_frame callbacks - plus the FAQ uses them).
Thanks again for the help
Mike
.............................................................................................................................................................................
Also, I've just realised a potential
problem: on_stream_created is called AFTER the call state is
'CALLING' (which calls my call_media_init function)... so I
guess that call_media_init is trying to connect things to
call_slot BEFORE call_slot is set by pjmedia_conf_add_port
inside of on_stream_created. I couldn't really tell from the
FAQ exactly where I should put these functions - do you know
where I've gone wrong?
UPDATE: Nope. I've just tried changing it so that
call_media_init is called when the MEDIA state is 'ACTIVE'
instead of when the call state is CALLING, so that
call_media_init is called after on_stream_created (which
calls pjmedia_conf_add_port(cd->conf, cd->pool, *p_port,
NULL, &cd->call_slot)). However I get the same
silence.
Anyway, the cod has some print commands which show the
order things run in, in case that's helpful to you:
WARNING: no real random source present!
RUNNING... on_call_state
Call state is CALLING.
RUNNING... call_media_init
RUNNING... on_call_state
RUNNING... on_stream_created
RUNNING... on_call_media_state
Media state is ACTIVE.
RUNNING... on_call_state
RUNNING... on_call_state
RUNNING... on_call_state
Call state is CONFIRMED.
RUNNING... on_call_state
Call state is DISCONNECTED.
RUNNING... call_media_deinit
Called call_media_deinit.
RUNNING... on_stream_destroyed
^C
Thanks
Mike