- Timestamp:
- Nov 1, 2013 7:11:48 AM (11 years ago)
- Location:
- pjproject/branches/projects/pjsua2
- Files:
-
- 3 added
- 3 deleted
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/pjsua2/build.mak.in
r4638 r4639 130 130 # variables. it will also require -lstdc++ 131 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 := \ 132 export APP_LDLIBS := \ 133 133 -lpjsua2-$(TARGET_NAME)\ 134 134 -lpjsua-$(TARGET_NAME)\ … … 154 154 # variables. it will also require -lstdc++ 155 155 # x x x x x x x x x x x x x x x x x x x x x x x x 156 export APP_LIB_FILES = \ 156 export APP_LIB_FILES = \ 157 157 $(PJ_DIR)/pjsip/lib/libpjsua2-$(LIB_SUFFIX) \ 158 158 $(PJ_DIR)/pjsip/lib/libpjsua-$(LIB_SUFFIX) \ -
pjproject/branches/projects/pjsua2/pjlib/include/pj/types.h
r4537 r4639 87 87 #endif 88 88 89 90 /** Status is OK. */ 91 #define PJ_SUCCESS 0 92 93 /** True value. */ 94 #define PJ_TRUE 1 95 96 /** False value. */ 97 #define PJ_FALSE 0 89 /** Some constants */ 90 enum pj_constants_ 91 { 92 /** Status is OK. */ 93 PJ_SUCCESS=0, 94 95 /** True value. */ 96 PJ_TRUE=1, 97 98 /** False value. */ 99 PJ_FALSE=0 100 }; 98 101 99 102 /** -
pjproject/branches/projects/pjsua2/pjmedia/include/pjmedia-videodev/videodev.h
r4167 r4639 132 132 * Device index constants. 133 133 */ 134 enum 134 enum pjmedia_vid_dev_std_index 135 135 { 136 136 /** -
pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/Makefile
r4597 r4639 9 9 export SRCS=$(SRC_DIR)/pjsua2/endpoint.hpp $(SRC_DIR)/pjsua2/types.hpp 10 10 11 all clean dep depend distclean print realclean: 11 .PHONY: all clean dep depend distclean print realclean install uninstall 12 13 all: symbols.i 14 15 all clean dep depend distclean print realclean install uninstall: 12 16 for dir in $(DIRS); do \ 13 17 if $(MAKE) $(MAKE_FLAGS) -C $$dir $@; then \ … … 17 21 fi; \ 18 22 done 23 24 symbols.i: symbols.lst 25 python importsym.py -
pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/java/Makefile
r4638 r4639 43 43 MY_LDFLAGS = $(PJ_LDFLAGS) -lpjsua2-$(TARGET_NAME) $(PJ_LDLIBS) $(MY_JNI_LDFLAGS) -static-libstdc++ 44 44 45 .PHONY: all java 45 .PHONY: all java install uninstall 46 46 47 47 all: $(LIBPJSUA2_SO) java … … 53 53 g++ -c $(OUT_DIR)/pjsua2_wrap.cpp -o $(OUT_DIR)/pjsua2_wrap.o $(MY_CFLAGS) $(MY_LDFLAGS) 54 54 55 $(OUT_DIR)/pjsua2_wrap.cpp: ../pjsua2.i $(SRCS)55 $(OUT_DIR)/pjsua2_wrap.cpp: ../pjsua2.i ../symbols.i $(SRCS) 56 56 swig $(SWIG_FLAGS) -java -o $(OUT_DIR)/pjsua2_wrap.cpp ../pjsua2.i 57 57 … … 71 71 @# CLASSPATH and java.library.path env settings 72 72 $(MY_JAVA) -cp $(OUT_DIR) -Djava.library.path="$(OUT_DIR)" test 73 74 install: 75 uninstall: 76 -
pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/pjsua2.i
r4638 r4639 15 15 %} 16 16 17 #ifdef SWIGPYTHON 18 %feature("director:except") { 19 if( $error != NULL ) { 20 PyObject *ptype, *pvalue, *ptraceback; 21 PyErr_Fetch( &ptype, &pvalue, &ptraceback ); 22 PyErr_Restore( ptype, pvalue, ptraceback ); 23 PyErr_Print(); 24 //Py_Exit(1); 25 } 26 } 27 #endif 28 29 // Constants from PJSIP libraries 30 %include "symbols.i" 31 32 33 // 34 // Classes that can be extended in the target language 35 // 36 %feature("director") LogWriter; 37 %feature("director") Endpoint; 38 %feature("director") Account; 39 40 17 41 // 18 42 // STL stuff. … … 21 45 %include "std_vector.i" 22 46 23 namespace std 24 { 25 %template(StringVector) std::vector<std::string>; 26 %template(IntVector) std::vector<int>; 27 %template(AuthCredInfoVector) std::vector<AuthCredInfo>; 28 %template(SipMultipartPartVector) std::vector<SipMultipartPart>; 29 %template(SipHeaderVector) std::vector<SipHeader>; 30 } 47 48 %template(StringVector) std::vector<std::string>; 49 %template(IntVector) std::vector<int>; 31 50 32 51 // 33 // Classes that can be extended in the target language 34 // 35 %feature("director") LogWriter; 36 %feature("director") EpCallback; 37 38 // 39 // And include supporting constants etc. Here we don't want to export 40 // the whole file, so we start with ignoring everything and then enable 41 // selected symbols 42 // 43 #define PJ_BEGIN_DECL 44 #define PJ_END_DECL 45 #define PJ_DECL(type) type 46 #define PJ_INLINE(type) type 47 #define PJ_DECL_DATA(type) extern type 48 49 // 50 // Start with ignoring everything 51 // 52 %ignore ""; 53 54 // Process the files. Keep them sorted. 55 56 // 57 // 58 %rename("%s") pj_file_access; // Unignore this 59 %rename("%s", regexmatch$name="PJ_O_.*") ""; // Unignore this 60 %include "pj/file_io.h" 61 62 // 63 // 64 %rename("%s") pj_log_decoration; // Unignore this 65 %rename("%s", regexmatch$name="PJ_LOG_HAS_.*") ""; // Unignore this 66 %include "pj/log.h" 67 68 // 69 // 70 %rename("%s") pj_qos_type; // Unignore this 71 %rename("%s", regexmatch$name="PJ_QOS_TYPE_.*") ""; // Unignore this 72 %rename("%s") pj_qos_flag; // Unignore this 73 %rename("%s", regexmatch$name="PJ_QOS_PARAM_HAS_.*") "";// Unignore this 74 %rename("%s") pj_qos_wmm_prio; // Unignore this 75 %rename("%s", regexmatch$name="PJ_QOS_WMM_PRIO_.*") ""; // Unignore this 76 // TODO: 77 // Wish there is a better way to unignore a struct than 78 // listing the fields one by one like below. Using regex 79 // doesn't seem to work? 80 %rename("%s") pj_qos_params; // Unignore this 81 %rename("%s") pj_qos_params::flags; // Unignore this 82 %rename("%s") pj_qos_params::dscp_val; // Unignore this 83 %rename("%s") pj_qos_params::so_prio; // Unignore this 84 %rename("%s") pj_qos_params::wmm_prio; // Unignore this 85 %include "pj/sock_qos.h" 86 87 // 88 // 89 %rename("%s") pj_ssl_cipher; // Unignore this 90 %rename("%s", regexmatch$name="PJ_O_.*") ""; // Unignore this 91 %include "pj/ssl_sock.h" 92 93 // 94 // 95 %rename("%s") pj_status_t; // Unignore this 96 %rename("%s") PJ_SUCCESS; // Unignore this 97 %include "pj/types.h" 98 99 // 100 // 101 %rename("%s") pj_stun_nat_type; // Unignore this 102 %rename("%s", regexmatch$name="PJ_STUN_NAT_TYPE_.*") "";// Unignore this 103 %include "pjnath/nat_detect.h" 104 105 // 106 // 107 %rename("%s") pj_turn_tp_type; // Unignore this 108 %rename("%s", regexmatch$name="PJ_TURN_TP_.*") ""; // Unignore this 109 %include "pjnath/turn_session.h" 110 111 // 112 // 113 %rename("%s") pjmedia_vid_stream_rc_method; // Unignore this 114 %rename("%s", regexmatch$name="PJMEDIA_VID_STREAM_RC_.*") "";// Unignore this 115 %include "pjmedia/vid_stream.h" 116 117 // 118 // 119 %rename("%s") pjmedia_srtp_use; // Unignore this 120 %rename("%s", regexmatch$name="PJMEDIA_SRTP_.*") ""; // Unignore this 121 %include "pjmedia/transport_srtp.h" 122 123 // 124 // 125 %rename("%s") pjmedia_vid_dev_index; // Unignore this 126 %rename("%s") PJMEDIA_VID_DEFAULT_CAPTURE_DEV; // Unignore this 127 %rename("%s") PJMEDIA_VID_DEFAULT_RENDER_DEV; // Unignore this 128 %rename("%s") PJMEDIA_VID_INVALID_DEV; // Unignore this 129 %include "pjmedia-videodev/videodev.h" 130 131 // 132 // 133 %rename("%s") pjsip_cred_data_type; // Unignore this 134 %rename("%s", regexmatch$name="PJSIP_CRED_DATA_.*") ""; // Unignore this 135 %include "pjsip/sip_auth.h" 136 137 // 138 // 139 %rename("%s") pjsip_status_code; // Unignore this 140 %rename("%s", regexmatch$name="PJSIP_SC_.*") ""; // Unignore this 141 %include "pjsip/sip_msg.h" 142 143 // 144 // 145 %rename("%s") pjsip_transport_type_e; // Unignore this 146 %rename("%s") pjsip_transport_flags_e; // Unignore this 147 %rename("%s") pjsip_transport_state; // Unignore this 148 %rename("%s", regexmatch$name="PJSIP_TRANSPORT_.*") ""; // Unignore this 149 %rename("%s", regexmatch$name="PJSIP_TP_STATE_.*") ""; // Unignore this 150 %include "pjsip/sip_transport.h" 151 152 // 153 // 154 %rename("%s") pjsip_ssl_method; // Unignore this 155 %rename("%s", regexmatch$name="PJSIP_TLS.*_METHOD") ""; // Unignore this 156 %rename("%s", regexmatch$name="PJSIP_SSL.*_METHOD") ""; // Unignore this 157 %include "pjsip/sip_transport_tls.h" 158 159 // 160 // 161 %rename("%s") PJSUA_INVALID_ID; // Unignore this 162 %rename("%s") pjsua_state; // Unignore this 163 %rename("%s", regexmatch$name="PJSUA_STATE_.*") ""; // Unignore this 164 %rename("%s") pjsua_stun_use; // Unignore this 165 %rename("%s", regexmatch$name="PJSUA_STUN_USE_.*") ""; // Unignore this 166 %rename("%s") pjsua_call_hold_type; // Unignore this 167 %rename("%s", regexmatch$name="PJSUA_CALL_HOLD_TYPE_.*") "";// Unignore this 168 %rename("%s") pjsua_acc_id; // Unignore this 169 %rename("%s") pjsua_destroy_flag; // Unignore this 170 %rename("%s", regexmatch$name="PJSUA_DESTROY_.*") ""; // Unignore this 171 %include "pjsua-lib/pjsua.h" 172 173 // 174 // Back to unignore everything 175 // 176 %rename("%s") ""; 177 178 // 179 // Ignore stuffs in pjsua2 itself 52 // Ignore stuffs in pjsua2 180 53 // 181 54 %ignore fromPj; … … 186 59 // 187 60 %include "pjsua2/types.hpp" 61 %template(SipHeaderVector) std::vector<pj::SipHeader>; 62 %template(AuthCredInfoVector) std::vector<pj::AuthCredInfo>; 63 %template(SipMultipartPartVector) std::vector<pj::SipMultipartPart>; 64 188 65 %include "pjsua2/endpoint.hpp" 189 #include "pjsua2/account.hpp"66 %include "pjsua2/account.hpp" 190 67 -
pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/python/Makefile
r4619 r4639 1 1 PYTHON_SO=_pjsua2.so 2 2 3 PYTHON_SETUP_FLAGS = --inplace3 #PYTHON_SETUP_FLAGS = --inplace 4 4 ifeq ($(OS),Windows_NT) 5 5 PYTHON_SETUP_FLAGS += --compiler=mingw32 6 6 endif 7 7 8 .PHONY: all 8 SWIG_FLAGS += -w312 9 10 .PHONY: all install uninstall 9 11 10 12 all: $(PYTHON_SO) 11 13 12 14 $(PYTHON_SO): pjsua2_wrap.cpp setup.py 13 python setup.py build _ext$(PYTHON_SETUP_FLAGS)15 python setup.py build $(PYTHON_SETUP_FLAGS) 14 16 15 pjsua2_wrap.cpp: ../pjsua2.i $(SRCS)17 pjsua2_wrap.cpp: ../pjsua2.i ../symbols.i Makefile $(SRCS) 16 18 swig $(SWIG_FLAGS) -python -o pjsua2_wrap.cpp ../pjsua2.i 17 19 18 20 clean distclean realclean: 19 21 rm -rf $(PYTHON_SO) pjsua2_wrap.cpp pjsua2_wrap.h pjsua2.py build *.pyc 22 23 install: 24 python setup.py install --user 25 26 uninstall: 27 rm -f $(HOME)/.local/lib/python2.7/site-packages/pjsua2* 28 rm -f $(HOME)/.local/lib/python2.7/site-packages/_pjsua2* 29 -
pjproject/branches/projects/pjsua2/pjsip/include/pjsua-lib/pjsua.h
r4592 r4639 252 252 253 253 /** Constant to identify invalid ID for all sorts of IDs. */ 254 #define PJSUA_INVALID_ID (-1) 254 enum pjsua_invalid_id_const_ 255 { 256 PJSUA_INVALID_ID = -1 257 }; 255 258 256 259 /** Disabled features temporarily for media reorganization */ … … 1881 1884 1882 1885 /** 1886 * Register a thread to poll for events. This function should be 1887 * called by an external worker thread, and it will block polling 1888 * for events until the library is destroyed. 1889 * 1890 * @return PJ_SUCCESS if things are working correctly 1891 * or an error polling cannot be done for some 1892 * reason. 1893 */ 1894 PJ_DECL(pj_status_t) pjsua_register_worker_thread(const char *name); 1895 1896 1897 /** 1898 * Signal all worker threads to quit. This will only wait until internal 1899 * threads are done. For external threads, application must perform 1900 * its own waiting for the external threads to quit from 1901 * pjsua_register_worker_thread() function. 1902 */ 1903 PJ_DECL(void) pjsua_stop_worker_threads(void); 1904 1905 /** 1883 1906 * Create memory pool to be used by the application. Once application 1884 1907 * finished using the pool, it must be released with pj_pool_release(). -
pjproject/branches/projects/pjsua2/pjsip/include/pjsua2/account.hpp
r4638 r4639 42 42 { 43 43 using std::string; 44 using std::vector;45 44 46 45 /** … … 141 140 }; 142 141 142 /** Array of SIP credentials */ 143 typedef std::vector<AuthCredInfo> AuthCredInfoVector; 143 144 144 145 /** -
pjproject/branches/projects/pjsua2/pjsip/include/pjsua2/endpoint.hpp
r4638 r4639 598 598 599 599 /** 600 * Get library version. 601 */ 602 Version libVersion() const; 603 604 /** 600 605 * Instantiate pjsua application. Application must call this function before 601 606 * calling any other functions, to make sure that the underlying libraries … … 629 634 */ 630 635 void libStart() throw(Error); 636 637 /** 638 * Register a thread to poll for events. This function should be 639 * called by an external worker thread, and it will block polling 640 * for events until the library is destroyed. 641 */ 642 void libRegisterWorkerThread(const string &name) throw(Error); 643 644 /** 645 * Stop all worker threads. 646 */ 647 void libStopWorkerThreads(); 648 649 /** 650 * Poll pjsua for events, and if necessary block the caller thread for 651 * the specified maximum interval (in miliseconds). 652 * 653 * Application doesn't normally need to call this function if it has 654 * configured worker thread (\a thread_cnt field) in pjsua_config 655 * structure, because polling then will be done by these worker threads 656 * instead. 657 * 658 * @param msec_timeout Maximum time to wait, in miliseconds. 659 * 660 * @return The number of events that have been handled during the 661 * poll. Negative value indicates error, and application 662 * can retrieve the error as (status = -return_value). 663 */ 664 int libHandleEvents(unsigned msec_timeout); 631 665 632 666 /** … … 641 675 * keep track of it's state. 642 676 * 643 * @param prmFlags 677 * @param prmFlags Combination of pjsua_destroy_flag enumeration. 644 678 */ 645 679 void libDestroy(unsigned prmFlags=0) throw(Error); -
pjproject/branches/projects/pjsua2/pjsip/include/pjsua2/types.hpp
r4638 r4639 71 71 72 72 /* 73 * Forward declaration of Account , AccountConfig,to be used73 * Forward declaration of Account to be used 74 74 * by Endpoint. 75 75 */ 76 76 class Account; 77 class AccountConfig;78 77 79 78 … … 143 142 144 143 # define PJSUA2_RAISE_ERROR3(status,op,txt) \ 145 throw Error(status, op, txt, __FILE__, __LINE__) 144 do { \ 145 Error err_ = Error(status, op, txt, __FILE__, __LINE__); \ 146 PJ_LOG(1,(THIS_FILE, "%s", err_.info().c_str())); \ 147 throw err_; \ 148 } while (0) 146 149 147 150 #else … … 153 156 154 157 # define PJSUA2_RAISE_ERROR3(status,op,txt) \ 155 throw Error(status, op, txt, string(), 0) 158 do { \ 159 Error err_ = Error(status, op, txt, string(), 0); \ 160 PJ_LOG(1,(THIS_FILE, "%s", err_.info().c_str())); \ 161 throw err_; \ 162 } while (0) 156 163 157 164 #endif … … 159 166 #define PJSUA2_CHECK_RAISE_ERROR2(status, op) \ 160 167 do { \ 161 if (status != PJ_SUCCESS) \168 if (status != PJ_SUCCESS) { \ 162 169 PJSUA2_RAISE_ERROR2(status, op); \ 170 } \ 163 171 } while (0) 164 172 … … 171 179 PJSUA2_CHECK_RAISE_ERROR2(the_status, #expr); \ 172 180 } while (0) 181 182 ////////////////////////////////////////////////////////////////////////////// 183 184 struct Version 185 { 186 /** Major number */ 187 int major; 188 189 /** Minor number */ 190 int minor; 191 192 /** Additional revision number */ 193 int rev; 194 195 /** Version suffix (e.g. "-svn") */ 196 string suffix; 197 198 /** The full version info (e.g. "2.1.0-svn") */ 199 string full; 200 201 /** 202 * PJLIB version number as three bytes with the following format: 203 * 0xMMIIRR00, where MM: major number, II: minor number, RR: revision 204 * number, 00: always zero for now. 205 */ 206 unsigned numeric; 207 }; 173 208 174 209 ////////////////////////////////////////////////////////////////////////////// … … 232 267 const int data_type, 233 268 const string data); 234 }; 235 236 /** Array of SIP credentials */ 237 typedef std::vector<AuthCredInfo> AuthCredInfoVector; 269 270 }; 271 238 272 239 273 ////////////////////////////////////////////////////////////////////////////// -
pjproject/branches/projects/pjsua2/pjsip/src/pjsua-lib/pjsua_core.c
r4555 r4639 687 687 } 688 688 689 PJ_DEF(pj_status_t) pjsua_register_worker_thread(const char *name) 690 { 691 pj_thread_desc desc; 692 pj_thread_t *thread; 693 pj_status_t status; 694 695 if (pjsua_var.thread_quit_flag) 696 return PJ_EGONE; 697 698 status = pj_thread_register(NULL, desc, &thread); 699 if (status != PJ_SUCCESS) 700 return status; 701 702 if (name) 703 PJ_LOG(4,(THIS_FILE, "Worker thread %s started", name)); 704 705 worker_thread(NULL); 706 707 if (name) 708 PJ_LOG(4,(THIS_FILE, "Worker thread %s stopped", name)); 709 710 return PJ_SUCCESS; 711 } 712 713 PJ_DEF(void) pjsua_stop_worker_threads(void) 714 { 715 unsigned i; 716 717 pjsua_var.thread_quit_flag = 1; 718 719 /* Wait worker threads to quit: */ 720 for (i=0; i<(int)pjsua_var.ua_cfg.thread_cnt; ++i) { 721 if (pjsua_var.thread[i]) { 722 pj_status_t status; 723 status = pj_thread_join(pjsua_var.thread[i]); 724 if (status != PJ_SUCCESS) { 725 PJ_PERROR(4,(THIS_FILE, status, "Error joining worker thread")); 726 pj_thread_sleep(1000); 727 } 728 pj_thread_destroy(pjsua_var.thread[i]); 729 pjsua_var.thread[i] = NULL; 730 } 731 } 732 } 689 733 690 734 /* Init random seed */ … … 1466 1510 1467 1511 /* Signal threads to quit: */ 1468 pjsua_var.thread_quit_flag = 1; 1469 1470 /* Wait worker threads to quit: */ 1471 for (i=0; i<(int)pjsua_var.ua_cfg.thread_cnt; ++i) { 1472 if (pjsua_var.thread[i]) { 1473 pj_status_t status; 1474 status = pj_thread_join(pjsua_var.thread[i]); 1475 if (status != PJ_SUCCESS) { 1476 PJ_PERROR(4,(THIS_FILE, status, "Error joining worker thread")); 1477 pj_thread_sleep(1000); 1478 } 1479 pj_thread_destroy(pjsua_var.thread[i]); 1480 pjsua_var.thread[i] = NULL; 1481 } 1482 } 1512 pjsua_stop_worker_threads(); 1483 1513 1484 1514 if (pjsua_var.endpt) { -
pjproject/branches/projects/pjsua2/pjsip/src/pjsua2/account.cpp
r4638 r4639 333 333 /////////////////////////////////////////////////////////////////////////////// 334 334 335 AccountPresenceStatus::AccountPresenceStatus() 336 : isOnline(false), activity(PJRPID_ACTIVITY_UNKNOWN) 337 { 338 } 339 340 /////////////////////////////////////////////////////////////////////////////// 341 335 342 void AccountInfo::fromPj(const pjsua_acc_info &pai) 336 343 { … … 379 386 { 380 387 pjsua_acc_config pj_acc_cfg = acc_cfg.toPj(); 381 388 pj_acc_cfg.user_data = (void*)this; 382 389 PJSUA2_CHECK_EXPR( pjsua_acc_modify(id, &pj_acc_cfg) ); 383 390 } -
pjproject/branches/projects/pjsua2/pjsip/src/pjsua2/endpoint.cpp
r4638 r4639 545 545 * Endpoint library operations 546 546 */ 547 Version Endpoint::libVersion() const 548 { 549 Version ver; 550 ver.major = PJ_VERSION_NUM_MAJOR; 551 ver.minor = PJ_VERSION_NUM_MINOR; 552 ver.rev = PJ_VERSION_NUM_REV; 553 ver.suffix = PJ_VERSION_NUM_EXTRA; 554 ver.full = pj_get_version(); 555 ver.numeric = PJ_VERSION_NUM; 556 return ver; 557 } 558 547 559 void Endpoint::libCreate() throw(Error) 548 560 { … … 594 606 } 595 607 608 void Endpoint::libRegisterWorkerThread(const string &name) throw(Error) 609 { 610 PJSUA2_CHECK_EXPR(pjsua_register_worker_thread(name.c_str())); 611 } 612 613 void Endpoint::libStopWorkerThreads() 614 { 615 pjsua_stop_worker_threads(); 616 } 617 618 int Endpoint::libHandleEvents(unsigned msec_timeout) 619 { 620 return pjsua_handle_events(msec_timeout); 621 } 622 596 623 void Endpoint::libDestroy(unsigned flags) throw(Error) 597 624 { -
pjproject/branches/projects/pjsua2/pjsip/src/pjsua2/types.cpp
r4638 r4639 23 23 using namespace std; 24 24 25 #define THIS_FILE "types.cpp" 26 25 27 /////////////////////////////////////////////////////////////////////////////// 26 28
Note: See TracChangeset
for help on using the changeset viewer.