Skip to content

Commit

Permalink
Merge 4f7f05c into 17bc91a
Browse files Browse the repository at this point in the history
  • Loading branch information
kingster authored Nov 18, 2020
2 parents 17bc91a + 4f7f05c commit 1dcba7b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,4 @@ notifications:
- provider: GitHubPullRequest
on_build_success: true
on_build_failure: true
on_build_status_changed: true
on_build_status_changed: false
7 changes: 5 additions & 2 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"retryIntervalSec": 30,
"timeoutSec": 600,
"refreshIntervalSec" : 120,
"transport": 2,
"transport": 1,
"uaPrefix": "TinyPhone Pjsua2 v",
"prefferedAudioDevices" : [ "sound", "usb" , "headphone", "audio" , "microphone" , "speakers" ],
"useDefaultAudioDevice" : true,
Expand All @@ -30,5 +30,8 @@
"metricsServerPort" : 8125,
"autoDeviceRefresh" : true,
"autoAnswer" : true,
"persistAccounts" : true
"persistAccounts" : true,
"enableSTUN" : true,
"enableICE" : false,
"stunServers" : [ "stun.l.google.com:19302" ]
}
3 changes: 3 additions & 0 deletions tinyphone/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,9 @@ void InitPJSUAEndpoint(std::string logfile) {
ep_cfg.logConfig.decor |= PJ_LOG_HAS_CR | PJ_LOG_HAS_DAY_OF_MON | PJ_LOG_HAS_MONTH | PJ_LOG_HAS_YEAR ;
ep_cfg.uaConfig.userAgent = ApplicationConfig.ua();
ep_cfg.uaConfig.threadCnt = ApplicationConfig.pjThreadCount;
if (ApplicationConfig.enableSTUN) {
ep_cfg.uaConfig.stunServer = ApplicationConfig.stunServers;
}
ep_cfg.medConfig.threadCnt = ApplicationConfig.pjMediaThreadCount;
ep_cfg.medConfig.noVad = ApplicationConfig.disableVAD;
ep_cfg.medConfig.clockRate = ApplicationConfig.clockRate;
Expand Down
13 changes: 11 additions & 2 deletions tinyphone/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ namespace tp {
bool autoAnswer = true;
bool persistAccounts = true;

bool enableSTUN;
bool enableICE;
std::vector<std::string> stunServers;

std::string ua(){
std::string productVersion;
Expand Down Expand Up @@ -109,6 +112,9 @@ namespace tp {
{"autoDeviceRefresh", p.autoDeviceRefresh },
{"autoAnswer", p.autoAnswer },
{"persistAccounts", p.persistAccounts },
{"enableSTUN", p.enableSTUN },
{"enableICE", p.enableICE },
{"stunServers", p.stunServers },
};
}

Expand Down Expand Up @@ -145,7 +151,10 @@ namespace tp {
j.at("autoDeviceRefresh").get_to(p.autoDeviceRefresh);
FROM_JSON_OPTIONAL(autoAnswer);
FROM_JSON_OPTIONAL(persistAccounts);
}
FROM_JSON_OPTIONAL(enableSTUN);
FROM_JSON_OPTIONAL(enableICE);
FROM_JSON_OPTIONAL(stunServers);
}

extern appConfig ApplicationConfig;

Expand Down Expand Up @@ -178,4 +187,4 @@ namespace tp {
}


#endif
#endif
4 changes: 3 additions & 1 deletion tinyphone/phone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,8 @@ namespace tp {
acc_cfg.regConfig.registrarUri = ("sip:" + config.domain);

addTransportSuffix(acc_cfg.regConfig.registrarUri);
acc_cfg.sipConfig.authCreds.push_back(AuthCredInfo("digest", "*", config.username, 0, config.password));
AuthCredInfo authCred("digest", "*", config.username, PJSIP_CRED_DATA_PLAIN_PASSWD, config.password);
acc_cfg.sipConfig.authCreds.push_back(authCred);

if (config.proxy.size() > 0) {
acc_cfg.sipConfig.proxies = { config.proxy };
Expand All @@ -320,6 +321,7 @@ namespace tp {

acc_cfg.videoConfig.autoTransmitOutgoing = PJ_FALSE;
acc_cfg.videoConfig.autoShowIncoming = PJ_FALSE;
acc_cfg.natConfig.iceEnabled = ApplicationConfig.enableICE ? PJ_TRUE : PJ_FALSE;

SIPAccount *acc(new SIPAccount(this, account_name, eventStream, config));
acc->domain = config.domain;
Expand Down

0 comments on commit 1dcba7b

Please sign in to comment.