endpoint.hpp 67 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182
  1. /*
  2. * Copyright (C) 2013 Teluu Inc. (http://www.teluu.com)
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  17. */
  18. #ifndef __PJSUA2_UA_HPP__
  19. #define __PJSUA2_UA_HPP__
  20. /**
  21. * @file pjsua2/endpoint.hpp
  22. * @brief PJSUA2 Base Agent Operation
  23. */
  24. #include <pjsua2/persistent.hpp>
  25. #include <pjsua2/media.hpp>
  26. #include <pjsua2/siptypes.hpp>
  27. #include <list>
  28. #include <map>
  29. /** PJSUA2 API is inside pj namespace */
  30. namespace pj
  31. {
  32. /**
  33. * @defgroup PJSUA2_UA Endpoint
  34. * @ingroup PJSUA2_Ref
  35. * @{
  36. */
  37. using std::string;
  38. using std::vector;
  39. //////////////////////////////////////////////////////////////////////////////
  40. /**
  41. * Argument to Endpoint::onNatDetectionComplete() callback.
  42. */
  43. struct OnNatDetectionCompleteParam
  44. {
  45. /**
  46. * Status of the detection process. If this value is not PJ_SUCCESS,
  47. * the detection has failed and \a nat_type field will contain
  48. * PJ_STUN_NAT_TYPE_UNKNOWN.
  49. */
  50. pj_status_t status;
  51. /**
  52. * The text describing the status, if the status is not PJ_SUCCESS.
  53. */
  54. string reason;
  55. /**
  56. * This contains the NAT type as detected by the detection procedure.
  57. * This value is only valid when the \a status is PJ_SUCCESS.
  58. */
  59. pj_stun_nat_type natType;
  60. /**
  61. * Text describing that NAT type.
  62. */
  63. string natTypeName;
  64. };
  65. /**
  66. * Argument to Endpoint::onNatCheckStunServersComplete() callback.
  67. */
  68. struct OnNatCheckStunServersCompleteParam
  69. {
  70. /**
  71. * Arbitrary user data that was passed to Endpoint::natCheckStunServers()
  72. * function.
  73. */
  74. Token userData;
  75. /**
  76. * This will contain PJ_SUCCESS if at least one usable STUN server
  77. * is found, otherwise it will contain the last error code during
  78. * the operation.
  79. */
  80. pj_status_t status;
  81. /**
  82. * The server name that yields successful result. This will only
  83. * contain value if status is successful.
  84. */
  85. string name;
  86. /**
  87. * The server IP address and port in "IP:port" format. This will only
  88. * contain value if status is successful.
  89. */
  90. SocketAddress addr;
  91. };
  92. /**
  93. * Parameter of Endpoint::onTimer() callback.
  94. */
  95. struct OnTimerParam
  96. {
  97. /**
  98. * Arbitrary user data that was passed to Endpoint::utilTimerSchedule()
  99. * function.
  100. */
  101. Token userData;
  102. /**
  103. * The interval of this timer, in miliseconds.
  104. */
  105. unsigned msecDelay;
  106. };
  107. /**
  108. * SSL certificate type and name structure.
  109. */
  110. struct SslCertName
  111. {
  112. pj_ssl_cert_name_type type; /**< Name type */
  113. string name; /**< The name */
  114. public:
  115. /**
  116. * Default constructor
  117. */
  118. SslCertName() : type(PJ_SSL_CERT_NAME_UNKNOWN)
  119. {}
  120. };
  121. /** Array of SSL certificate type and name. */
  122. typedef std::vector<SslCertName> SslCertNameVector;
  123. /**
  124. * SSL certificate information.
  125. */
  126. struct SslCertInfo
  127. {
  128. unsigned version; /**< Certificate version */
  129. unsigned char serialNo[20]; /**< Serial number, array
  130. of octets, first index
  131. is MSB */
  132. string subjectCn; /**< Subject common name */
  133. string subjectInfo; /**< One line subject, fields
  134. are separated by slash, e.g:
  135. "CN=sample.org/OU=HRD" */
  136. string issuerCn; /**< Issuer common name */
  137. string issuerInfo; /**< One line subject, fields
  138. are separated by slash */
  139. TimeVal validityStart; /**< Validity start */
  140. TimeVal validityEnd; /**< Validity end */
  141. bool validityGmt; /**< Flag if validity
  142. date/time use GMT */
  143. SslCertNameVector subjectAltName; /**< Subject alternative
  144. name extension */
  145. string raw; /**< Raw certificate in PEM
  146. format, only available
  147. for remote certificate */
  148. public:
  149. /**
  150. * Constructor.
  151. */
  152. SslCertInfo();
  153. /**
  154. * Check if the info is set with empty values.
  155. *
  156. * @return True if the info is empty.
  157. */
  158. bool isEmpty() const;
  159. /**
  160. * Convert from pjsip
  161. */
  162. void fromPj(const pj_ssl_cert_info &info);
  163. private:
  164. bool empty;
  165. };
  166. /**
  167. * TLS transport information.
  168. */
  169. struct TlsInfo
  170. {
  171. /**
  172. * Describes whether secure socket connection is established, i.e: TLS/SSL
  173. * handshaking has been done successfully.
  174. */
  175. bool established;
  176. /**
  177. * Describes secure socket protocol being used, see #pj_ssl_sock_proto.
  178. * Use bitwise OR operation to combine the protocol type.
  179. */
  180. unsigned protocol;
  181. /**
  182. * Describes cipher suite being used, this will only be set when connection
  183. * is established.
  184. */
  185. pj_ssl_cipher cipher;
  186. /**
  187. * Describes cipher name being used, this will only be set when connection
  188. * is established.
  189. */
  190. string cipherName;
  191. /**
  192. * Describes local address.
  193. */
  194. SocketAddress localAddr;
  195. /**
  196. * Describes remote address.
  197. */
  198. SocketAddress remoteAddr;
  199. /**
  200. * Describes active local certificate info. Use SslCertInfo.isEmpty()
  201. * to check if the local cert info is available.
  202. */
  203. SslCertInfo localCertInfo;
  204. /**
  205. * Describes active remote certificate info. Use SslCertInfo.isEmpty()
  206. * to check if the remote cert info is available.
  207. */
  208. SslCertInfo remoteCertInfo;
  209. /**
  210. * Status of peer certificate verification.
  211. */
  212. unsigned verifyStatus;
  213. /**
  214. * Error messages (if any) of peer certificate verification, based on
  215. * the field verifyStatus above.
  216. */
  217. StringVector verifyMsgs;
  218. public:
  219. /**
  220. * Constructor.
  221. */
  222. TlsInfo();
  223. /**
  224. * Check if the info is set with empty values.
  225. *
  226. * @return True if the info is empty.
  227. */
  228. bool isEmpty() const;
  229. /**
  230. * Convert from pjsip
  231. */
  232. void fromPj(const pjsip_tls_state_info &info);
  233. private:
  234. bool empty;
  235. };
  236. /**
  237. * Parameter of Endpoint::onTransportState() callback.
  238. */
  239. struct OnTransportStateParam
  240. {
  241. /**
  242. * The transport handle.
  243. */
  244. TransportHandle hnd;
  245. /**
  246. * The transport type.
  247. */
  248. string type;
  249. /**
  250. * Transport current state.
  251. */
  252. pjsip_transport_state state;
  253. /**
  254. * The last error code related to the transport state.
  255. */
  256. pj_status_t lastError;
  257. /**
  258. * TLS transport info, only used if transport type is TLS. Use
  259. * TlsInfo.isEmpty() to check if this info is available.
  260. */
  261. TlsInfo tlsInfo;
  262. };
  263. /**
  264. * Parameter of Endpoint::onSelectAccount() callback.
  265. */
  266. struct OnSelectAccountParam
  267. {
  268. /**
  269. * The incoming request.
  270. */
  271. SipRxData rdata;
  272. /**
  273. * The account index to be used to handle the request.
  274. * Upon entry, this will be filled by the account index
  275. * chosen by the library. Application may change it to
  276. * another value to use another account.
  277. */
  278. int accountIndex;
  279. };
  280. /**
  281. * Parameter of Endpoint::handleIpChange().
  282. */
  283. struct IpChangeParam {
  284. /**
  285. * If set to PJ_TRUE, this will restart the transport listener.
  286. *
  287. * Default : PJ_TRUE
  288. */
  289. bool restartListener;
  290. /**
  291. * If \a restartListener is set to PJ_TRUE, some delay might be needed
  292. * for the listener to be restarted. Use this to set the delay.
  293. *
  294. * Default : PJSUA_TRANSPORT_RESTART_DELAY_TIME
  295. */
  296. unsigned restartLisDelay;
  297. /**
  298. * If set to PJ_TRUE, this will forcefully shutdown all transports.
  299. * Note that this will shutdown TCP/TLS transports only, UDP transport
  300. * should be restarted via restart_listener.
  301. *
  302. * Default : PJ_TRUE
  303. */
  304. bool shutdownTransport;
  305. public:
  306. /**
  307. * Constructor.
  308. */
  309. IpChangeParam();
  310. /**
  311. * Export to pjsua_ip_change_param.
  312. */
  313. pjsua_ip_change_param toPj() const;
  314. /**
  315. * Convert from pjsip
  316. */
  317. void fromPj(const pjsua_ip_change_param &param);
  318. };
  319. /**
  320. * Information of Update contact on IP change progress.
  321. */
  322. struct RegProgressParam
  323. {
  324. /**
  325. * Indicate if this is a Register or Un-Register message.
  326. */
  327. bool isRegister;
  328. /**
  329. * SIP status code received.
  330. */
  331. int code;
  332. };
  333. /**
  334. * Parameter of Endpoint::onIpChangeProgress().
  335. */
  336. struct OnIpChangeProgressParam
  337. {
  338. /**
  339. * The IP change progress operation.
  340. */
  341. pjsua_ip_change_op op;
  342. /**
  343. * The operation progress status.
  344. */
  345. pj_status_t status;
  346. /**
  347. * Information of the transport id. This is only available when the
  348. * operation is PJSUA_IP_CHANGE_OP_RESTART_LIS.
  349. */
  350. TransportId transportId;
  351. /**
  352. * Information of the account id. This is only available when the
  353. * operation is:
  354. * - PJSUA_IP_CHANGE_OP_ACC_SHUTDOWN_TP
  355. * - PJSUA_IP_CHANGE_OP_ACC_UPDATE_CONTACT
  356. * - PJSUA_IP_CHANGE_OP_ACC_HANGUP_CALLS
  357. * - PJSUA_IP_CHANGE_OP_ACC_REINVITE_CALLS
  358. */
  359. int accId;
  360. /**
  361. * Information of the call id. This is only available when the operation is
  362. * PJSUA_IP_CHANGE_OP_ACC_HANGUP_CALLS or
  363. * PJSUA_IP_CHANGE_OP_ACC_REINVITE_CALLS
  364. */
  365. int callId;
  366. /**
  367. * Registration information. This is only available when the operation is
  368. * PJSUA_IP_CHANGE_OP_ACC_UPDATE_CONTACT
  369. */
  370. RegProgressParam regInfo;
  371. };
  372. /**
  373. * Parameter of Endpoint::onCallMediaEvent() callback.
  374. */
  375. struct OnMediaEventParam
  376. {
  377. /**
  378. * The media event.
  379. */
  380. MediaEvent ev;
  381. };
  382. /**
  383. * Parameter of Endpoint::onRejectedIncomingCall() callback.
  384. */
  385. struct OnRejectedIncomingCallParam
  386. {
  387. /**
  388. * The incoming call id. This will be set to PJSUA_INVALID_ID when there is
  389. * no available call slot at the time.
  390. */
  391. pjsua_call_id callId;
  392. /**
  393. * Local URI.
  394. */
  395. std::string localInfo;
  396. /**
  397. * Remote URI.
  398. */
  399. std::string remoteInfo;
  400. /**
  401. * Rejection code.
  402. */
  403. int statusCode;
  404. /**
  405. * Rejection text.
  406. */
  407. std::string reason;
  408. /**
  409. * The original INVITE message, on some cases it is not available.
  410. */
  411. SipRxData rdata;
  412. };
  413. /**
  414. * This structure describes authentication challenge used in Proxy-Authenticate
  415. * or WWW-Authenticate for digest authentication scheme.
  416. */
  417. struct DigestChallenge
  418. {
  419. /**
  420. * Realm for the challenge.
  421. * */
  422. std::string realm;
  423. /**
  424. * Other parameters.
  425. */
  426. StringToStringMap otherParam;
  427. /**
  428. * Domain.
  429. */
  430. std::string domain;
  431. /**
  432. * Nonce challenge.
  433. */
  434. std::string nonce;
  435. /**
  436. * Opaque value.
  437. */
  438. std::string opaque;
  439. /**
  440. * Stale parameter.
  441. */
  442. int stale;
  443. /**
  444. * Algorithm parameter.
  445. */
  446. std::string algorithm;
  447. /**
  448. * Quality of protection.
  449. */
  450. std::string qop;
  451. /**
  452. * Convert from pjsip
  453. */
  454. void fromPj(const pjsip_digest_challenge &prm);
  455. /**
  456. * Convert to pjsip
  457. */
  458. pjsip_digest_challenge toPj() const;
  459. };
  460. /**
  461. * This structure describe credential used in Authorization and
  462. * Proxy-Authorization header for digest authentication scheme.
  463. */
  464. struct DigestCredential
  465. {
  466. /**
  467. *Realm of the credential
  468. */
  469. std::string realm;
  470. /**
  471. *Other parameters.
  472. */
  473. StringToStringMap otherParam;
  474. /**
  475. *Username parameter.
  476. */
  477. std::string username;
  478. /**
  479. *Nonce parameter.
  480. */
  481. std::string nonce;
  482. /**
  483. *URI parameter.
  484. */
  485. std::string uri;
  486. /**
  487. *Response digest.
  488. */
  489. std::string response;
  490. /**
  491. *Algorithm.
  492. */
  493. std::string algorithm;
  494. /**
  495. *Cnonce.
  496. */
  497. std::string cnonce;
  498. /**
  499. *Opaque value.
  500. */
  501. std::string opaque;
  502. /**
  503. *Quality of protection.
  504. */
  505. std::string qop;
  506. /**
  507. *Nonce count.
  508. */
  509. std::string nc;
  510. /**
  511. * Convert from pjsip
  512. */
  513. void fromPj(const pjsip_digest_credential &prm);
  514. /**
  515. * Convert to pjsip
  516. */
  517. pjsip_digest_credential toPj() const;
  518. };
  519. /**
  520. * Parameters for onCredAuth account method.
  521. */
  522. struct OnCredAuthParam
  523. {
  524. /** Digest challenge */
  525. DigestChallenge digestChallenge;
  526. /** Credential info */
  527. AuthCredInfo credentialInfo;
  528. /** Method */
  529. std::string method;
  530. /** Digest credential */
  531. DigestCredential digestCredential;
  532. };
  533. //////////////////////////////////////////////////////////////////////////////
  534. /**
  535. * SIP User Agent related settings.
  536. */
  537. struct UaConfig : public PersistentObject
  538. {
  539. /**
  540. * Maximum calls to support (default: 4). The value specified here
  541. * must be smaller than the compile time maximum settings
  542. * PJSUA_MAX_CALLS, which by default is 32. To increase this
  543. * limit, the library must be recompiled with new PJSUA_MAX_CALLS
  544. * value.
  545. */
  546. unsigned maxCalls;
  547. /**
  548. * Number of worker threads. Normally application will want to have at
  549. * least one worker thread, unless when it wants to poll the library
  550. * periodically, which in this case the worker thread can be set to
  551. * zero.
  552. */
  553. unsigned threadCnt;
  554. /**
  555. * When this flag is non-zero, all callbacks that come from thread
  556. * other than main thread will be posted to the main thread and
  557. * to be executed by Endpoint::libHandleEvents() function. This
  558. * includes the logging callback. Note that this will only work if
  559. * threadCnt is set to zero and Endpoint::libHandleEvents() is
  560. * performed by main thread. By default, the main thread is set
  561. * from the thread that invoke Endpoint::libCreate()
  562. *
  563. * Default: false
  564. */
  565. bool mainThreadOnly;
  566. /**
  567. * Array of nameservers to be used by the SIP resolver subsystem.
  568. * The order of the name server specifies the priority (first name
  569. * server will be used first, unless it is not reachable).
  570. */
  571. StringVector nameserver;
  572. /**
  573. * Specify the URL of outbound proxies to visit for all outgoing requests.
  574. * The outbound proxies will be used for all accounts, and it will
  575. * be used to build the route set for outgoing requests. The final
  576. * route set for outgoing requests will consists of the outbound proxies
  577. * and the proxy configured in the account.
  578. */
  579. StringVector outboundProxies;
  580. /**
  581. * Optional user agent string (default empty). If it's empty, no
  582. * User-Agent header will be sent with outgoing requests.
  583. */
  584. string userAgent;
  585. /**
  586. * Array of STUN servers to try. The library will try to resolve and
  587. * contact each of the STUN server entry until it finds one that is
  588. * usable. Each entry may be a domain name, host name, IP address, and
  589. * it may contain an optional port number. For example:
  590. * - "pjsip.org" (domain name)
  591. * - "sip.pjsip.org" (host name)
  592. * - "pjsip.org:33478" (domain name and a non-standard port number)
  593. * - "10.0.0.1:3478" (IP address and port number)
  594. *
  595. * When nameserver is configured in the \a pjsua_config.nameserver field,
  596. * if entry is not an IP address, it will be resolved with DNS SRV
  597. * resolution first, and it will fallback to use DNS A resolution if this
  598. * fails. Port number may be specified even if the entry is a domain name,
  599. * in case the DNS SRV resolution should fallback to a non-standard port.
  600. *
  601. * When nameserver is not configured, entries will be resolved with
  602. * pj_gethostbyname() if it's not an IP address. Port number may be
  603. * specified if the server is not listening in standard STUN port.
  604. */
  605. StringVector stunServer;
  606. /**
  607. * This specifies if the library should try to do an IPv6 resolution of
  608. * the STUN servers if the IPv4 resolution fails. It can be useful
  609. * in an IPv6-only environment, including on NAT64.
  610. *
  611. * Default: FALSE
  612. */
  613. bool stunTryIpv6;
  614. /**
  615. * This specifies if the library startup should ignore failure with the
  616. * STUN servers. If this is set to PJ_FALSE, the library will refuse to
  617. * start if it fails to resolve or contact any of the STUN servers.
  618. *
  619. * Default: TRUE
  620. */
  621. bool stunIgnoreFailure;
  622. /**
  623. * Support for adding and parsing NAT type in the SDP to assist
  624. * troubleshooting. The valid values are:
  625. * - 0: no information will be added in SDP, and parsing is disabled.
  626. * - 1: only the NAT type number is added.
  627. * - 2: add both NAT type number and name.
  628. *
  629. * Default: 1
  630. */
  631. int natTypeInSdp;
  632. /**
  633. * Handle unsolicited NOTIFY requests containing message waiting
  634. * indication (MWI) info. Unsolicited MWI is incoming NOTIFY requests
  635. * which are not requested by client with SUBSCRIBE request.
  636. *
  637. * If this is enabled, the library will respond 200/OK to the NOTIFY
  638. * request and forward the request to Endpoint::onMwiInfo() callback.
  639. *
  640. * Note: the callback will not be invoked and 481/"No account to handle" response
  641. * will be sent if this is enabled but no account is configured.
  642. *
  643. * See also AccountMwiConfig.enabled.
  644. *
  645. * Default: PJ_TRUE
  646. */
  647. bool mwiUnsolicitedEnabled;
  648. /**
  649. * Specify whether to enable UPnP.
  650. *
  651. * Note that this setting can be further customized in account
  652. * configuration (#pjsua_acc_config).
  653. *
  654. * Default: FALSE
  655. */
  656. bool enableUpnp;
  657. /**
  658. * Specify which interface to use for UPnP. If empty, UPnP will use
  659. * the first suitable interface found.
  660. *
  661. * Note that this setting is only applicable if UPnP is enabled.
  662. *
  663. * Default: empty string
  664. */
  665. string upnpIfName;
  666. public:
  667. /**
  668. * Default constructor to initialize with default values.
  669. */
  670. UaConfig();
  671. /**
  672. * Construct from pjsua_config.
  673. */
  674. void fromPj(const pjsua_config &ua_cfg);
  675. /**
  676. * Export to pjsua_config
  677. */
  678. pjsua_config toPj() const;
  679. /**
  680. * Read this object from a container.
  681. *
  682. * @param node Container to write values from.
  683. */
  684. virtual void readObject(const ContainerNode &node) PJSUA2_THROW(Error);
  685. /**
  686. * Write this object to a container.
  687. *
  688. * @param node Container to write values to.
  689. */
  690. virtual void writeObject(ContainerNode &node) const PJSUA2_THROW(Error);
  691. };
  692. /**
  693. * Data containing log entry to be written by the LogWriter.
  694. */
  695. struct LogEntry
  696. {
  697. /** Log verbosity level of this message */
  698. int level;
  699. /** The log message */
  700. string msg;
  701. /** ID of current thread */
  702. long threadId;
  703. /** The name of the thread that writes this log */
  704. string threadName;
  705. };
  706. /**
  707. * Interface for writing log messages. Applications can inherit this class
  708. * and supply it in the LogConfig structure to implement custom log
  709. * writing facility.
  710. */
  711. class LogWriter
  712. {
  713. public:
  714. /** Destructor */
  715. virtual ~LogWriter() {}
  716. /** Write a log entry. */
  717. virtual void write(const LogEntry &entry) = 0;
  718. };
  719. /**
  720. * Logging configuration, which can be (optionally) specified when calling
  721. * Lib::init().
  722. */
  723. struct LogConfig : public PersistentObject
  724. {
  725. /** Log incoming and outgoing SIP message? Yes! */
  726. unsigned msgLogging;
  727. /** Input verbosity level. Value 5 is reasonable. */
  728. unsigned level;
  729. /** Verbosity level for console. Value 4 is reasonable. */
  730. unsigned consoleLevel;
  731. /** Log decoration. */
  732. unsigned decor;
  733. /** Optional log filename if app wishes the library to write to log file.
  734. */
  735. string filename;
  736. /**
  737. * Additional flags to be given to pj_file_open() when opening
  738. * the log file. By default, the flag is PJ_O_WRONLY. Application
  739. * may set PJ_O_APPEND here so that logs are appended to existing
  740. * file instead of overwriting it.
  741. *
  742. * Default is 0.
  743. */
  744. unsigned fileFlags;
  745. /**
  746. * Custom log writer, if required. This instance will be destroyed
  747. * by the endpoint when the endpoint is destroyed.
  748. */
  749. LogWriter *writer;
  750. public:
  751. /** Default constructor initialises with default values */
  752. LogConfig();
  753. /** Construct from pjsua_logging_config */
  754. void fromPj(const pjsua_logging_config &lc);
  755. /** Generate pjsua_logging_config. */
  756. pjsua_logging_config toPj() const;
  757. /**
  758. * Read this object from a container.
  759. *
  760. * @param node Container to write values from.
  761. */
  762. virtual void readObject(const ContainerNode &node) PJSUA2_THROW(Error);
  763. /**
  764. * Write this object to a container.
  765. *
  766. * @param node Container to write values to.
  767. */
  768. virtual void writeObject(ContainerNode &node) const PJSUA2_THROW(Error);
  769. };
  770. /**
  771. * This structure describes media configuration, which will be specified
  772. * when calling Lib::init().
  773. */
  774. struct MediaConfig : public PersistentObject
  775. {
  776. public:
  777. /**
  778. * Clock rate to be applied to the conference bridge.
  779. * If value is zero, default clock rate will be used
  780. * (PJSUA_DEFAULT_CLOCK_RATE, which by default is 16KHz).
  781. */
  782. unsigned clockRate;
  783. /**
  784. * Clock rate to be applied when opening the sound device.
  785. * If value is zero, conference bridge clock rate will be used.
  786. */
  787. unsigned sndClockRate;
  788. /**
  789. * Channel count be applied when opening the sound device and
  790. * conference bridge.
  791. */
  792. unsigned channelCount;
  793. /**
  794. * Specify audio frame ptime. The value here will affect the
  795. * samples per frame of both the sound device and the conference
  796. * bridge. Specifying lower ptime will normally reduce the
  797. * latency.
  798. *
  799. * Default value: PJSUA_DEFAULT_AUDIO_FRAME_PTIME
  800. */
  801. unsigned audioFramePtime;
  802. /**
  803. * Specify maximum number of media ports to be created in the
  804. * conference bridge. Since all media terminate in the bridge
  805. * (calls, file player, file recorder, etc), the value must be
  806. * large enough to support all of them. However, the larger
  807. * the value, the more computations are performed.
  808. *
  809. * Default value: PJSUA_MAX_CONF_PORTS
  810. */
  811. unsigned maxMediaPorts;
  812. /**
  813. * Specify whether the media manager should manage its own
  814. * ioqueue for the RTP/RTCP sockets. If yes, ioqueue will be created
  815. * and at least one worker thread will be created too. If no,
  816. * the RTP/RTCP sockets will share the same ioqueue as SIP sockets,
  817. * and no worker thread is needed.
  818. *
  819. * Normally application would say yes here, unless it wants to
  820. * run everything from a single thread.
  821. */
  822. bool hasIoqueue;
  823. /**
  824. * Specify the number of worker threads to handle incoming RTP
  825. * packets. A value of one is recommended for most applications.
  826. */
  827. unsigned threadCnt;
  828. /**
  829. * Media quality, 0-10, according to this table:
  830. * 5-10: resampling use large filter,
  831. * 3-4: resampling use small filter,
  832. * 1-2: resampling use linear.
  833. * The media quality also sets speex codec quality/complexity to the
  834. * number.
  835. *
  836. * Default: PJSUA_DEFAULT_CODEC_QUALITY.
  837. */
  838. unsigned quality;
  839. /**
  840. * Specify default codec ptime.
  841. *
  842. * Default: 0 (codec specific)
  843. */
  844. unsigned ptime;
  845. /**
  846. * Disable VAD?
  847. *
  848. * Default: 0 (codec specific)
  849. */
  850. bool noVad;
  851. /**
  852. * iLBC mode (20 or 30).
  853. *
  854. * Default: 30 (PJSUA_DEFAULT_ILBC_MODE)
  855. */
  856. unsigned ilbcMode;
  857. /**
  858. * Percentage of RTP packet to drop in TX direction
  859. * (to simulate packet lost).
  860. *
  861. * Default: 0
  862. */
  863. unsigned txDropPct;
  864. /**
  865. * Percentage of RTP packet to drop in RX direction
  866. * (to simulate packet lost).
  867. *
  868. * Default: 0
  869. */
  870. unsigned rxDropPct;
  871. /**
  872. * Echo canceller options (see pjmedia_echo_create()).
  873. * Specify PJMEDIA_ECHO_USE_SW_ECHO here if application wishes
  874. * to use software echo canceller instead of device EC.
  875. *
  876. * Default: 0.
  877. */
  878. unsigned ecOptions;
  879. /**
  880. * Echo canceller tail length, in miliseconds. Setting this to zero
  881. * will disable echo cancellation.
  882. *
  883. * Default: PJSUA_DEFAULT_EC_TAIL_LEN
  884. */
  885. unsigned ecTailLen;
  886. /**
  887. * Audio capture buffer length, in milliseconds.
  888. *
  889. * Default: PJMEDIA_SND_DEFAULT_REC_LATENCY
  890. */
  891. unsigned sndRecLatency;
  892. /**
  893. * Audio playback buffer length, in milliseconds.
  894. *
  895. * Default: PJMEDIA_SND_DEFAULT_PLAY_LATENCY
  896. */
  897. unsigned sndPlayLatency;
  898. /**
  899. * Jitter buffer initial prefetch delay in msec. The value must be
  900. * between jb_min_pre and jb_max_pre below. If the value is 0,
  901. * prefetching will be disabled.
  902. *
  903. * Default: -1 (to use default stream settings, currently 0)
  904. */
  905. int jbInit;
  906. /**
  907. * Jitter buffer minimum prefetch delay in msec.
  908. *
  909. * Default: -1 (to use default stream settings, currently codec ptime)
  910. */
  911. int jbMinPre;
  912. /**
  913. * Jitter buffer maximum prefetch delay in msec.
  914. *
  915. * Default: -1 (to use default stream settings, currently 80% of jbMax)
  916. */
  917. int jbMaxPre;
  918. /**
  919. * Set maximum delay that can be accomodated by the jitter buffer msec.
  920. *
  921. * Default: -1 (to use default stream settings, currently 500 msec)
  922. */
  923. int jbMax;
  924. /**
  925. * Set the algorithm the jitter buffer uses to discard frames in order to
  926. * adjust the latency.
  927. *
  928. * Default: PJMEDIA_JB_DISCARD_PROGRESSIVE
  929. */
  930. pjmedia_jb_discard_algo jbDiscardAlgo;
  931. /**
  932. * Specify idle time of sound device before it is automatically closed,
  933. * in seconds. Use value -1 to disable the auto-close feature of sound
  934. * device
  935. *
  936. * Default : 1
  937. */
  938. int sndAutoCloseTime;
  939. /**
  940. * Specify whether built-in/native preview should be used if available.
  941. * In some systems, video input devices have built-in capability to show
  942. * preview window of the device. Using this built-in preview is preferable
  943. * as it consumes less CPU power. If built-in preview is not available,
  944. * the library will perform software rendering of the input. If this
  945. * field is set to PJ_FALSE, software preview will always be used.
  946. *
  947. * Default: PJ_TRUE
  948. */
  949. bool vidPreviewEnableNative;
  950. public:
  951. /** Default constructor initialises with default values */
  952. MediaConfig();
  953. /** Construct from pjsua_media_config. */
  954. void fromPj(const pjsua_media_config &mc);
  955. /** Export */
  956. pjsua_media_config toPj() const;
  957. /**
  958. * Read this object from a container.
  959. *
  960. * @param node Container to write values from.
  961. */
  962. virtual void readObject(const ContainerNode &node) PJSUA2_THROW(Error);
  963. /**
  964. * Write this object to a container.
  965. *
  966. * @param node Container to write values to.
  967. */
  968. virtual void writeObject(ContainerNode &node) const PJSUA2_THROW(Error);
  969. };
  970. /**
  971. * Endpoint configuration
  972. */
  973. struct EpConfig : public PersistentObject
  974. {
  975. /** UA config */
  976. UaConfig uaConfig;
  977. /** Logging config */
  978. LogConfig logConfig;
  979. /** Media config */
  980. MediaConfig medConfig;
  981. /**
  982. * Read this object from a container.
  983. *
  984. * @param node Container to write values from.
  985. */
  986. virtual void readObject(const ContainerNode &node) PJSUA2_THROW(Error);
  987. /**
  988. * Write this object to a container.
  989. *
  990. * @param node Container to write values to.
  991. */
  992. virtual void writeObject(ContainerNode &node) const PJSUA2_THROW(Error);
  993. };
  994. /* This represents posted job */
  995. struct PendingJob
  996. {
  997. /** Perform the job */
  998. virtual void execute(bool is_pending) = 0;
  999. /** Virtual destructor */
  1000. virtual ~PendingJob() {}
  1001. };
  1002. //////////////////////////////////////////////////////////////////////////////
  1003. /**
  1004. * Endpoint represents an instance of pjsua library. There can only be
  1005. * one instance of pjsua library in an application, hence this class
  1006. * is a singleton.
  1007. */
  1008. class Endpoint
  1009. {
  1010. public:
  1011. /** Retrieve the singleton instance of the endpoint */
  1012. static Endpoint &instance() PJSUA2_THROW(Error);
  1013. /** Default constructor */
  1014. Endpoint();
  1015. /** Virtual destructor */
  1016. virtual ~Endpoint();
  1017. /*************************************************************************
  1018. * Base library operations
  1019. */
  1020. /**
  1021. * Get library version.
  1022. */
  1023. Version libVersion() const;
  1024. /**
  1025. * Instantiate pjsua application. Application must call this function before
  1026. * calling any other functions, to make sure that the underlying libraries
  1027. * are properly initialized. Once this function has returned success,
  1028. * application must call libDestroy() before quitting.
  1029. */
  1030. void libCreate() PJSUA2_THROW(Error);
  1031. /**
  1032. * Get library state.
  1033. *
  1034. * @return library state.
  1035. */
  1036. pjsua_state libGetState() const;
  1037. /**
  1038. * Initialize pjsua with the specified settings. All the settings are
  1039. * optional, and the default values will be used when the config is not
  1040. * specified.
  1041. *
  1042. * Note that create() MUST be called before calling this function.
  1043. *
  1044. * @param prmEpConfig Endpoint configurations
  1045. */
  1046. void libInit( const EpConfig &prmEpConfig) PJSUA2_THROW(Error);
  1047. /**
  1048. * Call this function after all initialization is done, so that the
  1049. * library can do additional checking set up. Application may call this
  1050. * function any time after init().
  1051. */
  1052. void libStart() PJSUA2_THROW(Error);
  1053. /**
  1054. * Register a thread that was created by external or native API to the
  1055. * library. Note that each time this function is called, it will allocate
  1056. * some memory to store the thread description, which will only be freed
  1057. * when the library is destroyed.
  1058. *
  1059. * @param name The optional name to be assigned to the thread.
  1060. */
  1061. void libRegisterThread(const string &name) PJSUA2_THROW(Error);
  1062. /**
  1063. * Check if this thread has been registered to the library. Note that
  1064. * this function is only applicable for library main & worker threads and
  1065. * external/native threads registered using libRegisterThread().
  1066. */
  1067. bool libIsThreadRegistered();
  1068. /**
  1069. * Stop all worker threads.
  1070. */
  1071. void libStopWorkerThreads();
  1072. /**
  1073. * Poll pjsua for events, and if necessary block the caller thread for
  1074. * the specified maximum interval (in miliseconds).
  1075. *
  1076. * Application doesn't normally need to call this function if it has
  1077. * configured worker thread (\a thread_cnt field) in pjsua_config
  1078. * structure, because polling then will be done by these worker threads
  1079. * instead.
  1080. *
  1081. * If EpConfig::UaConfig::mainThreadOnly is enabled and this function
  1082. * is called from the main thread (by default the main thread is thread
  1083. * that calls libCreate()), this function will also scan and run any
  1084. * pending jobs in the list.
  1085. *
  1086. * @param msec_timeout Maximum time to wait, in miliseconds.
  1087. *
  1088. * @return The number of events that have been handled during the
  1089. * poll. Negative value indicates error, and application
  1090. * can retrieve the error as (status = -return_value).
  1091. */
  1092. int libHandleEvents(unsigned msec_timeout);
  1093. /**
  1094. * Destroy pjsua. Application is recommended to perform graceful shutdown
  1095. * before calling this function (such as unregister the account from the
  1096. * SIP server, terminate presense subscription, and hangup active calls),
  1097. * however, this function will do all of these if it finds there are
  1098. * active sessions that need to be terminated. This function will
  1099. * block for few seconds to wait for replies from remote.
  1100. *
  1101. * Application.may safely call this function more than once if it doesn't
  1102. * keep track of it's state.
  1103. *
  1104. * @param prmFlags Combination of pjsua_destroy_flag enumeration.
  1105. */
  1106. void libDestroy(unsigned prmFlags=0) PJSUA2_THROW(Error);
  1107. /*************************************************************************
  1108. * Utilities
  1109. */
  1110. /**
  1111. * Retrieve the error string for the specified status code.
  1112. *
  1113. * @param prmErr The error code.
  1114. */
  1115. string utilStrError(pj_status_t prmErr);
  1116. /**
  1117. * Write a log message.
  1118. *
  1119. * @param prmLevel Log verbosity level (1-5)
  1120. * @param prmSender The log sender.
  1121. * @param prmMsg The log message.
  1122. */
  1123. void utilLogWrite(int prmLevel,
  1124. const string &prmSender,
  1125. const string &prmMsg);
  1126. /**
  1127. * Write a log entry.
  1128. * Application must implement its own custom LogWriter and
  1129. * this function will then call the LogWriter::write() method.
  1130. * Note that this function does not call PJSIP's internal
  1131. * logging functionality. For that, you should use
  1132. * utilLogWrite(prmLevel, prmSender, prmMsg) above.
  1133. *
  1134. * @param e The log entry.
  1135. */
  1136. void utilLogWrite(LogEntry &e);
  1137. /**
  1138. * This is a utility function to verify that valid SIP url is given. If the
  1139. * URL is a valid SIP/SIPS scheme, PJ_SUCCESS will be returned.
  1140. *
  1141. * @param prmUri The URL string.
  1142. *
  1143. * @return PJ_SUCCESS on success, or the appropriate error
  1144. * code.
  1145. *
  1146. * @see utilVerifyUri()
  1147. */
  1148. pj_status_t utilVerifySipUri(const string &prmUri);
  1149. /**
  1150. * This is a utility function to verify that valid URI is given. Unlike
  1151. * utilVerifySipUri(), this function will return PJ_SUCCESS if tel: URI
  1152. * is given.
  1153. *
  1154. * @param prmUri The URL string.
  1155. *
  1156. * @return PJ_SUCCESS on success, or the appropriate error
  1157. * code.
  1158. *
  1159. * @see pjsua_verify_sip_url()
  1160. */
  1161. pj_status_t utilVerifyUri(const string &prmUri);
  1162. /**
  1163. * Schedule a timer with the specified interval and user data. When the
  1164. * interval elapsed, onTimer() callback will be
  1165. * called. Note that the callback may be executed by different thread,
  1166. * depending on whether worker thread is enabled or not.
  1167. *
  1168. * @param prmMsecDelay The time interval in msec.
  1169. * @param prmUserData Arbitrary user data, to be given back to
  1170. * application in the callback.
  1171. *
  1172. * @return Token to identify the timer, which could be
  1173. * given to utilTimerCancel().
  1174. */
  1175. Token utilTimerSchedule(unsigned prmMsecDelay,
  1176. Token prmUserData) PJSUA2_THROW(Error);
  1177. /**
  1178. * Cancel previously scheduled timer with the specified timer token.
  1179. *
  1180. * @param prmToken The timer token, which was returned from
  1181. * previous utilTimerSchedule() call.
  1182. */
  1183. void utilTimerCancel(Token prmToken);
  1184. /**
  1185. * Utility to register a pending job to be executed by main thread.
  1186. * If EpConfig::UaConfig::mainThreadOnly is false, the job will be
  1187. * executed immediately.
  1188. *
  1189. * @param job The job class.
  1190. */
  1191. void utilAddPendingJob(PendingJob *job);
  1192. /**
  1193. * Get cipher list supported by SSL/TLS backend.
  1194. */
  1195. IntVector utilSslGetAvailableCiphers() PJSUA2_THROW(Error);
  1196. /*************************************************************************
  1197. * NAT operations
  1198. */
  1199. /**
  1200. * This is a utility function to detect NAT type in front of this endpoint.
  1201. * Once invoked successfully, this function will complete asynchronously
  1202. * and report the result in onNatDetectionComplete().
  1203. *
  1204. * After NAT has been detected and the callback is called, application can
  1205. * get the detected NAT type by calling natGetType(). Application
  1206. * can also perform NAT detection by calling natDetectType()
  1207. * again at later time.
  1208. *
  1209. * Note that STUN must be enabled to run this function successfully.
  1210. */
  1211. void natDetectType(void) PJSUA2_THROW(Error);
  1212. /**
  1213. * Get the NAT type as detected by natDetectType() function. This
  1214. * function will only return useful NAT type after natDetectType()
  1215. * has completed successfully and onNatDetectionComplete()
  1216. * callback has been called.
  1217. *
  1218. * Exception: if this function is called while detection is in progress,
  1219. * PJ_EPENDING exception will be raised.
  1220. */
  1221. pj_stun_nat_type natGetType() PJSUA2_THROW(Error);
  1222. /**
  1223. * Update the STUN servers list. The libInit() must have been called
  1224. * before calling this function.
  1225. *
  1226. * @param prmServers Array of STUN servers to try. The endpoint
  1227. * will try to resolve and contact each of the
  1228. * STUN server entry until it finds one that is
  1229. * usable. Each entry may be a domain name, host
  1230. * name, IP address, and it may contain an
  1231. * optional port number. For example:
  1232. * - "pjsip.org" (domain name)
  1233. * - "sip.pjsip.org" (host name)
  1234. * - "pjsip.org:33478" (domain name and a non-
  1235. * standard port number)
  1236. * - "10.0.0.1:3478" (IP address and port number)
  1237. * @param prmWait Specify if the function should block until
  1238. * it gets the result. In this case, the
  1239. * function will block while the resolution
  1240. * is being done, and the callback
  1241. * onNatCheckStunServersComplete() will be called
  1242. * before this function returns.
  1243. *
  1244. */
  1245. void natUpdateStunServers(const StringVector &prmServers,
  1246. bool prmWait) PJSUA2_THROW(Error);
  1247. /**
  1248. * Auxiliary function to resolve and contact each of the STUN server
  1249. * entries (sequentially) to find which is usable. The libInit() must
  1250. * have been called before calling this function.
  1251. *
  1252. * @param prmServers Array of STUN servers to try. The endpoint
  1253. * will try to resolve and contact each of the
  1254. * STUN server entry until it finds one that is
  1255. * usable. Each entry may be a domain name, host
  1256. * name, IP address, and it may contain an
  1257. * optional port number. For example:
  1258. * - "pjsip.org" (domain name)
  1259. * - "sip.pjsip.org" (host name)
  1260. * - "pjsip.org:33478" (domain name and a non-
  1261. * standard port number)
  1262. * - "10.0.0.1:3478" (IP address and port number)
  1263. * @param prmWait Specify if the function should block until
  1264. * it gets the result. In this case, the function
  1265. * will block while the resolution is being done,
  1266. * and the callback will be called before this
  1267. * function returns.
  1268. * @param prmUserData Arbitrary user data to be passed back to
  1269. * application in the callback.
  1270. *
  1271. * @see natCancelCheckStunServers()
  1272. */
  1273. void natCheckStunServers(const StringVector &prmServers,
  1274. bool prmWait,
  1275. Token prmUserData) PJSUA2_THROW(Error);
  1276. /**
  1277. * Cancel pending STUN resolution which match the specified token.
  1278. *
  1279. * @param token The token to match. This token was given to
  1280. * natCheckStunServers()
  1281. * @param notify_cb Boolean to control whether the callback should
  1282. * be called for cancelled resolutions. When the
  1283. * callback is called, the status in the result
  1284. * will be set as PJ_ECANCELLED.
  1285. *
  1286. * Exception: PJ_ENOTFOUND if there is no matching one, or other error.
  1287. */
  1288. void natCancelCheckStunServers(Token token,
  1289. bool notify_cb = false) PJSUA2_THROW(Error);
  1290. /*************************************************************************
  1291. * Transport operations
  1292. */
  1293. /**
  1294. * Create and start a new SIP transport according to the specified
  1295. * settings.
  1296. *
  1297. * @param type Transport type.
  1298. * @param cfg Transport configuration.
  1299. *
  1300. * @return The transport ID.
  1301. */
  1302. TransportId transportCreate(pjsip_transport_type_e type,
  1303. const TransportConfig &cfg) PJSUA2_THROW(Error);
  1304. /**
  1305. * Enumerate all transports currently created in the system. This
  1306. * function will return all transport IDs, and application may then
  1307. * call transportGetInfo() function to retrieve detailed information
  1308. * about the transport.
  1309. *
  1310. * @return Array of transport IDs.
  1311. */
  1312. IntVector transportEnum() const PJSUA2_THROW(Error);
  1313. /**
  1314. * Get information about transport.
  1315. *
  1316. * @param id Transport ID.
  1317. *
  1318. * @return Transport info.
  1319. */
  1320. TransportInfo transportGetInfo(TransportId id) const PJSUA2_THROW(Error);
  1321. /**
  1322. * Disable a transport or re-enable it. By default transport is always
  1323. * enabled after it is created. Disabling a transport does not necessarily
  1324. * close the socket, it will only discard incoming messages and prevent
  1325. * the transport from being used to send outgoing messages.
  1326. *
  1327. * @param id Transport ID.
  1328. * @param enabled Enable or disable the transport.
  1329. *
  1330. */
  1331. void transportSetEnable(TransportId id, bool enabled) PJSUA2_THROW(Error);
  1332. /**
  1333. * Close the transport. The system will wait until all transactions are
  1334. * closed while preventing new users from using the transport, and will
  1335. * close the transport when its usage count reaches zero.
  1336. *
  1337. * @param id Transport ID.
  1338. */
  1339. void transportClose(TransportId id) PJSUA2_THROW(Error);
  1340. /**
  1341. * Start graceful shutdown procedure for this transport handle. After
  1342. * graceful shutdown has been initiated, no new reference can be
  1343. * obtained for the transport. However, existing objects that currently
  1344. * uses the transport may still use this transport to send and receive
  1345. * packets. After all objects release their reference to this transport,
  1346. * the transport will be destroyed immediately.
  1347. *
  1348. * Note: application normally uses this API after obtaining the handle
  1349. * from onTransportState() callback.
  1350. *
  1351. * @param tp The transport.
  1352. */
  1353. void transportShutdown(TransportHandle tp) PJSUA2_THROW(Error);
  1354. /*************************************************************************
  1355. * Call operations
  1356. */
  1357. /**
  1358. * Terminate all calls. This will initiate call hangup for all
  1359. * currently active calls.
  1360. */
  1361. void hangupAllCalls(void);
  1362. /*************************************************************************
  1363. * Media operations
  1364. */
  1365. /**
  1366. * Add media to the media list.
  1367. *
  1368. * @param media media to be added.
  1369. */
  1370. void mediaAdd(AudioMedia &media);
  1371. /**
  1372. * Remove media from the media list.
  1373. *
  1374. * @param media media to be removed.
  1375. */
  1376. void mediaRemove(AudioMedia &media);
  1377. /**
  1378. * Check if media has been added to the media list.
  1379. *
  1380. * @param media media to be check.
  1381. *
  1382. * @return True if media has been added, false otherwise.
  1383. */
  1384. bool mediaExists(const AudioMedia &media) const;
  1385. /**
  1386. * Get maximum number of media port.
  1387. *
  1388. * @return Maximum number of media port in the conference bridge.
  1389. */
  1390. unsigned mediaMaxPorts() const;
  1391. /**
  1392. * Get current number of active media port in the bridge.
  1393. *
  1394. * @return The number of active media port.
  1395. */
  1396. unsigned mediaActivePorts() const;
  1397. #if !DEPRECATED_FOR_TICKET_2232
  1398. /**
  1399. * Warning: deprecated, use mediaEnumPorts2() instead. This function is
  1400. * not safe in multithreaded environment.
  1401. *
  1402. * Enumerate all media port.
  1403. *
  1404. * @return The list of media port.
  1405. */
  1406. const AudioMediaVector &mediaEnumPorts() const PJSUA2_THROW(Error);
  1407. #endif
  1408. /**
  1409. * Enumerate all audio media port.
  1410. *
  1411. * @return The list of audio media port.
  1412. */
  1413. AudioMediaVector2 mediaEnumPorts2() const PJSUA2_THROW(Error);
  1414. /**
  1415. * Enumerate all video media port.
  1416. *
  1417. * @return The list of video media port.
  1418. */
  1419. VideoMediaVector mediaEnumVidPorts() const PJSUA2_THROW(Error);
  1420. /**
  1421. * Get the instance of Audio Device Manager.
  1422. *
  1423. * @return The Audio Device Manager.
  1424. */
  1425. AudDevManager &audDevManager();
  1426. /**
  1427. * Get the instance of Video Device Manager.
  1428. *
  1429. * @return The Video Device Manager.
  1430. */
  1431. VidDevManager &vidDevManager();
  1432. /*************************************************************************
  1433. * Codec management operations
  1434. */
  1435. #if !DEPRECATED_FOR_TICKET_2232
  1436. /**
  1437. * Warning: deprecated, use codecEnum2() instead. This function is not
  1438. * safe in multithreaded environment.
  1439. *
  1440. * Enum all supported codecs in the system.
  1441. *
  1442. * @return Array of codec info.
  1443. */
  1444. const CodecInfoVector &codecEnum() PJSUA2_THROW(Error);
  1445. #endif
  1446. /**
  1447. * Enum all supported codecs in the system.
  1448. *
  1449. * @return Array of codec info.
  1450. */
  1451. CodecInfoVector2 codecEnum2() const PJSUA2_THROW(Error);
  1452. /**
  1453. * Change codec priority.
  1454. *
  1455. * @param codec_id Codec ID, which is a string that uniquely identify
  1456. * the codec (such as "speex/8000").
  1457. * @param priority Codec priority, 0-255, where zero means to disable
  1458. * the codec.
  1459. *
  1460. */
  1461. void codecSetPriority(const string &codec_id,
  1462. pj_uint8_t priority) PJSUA2_THROW(Error);
  1463. /**
  1464. * Get codec parameters.
  1465. *
  1466. * @param codec_id Codec ID.
  1467. *
  1468. * @return Codec parameters. If codec is not found, Error
  1469. * will be thrown.
  1470. *
  1471. */
  1472. CodecParam codecGetParam(const string &codec_id) const PJSUA2_THROW(Error);
  1473. /**
  1474. * Set codec parameters.
  1475. *
  1476. * @param codec_id Codec ID.
  1477. * @param param Codec parameter to set. Set to NULL to reset
  1478. * codec parameter to library default settings.
  1479. *
  1480. */
  1481. void codecSetParam(const string &codec_id,
  1482. const CodecParam param) PJSUA2_THROW(Error);
  1483. #if !DEPRECATED_FOR_TICKET_2232
  1484. /**
  1485. * Warning: deprecated, use videoCodecEnum2() instead. This function is
  1486. * not safe in multithreaded environment.
  1487. *
  1488. * Enum all supported video codecs in the system.
  1489. *
  1490. * @return Array of video codec info.
  1491. */
  1492. const CodecInfoVector &videoCodecEnum() PJSUA2_THROW(Error);
  1493. #endif
  1494. /**
  1495. * Enum all supported video codecs in the system.
  1496. *
  1497. * @return Array of video codec info.
  1498. */
  1499. CodecInfoVector2 videoCodecEnum2() const PJSUA2_THROW(Error);
  1500. /**
  1501. * Change video codec priority.
  1502. *
  1503. * @param codec_id Codec ID, which is a string that uniquely identify
  1504. * the codec (such as "H263/90000"). Please see pjsua
  1505. * manual or pjmedia codec reference for details.
  1506. * @param priority Codec priority, 0-255, where zero means to disable
  1507. * the codec.
  1508. *
  1509. */
  1510. void videoCodecSetPriority(const string &codec_id,
  1511. pj_uint8_t priority) PJSUA2_THROW(Error);
  1512. /**
  1513. * Get video codec parameters.
  1514. *
  1515. * @param codec_id Codec ID.
  1516. *
  1517. * @return Codec parameters. If codec is not found, Error
  1518. * will be thrown.
  1519. *
  1520. */
  1521. VidCodecParam getVideoCodecParam(const string &codec_id) const
  1522. PJSUA2_THROW(Error);
  1523. /**
  1524. * Set video codec parameters.
  1525. *
  1526. * @param codec_id Codec ID.
  1527. * @param param Codec parameter to set.
  1528. *
  1529. */
  1530. void setVideoCodecParam(const string &codec_id,
  1531. const VidCodecParam &param) PJSUA2_THROW(Error);
  1532. /**
  1533. * Reset video codec parameters to library default settings.
  1534. *
  1535. * @param codec_id Codec ID.
  1536. *
  1537. */
  1538. void resetVideoCodecParam(const string &codec_id) PJSUA2_THROW(Error);
  1539. /**
  1540. * Get codec Opus config.
  1541. *
  1542. */
  1543. CodecOpusConfig getCodecOpusConfig() const PJSUA2_THROW(Error);
  1544. /**
  1545. * Set codec Opus config.
  1546. *
  1547. * @param opus_cfg Codec Opus configuration.
  1548. *
  1549. */
  1550. void setCodecOpusConfig(const CodecOpusConfig &opus_cfg)
  1551. PJSUA2_THROW(Error);
  1552. /**
  1553. * Get codec Lyra config.
  1554. *
  1555. */
  1556. CodecLyraConfig getCodecLyraConfig() const PJSUA2_THROW(Error);
  1557. /**
  1558. * Set codec Lyra config.
  1559. *
  1560. * @param lyra_cfg Codec Lyra configuration.
  1561. *
  1562. */
  1563. void setCodecLyraConfig(const CodecLyraConfig &lyra_cfg)
  1564. PJSUA2_THROW(Error);
  1565. /**
  1566. * Enumerate all SRTP crypto-suite names.
  1567. *
  1568. * @return The list of SRTP crypto-suite name.
  1569. */
  1570. StringVector srtpCryptoEnum() PJSUA2_THROW(Error);
  1571. /*************************************************************************
  1572. * IP Change
  1573. */
  1574. /**
  1575. * Inform the stack that IP address change event was detected.
  1576. * The stack will:
  1577. * 1. Restart the listener (this step is configurable via
  1578. * \a IpChangeParam.restartListener).
  1579. * 2. Shutdown the transport used by account registration (this step is
  1580. * configurable via \a AccountConfig.ipChangeConfig.shutdownTp).
  1581. * 3. Update contact URI by sending re-Registration (this step is
  1582. * configurable via a\ AccountConfig.natConfig.contactRewriteUse and
  1583. * a\ AccountConfig.natConfig.contactRewriteMethod)
  1584. * 4. Hangup active calls (this step is configurable via
  1585. * a\ AccountConfig.ipChangeConfig.hangupCalls) or
  1586. * continue the call by sending re-INVITE
  1587. * (configurable via \a AccountConfig.ipChangeConfig.reinviteFlags).
  1588. *
  1589. * @param param The IP change parameter, have a look at IpChangeParam.
  1590. */
  1591. void handleIpChange(const IpChangeParam &param) PJSUA2_THROW(Error);
  1592. public:
  1593. /*
  1594. * Overrideables callbacks
  1595. */
  1596. /**
  1597. * Callback when the Endpoint has finished performing NAT type
  1598. * detection that is initiated with natDetectType().
  1599. *
  1600. * @param prm Callback parameters containing the detection
  1601. * result.
  1602. */
  1603. virtual void onNatDetectionComplete(
  1604. const OnNatDetectionCompleteParam &prm)
  1605. { PJ_UNUSED_ARG(prm); }
  1606. /**
  1607. * Callback when the Endpoint has finished performing STUN server
  1608. * checking that is initiated when calling libInit(), or by
  1609. * calling natCheckStunServers() or natUpdateStunServers().
  1610. *
  1611. * @param prm Callback parameters.
  1612. */
  1613. virtual void onNatCheckStunServersComplete(
  1614. const OnNatCheckStunServersCompleteParam &prm)
  1615. { PJ_UNUSED_ARG(prm); }
  1616. /**
  1617. * This callback is called when transport state has changed.
  1618. *
  1619. * @param prm Callback parameters.
  1620. */
  1621. virtual void onTransportState(
  1622. const OnTransportStateParam &prm)
  1623. { PJ_UNUSED_ARG(prm); }
  1624. /**
  1625. * Callback when a timer has fired. The timer was scheduled by
  1626. * utilTimerSchedule().
  1627. *
  1628. * @param prm Callback parameters.
  1629. */
  1630. virtual void onTimer(const OnTimerParam &prm)
  1631. { PJ_UNUSED_ARG(prm); }
  1632. /**
  1633. * This callback can be used by application to override the account
  1634. * to be used to handle an incoming message. Initially, the account to
  1635. * be used will be calculated automatically by the library. This initial
  1636. * account will be used if application does not implement this callback,
  1637. * or application sets an invalid account upon returning from this
  1638. * callback.
  1639. *
  1640. * Note that currently the incoming messages requiring account assignment
  1641. * are INVITE, MESSAGE, SUBSCRIBE, and unsolicited NOTIFY. This callback
  1642. * may be called before the callback of the SIP event itself, i.e:
  1643. * incoming call, pager, subscription, or unsolicited-event.
  1644. *
  1645. * @param prm Callback parameters.
  1646. */
  1647. virtual void onSelectAccount(OnSelectAccountParam &prm)
  1648. { PJ_UNUSED_ARG(prm); }
  1649. /**
  1650. * Calling #handleIpChange() may involve different operation. This
  1651. * callback is called to report the progress of each enabled operation.
  1652. *
  1653. * @param prm Callback parameters.
  1654. *
  1655. */
  1656. virtual void onIpChangeProgress(OnIpChangeProgressParam &prm)
  1657. { PJ_UNUSED_ARG(prm); }
  1658. /**
  1659. * Notification about media events such as video notifications. This
  1660. * callback will most likely be called from media threads, thus
  1661. * application must not perform heavy processing in this callback.
  1662. * If application needs to perform more complex tasks to handle the
  1663. * event, it should post the task to another thread.
  1664. *
  1665. * @param prm Callback parameter.
  1666. */
  1667. virtual void onMediaEvent(OnMediaEventParam &prm)
  1668. { PJ_UNUSED_ARG(prm); }
  1669. /**
  1670. * Callback for computation of the digest credential.
  1671. *
  1672. * Usually, an application does not need to implement (overload) this callback.
  1673. * Use it, if your application needs to support Digest AKA authentication without
  1674. * the default digest computation back-end (i.e: using <b>libmilenage</b>).
  1675. *
  1676. * To use Digest AKA authentication, add \a PJSIP_CRED_DATA_EXT_AKA flag in the
  1677. * AuthCredInfo's \a dataType field of the AccountConfig, and fill up other
  1678. * AKA specific information in AuthCredInfo:
  1679. * - If PJSIP_HAS_DIGEST_AKA_AUTH is disabled, you have to overload this callback
  1680. * to provide your own digest computation back-end.
  1681. * - If PJSIP_HAS_DIGEST_AKA_AUTH is enabled, <b>libmilenage</b> library from
  1682. * \a third_party directory is linked, and this callback returns PJ_ENOTSUP,
  1683. * then the default digest computation back-end is used.
  1684. *
  1685. * @param prm.digestChallenge The authentication challenge sent by server in 401
  1686. * or 401 response, as either Proxy-Authenticate or
  1687. * WWW-Authenticate header.
  1688. * @param prm.credentialInfo The credential to be used.
  1689. * @param method The request method.
  1690. * @param prm.digestCredential The digest credential where the digest response
  1691. * will be placed to. Upon calling this function, the
  1692. * nonce, nc, cnonce, qop, uri, and realm fields of
  1693. * this structure must have been set by caller. Upon
  1694. * return, the \a response field will be initialized
  1695. * by this function.
  1696. *
  1697. * @return PJ_ENOTSUP is the default. If you overload this callback,
  1698. * return PJ_SUCCESS on success.
  1699. */
  1700. virtual pj_status_t onCredAuth(OnCredAuthParam &prm);
  1701. /**
  1702. * This callback will be invoked when the library implicitly rejects
  1703. * an incoming call.
  1704. *
  1705. * In addition to being declined explicitly using the Call::answer()
  1706. * method, the library may also automatically reject the incoming call
  1707. * due to different scenarios, e.g:
  1708. * - no available call slot.
  1709. * - no available account to handle the call.
  1710. * - when an incoming INVITE is received with, for instance, a message
  1711. * containing invalid SDP.
  1712. *
  1713. * @param prm Callback parameters.
  1714. */
  1715. virtual void onRejectedIncomingCall(OnRejectedIncomingCallParam &prm)
  1716. { PJ_UNUSED_ARG(prm); }
  1717. private:
  1718. static Endpoint *instance_; // static instance
  1719. LogWriter *writer; // Custom writer, if any
  1720. AudDevManager *audioDevMgr;
  1721. VidDevManager *videoDevMgr;
  1722. #if !DEPRECATED_FOR_TICKET_2232
  1723. CodecInfoVector codecInfoList;
  1724. CodecInfoVector videoCodecInfoList;
  1725. #endif
  1726. std::map<pj_thread_t*, pj_thread_desc*> threadDescMap;
  1727. pj_mutex_t *threadDescMutex;
  1728. #if !DEPRECATED_FOR_TICKET_2232
  1729. AudioMediaVector mediaList;
  1730. pj_mutex_t *mediaListMutex;
  1731. #endif
  1732. /* Pending logging */
  1733. bool mainThreadOnly;
  1734. void *mainThread;
  1735. unsigned pendingJobSize;
  1736. std::list<PendingJob*> pendingJobs;
  1737. void performPendingJobs();
  1738. /* Endpoint static callbacks */
  1739. static void logFunc(int level, const char *data, int len);
  1740. static void stun_resolve_cb(const pj_stun_resolve_result *result);
  1741. static void on_timer(pj_timer_heap_t *timer_heap,
  1742. struct pj_timer_entry *entry);
  1743. static void on_nat_detect(const pj_stun_nat_detect_result *res);
  1744. static void on_transport_state(pjsip_transport *tp,
  1745. pjsip_transport_state state,
  1746. const pjsip_transport_state_info *info);
  1747. private:
  1748. /*
  1749. * Account & Call lookups
  1750. */
  1751. static Account *lookupAcc(int acc_id, const char *op);
  1752. static Call *lookupCall(int call_id, const char *op);
  1753. /* static callbacks */
  1754. static void on_incoming_call(pjsua_acc_id acc_id,
  1755. pjsua_call_id call_id,
  1756. pjsip_rx_data *rdata);
  1757. static void on_reg_started(pjsua_acc_id acc_id,
  1758. pj_bool_t renew);
  1759. static void on_reg_state2(pjsua_acc_id acc_id,
  1760. pjsua_reg_info *info);
  1761. static void on_incoming_subscribe(pjsua_acc_id acc_id,
  1762. pjsua_srv_pres *srv_pres,
  1763. pjsua_buddy_id buddy_id,
  1764. const pj_str_t *from,
  1765. pjsip_rx_data *rdata,
  1766. pjsip_status_code *code,
  1767. pj_str_t *reason,
  1768. pjsua_msg_data *msg_data);
  1769. static void on_pager2(pjsua_call_id call_id,
  1770. const pj_str_t *from,
  1771. const pj_str_t *to,
  1772. const pj_str_t *contact,
  1773. const pj_str_t *mime_type,
  1774. const pj_str_t *body,
  1775. pjsip_rx_data *rdata,
  1776. pjsua_acc_id acc_id);
  1777. static void on_pager_status2(pjsua_call_id call_id,
  1778. const pj_str_t *to,
  1779. const pj_str_t *body,
  1780. void *user_data,
  1781. pjsip_status_code status,
  1782. const pj_str_t *reason,
  1783. pjsip_tx_data *tdata,
  1784. pjsip_rx_data *rdata,
  1785. pjsua_acc_id acc_id);
  1786. static void on_typing2(pjsua_call_id call_id,
  1787. const pj_str_t *from,
  1788. const pj_str_t *to,
  1789. const pj_str_t *contact,
  1790. pj_bool_t is_typing,
  1791. pjsip_rx_data *rdata,
  1792. pjsua_acc_id acc_id);
  1793. static void on_mwi_info(pjsua_acc_id acc_id,
  1794. pjsua_mwi_info *mwi_info);
  1795. static void on_acc_find_for_incoming(const pjsip_rx_data *rdata,
  1796. pjsua_acc_id* acc_id);
  1797. static void on_buddy_state(pjsua_buddy_id buddy_id);
  1798. static void on_buddy_evsub_state(pjsua_buddy_id buddy_id,
  1799. pjsip_evsub *sub,
  1800. pjsip_event *event);
  1801. // Call callbacks
  1802. static void on_call_state(pjsua_call_id call_id, pjsip_event *e);
  1803. static void on_call_tsx_state(pjsua_call_id call_id,
  1804. pjsip_transaction *tsx,
  1805. pjsip_event *e);
  1806. static void on_call_media_state(pjsua_call_id call_id);
  1807. static void on_call_sdp_created(pjsua_call_id call_id,
  1808. pjmedia_sdp_session *sdp,
  1809. pj_pool_t *pool,
  1810. const pjmedia_sdp_session *rem_sdp);
  1811. static void on_stream_precreate(pjsua_call_id call_id,
  1812. pjsua_on_stream_precreate_param *param);
  1813. static void on_stream_created2(pjsua_call_id call_id,
  1814. pjsua_on_stream_created_param *param);
  1815. static void on_stream_destroyed(pjsua_call_id call_id,
  1816. pjmedia_stream *strm,
  1817. unsigned stream_idx);
  1818. static void on_dtmf_digit(pjsua_call_id call_id, int digit);
  1819. static void on_dtmf_digit2(pjsua_call_id call_id,
  1820. const pjsua_dtmf_info *info);
  1821. static void on_dtmf_event(pjsua_call_id call_id,
  1822. const pjsua_dtmf_event *event);
  1823. static void on_call_transfer_request(pjsua_call_id call_id,
  1824. const pj_str_t *dst,
  1825. pjsip_status_code *code);
  1826. static void on_call_transfer_request2(pjsua_call_id call_id,
  1827. const pj_str_t *dst,
  1828. pjsip_status_code *code,
  1829. pjsua_call_setting *opt);
  1830. static void on_call_transfer_status(pjsua_call_id call_id,
  1831. int st_code,
  1832. const pj_str_t *st_text,
  1833. pj_bool_t final,
  1834. pj_bool_t *p_cont);
  1835. static void on_call_replace_request(pjsua_call_id call_id,
  1836. pjsip_rx_data *rdata,
  1837. int *st_code,
  1838. pj_str_t *st_text);
  1839. static void on_call_replace_request2(pjsua_call_id call_id,
  1840. pjsip_rx_data *rdata,
  1841. int *st_code,
  1842. pj_str_t *st_text,
  1843. pjsua_call_setting *opt);
  1844. static void on_call_replaced(pjsua_call_id old_call_id,
  1845. pjsua_call_id new_call_id);
  1846. static void on_call_rx_offer(pjsua_call_id call_id,
  1847. const pjmedia_sdp_session *offer,
  1848. void *reserved,
  1849. pjsip_status_code *code,
  1850. pjsua_call_setting *opt);
  1851. static void on_call_rx_reinvite(pjsua_call_id call_id,
  1852. const pjmedia_sdp_session *offer,
  1853. pjsip_rx_data *rdata,
  1854. void *reserved,
  1855. pj_bool_t *async,
  1856. pjsip_status_code *code,
  1857. pjsua_call_setting *opt);
  1858. static void on_call_tx_offer(pjsua_call_id call_id,
  1859. void *reserved,
  1860. pjsua_call_setting *opt);
  1861. static pjsip_redirect_op on_call_redirected(pjsua_call_id call_id,
  1862. const pjsip_uri *target,
  1863. const pjsip_event *e);
  1864. static pj_status_t
  1865. on_call_media_transport_state(pjsua_call_id call_id,
  1866. const pjsua_med_tp_state_info *info);
  1867. static void on_media_event(pjmedia_event *event);
  1868. static void on_call_media_event(pjsua_call_id call_id,
  1869. unsigned med_idx,
  1870. pjmedia_event *event);
  1871. static pjmedia_transport*
  1872. on_create_media_transport(pjsua_call_id call_id,
  1873. unsigned media_idx,
  1874. pjmedia_transport *base_tp,
  1875. unsigned flags);
  1876. static void
  1877. on_create_media_transport_srtp(pjsua_call_id call_id,
  1878. unsigned media_idx,
  1879. pjmedia_srtp_setting *srtp_opt);
  1880. static void
  1881. on_ip_change_progress(pjsua_ip_change_op op,
  1882. pj_status_t status,
  1883. const pjsua_ip_change_op_info *info);
  1884. static pj_status_t on_auth_create_aka_response_callback(
  1885. pj_pool_t *pool,
  1886. const pjsip_digest_challenge*chal,
  1887. const pjsip_cred_info *cred,
  1888. const pj_str_t *method,
  1889. pjsip_digest_credential *auth);
  1890. static void on_rejected_incoming_call(
  1891. const pjsua_on_rejected_incoming_call_param *param);
  1892. friend class Account;
  1893. private:
  1894. void clearCodecInfoList(CodecInfoVector &codec_list);
  1895. void updateCodecInfoList(pjsua_codec_info pj_codec[], unsigned count,
  1896. CodecInfoVector &codec_list);
  1897. };
  1898. /**
  1899. * @} PJSUA2_UA
  1900. */
  1901. }
  1902. /* End pj namespace */
  1903. #endif /* __PJSUA2_UA_HPP__ */