Hello everyone :)
I'm currently working on a little project based on PJSUA. I'm using the
most recent (PJSIP 2.7.1) libraries.
According to Ticket #1926 (https://trac.pjsip.org/repos/ticket/1926) it
should resolve my IPv6-Domain correctly.
But it doesn't.
The client only works if i specify the IPv6-Adress, not the domain.
Here's the code for setting up the connection:
status = pjsua_create();
if (status != PJ_SUCCESS) error_exit("Error in pjsua_create()", status);
// configure pjsua
pjsua_config cfg;
pjsua_config_default(&cfg);
// enable just 1 simultaneous call
cfg.max_calls = 1;
//Media and callback stuff here, omitted to shorten the Email
// initialize pjsua
status = pjsua_init(&cfg, &log_cfg, &media_cfg);
if (status != PJ_SUCCESS) error_exit("Error in pjsua_init()", status);
pjsua_transport_config udpcfg;
pjsip_transport_type_e transport_type;
pjsua_transport_config_default(&udpcfg);
if(app_cfg.ipv6 != 1) { //if IPv4 used
transport_type = PJSIP_TRANSPORT_UDP;
}
else //If IPv6 used
{
transport_type = PJSIP_TRANSPORT_UDP6;
log_message("Enabling IPv6\n");
}
udpcfg.port = 5060;
status = pjsua_transport_create(transport_type, &udpcfg, &udp_tp_id);
if (status != PJ_SUCCESS) error_exit("Error creating transport", status);
// initialization is done, start pjsua
status = pjsua_start();
if (status != PJ_SUCCESS) error_exit("Error starting pjsua", status);
// disable sound - use null sound device
status = pjsua_set_null_snd_dev();
if (status != PJ_SUCCESS) error_exit("Error disabling audio", status);
log_message("Done.\n");
}
// helper for creating and registering sip-account
static void register_sip(void)
{
pj_status_t status;
log_message("Registering account ... ");
// prepare account configuration
pjsua_acc_config cfg;
pjsua_acc_config_default(&cfg);
// build sip-user-url
char sip_user_url[100];
sprintf(sip_user_url, "sip:%s@%s", app_cfg.sip_user, app_cfg.sip_domain);
// build sip-provider-url
char sip_provider_url[100];
sprintf(sip_provider_url, "sip:%s", app_cfg.sip_domain);
// create and define account
cfg.id = pj_str(sip_user_url);
cfg.reg_uri = pj_str(sip_provider_url);
cfg.cred_count = 1;
cfg.cred_info[0].realm = pj_str("*");
cfg.cred_info[0].scheme = pj_str("digest");
cfg.cred_info[0].username = pj_str(app_cfg.sip_user);
cfg.cred_info[0].data_type = PJSIP_CRED_DATA_PLAIN_PASSWD;
cfg.cred_info[0].data = pj_str(app_cfg.sip_password);
cfg.transport_id=udp_tp_id;
//enable IPv6
if(app_cfg.ipv6==1) {
log_message("Enabling IPv6\n");
cfg.ipv6_media_use = PJSUA_IPV6_ENABLED;
}
// add account
status = pjsua_acc_add(&cfg, PJ_TRUE, &acc_id);
if (status != PJ_SUCCESS) error_exit("Error adding account", status);
log_message("Done.\n");
}
Can you help me with this please? Where is my mistake?
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus