Skip to content
Snippets Groups Projects
Commit 8a9b264d authored by Yun Liu's avatar Yun Liu
Browse files

Modify return value( change PJ_SUCCESS to boolean )

parent 3b814e02
Branches
Tags
No related merge requests found
...@@ -358,7 +358,7 @@ void UserAgent::busy_sleep(unsigned msec) ...@@ -358,7 +358,7 @@ void UserAgent::busy_sleep(unsigned msec)
#endif #endif
} }
int UserAgent::addAccount(AccountID id, pjsip_regc **regc2, const std::string& server, const std::string& user, const std::string& passwd, bool UserAgent::addAccount(AccountID id, pjsip_regc **regc2, const std::string& server, const std::string& user, const std::string& passwd,
const int& timeout UNUSED) { const int& timeout UNUSED) {
pj_status_t status; pj_status_t status;
AccountID *currentId = new AccountID(id); AccountID *currentId = new AccountID(id);
...@@ -376,7 +376,7 @@ int UserAgent::addAccount(AccountID id, pjsip_regc **regc2, const std::string& s ...@@ -376,7 +376,7 @@ int UserAgent::addAccount(AccountID id, pjsip_regc **regc2, const std::string& s
status = pjsip_regc_create(_endpt, (void *) currentId, &regc_cb, &regc); status = pjsip_regc_create(_endpt, (void *) currentId, &regc_cb, &regc);
if (status != PJ_SUCCESS) { if (status != PJ_SUCCESS) {
_debug("UserAgent: Unable to create regc.\n"); _debug("UserAgent: Unable to create regc.\n");
return status; return false;
} }
tmp = "sip:" + server; tmp = "sip:" + server;
...@@ -394,7 +394,7 @@ int UserAgent::addAccount(AccountID id, pjsip_regc **regc2, const std::string& s ...@@ -394,7 +394,7 @@ int UserAgent::addAccount(AccountID id, pjsip_regc **regc2, const std::string& s
status = pjsip_regc_init(regc, &svr, &aor, &aor, 1, &contact, 600); //timeout); status = pjsip_regc_init(regc, &svr, &aor, &aor, 1, &contact, 600); //timeout);
if (status != PJ_SUCCESS) { if (status != PJ_SUCCESS) {
_debug("UserAgent: Unable to initialize regc. %d\n", status); //, regc->str_srv_url.ptr); _debug("UserAgent: Unable to initialize regc. %d\n", status); //, regc->str_srv_url.ptr);
return status; return false;
} }
...@@ -418,13 +418,13 @@ int UserAgent::addAccount(AccountID id, pjsip_regc **regc2, const std::string& s ...@@ -418,13 +418,13 @@ int UserAgent::addAccount(AccountID id, pjsip_regc **regc2, const std::string& s
status = pjsip_regc_register(regc, PJ_TRUE, &tdata); status = pjsip_regc_register(regc, PJ_TRUE, &tdata);
if (status != PJ_SUCCESS) { if (status != PJ_SUCCESS) {
_debug("UserAgent: Unable to register regc.\n"); _debug("UserAgent: Unable to register regc.\n");
return status; return false;
} }
status = pjsip_regc_send(regc, tdata); status = pjsip_regc_send(regc, tdata);
if (status != PJ_SUCCESS) { if (status != PJ_SUCCESS) {
_debug("UserAgent: Unable to send regc request.\n"); _debug("UserAgent: Unable to send regc request.\n");
return status; return false;
} }
account->setUserName(user); account->setUserName(user);
...@@ -436,7 +436,7 @@ int UserAgent::addAccount(AccountID id, pjsip_regc **regc2, const std::string& s ...@@ -436,7 +436,7 @@ int UserAgent::addAccount(AccountID id, pjsip_regc **regc2, const std::string& s
pj_mutex_unlock(_mutex); pj_mutex_unlock(_mutex);
return PJ_SUCCESS; return true;
} }
bool UserAgent::removeAccount(pjsip_regc *regc) bool UserAgent::removeAccount(pjsip_regc *regc)
...@@ -893,7 +893,7 @@ bool UserAgent::makeOutgoingCall(const std::string& strTo, SIPCall* call, const ...@@ -893,7 +893,7 @@ bool UserAgent::makeOutgoingCall(const std::string& strTo, SIPCall* call, const
&to, &to,
NULL, NULL,
&dialog); &dialog);
PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1); PJ_ASSERT_RETURN(status == PJ_SUCCESS, false);
setCallAudioLocal(call); setCallAudioLocal(call);
call->setIp(getInstance()->getLocalIP()); call->setIp(getInstance()->getLocalIP());
...@@ -904,7 +904,7 @@ bool UserAgent::makeOutgoingCall(const std::string& strTo, SIPCall* call, const ...@@ -904,7 +904,7 @@ bool UserAgent::makeOutgoingCall(const std::string& strTo, SIPCall* call, const
// Create the invite session for this call // Create the invite session for this call
pjsip_inv_session *inv; pjsip_inv_session *inv;
status = pjsip_inv_create_uac(dialog, call->getLocalSDPSession(), 0, &inv); status = pjsip_inv_create_uac(dialog, call->getLocalSDPSession(), 0, &inv);
PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1); PJ_ASSERT_RETURN(status == PJ_SUCCESS, false);
// Set auth information // Set auth information
pjsip_auth_clt_set_credentials(&dialog->auth_sess, 1, account->getCredInfo()); pjsip_auth_clt_set_credentials(&dialog->auth_sess, 1, account->getCredInfo());
...@@ -913,7 +913,7 @@ bool UserAgent::makeOutgoingCall(const std::string& strTo, SIPCall* call, const ...@@ -913,7 +913,7 @@ bool UserAgent::makeOutgoingCall(const std::string& strTo, SIPCall* call, const
inv->mod_data[_mod.id] = call; inv->mod_data[_mod.id] = call;
status = pjsip_inv_invite(inv, &tdata); status = pjsip_inv_invite(inv, &tdata);
PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1); PJ_ASSERT_RETURN(status == PJ_SUCCESS, false);
// Associate current invite session in the call // Associate current invite session in the call
call->setInvSession(inv); call->setInvSession(inv);
......
...@@ -102,7 +102,7 @@ public: ...@@ -102,7 +102,7 @@ public:
pj_str_t getStunServer() { return _stunHost; } pj_str_t getStunServer() { return _stunHost; }
int addAccount(AccountID id, pjsip_regc **regc, const std::string& server, const std::string& user, const std::string& passwd bool addAccount(AccountID id, pjsip_regc **regc, const std::string& server, const std::string& user, const std::string& passwd
, const int& timeout); , const int& timeout);
bool removeAccount(pjsip_regc *regc); bool removeAccount(pjsip_regc *regc);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment