简体   繁体   中英

How to add support of IPv6 using pjsip with Domain in ios?

I make the VOIP app. Now added ipv6 in ios code but it's working with IP only.insted of IP we used domain then give us an error. Error:- "503(Bad gateway)."

Used below code for additional support of ipv6.

pj_status_t status;
pjsua_acc_config acc_cfg;
const char *uname;
const char *authname;
const char *contactname;
const char *passwd;
const char *server;
//const char *proxy;

NSLog(@"isIPv6 = %@", [[NSUserDefaults standardUserDefaults] objectForKey:@"isIPv6"]);

uname  = authname = contactname = [SharedAppDelegate.username UTF8String];//[@"4069567731" UTF8String];//
passwd = [SharedAppDelegate.password UTF8String];//[@"4069567731" UTF8String];//
server = (char*)[SharedAppDelegate.baseurl UTF8String];//[@"voiceforfriends.info" UTF8String];//

NSLog(@"Name is--->%s",uname);
NSLog(@"password is-->%s",passwd);
NSLog(@"server is--->%s",server);

NSLog(@"IPv6 flag = %@", [[NSUserDefaults standardUserDefaults] objectForKey:@"isIPv6"]);

if([[[NSUserDefaults standardUserDefaults] objectForKey:@"isIPv6"] isEqualToString:@"1"])
{
    server = [@"[2607:feb8::4:ce]:7777" UTF8String]; 
    
}
contactname = nil;

//pjsua_acc_config_default(&acc_cfg);
printf("1");
pjsua_acc_config_default(&acc_cfg);

So now I want to use Domain instead of Ip for ipv6.

So anyone has solution then please help me.

Thanks in advance.

You can handle this issue on Server side as well.

There are two changes you need to made on server side.

  1. Configuration level
  2. OS level

1. Configuration level
You need to open vars.xml file and paste following code inside that file.

<X-PRE-PROCESS cmd="set" data="domain=yourdomain.com”/>

2. OS level
You need to go to this path /etc/hosts/ and add this line.

127.0.0.1 localhost yourdomain.com

Note : Don't forget to replace my sample domain address with your original domain address.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM