Hi all,
I'm newbie with Sofia-Sip and I'm trying to make a simple User Agent

I sent the INVITE request in this way:

nua_invite(handle,  SIPTAG_CONTENT_TYPE_STR("application/sdp"),
SOATAG_USER_SDP_STR("m=audio 48450 RTP/AVP 0\n"
"m=video 53630 RTP/AVP 31\n"), TAG_END());

Then I treat the offer with this function:

void process_soa_offer (nua_handle_t *nh, char const *msg) {
su_home_t home[1] = { SU_HOME_INIT(home) };
su_root_t *root; root = su_root_create (NULL);
sdp_parser_t *parser = sdp_parse(home, msg, strlen(msg), sdp_f_strict);
sdp_session_t *remote_sdp = sdp_session(parser);
soa_session_t *ss = soa_create("default", root, NULL);
soa_init_offer_answer(ss);
soa_set_params(ss, SOATAG_RTP_MISMATCH(0),
SOATAG_RTP_SELECT(SOA_RTP_SELECT_COMMON), TAG_END());
soa_set_remote_sdp(ss, remote_sdp, msg, strlen(msg));
const char *local_sdp_m_line = "m=audio 48950 RTP/AVP 0\n";
soa_set_user_sdp(ss, NULL, local_sdp_m_line, strlen(local_sdp_m_line));
soa_generate_answer(ss, NULL);
const char *local_sdp_msg;
const sdp_session_t *local_sdp; unsigned int len; soa_get_local_sdp(ss,
&local_sdp, &local_sdp_msg, &len);
soa_activate(ss, NULL);
nua_respond(nh, 200, "OK",SIPTAG_CONTENT_TYPE_STR("application/sdp"),
SOATAG_USER_SDP_STR(local_sdp_msg), TAG_NULL());
sdp_parser_free(parser); su_root_destroy (root); su_home_deinit(home);
}

My questions are :

1- am I making it in the right way ?
2- I can not process the answer using the soa_process_answer() because I can
not access the default soa_session:
a- How can I access the default soa_session since I have set the SDP offer
description in the INVITE request
b- I think if I can access the default soa_session I can write a function
that look like that: (assuming that ss represents the default session)

void process_soa_answer (soa_session_t *ss)
{
su_home_t home[1] = { SU_HOME_INIT(home) };
su_root_t *root; root = su_root_create (NULL);
sdp_parser_t *parser = sdp_parse(home, msg, strlen(msg), sdp_f_strict);
sdp_session_t *remote_sdp = sdp_session(parser);

soa_set_remote_sdp(ss, remote_sdp, msg, strlen(msg));
soa_process_answer(ss, NULL);
const char *local_sdp_msg;
const sdp_session_t *local_sdp; unsigned int len; soa_get_local_sdp(ss,
&local_sdp, &local_sdp_msg, &len);
soa_activate(ss);
/* activate the code responsable of media ..... */
}

Is it possible to do it ?

Best Regards
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to