49
49
// SIP specific configuration keys
50
const char *const interfaceKey = "interface";
51
const char *const portKey = "port";
52
const char *const publishAddrKey = "publishAddr";
53
const char *const publishPortKey = "publishPort";
54
const char *const sameasLocalKey = "sameasLocal";
55
const char *const dtmfTypeKey = "dtmfType";
56
const char *const serviceRouteKey = "serviceRoute";
57
const char *const updateContactHeaderKey = "updateContact";
50
const char *const INTERFACE_KEY = "interface";
51
const char *const PORT_KEY = "port";
52
const char *const PUBLISH_ADDR_KEY = "publishAddr";
53
const char *const PUBLISH_PORT_KEY = "publishPort";
54
const char *const SAME_AS_LOCAL_KEY = "sameasLocal";
55
const char *const DTMF_TYPE_KEY = "dtmfType";
56
const char *const SERVICE_ROUTE_KEY = "serviceRoute";
57
const char *const UPDATE_CONTACT_HEADER_KEY = "updateContact";
58
const char *const KEEP_ALIVE_ENABLED = "keepAlive";
59
60
// TODO: write an object to store credential which implement serializable
60
const char *const srtpKey = "srtp";
61
const char *const srtpEnableKey = "enable";
62
const char *const keyExchangeKey = "keyExchange";
63
const char *const rtpFallbackKey = "rtpFallback";
61
const char *const SRTP_KEY = "srtp";
62
const char *const SRTP_ENABLE_KEY = "enable";
63
const char *const KEY_EXCHANGE_KEY = "keyExchange";
64
const char *const RTP_FALLBACK_KEY = "rtpFallback";
65
66
// TODO: wirte an object to store zrtp params wich implement serializable
66
const char *const zrtpKey = "zrtp";
67
const char *const displaySasKey = "displaySas";
68
const char *const displaySasOnceKey = "displaySasOnce";
69
const char *const helloHashEnabledKey = "helloHashEnabled";
70
const char *const notSuppWarningKey = "notSuppWarning";
67
const char *const ZRTP_KEY = "zrtp";
68
const char *const DISPLAY_SAS_KEY = "displaySas";
69
const char *const DISPLAY_SAS_ONCE_KEY = "displaySasOnce";
70
const char *const HELLO_HASH_ENABLED_KEY = "helloHashEnabled";
71
const char *const NOT_SUPP_WARNING_KEY = "notSuppWarning";
72
73
// TODO: write an object to store tls params which implement serializable
73
const char *const tlsKey = "tls";
74
const char *const tlsPortKey = "tlsPort";
75
const char *const certificateKey = "certificate";
76
const char *const calistKey = "calist";
77
const char *const ciphersKey = "ciphers";
78
const char *const tlsEnableKey = "enable";
79
const char *const methodKey = "method";
80
const char *const timeoutKey = "timeout";
81
const char *const tlsPasswordKey = "password";
82
const char *const privateKeyKey = "privateKey";
83
const char *const requireCertifKey = "requireCertif";
84
const char *const serverKey = "server";
85
const char *const verifyClientKey = "verifyClient";
86
const char *const verifyServerKey = "verifyServer";
88
const char *const stunEnabledKey = "stunEnabled";
89
const char *const stunServerKey = "stunServer";
91
const char *const credKey = "credential";
74
const char *const TLS_KEY = "tls";
75
const char *const TLS_PORT_KEY = "tlsPort";
76
const char *const CERTIFICATE_KEY = "certificate";
77
const char *const CALIST_KEY = "calist";
78
const char *const CIPHERS_KEY = "ciphers";
79
const char *const TLS_ENABLE_KEY = "enable";
80
const char *const METHOD_KEY = "method";
81
const char *const TIMEOUT_KEY = "timeout";
82
const char *const TLS_PASSWORD_KEY = "password";
83
const char *const PRIVATE_KEY_KEY = "privateKey";
84
const char *const REQUIRE_CERTIF_KEY = "requireCertif";
85
const char *const SERVER_KEY = "server";
86
const char *const VERIFY_CLIENT_KEY = "verifyClient";
87
const char *const VERIFY_SERVER_KEY = "verifyServer";
89
const char *const STUN_ENABLED_KEY = "stunEnabled";
90
const char *const STUN_SERVER_KEY = "stunServer";
91
const char *const CRED_KEY = "credential";
495
498
return zrtpHelloHash_;
501
void setReceivedParameter(const std::string &received) {
502
receivedParameter_ = received;
505
std::string getReceivedParameter() const {
506
return receivedParameter_;
509
int getRPort() const {
516
void setRPort(int rPort) { rPort_ = rPort; }
499
519
* Timer used to periodically send re-register request based
500
520
* on the "Expire" sip header (or the "expire" Contact parameter)
502
522
static void keepAliveRegistrationCb(pj_timer_heap_t *th, pj_timer_entry *te);
524
bool isKeepAliveEnabled() const {
525
return keepAliveEnabled_;
529
* Pointer to the transport used by this acccount
504
531
pjsip_transport* transport_;
506
534
NON_COPYABLE(SIPAccount);
537
* Map of credential for this account
508
539
std::vector< std::map<std::string, std::string > > credentials_;
510
/* Maps a string description of the SSL method
542
* Maps a string description of the SSL method
511
543
* to the corresponding enum value in pjsip_ssl_method.
512
544
* @param method The string representation
513
545
* @return pjsip_ssl_method The corresponding value in the enum
515
547
static pjsip_ssl_method sslMethodStringToPjEnum(const std::string& method);
518
550
* Initializes tls settings from configuration file.
521
552
void initTlsConfiguration();
524
555
* Initializes STUN config from the config file
526
557
void initStunConfiguration();
547
580
int registrationExpire_;
549
// interface name on which this account is bound
583
* interface name on which this account is bound
550
585
std::string interface_;
552
// Flag which determine if localIpAddress_ or publishedIpAddress_ is used in
588
* Flag which determine if localIpAddress_ or publishedIpAddress_ is used in
554
591
bool publishedSameasLocal_;
594
* Published IP address, ued only if defined by the user in account
556
597
std::string publishedIpAddress_;
600
* Local port to whih this account is bound
558
602
pj_uint16_t localPort_;
605
* Published port, used only if defined by the user
559
607
pj_uint16_t publishedPort_;
610
* Optional list of SIP service this
561
612
std::string serviceRoute_;
690
736
std::pair<int, std::string> registrationStateDetailed_;
739
* Determine if the keep alive timer will be activated or not
741
bool keepAliveEnabled_;
693
744
* Timer used to regularrly send re-register request based
694
745
* on the "Expire" sip header (or the "expire" Contact parameter)
696
747
pj_timer_entry keepAliveTimer_;
750
* Once enabled, this variable tells if the keepalive timer is activated
753
bool keepAliveTimerActive_;
700
756
* Voice over IP Link contains a listener thread and calls
702
758
SIPVoIPLink* link_;
761
* Optional: "received" parameter from VIA header
763
std::string receivedParameter_;
766
* Optional: "rport" parameter from VIA header