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