Hello,
I want to implement a sip client that sends early media (unidirectional
video only), and once the call is established, sends video and audio but
receives audio only. The idea is to implement a doorbell with video.
It's mostly working, except for early media, and I haven't been able to
find any sample code for this.
I thought I was supposed to do it in the on_call_state() callback:
static void on_call_state(pjsua_call_id call_id, pjsip_event *e) {
pjsua_call_info ci;
pjsua_call_get_info(call_id, &ci);
if (ci.state == PJSIP_INV_STATE_EARLY) {
pjsua_call_vid_strm_op_param param;
pjsua_call_vid_strm_op_param_default(¶m);
param.dir = PJMEDIA_DIR_ENCODING; /* send video only /
param.cap_dev = video_device_id; / video_device_id set
somewhere else */
pjsua_conf_connect(ci.conf_slot, pjsua_call_get_conf_port(call_id));
unsigned i;
for (i = 0; i < ci.media_cnt; i++) {
if (ci.media[i].type == PJMEDIA_TYPE_VIDEO) {
pj_status_t status;
param.med_idx = i;
pjsua_call_set_vid_strm(call_id,
PJSUA_CALL_VID_STRM_START_TRANSMIT, ¶m);
}
}
}
}
But when ci.state == PJSIP_INV_STATE_EARLY, ci.media_cnt == 0.
Any ideas or examples?