- Timestamp:
- Oct 23, 2013 5:34:48 AM (11 years ago)
- Location:
- pjproject/branches/projects/pjsua2
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/pjsua2/build.mak.in
r3999 r4631 123 123 $(PJ_VIDEO_LDFLAGS) \ 124 124 @LDFLAGS@ 125 export APP_LDLIBS := -lpjsua-$(TARGET_NAME)\ 125 # x x x x x x x x x x x x x x x x x x x x x x x x 126 # 127 # FIX THIS 128 # 129 # pjsua2 is c++ library hence maybe needs to be put in separate 130 # variables. it will also require -lstdc++ 131 # x x x x x x x x x x x x x x x x x x x x x x x x 132 export APP_LDLIBS := \ 133 -lpjsua2-$(TARGET_NAME)\ 134 -lpjsua-$(TARGET_NAME)\ 126 135 -lpjsip-ua-$(TARGET_NAME)\ 127 136 -lpjsip-simple-$(TARGET_NAME)\ … … 137 146 -lpj-$(TARGET_NAME)\ 138 147 @LIBS@ 139 export APP_LIB_FILES = $(PJ_DIR)/pjsip/lib/libpjsua-$(LIB_SUFFIX) \ 148 # x x x x x x x x x x x x x x x x x x x x x x x x 149 # 150 # FIX THIS 151 # 152 # pjsua2 is c++ library hence maybe needs to be put in separate 153 # variables. it will also require -lstdc++ 154 # x x x x x x x x x x x x x x x x x x x x x x x x 155 export APP_LIB_FILES = \ 156 $(PJ_DIR)/pjsip/lib/libpjsua2-$(LIB_SUFFIX) \ 157 $(PJ_DIR)/pjsip/lib/libpjsua-$(LIB_SUFFIX) \ 140 158 $(PJ_DIR)/pjsip/lib/libpjsip-ua-$(LIB_SUFFIX) \ 141 159 $(PJ_DIR)/pjsip/lib/libpjsip-simple-$(LIB_SUFFIX) \ -
pjproject/branches/projects/pjsua2/pjsip-apps/build/Makefile
r4597 r4631 57 57 # 58 58 # 59 60 # x x x x x x x x x x x x x x x x x x x x x x x x 61 # 62 # FIX THIS 63 # 64 # x x x x x x x x x x x x x x x x x x x x x x x x 59 65 #TARGETS := swig pjsua pjsystest samples 60 TARGETS := swig 66 TARGETS := swig samples 61 67 62 68 .PHONY: $(TARGETS) -
pjproject/branches/projects/pjsua2/pjsip-apps/build/Samples.mak
r4440 r4631 29 29 pjsip-perf \ 30 30 pcaputil \ 31 pjsua2_demo \ 31 32 playfile \ 32 33 playsine \ … … 46 47 vid_streamutil 47 48 49 # x x x x x x x x x x x x x x x x x x x x x x x x 50 # 51 # FIX THIS 52 # 53 # Only pjsua2_demo is built, and also -lstdc++ is added for all 54 # samples 55 # x x x x x x x x x x x x x x x x x x x x x x x x 56 SAMPLES := pjsua2_demo 57 48 58 EXES := $(foreach file, $(SAMPLES), $(BINDIR)/$(file)$(HOST_EXE)) 49 59 50 60 all: $(BINDIR) $(OBJDIR) $(EXES) 51 61 52 $(BINDIR)/%$(HOST_EXE): $(OBJDIR)/%$(OBJEXT) $(PJ_LIB_FILES) 62 $(BINDIR)/%$(HOST_EXE): $(OBJDIR)/%$(OBJEXT) $(PJ_LIB_FILES) 53 63 $(LD) $(LDOUT)$(subst /,$(HOST_PSEP),$@) \ 54 64 $(subst /,$(HOST_PSEP),$<) \ 55 $(_LDFLAGS)65 $(_LDFLAGS) -lstdc++ 56 66 57 67 $(OBJDIR)/%$(OBJEXT): $(SRCDIR)/%.c 68 $(CC) $(_CFLAGS) \ 69 $(CC_OUT)$(subst /,$(HOST_PSEP),$@) \ 70 $(subst /,$(HOST_PSEP),$<) 71 72 $(OBJDIR)/%$(OBJEXT): $(SRCDIR)/%.cpp 58 73 $(CC) $(_CFLAGS) \ 59 74 $(CC_OUT)$(subst /,$(HOST_PSEP),$@) \ -
pjproject/branches/projects/pjsua2/pjsip/include/pjsua2/account.hpp
r4608 r4631 799 799 }; 800 800 801 801 802 /** 802 803 * Account information. Application can query the account information … … 824 825 * (reg_uri is not empty). 825 826 */ 826 bool hasRegistration;827 bool regIsConfigured; 827 828 828 829 /** … … 830 831 * (has active registration session). 831 832 */ 832 bool isRegistered;833 bool regIsActive; 833 834 834 835 /** 835 836 * An up to date expiration interval for account registration session. 836 837 */ 837 int expiresSec;838 int regExpiresSec; 838 839 839 840 /** … … 842 843 * status code of the registration. 843 844 */ 844 pjsip_status_code status;845 pjsip_status_code regStatus; 845 846 846 847 /** 847 848 * String describing the registration status. 848 849 */ 849 string statusText;850 string regStatusText; 850 851 851 852 /** … … 867 868 string onlineStatusText; 868 869 870 public: 871 void fromPj(const pjsua_acc_info &pai); 869 872 }; 870 873 … … 909 912 * SIP status code received. 910 913 */ 911 intcode;914 pjsip_status_code code; 912 915 913 916 /** … … 1090 1093 /** Virtual destructor */ 1091 1094 virtual ~AccountCallback() {} 1095 1096 /** 1097 * Get the account associated with this callback. 1098 */ 1099 Account *account() 1100 { return acc; } 1092 1101 1093 1102 /** … … 1191 1200 virtual void onMwiInfo(OnMwiInfoParam &prm) 1192 1201 {} 1202 1203 protected: 1204 AccountCallback() 1205 : acc(NULL) 1206 {} 1207 1208 private: 1209 Account *acc; 1210 1211 /** Set the account. Must only be called by Account class */ 1212 void setAccount(Account *the_acc) 1213 { acc = the_acc; } 1214 1215 friend class Account; 1193 1216 }; 1194 1217 … … 1210 1233 { 1211 1234 public: 1235 /** 1236 * Constructor. 1237 */ 1238 Account(AccountCallback *cb, Token user_data); 1239 1240 /** 1241 * Destructor. 1242 */ 1243 ~Account(); 1244 1245 /** 1246 * Create the account. 1247 * 1248 * @param cfg The account config. 1249 * @param make_default Make this the default account. 1250 */ 1251 void create(const AccountConfig &cfg, 1252 bool make_default=false) throw(Error); 1253 1254 /** 1255 * Modify the account to use the specified account configuration. 1256 * Depending on the changes, this may cause unregistration or 1257 * reregistration on the account. 1258 * 1259 * @param cfg New account config to be applied to the account. 1260 */ 1261 void modify(const AccountConfig &acc) throw(Error); 1262 1212 1263 /** 1213 1264 * Check if this account is still valid. … … 1260 1311 * @return Account info. 1261 1312 */ 1262 AccountInfo getInfo() const; 1263 1264 /** 1265 * Modify the account to use the specified account configuration. 1266 * Depending on the changes, this may cause unregistration or 1267 * reregistration on the account. 1268 * 1269 * @param cfg New account config to be applied to the account. 1270 */ 1271 void modify(const AccountConfig &acc) throw(Error); 1313 AccountInfo getInfo() const throw(Error); 1272 1314 1273 1315 /** … … 1311 1353 friend class Endpoint; 1312 1354 1313 Account(); 1355 private: 1356 pjsua_acc_id id; 1357 AccountCallback *cb; 1358 Token userData; 1314 1359 }; 1315 1360 -
pjproject/branches/projects/pjsua2/pjsip/include/pjsua2/types.hpp
r4608 r4631 70 70 typedef void *TransportHandle; 71 71 72 /* 73 * Forward declaration of Account, AccountCallback, AccountConfig, to be used 74 * by Endpoint. 75 */ 76 class Account; 77 class AccountCallback; 78 class AccountConfig; 79 72 80 73 81 /** … … 105 113 /** The line number of PJSUA source file that throws the error */ 106 114 int srcLine; 115 116 /** Build error string. */ 117 string info(bool multi_line=false) const; 107 118 108 119 /** Default constructor */ … … 156 167 PJSUA2_CHECK_RAISE_ERROR2(status, "") 157 168 169 #define PJSUA2_CHECK_EXPR(expr) \ 170 do { \ 171 pj_status_t the_status = expr; \ 172 PJSUA2_CHECK_RAISE_ERROR2(the_status, #expr); \ 173 } while (0) 158 174 159 175 ////////////////////////////////////////////////////////////////////////////// … … 166 182 { 167 183 /** 184 * The authentication scheme (e.g. "digest"). 185 */ 186 string scheme; 187 188 /** 168 189 * Realm on which this credential is to be used. Use "*" to make 169 190 * a credential that can be used to authenticate against any challenges. 170 191 */ 171 192 string realm; 172 173 /**174 * The authentication scheme (e.g. "digest").175 */176 string scheme;177 193 178 194 /** … … 208 224 string akaAmf; 209 225 226 /** Default constructor */ 227 AuthCredInfo(); 228 229 /** Construct a credential with the specified parameters */ 230 AuthCredInfo(const string &scheme, 231 const string &realm, 232 const string &user_name, 233 const int data_type, 234 const string data); 210 235 }; 211 236 -
pjproject/branches/projects/pjsua2/pjsip/src/pjsua2/account.cpp
r4608 r4631 18 18 */ 19 19 #include <pjsua2/account.hpp> 20 #include <pjsua2/endpoint.hpp> 20 21 #include <pj/ctype.h> 21 22 #include "util.hpp" … … 330 331 } 331 332 332 333 /////////////////////////////////////////////////////////////////////////////// 334 335 void AccountInfo::fromPj(const pjsua_acc_info &pai) 336 { 337 id = pai.id; 338 isDefault = pai.is_default != 0; 339 uri = pj2Str(pai.acc_uri); 340 regIsConfigured = pai.has_registration != 0; 341 regIsActive = pai.has_registration && pai.expires > 0 && 342 (pai.status / 100 == 2); 343 regExpiresSec = pai.expires; 344 regStatus = pai.status; 345 regStatusText = pj2Str(pai.status_text); 346 regLastErr = pai.reg_last_err; 347 onlineStatus = pai.online_status != 0; 348 onlineStatusText = pj2Str(pai.online_status_text); 349 } 350 351 /////////////////////////////////////////////////////////////////////////////// 352 353 Account::Account(AccountCallback *param_cb, Token user_data) 354 : id(PJSUA_INVALID_ID), cb(param_cb), userData(user_data) 355 { 356 cb->setAccount(this); 357 } 358 359 Account::~Account() 360 { 361 delete cb; 362 } 363 364 void Account::create(const AccountConfig &acc_cfg, 365 bool make_default) throw(Error) 366 { 367 pjsua_acc_config pj_acc_cfg = acc_cfg.toPj(); 368 369 PJSUA2_CHECK_EXPR( pjsua_acc_add(&pj_acc_cfg, make_default, &id) ); 370 } 371 372 void Account::modify(const AccountConfig &acc_cfg) throw(Error) 373 { 374 pjsua_acc_config pj_acc_cfg = acc_cfg.toPj(); 375 376 PJSUA2_CHECK_EXPR( pjsua_acc_modify(id, &pj_acc_cfg) ); 377 } 378 379 bool Account::isValid() const 380 { 381 return pjsua_acc_is_valid(id) != 0; 382 } 383 384 void Account::setDefault() throw(Error) 385 { 386 PJSUA2_CHECK_EXPR( pjsua_acc_set_default(id) ); 387 } 388 389 bool Account::isDefault() const 390 { 391 return pjsua_acc_get_default() == id; 392 } 393 394 int Account::getIndex() const 395 { 396 return id; 397 } 398 399 void Account::setUserData(Token user_data) 400 { 401 userData = user_data; 402 } 403 404 Token Account::getUserData() const 405 { 406 return userData; 407 } 408 409 AccountInfo Account::getInfo() const throw(Error) 410 { 411 pjsua_acc_info pj_ai; 412 AccountInfo ai; 413 414 PJSUA2_CHECK_EXPR( pjsua_acc_get_info(id, &pj_ai) ); 415 ai.fromPj(pj_ai); 416 return ai; 417 } 418 419 void Account::setRegistration(bool renew) throw(Error) 420 { 421 PJSUA2_CHECK_EXPR( pjsua_acc_set_registration(id, renew) ); 422 } 423 424 void 425 Account::setOnlineStatus(const AccountPresenceStatus &pres_st) throw(Error) 426 { 427 pjrpid_element pj_rpid; 428 429 pj_bzero(&pj_rpid, sizeof(pj_rpid)); 430 pj_rpid.type = PJRPID_ELEMENT_TYPE_PERSON; 431 pj_rpid.activity = pres_st.activity; 432 pj_rpid.id = str2Pj(pres_st.rpidId); 433 pj_rpid.note = str2Pj(pres_st.note); 434 435 PJSUA2_CHECK_EXPR( pjsua_acc_set_online_status2(id, pres_st.isOnline, 436 &pj_rpid) ); 437 } 438 439 void Account::setTransport(TransportId tp_id) throw(Error) 440 { 441 PJSUA2_CHECK_EXPR( pjsua_acc_set_transport(id, tp_id) ); 442 } 443 -
pjproject/branches/projects/pjsua2/pjsip/src/pjsua2/endpoint.cpp
r4608 r4631 384 384 } 385 385 386 387 386 /////////////////////////////////////////////////////////////////////////////// 388 387 /* … … 589 588 } 590 589 590 /////////////////////////////////////////////////////////////////////////////// 591 -
pjproject/branches/projects/pjsua2/pjsip/src/pjsua2/types.cpp
r4608 r4631 45 45 } 46 46 47 string Error::info(bool multi_line) const 48 { 49 string output; 50 51 if (status==PJ_SUCCESS) { 52 output = "No error"; 53 } else if (!multi_line) { 54 char temp[80]; 55 56 if (!title.empty()) { 57 output += title + " error: "; 58 } 59 snprintf(temp, sizeof(temp), " (status=%d)", status); 60 output += reason + temp; 61 if (!srcFile.empty()) { 62 output += " ["; 63 output += srcFile; 64 snprintf(temp, sizeof(temp), ":%d]", srcLine); 65 output += temp; 66 } 67 } else { 68 char temp[80]; 69 70 if (!title.empty()) { 71 output += string("Title: ") + title + "\n"; 72 } 73 74 snprintf(temp, sizeof(temp), "%d\n", status); 75 output += string("Code: ") + temp; 76 output += string("Description: ") + reason + "\n"; 77 if (!srcFile.empty()) { 78 snprintf(temp, sizeof(temp), ":%d\n", srcLine); 79 output += string("Location: ") + srcFile + temp; 80 } 81 } 82 83 return output; 84 } 85 86 /////////////////////////////////////////////////////////////////////////////// 87 88 AuthCredInfo::AuthCredInfo() 89 : dataType(0) 90 { 91 } 92 93 AuthCredInfo::AuthCredInfo(const string ¶m_scheme, 94 const string ¶m_realm, 95 const string ¶m_user_name, 96 const int param_data_type, 97 const string param_data) 98 : scheme(param_scheme), realm(param_realm), username(param_user_name), 99 dataType(param_data_type), data(param_data) 100 { 101 } 102 47 103 48 104 ///////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.