Extending Simple PJSUA to use ICE w/TURN

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

 



Sorry, the first one was a mess. Here's an updated attempt:

First add the TURN-related variables:

#define TURN_SERVER "numb.viagenie.ca"
#define TURN_USER "user at domain.com"
#define TURN_PASSWD "secret"

Then update the init section with the media info:

    /* Init pjsua */
    {
	pjsua_config cfg;
	pjsua_logging_config log_cfg;
	pjsua_media_config media_cfg;

	pjsua_config_default(&cfg);
	cfg.cb.on_incoming_call = &on_incoming_call;
	cfg.cb.on_call_media_state = &on_call_media_state;
	cfg.cb.on_call_state = &on_call_state;

	pjsua_logging_config_default(&log_cfg);
	log_cfg.console_level = 4;
	
	pjsua_media_config_default(&media_cfg);
	media_cfg.enable_ice = PJ_TRUE;
	media_cfg.enable_turn = PJ_TRUE;
	media_cfg.turn_server = pj_str(pj_optarg);
	media_cfg.turn_conn_type = PJ_TURN_TP_TCP;

	media_cfg.turn_auth_cred.type = PJ_STUN_AUTH_CRED_STATIC;
	media_cfg.turn_auth_cred.data.static_cred.realm = pj_str("*");
	media_cfg.turn_auth_cred.data.static_cred.username = TURN_USER;

	media_cfg.turn_auth_cred.data.static_cred.data_type = PJ_STUN_PASSWD_PLAIN;
	media_cfg.turn_auth_cred.data.static_cred.data = TURN_PASSWD;

	status = pjsua_init(&cfg, &log_cfg, &media_cfg);
	if (status != PJ_SUCCESS) error_exit("Error in pjsua_init()", status);
    }

Does that look correct?
Are there other additions that need to be made?

cheers!


On Thu, Dec 15, 2011 at 7:06 PM, Michael Fortson <mfortson at gmail.com> wrote:
> Hi all,
>
> Starting with the current Simple PJSUA demo:
> http://www.pjsip.org/pjsip/docs/html/page__pjsip__sample__simple__pjsuaua__c.htm
>
> I'd like to get it to use ICE and a TURN server. It looks like we would need to:
> - define turn details:
>
> #define TURN_SERVER "numb.viagenie.ca"
> #define TURN_USER "user at domain.com"
> #define TURN_PASSWD "secret"
>
>
> - add the media configuration below the transport config:
> {
> pjsua_media_config media_cfg;
>
> pjsua_media_config_default(&cfg);
>
> media_cfg.enable_ice = PJ_TRUE;
>
> media_cfg.enable_turn = PJ_TRUE;
> media_cfg.turn_server = TURN_SERVER;
> media_cfg.turn_conn_type = PJ_TURN_TP_TCP;
>
> media_cfg.turn_auth_cred.type = PJ_STUN_AUTH_CRED_STATIC;
> media_cfg.turn_auth_cred.data.static_cred.realm = pj_str("*");
> media_cfg.turn_auth_cred.data.static_cred.username = TURN_USER;
>
> media_cfg.turn_auth_cred.data.static_cred.data_type = PJ_STUN_PASSWD_PLAIN;
> media_cfg.turn_auth_cred.data.static_cred.data = TURN_PASSWD;
> }
>
> - use the media config when calling pjsua_init
> status = pjsua_init(&cfg, &log_cfg, &media_cfg);
>
>
> Is that correct?
>
> thanks in advance!



[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